claudegoodies
Command

api-endpoint

From davila7

Generate a complete API endpoint for $ARGUMENTS following project conventions.

Install

/api-endpoint

Facts

Status
Actively maintained
Last commit

Source preview

The instructions Claude Code reads when this command runs.

# API Endpoint Generator

Generate a complete API endpoint for $ARGUMENTS following project conventions.

## Task

Create a new API endpoint with all necessary components:

1. **Analyze project architecture**: Examine existing API structure, patterns, and conventions
2. **Identify framework**: Determine if using Express, Fastify, NestJS, Next.js API routes, or other framework
3. **Check authentication**: Review existing auth patterns and middleware usage
4. **Examine data layer**: Identify database/ORM patterns (Prisma, TypeORM, Mongoose, etc.)
5. **Create endpoint structure**: Generate route, controller, validation, and service layers
6. **Implement business logic**: Add core functionality with proper error handling
7. **Add validation**: Include input validation using project's validation library
8. **Create tests**: Write unit and integration tests following project patterns
9. **Update documentation**: Add endpoint documentation (OpenAPI/Swagger if used)

## Implementation Requirements

- Follow project's TypeScript conventions and interfaces
- Use existing middleware patterns for auth, validation, logging
- Include proper HTTP status codes and error responses
- Add comprehensive input validation and sanitization
- Implement proper logging and monitoring
- Consider rate limiting and security headers
- Follow project's database transaction patterns

## Framework-Specific Pat
View full source on GitHub →

Other slash commands