add-backend-development
Backend API architecture: Clean Architecture, SOLID, DTOs, Services, Repositories, RESTful — stack-agnostic.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Backend API architecture: Clean Architecture, SOLID, DTOs, Services, Repositories, RESTful — stack-agnostic.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Consolidated view of the add-pro ecosystem - commands, skills, relationships and dependencies. Loaded by /add as source of truth.
Source of truth for ADD doc rules, depth floors, IDs, refs, validation gate. Load before any doc write.
Use when running agent-judged QA validation (read-PNG by default; the playwright plugin adds live driving) — the Level C judge rubric, severity taxonomy, dual-judge (@ux-agent review ∥ @qa-agent) method, report schema/template, and the config.json/screens.json formats. Consumed by /add.qa and both judges.
Use when a state-materializing command starts or is asked to upgrade — reads the setup receipt, compares the recorded contract against the shipped one, executes the declared upgrade deltas sequentially, and rewrites the receipt even on a verified-current no-op. Consumed by /add.qa-setup STEP 1.5 and STEP 11.
Internal skill for developing ADD framework artefacts (commands, skills, agents, scripts). Use when add-framework--plan analyzes viability of new framework features, when add-framework--build implements framework artefacts, or when creating/modifying commands, skills, or agents. Always use this skill before proposing or implementing changes to the framework itself.
Use when building, styling, or theming UI components, pages, layouts, dashboards, charts, tables, or forms for SaaS products.
| name | add-backend-development |
| description | Backend API architecture: Clean Architecture, SOLID, DTOs, Services, Repositories, RESTful — stack-agnostic. |
Skill for backend API implementation following universal architectural principles.
Use for: Routes/Controllers, Services, DTOs, Domain logic, Data access, Error handling
Not for: Frontend (ux-design), Database migrations (database-development), Security (security-audit)
Stack resolution: Consult CLAUDE.md ## Architecture Contract for the framework in use (Express, Fastify, NestJS, Hono, Elysia, etc.). Apply these principles using the framework's idiomatic patterns. The AI already knows each framework's syntax — this skill teaches architecture, not framework tutorials.
Reference: Always consult CLAUDE.md for general project standards.
ux-design or add-frontend-development insteadadd-database-developmentadd-security-auditadd-backend-architecture to choose structure firstadd-project-scaffolding for initial setupdomain → application → infrastructure → presentation
| Layer | Allowed deps | Content |
|---|---|---|
| domain | zero | entities, value objects, enums, types, domain errors |
| application | domain only | service interfaces, use cases, DTOs |
| infrastructure | domain, application | repository implementations, external services, config |
| presentation | all | routes/controllers, middleware, error mapping |
Rules:
| Method | Use | Idempotent | Body | Status |
|---|---|---|---|---|
| GET | read | yes | no | 200 |
| POST | create | no | yes | 201 |
| PUT | full update | yes | yes | 200 |
| PATCH | partial | yes | yes | 200 |
| DELETE | remove | yes | no | 204 |
URL rules:
Do:
/users/accounts/accounts/:id/users/user-roles/api/v1Don't:
/getUsers/user/userRolesParams:
Status codes:
| Code | Meaning |
|---|---|
| 200 | GET, PUT, PATCH ok |
| 201 | POST created |
| 204 | DELETE ok |
| 400 | validation |
| 401 | no auth |
| 403 | no permission |
| 404 | not found |
| 409 | conflict |
EVERY service, repository, and handler MUST be registered in the framework's DI container.
Principles:
Common DI errors: Unresolved dependency = not registered. Cross-module failure = not exported. Route 404 = module not loaded. Consult framework docs for idiomatic registration.
File naming (lookup):
| Type | Pattern |
|---|---|
| Controller / Route | kebab.controller.ts or kebab.routes.ts |
| Service | kebab.service.ts |
| Repository | PascalRepository.ts |
| Interface | IPascalRepository.ts |
| Entity | Pascal.ts |
| Enum | PascalCase.ts |
| DTO | PascalDto.ts |
Casing rules:
| Element | Casing |
|---|---|
| Files | kebab-case or PascalCase (follow project convention) |
| Classes | PascalCase |
| Interfaces | I + PascalCase |
| DB columns | snake_case |
| Variables | camelCase |
Paths and aliases: Follow the project's existing import aliases and directory structure. Do not invent new aliases — check tsconfig.json paths and existing code.
DTO naming:
| Action | Pattern |
|---|---|
| create | Create[Entity]Dto |
| update | Update[Entity]Dto |
| patch | Patch[Entity]Dto |
| response | [Entity]ResponseDto |
| list | [Entity]ListResponseDto |
| query | [Entity]QueryDto |
Rules:
create/update/patch) are SEPARATE from response DTOsreq/res, no status codes, no headers)| Layer | Responsibility |
|---|---|
| domain | Throw domain-specific errors (NotFoundError, BusinessRuleViolationError, ConflictError). No HTTP concepts. |
| application | Let domain errors propagate. Add application-level errors if needed (ValidationError). |
| presentation | Map domain/application errors to HTTP status codes. This is the ONLY layer that knows about HTTP. |
Error mapping:
| Domain | HTTP |
|---|---|
NotFoundError | 404 |
ValidationError | 400 |
UnauthorizedError | 401 |
ForbiddenError | 403 |
ConflictError | 409 |
BusinessRuleViolationError | 422 |
Rule: Services throw domain errors. The presentation layer (middleware, error handler, or framework mechanism) maps them to HTTP responses. Never import HTTP concepts into services.
Organize code by domain/feature, not by technical role. Each feature module contains its own controllers, services, DTOs, and domain logic.
[feature]/
├── dtos/
│ ├── Create[Feature]Dto.ts
│ ├── Update[Feature]Dto.ts
│ └── [Feature]ResponseDto.ts
├── [feature].controller.ts (or routes.ts)
├── [feature].service.ts
└── [feature].module.ts (or index.ts)
DDD-lite principles:
account_id) at repository levelprocess.env, Bun.env, etc.)Rules:
/getUsers, /createOrder)/api/v1/resource