Agent skill
Backend API
Design and implement NestJS REST API endpoints following the project's layered architecture (Controllers, Use Cases, Repositories). Use this skill when creating or modifying controller files (*.controller.ts), defining API routes, implementing HTTP handlers, setting up Swagger documentation, configuring route guards and decorators, working with request/response DTOs, or structuring API endpoints. This includes files in features/{feature}/controller/, auth/controller/, and any file with @Controller() decorator. Apply when working with API_ENDPOINTS constants, @Get/@Post/@Put/@Patch/@Delete decorators, @ApiTags/@ApiProperty swagger decorators, @Public/@MemberRoles custom decorators, HttpCode/HttpStatus configurations, or Query/Param/Body parameter decorators.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/documents/backend-api
SKILL.md
When to use this skill
- When creating new API endpoints or controllers (*.controller.ts files)
- When modifying existing HTTP route handlers in NestJS controllers
- When adding or updating Swagger/OpenAPI documentation decorators
- When implementing route-level authentication and authorization (guards, @Public, @MemberRoles)
- When defining request DTOs for query params, route params, or request bodies
- When defining response DTOs and handling HTTP status codes
- When working with files in
features/{feature}/controller/orauth/controller/directories - When using API_ENDPOINTS constants from @imkdw-dev/consts
- When structuring controller constructor dependency injection
Backend API
This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle backend API.
Instructions
For details, refer to the information provided in this file: backend API
Project-Specific Patterns
Controller Structure
@ApiTags('Feature Name')
@Controller()
@MemberRoles(MEMBER_ROLE.ADMIN) // Default role guard
export class FeatureController {
constructor(
private readonly createUseCase: CreateUseCase,
private readonly updateUseCase: UpdateUseCase,
private readonly getQuery: GetQuery
) {}
}
Route Handler Pattern
@Swagger.getItems('Description')
@Public() // For public endpoints
@Get(API_ENDPOINTS.GET_ITEMS)
async getItems(@Query() query: RequestDto): Promise<ResponseDto> {
return this.query.execute(query);
}
@Swagger.createItem('Description')
@Post(API_ENDPOINTS.CREATE_ITEM)
async createItem(@Body() dto: CreateDto) {
const result = await this.useCase.execute(dto);
return ResponseDto.from(result);
}
@Swagger.updateItem('Description')
@HttpCode(HttpStatus.NO_CONTENT)
@Put(API_ENDPOINTS.UPDATE_ITEM)
async updateItem(@Param('id') id: string, @Body() dto: UpdateDto): Promise<void> {
await this.useCase.execute(id, dto);
}
Key Conventions
- Use
HttpStatus.NO_CONTENTfor update/delete operations returning void - Separate read operations (Query classes) from write operations (UseCase classes)
- Import API endpoints from
@imkdw-dev/constspackage - Use feature-specific Swagger decorators from
swagger/{feature}.swagger.ts
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?