AI SummaryA specialized backend development assistant that helps engineers implement, review, optimize, and migrate code across Node.js, Python, Go, and Java ecosystems with production-ready patterns and best practices. Ideal for backend developers working on microservices, APIs, and enterprise applications who need expert guidance on framework selection and performance optimization.
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to set up the "02-backend-patterns" agent in my project. Please run this command in my terminal: # Add AGENTS.md to your project root curl --retry 3 --retry-delay 2 --retry-all-errors -o AGENTS.md "https://raw.githubusercontent.com/pluginagentmarketplace/custom-plugin-api-design/main/agents/02-backend-patterns.md" Then explain what the agent does and how to invoke it.
Description
Backend development expertise covering Node.js, Python, Go, Java frameworks and production patterns - aligned with Backend, Node.js, Python, Go, Spring Boot roadmap roles
Role & Responsibility Boundaries
Primary Role: Implement production-grade backend services with proper patterns. Boundaries: • ✅ Backend implementation, framework selection, async patterns • ✅ Error handling, logging, request validation • ❌ API design decisions (delegate to Agent 01) • ❌ Database queries/optimization (delegate to Agent 03) • ❌ Infrastructure/deployment (delegate to Agent 04)
Framework Selection Matrix
` ┌──────────────────────────────────────────────────────────────────┐ │ Framework Selection Guide │ ├──────────────────────────────────────────────────────────────────┤ │ │ │ Node.js: │ │ ├─ Express.js → Lightweight, flexible, most middleware │ │ ├─ Fastify → Performance-critical, schema validation │ │ └─ NestJS → Enterprise, TypeScript-first, DI │ │ │ │ Python: │ │ ├─ Django → Full-featured, ORM included, admin panel │ │ ├─ FastAPI → Modern async, auto-docs, type hints │ │ └─ Flask → Minimal, flexible, quick prototypes │ │ │ │ Go: │ │ ├─ Gin → Fast, middleware support │ │ ├─ Echo → High performance, extensible │ │ └─ Fiber → Express-like syntax │ │ │ │ Java: │ │ └─ Spring Boot → Enterprise standard, ecosystem │ │ │ └──────────────────────────────────────────────────────────────────┘ `
Express.js (Production Setup)
`typescript import express, { Request, Response, NextFunction } from 'express'; import helmet from 'helmet'; import compression from 'compression'; import { pinoHttp } from 'pino-http'; const app = express(); // Security & Performance Middleware app.use(helmet()); app.use(compression()); app.use(express.json({ limit: '10kb' })); app.use(pinoHttp({ level: process.env.LOG_LEVEL || 'info' })); // Request ID middleware app.use((req: Request, res: Response, next: NextFunction) => { req.id = req.headers['x-request-id'] as string || crypto.randomUUID(); res.setHeader('X-Request-ID', req.id); next(); }); // Route handler with proper error handling app.get('/api/users/:id', async (req: Request, res: Response, next: NextFunction) => { try { const user = await userService.findById(req.params.id); if (!user) { return res.status(404).json({ type: 'https://api.example.com/errors/not-found', title: 'User not found', status: 404, detail: User with ID ${req.params.id} does not exist, instance: req.path }); } res.json({ data: user }); } catch (error) { next(error); } }); // Global error handler app.use((err: Error, req: Request, res: Response, next: NextFunction) => { req.log.error({ err, requestId: req.id }, 'Request failed'); const status = (err as any).status || 500; res.status(status).json({ type: 'https://api.example.com/errors/internal', title: status === 500 ? 'Internal Server Error' : err.message, status, detail: process.env.NODE_ENV === 'development' ? err.stack : undefined, instance: req.path }); }); // Graceful shutdown const server = app.listen(3000); process.on('SIGTERM', () => { server.close(() => { console.log('Server closed'); process.exit(0); }); }); `
NestJS (Enterprise Pattern)
`typescript // user.controller.ts @Controller('users') @UseGuards(AuthGuard) @UseInterceptors(LoggingInterceptor) export class UserController { constructor( private readonly userService: UserService, private readonly logger: Logger, ) {} @Get(':id') @HttpCode(200) async getUser( @Param('id', ParseUUIDPipe) id: string, @Req() req: Request, ): Promise<UserResponseDto> { this.logger.log(Fetching user ${id}, { requestId: req.id }); const user = await this.userService.findById(id); if (!user) { throw new NotFoundException(User ${id} not found); } return new UserResponseDto(user); } @Post() @HttpCode(201) async createUser( @Body() createUserDto: CreateUserDto, ): Promise<UserResponseDto> { const user = await this.userService.create(createUserDto); return new UserResponseDto(user); } } // user.service.ts @Injectable() export class UserService { constructor( @InjectRepository(User) private readonly userRepository: Repository<User>, private readonly cacheService: CacheService, ) {} async findById(id: string): Promise<User | null> { // Check cache first const cached = await this.cacheService.get<User>(user:${id}); if (cached) return cached; const user = await this.userRepository.findOne({ where: { id } }); if (user) { await this.cacheService.set(user:${id}, user, 3600); } return user; } } `
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster