Build a REST endpoint end to end
Implements one HTTP endpoint with route, input validation, handler, error mapping and tests in the project's own framework and conventions. Use when adding an API route.
A new endpoint is a public contract. Clients will depend on its status codes and error bodies, and attackers will probe its validation and authorization. The usual failures are: validation that trusts types but not ranges, an ownership check that is missing because the route is authenticated, errors that leak stack traces, a handler that duplicates business logic already living in a service, and tests that cover only the happy path.
Implement this endpoint:
Framework: (if empty, detect it from the dependency manifest and existing routes). Authorization: (if empty, copy the policy of the closest existing route and say which one).
- Study two or three existing routes. Note how they register routes, validate input, call services, map errors, shape error bodies, log, paginate, and test. Follow that pattern exactly.
- Write the contract first: method, path, request schema with types, required fields, ranges and string limits, success response, and every error response. Use the method's semantics: GET is safe; PUT and DELETE are idempotent; POST creating a resource returns 201 with a
Locationheader if the project does that elsewhere. - Validate at the boundary. Reject bad input with the project's validation error status (400 or 422, whichever it already uses). Follow the project's policy on unknown fields. Cap page sizes and list lengths.
- Authorize the resource, not just the caller. Load the object and check the caller may act on it (broken object-level authorization is the most common API flaw). Use 401 for no or invalid credentials and 403 for authenticated but not allowed; use 404 instead where the project hides resources the caller does not own.
- Keep the handler thin: parse, authorize, call the existing domain or service layer, map the result. Map domain errors to HTTP in the project's central place. If there is none, use RFC 9457 problem details.
- If the repo has an OpenAPI or other schema file, update it in the same change.
- Write tests for the happy path, each validation rule, missing auth (401), another user's resource (403 or 404), not found, and any conflict (409) or precondition (412) the spec implies.
- Run the tests and the type check.
- No stack traces, SQL, internal ids or secrets in error responses. Log them server-side with the request id instead, and keep personal data out of logs.
- Do not add a new validation, HTTP or error library if the project already has one.
- Wrap multi-step writes in a transaction if the project uses them elsewhere.
- If the spec conflicts with existing conventions (for example camelCase versus snake_case fields), follow the conventions and record the conflict under Decisions.
- Do only what was asked. If you notice something else worth changing, mention it in one line at the end instead of changing it.
- Keep the change as small as it can be while still being correct.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
- Before saying the work is done, run the check that proves it (tests, build, type check or the command the user gave) and report the real result.
- If you could not run a check, say so plainly and say which one.
Contract
METHOD /path, then a table: Case | Status | Body shape. Then the request schema.
Changes
One line per file: path, what changed.
Tests
One line per test: the case it covers.
Decisions
Choices the spec did not settle, and the existing code that justified each.
Verification
Commands run and actual results.
1 required value still a placeholder; the assistant will ask for it.
details
- kind
- Prompt: a task you run by name to get one finished thing back
- domain
- Software engineering
- category
- Implementation
- level
- Intermediate
- made for
- Backend engineer, Full-stack engineer, Software engineer
- needs
- repo-read, file-write, shell
- risk
- runs-commands
- version
- v1.0.0 · incubating
- reviewed
- 2026-10-02
- works in
- Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Antigravity, OpenCode, Windsurf, Zed, Continue, AGENTS.md
use in
npx @hermes-hq/hodios install build-rest-endpoint --target claude-codenpx skills add hermes-hq/hodios-dist --skill build-rest-endpoint -a claude-codeclaude plugin marketplace add hermes-hq/hodios-distclaude plugin install hodios-software-engineering@hodiosThe plugin brings every entry in this domain at once.
more in implementation
All of ImplementationPut a change behind a feature flag
Wraps new behaviour behind a feature flag with a safe default, a kill switch, tests for both paths and a cleanup ticket. Use when shipping a risky change incrementally.
add-feature-flagAdd rate limiting to an API
Adds rate limiting to API endpoints with a fitting algorithm, keys, per-tier limits, standard headers, 429 responses and tests. Use when protecting endpoints from abuse or overload.
add-rate-limitingBackend engineer
Acts as a backend engineer focused on correct data handling, clear API contracts, explicit failure modes and services that are easy to operate. Use as a builder or reviewer persona for server code.
backend-engineerBuild a reusable UI component
Builds a typed, accessible UI component from a description or screenshot, with loading, empty and error states and a usage example. Use when adding a component to a frontend.
build-ui-componentBuild a webhook handler
Implements a webhook receiver with signature checks, replay protection, idempotent processing, fast acknowledgement, async work, retries and tests. Use when integrating Stripe, GitHub or similar.
build-webhook-handlerFrontend engineer
Acts as a frontend engineer who balances UX, accessibility, performance and maintainable components, and checks work in a real browser. Use to build or review web UI.
frontend-engineer