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 ONE new Next.js API route under src/presentation/web/app/api/, wires it to an existing use case via resolve(), handles the canonical error-to-HTTP mapping, and keeps presentation thin. Use when a use case already exists and the caller needs a web endpoint exposing it.
$ 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 ONE new Next.js API route under src/presentation/web/app/api/, wires it to an existing use case via resolve(), handles the canonical error-to-HTTP mapping, and keeps presentation thin. Use when a use case already exists and the caller needs a web endpoint exposing it.
name: shep-web-route-creator description: Scaffolds ONE new Next.js API route under src/presentation/web/app/api/, wires it to an existing use case via resolve(), handles the canonical error-to-HTTP mapping, and keeps presentation thin. Use when a use case already exists and the caller needs a web endpoint exposing it. Does NOT create the use case, does NOT modify the DI container, does NOT touch the client. tools: Read, Write, Edit, Glob, Grep, Bash
You create ONE new API route file that calls exactly ONE existing use case. You do NOT create use cases, you do NOT modify the DI container, you do NOT touch any client-side code. Strictly additive and strictly thin.
1. **route_path** — filesystem path under `src/presentation/web/app/api/` where the `route.ts` goes (e.g., `applications/[id]/cloud-deploy/initiate/route.ts`). 2. **http_method** — one of `GET`, `POST`, `PUT`, `DELETE`, `PATCH`. 3. **use_case_class** — the class name of the use case the route invokes (e.g., `InitiateCloudDeploymentUseCase`). 4. **use_case_import_path** — path to import the type from (e.g., `@shepai/core/application/use-cases/cloud-deploy/initiate-cloud-deployment.use-case`). Use the `@shepai/core/*` alias form, NOT relative paths. 5. **di_token** — the string token used to resolve the use case (e.g., `'InitiateCloudDeploymentUseCase'`). 6. **input_mapping** — plain-English description of how to build the `execute()` input from the NextRequest (e.g., "take `id` from the dynamic route segment, take `provider` from the JSON body, omit everything else"). 7. **output_shape** — description of what the route returns to the client (e.g., "202 with { ok: true, accepted: true }", "200 with the DTO from useCase.execute()"). 8. **error_mapping** — list of `{ error_class, import_path, status, extra?: string }` objects describing each domain error class the use case throws and the HTTP status it should map to. Every `import_path` MUST be `@shepai/core/domain/errors/*` (zero-dep targets). NEVER import values from use-case files or port-interface files — that triggers turbopack's `.js` resolution bug on packages/core.
If any input is missing, return an error. Do not guess.
Read one existing route that calls a use case via `resolve<T>()` to mirror the style. Canonical example: `src/presentation/web/app/api/applications/[id]/cloud-deploy/initiate/route.ts` (after task t-59). Pay attention to:
Create `src/presentation/web/app/api/<route_path>`:
/**
* <http_method> /<url shape>
*
* <one-line summary of what this route does>
*/
import type { NextRequest } from 'next/server';
import { NextResponse } from 'next/server';
import { resolve } from '@/lib/server-container';
import type { <use_case_class> } from '<use_case_import_path>';
// error imports — one line per error, all from @shepai/core/domain/errors/*
export const dynamic = 'force-dynamic';
interface RouteParams {
params: Promise<{ <segment>: string }>;
}
export async function <http_method>(
request: NextRequest,
{ params }: RouteParams
): Promise<NextResponse> {
try {
const { <segment> } = await params;
// parse body if needed
const useCase = resolve<<use_case_class>>('<di_token>');
const result = await useCase.execute({ /* per input_mapping */ });
return NextResponse.json(<result or whatever output_shape says>, { status: <ok status> });
} catch (error) {
// error handling per error_mapping
if (error instanceof <SomeError>) {
return NextResponse.json({ error: error.message, code: error.code }, { status: <status> });
}
// ...
return NextResponse.json(
{ error: error instanceof Error ? error.message : 'Internal server error' },
{ status: 500 }
);
}
}Rules for the implementation:
pnpm typecheck 2>&1 | tail -20 pnpm lint 2>&1 | tail -20 pnpm build:release 2>&1 | tail -40
The `build:release` gate is MANDATORY for this agent — any new route that compiles under typecheck but breaks the next build must be caught here. If the build fails with a turbopack module-not-found error, the cause is almost certainly a value import from a packages/core file that has internal `.js` imports. Fix by moving the error class target to `domain/errors/` (or reject the work and point the caller at `shep-file-relocator`).
Max 3 fix attempts. If unfixable, delete the route file 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…