crud-di

Enforce dependency injection consistency in Go PowerX CRUD services and transport layers.

357|65|Updated Jul 29, 2022
One-click install
npx skills add https://github.com/ArtisanCloud/PowerX --skill crud-di
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: crud-di
Source: https://github.com/ArtisanCloud/PowerX/tree/main/.codex/skills/crud/di
Command: npx skills add https://github.com/ArtisanCloud/PowerX --skill crud-di

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill codifies PowerX CRUD dependency injection conventions to prevent ad-hoc resource creation in handlers and services, reduce coupling, and ensure consistent initialization and lifecycle management across HTTP, gRPC, and background transports.

Core Features & Use Cases

  • Architectural Enforcement: Verifies Deps struct and NewDeps factory, constructor-based service and repo wiring, and transport decoupling rules.
  • Static CI Checks: Detects forbidden imports and direct external client instantiation in handlers and provides warning-level guidance for gRPC implementations.
  • Templates and Wiring: Supplies example templates for deps, service, repo, and handler registration to standardize implementations across modules.
  • Use Case: Integrate into repository onboarding or CI pipelines to automatically validate that newly added CRUD modules follow PowerX DI patterns and avoid runtime resource mismanagement.

Quick Start

Run a code scan applying the di.yaml rules to confirm internal/app/shared/deps.go defines Deps and NewDeps and that services, repos, and handlers are constructed via dependency injection.

Frequently Asked Questions about crud-di

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce dependency injection in Go CRUD services?

You can enforce dependency injection in Go CRUD services by scanning repository, service, and handler files to verify constructor injection patterns and ensure a Deps struct with a NewDeps factory manages external client initialization.

Why should HTTP handlers avoid direct database instantiation in service architectures?

Direct database instantiation in HTTP handlers breaks transport decoupling and creates ad-hoc resource creation; centralizing external clients in injected dependencies ensures consistent initialization across HTTP and gRPC layers.

Can I use a dependency injection check for gRPC server implementations in PowerX?

Dependency injection checks support gRPC server implementations in PowerX by validating constructor injection patterns in gRPC transport layers and providing warning-level guidance to prevent direct external client instantiation.

What is the best way to standardize dependency wiring templates across Go modules?

Standardize dependency wiring templates across Go modules by applying example templates for deps, service, repo, and handler registration that codify constructor injection patterns and enforce consistent initialization across new modules.

How do I integrate dependency injection validation into CI pipelines for Go repositories?

To integrate dependency injection validation into CI pipelines for Go repositories, run static code scans matching configured globs for service, repository, and handler files to detect forbidden imports and direct external client instantiation during builds.