vanessamarely/ai-playbook-reposito/node-microservice-builder
Claude Code and agent skill by vanessamarely/ai-playbook-reposito
- community
Checking that the SKILL.md file is still in the repository.
Scaffold or extend Node.js/TypeScript microservices with validation, error handling, and testing. Use when the user wants to create or modify an API endpoint, service layer, or route handler in Express, Nest.js, or Fastify.
Install
npx vskill@latest install vanessamarely/ai-playbook-reposito/node-microservice-builderSKILL.md
The same SKILL.md was published earlier as vanessamarely/ai-playbook-reposito/node-microservice-builder.
Skill: Node Microservice Builder
Purpose
Create or modify Node.js/TypeScript microservice endpoints following backend conventions and best practices.
Inputs
serviceName: Name of the service or module.endpointSpec: HTTP method, path, request/response schemas, and business logic description.targetFolder: Service directory within the project.
Outputs
- Controller or route handler file.
- Validation schemas (Zod, Joi, or class-validator).
- Test file with unit and integration tests.
- Updated routing configuration if needed.
Procedure
Step 1: Validate Inputs
- Ensure
serviceNamefollows the project's naming convention. - Verify
targetFolderis a valid Node.js project (containspackage.json). - Check for
tsconfig.jsonto confirm TypeScript usage.
Step 2: Load Skill
Read: .agents/skills/node-typescript-service/SKILL.md
Follow the procedures defined in that skill.
Step 3: Detect Framework
Check package.json dependencies:
express→ Express.js@nestjs/core→ Nest.jsfastify→ Fastify
Adjust code patterns accordingly.
Step 4: Generate Endpoint Handler
- Create handler function with typed parameters.
- Implement request validation using the project's validation library.
- Add error handling with appropriate HTTP status codes.
- Structure response with consistent format.
For Nest.js:
- Use controller class with decorators (
@Controller,@Post, etc.). - Inject dependencies via constructor.
- Use DTOs with validation decorators.
For Express:
- Create route handler function.
- Use middleware for validation.
- Return responses via
res.status().json().
Step 5: Add Validation Schema
Refer to: .agents/skills/node-typescript-service/references/validation-and-errors.md
- Define input schema (request body, query params, path params).
- Use appropriate validation library based on framework:
- NestJS: class-validator with DTOs:
```typescript export class CreateUserDto { @IsString() @IsNotEmpty() @MaxLength(100) name!: string
@IsEmail() email!: string
@IsEnum(UserRole) role!: UserRole } ```
- Express: Joi or Zod middleware
- Ensure DTOs/schemas have explicit types (no
any). - Use discriminated unions for variant request types.
- Attach validation middleware or decorator.
- Provide typed response DTOs separate from entities:
``typescript export class UserResponseDto { id: string name: string email: string role: UserRole } ``
Step 6: Implement Error Handling
- Check for existing error handling patterns in the project.
- Use Result type pattern for service layer methods:
```typescript type Result<T, E = Error> =
| { success: true; data: T } |
|---|
| { success: false; error: E } |
async function findUser(id: string): Promise<Result<User>> { try { const user = await userRepository.findOne(id) if (!user) { return { success: false, error: new NotFoundError('User not found') } } return { success: true, data: user } } catch (error) { return { success: false, error: error instanceof Error ? error : new Error('Unknown error') } } } ```
- Create or use custom error classes with proper typing:
``typescript class ValidationError extends Error { constructor( message: string, public readonly field: string, public readonly value: unknown ) { super(message) this.name = 'ValidationError' } } ``
- Map business logic errors to HTTP status codes:
- 400 for validation errors
- 401 for authentication failures
- 403 for authorization failures
- 404 for not found
- 409 for conflict errors
- 500 for unexpected errors
- Return structured error responses:
``typescript interface ErrorResponse { statusCode: number message: string error: string timestamp: string path: string } ``
- Always handle promise rejections explicitly with try/catch.
Step 7: Generate Tests
Create test file adjacent to the handler:
- Unit tests for business logic.
- Integration tests for HTTP endpoints (use supertest or similar).
- Include test cases for:
- Successful request.
- Validation failures.
- Error conditions.
Step 8: Update Routing
If the project has centralized routing:
- Register the new endpoint in the routing module.
- Ensure route conflicts are avoided.
Step 9: Output Summary
Provide:
- Path to created handler file with markdown link
- Path to validation schema/DTO files with links
- Path to test file with link
- List of TypeScript patterns used (Result types, custom errors, DTOs)
- Error handling approach documented
- Suggested verification commands (run from project folder):
npm run lintnpm test -- <serviceName>npm run buildnpm run type-check
Session Context: When this skill completes, session logs should show:
- Framework detection and selection reasoning
- Validation strategy chosen and why
- Error handling patterns applied
- TypeScript type safety measures
- Test coverage decisions
- Any assumptions made about business logic
Error Handling
- Framework mismatch: If the detected framework differs from expectation, clarify before proceeding.
- Missing validation library: Suggest installing an appropriate package.
- Route conflict: Notify and suggest alternative path or method.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingai-playbook/.agents/skills/node-microservice-builder/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/vanessamarely/ai-playbook-reposito/node-microservice-builder)