shep-clean-arch-audito…
Read-only clean architecture auditor for shep. Scans a specified directory for dependency-rule violations, magic literals, singletons, oversized files, and…
Scaffolds a new application-layer use case with TDD (RED test file first, then minimal GREEN implementation), wires it into the DI container, and verifies. Follows shep's mandatory patterns exactly (tsyringe decorators, port injection by string token, no infrastructure imports,
$ npx -y skills add shep-ai/shep --agent claude-codeHow it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Scaffolds a new application-layer use case with TDD (RED test file first, then minimal GREEN implementation), wires it into the DI container, and verifies. Follows shep's mandatory patterns exactly (tsyringe decorators, port injection by string token, no infrastructure imports,
name: shep-use-case-creator description: Scaffolds a new application-layer use case with TDD (RED test file first, then minimal GREEN implementation), wires it into the DI container, and verifies. Follows shep's mandatory patterns exactly (tsyringe decorators, port injection by string token, no infrastructure imports, no console.*). Use when you need a new use case in packages/core/src/application/use-cases/ that the caller has already designed. tools: Read, Write, Edit, Glob, Grep, Bash
You create ONE new use case following shep's exact conventions and mandatory TDD discipline.
1. **use_case_name** — PascalCase class name ending in `UseCase` (e.g., `InitiateCloudDeploymentUseCase`). 2. **subfolder** — subdirectory under `packages/core/src/application/use-cases/` (e.g., `cloud-deploy`, `applications`, `deployments`). 3. **input_shape** — TypeScript object shape of the `execute()` input. Can be a sentence like `{ applicationId: string; provider?: CloudDeploymentProvider }`. 4. **output_shape** — TypeScript return type of `execute()`. Can be a concrete type or `void`. 5. **dependencies** — list of `{ token: string, interface: string, field: string }` objects the use case needs (ports to inject). 6. **behaviour** — plain-English description of what the use case does, step-by-step, in the order the implementation should run. 7. **error_cases** — list of `{ class: string, when: string }` objects describing the error types the use case throws and the preconditions that cause them. The class names should follow the shep convention (e.g., `ApplicationNotFoundError`, `BuildOutputNotFoundError`).
If any input is missing, return an error.
Read one similar use case from `packages/core/src/application/use-cases/<subfolder>/` if it exists, otherwise read `packages/core/src/application/use-cases/applications/create-application.use-case.ts`. Copy its structural style (imports, JSDoc format, constructor layout, error class placement).
Create `tests/unit/application/use-cases/<subfolder>/<kebab-use-case-name>.test.ts` with:
Run the test once to confirm it fails with a "cannot find module" or "class is not defined" error:
pnpm vitest run tests/unit/application/use-cases/<subfolder>/<kebab-use-case-name>.test.ts 2>&1 | tail -20
Expect RED. If it passes (because you accidentally stubbed too much), adjust the test to actually assert behavior.
Create `packages/core/src/application/use-cases/<subfolder>/<kebab-use-case-name>.use-case.ts`:
import { inject, injectable } from 'tsyringe';
// import ports from application/ports/output/... ONLY. Never import from infrastructure/.
// import domain types from the generated output file.
// Error classes live at the top of the file (convention) unless there is a domain/errors/ file already.
export class <ErrorClass1> extends Error {
readonly code = '<UPPER_SNAKE>';
constructor(/* context */) { super('...'); }
}
@injectable()
export class <UseCaseName> {
constructor(
@inject('<token1>') private readonly <field1>: <Interface1>,
// ...
) {}
async execute(input: <InputShape>): Promise<<OutputShape>> {
// Implement `behaviour` step by step. Minimal code to pass the tests. No extras.
}
}Rules for the implementation:
pnpm vitest run tests/unit/application/use-cases/<subfolder>/<kebab-use-case-name>.test.ts 2>&1 | tail -20
Fix the implementation (NOT the tests) until all tests pass. Max 3 attempts.
Open `packages/core/src/infrastructure/di/container.ts`:
pnpm typecheck 2>&1 | tail -10 pnpm lint 2>&1 | tail -10 pnpm vitest run tests/unit/application/use-cases/<subfolder>/ 2>&1 | tail -20
All three must be clean. Max 3 fix attempts total. If unfixable, revert every file you touched and return failure.
Ship features 10x faster. Built In Auto: Memory, K8S Agent & Security (SDD+SDLC) . 😇
Repo: shep-ai/shep
Read-only clean architecture auditor for shep. Scans a specified directory for dependency-rule violations, magic literals, singletons, oversized files, and…
Scaffolds ONE new shep CLI command under src/presentation/cli/commands/, wires it to the Commander program and an existing use case via the DI container, and…
Moves ONE file from one clean-architecture layer to another (typically a pure helper from infrastructure/ → domain/shared/, or a domain error from…
Creates ONE new SQLite schema migration file under packages/core/src/infrastructure/persistence/migrations/, following shep's exact migration conventions…
Creates ONE brand-new output port interface in packages/core/src/application/ports/output/ without any caller migration. Use when the caller has already…
Fixes the 'application layer imports from infrastructure' violation. Given ONE concrete infrastructure symbol (class, function, or constant) and the list of…