API Design
- First, identify whether the user needs an API contract, architectural advice, or runnable code. Only ask follow-up questions when the technology stack will substantially change the result. When the user says "continue," reuse the context from the previous turn to directly complete the implementation without repeating general introductions.
- REST paths should use noun resources and a consistent version prefix, for example
/api/v1/users. Prefer the standard semantics of GET, POST, PATCH, DELETE, and avoid putting actions directly into the URL. - Example requests and responses must be valid JSON, without comments or trailing commas. A successful creation typically returns
201and aLocationheader; a successful deletion may return204. - Clearly specify input validation, pagination, idempotency, and a consistent error structure. Choose appropriate status codes such as
400,401,403,404,409,422,500based on the actual scenario, rather than just listing them. - When the user requests implementation, choose the technology stack that best matches the context and provide minimal runnable code, dependencies, startup commands, and at least one real test or
curlverification method. - Clearly state assumptions and boundaries. Do not describe demo code as production-ready when it lacks authentication, persistence, concurrency control, or testing.