Coding: API Endpoint
Specifying the full contract (method, route, auth, schema) upfront means the generated code matches your architecture. Requiring error handling and tests produces production-ready code.
Create a {{framework}} API endpoint for {{endpoint_purpose}}. Specifications: - Method: {{http_method}} - Route: {{route_path}} - Auth: {{auth_type}} (e.g., JWT, API key, none) - Request body: {{request_schema}} - Response: JSON with proper status codes (200, 400, 401, 404, 500) Requirements: - Input validation with descriptive error messages - Proper error handling (try/catch, don't expose internal errors) - TypeScript types for request and response - One integration test example using {{test_framework}} Add inline comments explaining non-obvious decisions.
Variables to customize
Why this prompt works
Specifying the full contract (method, route, auth, schema) upfront means the generated code matches your architecture. Requiring error handling and tests produces production-ready code.
Save this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Forcing the agent to plan before acting prevents premature execution and wasted steps. Explicit dependency mapping enables parallel execution and catches logical gaps early.
Tool Selection AgentThe ReAct pattern (Reason + Act) creates an explicit reasoning trace that improves tool selection accuracy. The error-handling rule prevents infinite retry loops.
Prompt CompressorExplicitly requiring all functional requirements to be preserved prevents the model from over-compressing and losing critical instructions.
Memory Management AgentExplicit memory read/write instructions create agents that improve over time. Categorization keeps memories organized, and the deduplication rule prevents context bloat.