Prompts for Backend Developers: copy one, fill it in, paste it into your AI.
Track progress as a memberIn this lesson
- 01Draft REST Endpoint SkeletonUse this when you need a working controller and route scaffold in your framework before the real logic exists.
- 02Write Request Validation RulesUse this when you need to define and enforce input schemas for an endpoint.
- 03Generate OpenAPI Spec for an EndpointUse this when you need to document an API for frontend or partner teams.
Draft REST Endpoint Skeleton
Use this when you need a working controller and route scaffold in your framework before the real logic exists.
Role You are a backend engineer who drafts idiomatic REST endpoint scaffolds that drop into an existing service and can be wired up without rework.
Context you provide
- {{framework}} and {{language}} with the routing style in use
- {{resource_name}} and the actions needed (list, read, create, update, delete)
- {{api_version}} and base path prefix
- {{auth_scheme}} and which roles may call each action
- {{fields}} with types, required or optional, and validation rules
- {{db_layer}} and the table or collection names
- {{error_conventions}} status codes and error body shape
- {{existing_patterns}} folder layout and shared middleware
Instructions
- Ask for any missing inputs, then restate the resource, actions, and response shape for confirmation.
- Draft route registration for each action using the versioned path.
- Write one handler per action: parse input, validate it, call a named service function, return the response.
- Leave the service layer as a stub with the expected signature and a TODO.
- Map each validation or lookup failure to the agreed status code and error body.
- Mark where authentication and role checks belong in the chain.
- Close with a list of what the developer must still implement.
Output format Three fenced code blocks: route registration, handlers, service stubs. Follow with a short file map and TODO list. Comment only where intent is not obvious. Stay under 150 lines. Skip migrations, tests, and deployment config.
Guardrails
- Do not invent framework APIs, package names, or library versions. If unsure, use a plain placeholder and say so.
- Flag every assumption about schema, auth, or status codes at the end.
- Tell the user to confirm details against their framework version docs and have a senior engineer review before merging.
Example Framework: FastAPI, language: Python, resource: invoices, api version: v1, auth: bearer token, roles: admin and viewer.
Write Request Validation Rules
Use this when you need to define and enforce input schemas for an endpoint.
Role You are a backend engineer who turns endpoint requirements into precise, testable request validation rules that block malformed or unsafe input before it reaches business logic.
Context you provide
- {{endpoint_method_and_path}}: e.g. POST /v1/orders
- {{resource_or_entity}}: what the endpoint creates or updates
- {{field_inventory}}: each field, type, required or optional, constraints, allowed values
- {{content_types}}: expected request body format and content types
- {{auth_and_role_context}}: caller role and any tenant or ownership scoping
- {{error_response_convention}}: status codes and error body shape
- {{framework_and_validation_library}}: language, framework, existing validation tool
- {{localization_requirements}}: error message language and tone
Instructions
- Ask for any missing inputs, then draft the validation rules.
- Split fields into required and optional; note types and constraints.
- For each field, define rules: presence, type, length, range, pattern, enum, trimming.
- Add object-level rules: unknown fields, conditional requirements, cross-field checks, array limits.
- Map every failure to a clear error code, message, and HTTP status.
- State where each rule runs (middleware, controller, or model) and any performance notes.
- Provide example valid and invalid payloads and a test checklist.
Output format Return a markdown document with: a short summary; a field-level rules table (field, type, required, constraints, error code); object-level rules; error response examples; and a test checklist. Keep it concise and skip full implementation code unless asked. Leave out generic security advice and unrelated endpoint details.
Guardrails
- Do not invent field names, constraints, or standards numbers; if a constraint is missing, mark it as an open question for the user.
- Flag any rule that depends on framework-specific behavior or requires a security or compliance review.
- Tell the user to check the framework or validation library documentation for exact syntax and edge-case behavior.
Example POST /v1/orders, order entity, fields: customer_id (UUID, required), items (array of {sku, quantity}), notes (string, optional, max 500), content-type application/json, auth: customer role, errors: {error: {code, message, field}}, stack: TypeScript with a web framework and schema validation library, localization: English.
Generate OpenAPI Spec for an Endpoint
Use this when you need to document an API for frontend or partner teams.
Role You are a backend engineer who writes precise, standards-compliant OpenAPI 3.0 specifications so frontend and partner teams can integrate without guesswork. Optimise for clarity, consistency and copy-paste accuracy.
Context you provide
- {{endpoint_name}} — short name, e.g. "Create Invoice"
- {{http_method_and_path}} — e.g. "POST /v1/invoices"
- {{purpose}} — what the endpoint does, in one sentence
- {{auth_scheme}} — e.g. "Bearer JWT", "API key header"
- {{request_fields}} — field names, types, required/optional, constraints
- {{response_fields}} — field names and types for success and error cases
- {{status_codes}} — success and error codes you actually return
- {{existing_conventions}} — naming, pagination or error-envelope rules to follow
Instructions
- Ask for any missing inputs, then continue once you have them.
- Confirm the resource model and naming conventions before writing.
- Draft a complete OpenAPI 3.0 document for this single endpoint: paths, operation, parameters, requestBody, responses and security.
- Include one realistic request example and one success response example.
- Add error responses for each status code supplied, with a short description.
- List any assumptions you made and any field you had to guess.
Output format One YAML code block containing the full spec, followed by a short bulleted list of assumptions. Keep descriptions under 15 words. No prose outside the code block and assumption list.
Guardrails
- Do not invent field names, status codes or auth mechanisms; use only what is provided or clearly flag the gap.
- Do not claim compliance with any external standard or regulation unless the user states it.
- Remind the user to validate the spec against their actual implementation and gateway before sharing with partners.
Example endpoint_name: Create Invoice; method_and_path: POST /v1/invoices; auth: Bearer JWT; request_fields: customer_id (string, required), amount_cents (integer, required), currency (string, required); status_codes: 201, 400, 401, 422.
Skills for these tasks
Give your AI these skills and it does these tasks the expert way. Connect your AI once and it picks them up by itself.