Generates production-quality REST API endpoints with routes, validation, error handling, and tests based on a resource description.
Ships in recipe-commands. Installing the plugin adds it to Claude Code.
Generate production-quality REST API endpoints from a description provided in $ARGUMENTS.
Parse $ARGUMENTS to determine:
If $ARGUMENTS is vague (e.g., just "users"), generate a standard CRUD API with sensible defaults and ask the user to confirm the field list before writing code.
Search the project to determine:
If no existing backend framework is found, ask the user which stack to use. Do not assume.
Create a specification before writing any code:
## API Design: [Resource]
Base path: /api/[resource]
| Method | Path | Description | Auth | Status Codes |
|--------|-----------------|----------------------|------|--------------------|
| GET | / | List all (paginated) | Yes | 200, 401 |
| GET | /:id | Get one by ID | Yes | 200, 401, 404 |
| POST | / | Create new | Yes | 201, 400, 401, 409 |
| PUT | /:id | Update by ID | Yes | 200, 400, 401, 404 |
| DELETE | /:id | Delete by ID | Yes | 204, 401, 404 |
### Request/Response Shapes
(show the JSON schema for request body and response body)
Present this design to the user and ask for confirmation before generating code.
Create files following the project's existing structure. Generate:
{
"error": {
"code": "NOT_FOUND",
"message": "User with ID 123 not found"
}
}
Write tests for every endpoint:
Use the project's existing test framework and patterns. Place test files where the project convention dictates.
## API Generation Report
**Resource:** [name]
**Endpoints:** [count]
### Files Created
- (path) -- model/schema
- (path) -- validation
- (path) -- controller/handlers
- (path) -- routes
- (path) -- tests
### Endpoints
| Method | Path | Description |
|--------|------|-------------|
| ... | ... | ... |
### Tests Written
- [count] test cases covering success, validation, not-found, and auth scenarios
### Next Steps
- Add business-specific validation rules
- Implement authorization (who can access what)
- Add rate limiting if this is a public API
- Update API documentation
What the command file sets; muted values are Claude Code's defaults
sonnet7-day visitors to each command page
/recipe-commands:api-genfrom recipe-commands
npx claudepluginhub sagargupta16/claude-code-recipes --plugin recipe-commands15 commands in this plugin
/audit-reposStep 1 -- List the ReposAudit all your GitHub repos for CI health, hygiene, security alerts, and staleness/check-all-prsStep 1 -- Find the PRsCheck all your open PRs across GitHub repos for CI, reviews, and merge readiness/code-reviewStep 1 -- Gather the DiffReview staged git changes for bugs, security issues, and style violations/commit-messageStep 1 -- Get the Staged DiffGenerate a conventional commit message from staged changes/component-genStep 1 -- Parse the RequestGenerate React or Vue components with prop types, styling, accessibility, and tests/debugPhase 1 -- Understand the Bug ReportSystematic debugging -- reproduce, isolate, fix, verify, and add regression test