[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CRHK36AAHFS2A1N7S0N5VC":3,"skill-same:01M7CRHK36AAHFS2A1N7S0N5VC":50},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M7CRHK36AAHFS2A1N7S0N5VC","api-design-conventions",null,"Use when you design or change an endpoint's errors, status codes, pagination, idempotency or concurrency behaviour — one error shape, the status-code table, bounded lists, safe retries","makifbaysal\u002Ftasktrooper","makifbaysal","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F25031940?v=4","01M7CRG3ZCSYZSSEVDMW3DEYC8","Mehmet Akif Baysal","01M7CRG401FJ8YAXH5ER730XYV",122,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fbackend-developer\u002Fskills\u002Fapi-design-conventions\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: api-design-conventions\ncategory: api\ndescription: Use when you design or change an endpoint's errors, status codes, pagination, idempotency or concurrency behaviour — one error shape, the status-code table, bounded lists, safe retries\ntech_stack: Go\nsource: Zalando RESTful API Guidelines (CC-BY-4.0), IETF idempotency-key-header draft, RFC 9457, adapted\n---\n# API Design Conventions\n\n## Overview\n\nMost backend-caused QA bounces are inconsistency, not bugs: a 422 here and a 400 there, an unbounded list, a create that isn't safe to retry. This skill is the shared vocabulary so every endpoint in a service answers these the same way.\n\n**Core principle:** the repository's existing choice wins (rule repo-conventions-win); these are the defaults for a new repo or an endpoint with nothing established yet.\n\n## One error shape\n\nDefault for a repo with no convention yet: RFC 9457 `application\u002Fproblem+json` — `{type, title, status, detail, instance}` plus an extension array for field errors, e.g. `errors: [{field, message}]`. Never a bare string, never a stack trace, never a raw framework exception body. Map it in ONE place (fiber-rest-api's central `ErrorHandler`, Spring `@RestControllerAdvice` + `ProblemDetail`\u002F`spring.mvc.problemdetails.enabled=true`, Quarkus `@ServerExceptionMapper`) — not per handler.\n\n## Status code table\n\n| Code | When | Note |\n|---|---|---|\n| 200 \u002F 201 | success \u002F created | 201 includes `Location` of the new resource |\n| 204 | success with no body (e.g. delete) | |\n| 400 | unparseable or invalid input | or 422 if the repo already standardizes on it — don't introduce a second convention |\n| 401 \u002F 403 | unauthenticated \u002F forbidden | |\n| 404 | missing, OR present-but-not-yours (BOLA, api-security-checklist) | |\n| 409 | duplicate or invalid state transition | e.g. a unique-constraint violation (pgx `23505`) |\n| 412 | a conditional request's precondition failed | `If-Match` version mismatch |\n| 413 | body too large | |\n| 429 | rate-limited | include `Retry-After` |\n| 500 | genuinely unexpected only | never for validation or not-found |\n\nThe task's acceptance criteria or an existing contract always wins over this table.\n\n## Mapping database errors (Go, pgx)\n\nDo the translation in the adapter, never in the handler:\n\n```go\nswitch {\ncase errors.Is(err, pgx.ErrNoRows):\n    return domain.ErrNotFound\ncase isPGCode(err, \"23505\"):          \u002F\u002F unique_violation\n    return domain.ErrConflict\ncase isPGCode(err, \"23503\"):          \u002F\u002F foreign_key_violation\n    return domain.ErrInvalidReference\n}\n```\n\n## Pagination\n\n- Every list endpoint has a default page size (e.g. 20–50) and a enforced maximum (e.g. 100) — clamp silently or reject with 400, whichever the repo already does.\n- Deterministic order: `ORDER BY created_at DESC, id DESC` (a tiebreaker column prevents duplicate\u002Fmissing rows across pages when timestamps collide).\n- Prefer keyset pagination over offset for anything that can grow past a few thousand rows: `WHERE (created_at, id) \u003C ($1, $2) ORDER BY created_at DESC, id DESC LIMIT $3+1`, use the extra row to compute `has_more`, return an opaque `next_cursor` (base64 of the last row's sort key). Offset pagination (`LIMIT\u002FOFFSET`) is fine for small, bounded tables only.\n\n## Idempotency and concurrency\n\n- PUT and DELETE are idempotent by construction — calling them twice with the same input produces the same end state.\n- Make POST\u002Fcreate idempotent where duplicates are a real risk: a natural unique key with `INSERT ... ON CONFLICT (key) DO NOTHING RETURNING ...`, or an `Idempotency-Key` request header backed by a dedupe table, following the draft semantics: same key + same payload → replay the stored response; same key + different payload → 422; a second request with the same in-flight key → 409; a required key that's missing → 400.\n- Concurrent read-modify-write: optimistic locking with a `version` column (`UPDATE ... SET ..., version = version + 1 WHERE id = $1 AND version = $2`; zero rows affected → 409\u002F412) or JPA `@Version` (java-persistence); or `SELECT ... FOR UPDATE` inside one transaction when the operation must serialize.\n\n## Compatibility\n\nEvolve additively; prefer a new optional field over renaming one in place; readers should ignore fields they don't recognise rather than failing closed (api-contract-openapi has the breaking-change procedure).\n\n## Formats\n\nRFC 3339 timestamps in UTC; money as a decimal string or integer minor units, never a float; ids as strings even when they're numeric internally, so a client never silently loses precision.\n\n## Worked Example\n\n```\n❌ POST \u002Ftasks twice with the same client-generated request → two rows, two 201s\n✅ POST \u002Ftasks with Idempotency-Key: \u003Cuuid> twice → first 201, second replays the same 201 body\n\n❌ GET \u002Ftasks?page=50 on a 2M-row table → OFFSET 500000, a sequential scan\n✅ GET \u002Ftasks?after=\u003Ccursor>&limit=50 → keyset WHERE, index-only scan\n```\n\n## Common Mistakes\n\n- Two different error shapes in the same service.\n- A list endpoint with a default page size but no enforced maximum.\n- A create endpoint with no idempotency story on a client that can legitimately retry (mobile, flaky network).\n- Offset pagination on a table that will outgrow a few thousand rows.\n- Money stored\u002Freturned as a float.\n\n## Red Flags\n\n- A 500 response body that is actually a validation failure.\n- `OFFSET` climbing past five digits in a hot path.\n- A `version`\u002F`@Version` field present on the entity but never checked in the update query.\n","# API Design Conventions\n\n## Overview\n\nMost backend-caused QA bounces are inconsistency, not bugs: a 422 here and a 400 there, an unbounded list, a create that isn't safe to retry. This skill is the shared vocabulary so every endpoint in a service answers these the same way.\n\n**Core principle:** the repository's existing choice wins (rule repo-conventions-win); these are the defaults for a new repo or an endpoint with nothing established yet.\n\n## One error shape\n\nDefault for a repo with no convention yet: RFC 9457 `application\u002Fproblem+json` — `{type, title, status, detail, instance}` plus an extension array for field errors, e.g. `errors: [{field, message}]`. Never a bare string, never a stack trace, never a raw framework exception body. Map it in ONE place (fiber-rest-api's central `ErrorHandler`, Spring `@RestControllerAdvice` + `ProblemDetail`\u002F`spring.mvc.problemdetails.enabled=true`, Quarkus `@ServerExceptionMapper`) — not per handler.\n\n## Status code table\n\n| Code | When | Note |\n|---|---|---|\n| 200 \u002F 201 | success \u002F created | 201 includes `Location` of the new resource |\n| 204 | success with no body (e.g. delete) | |\n| 400 | unparseable or invalid input | or 422 if the repo already standardizes on it — don't introduce a second convention |\n| 401 \u002F 403 | unauthenticated \u002F forbidden | |\n| 404 | missing, OR present-but-not-yours (BOLA, api-security-checklist) | |\n| 409 | duplicate or invalid state transition | e.g. a unique-constraint violation (pgx `23505`) |\n| 412 | a conditional request's precondition failed | `If-Match` version mismatch |\n| 413 | body too large | |\n| 429 | rate-limited | include `Retry-After` |\n| 500 | genuinely unexpected only | never for validation or not-found |\n\nThe task's acceptance criteria or an existing contract always wins over this table.\n\n## Mapping database errors (Go, pgx)\n\nDo the translation in the adapter, never in the handler:\n\n```go\nswitch {\ncase errors.Is(err, pgx.ErrNoRows):\n    return domain.ErrNotFound\ncase isPGCode(err, \"23505\"):          \u002F\u002F unique_violation\n    return domain.ErrConflict\ncase isPGCode(err, \"23503\"):          \u002F\u002F foreign_key_violation\n    return domain.ErrInvalidReference\n}\n```\n\n## Pagination\n\n- Every list endpoint has a default page size (e.g. 20–50) and a enforced maximum (e.g. 100) — clamp silently or reject with 400, whichever the repo already does.\n- Deterministic order: `ORDER BY created_at DESC, id DESC` (a tiebreaker column prevents duplicate\u002Fmissing rows across pages when timestamps collide).\n- Prefer keyset pagination over offset for anything that can grow past a few thousand rows: `WHERE (created_at, id) \u003C ($1, $2) ORDER BY created_at DESC, id DESC LIMIT $3+1`, use the extra row to compute `has_more`, return an opaque `next_cursor` (base64 of the last row's sort key). Offset pagination (`LIMIT\u002FOFFSET`) is fine for small, bounded tables only.\n\n## Idempotency and concurrency\n\n- PUT and DELETE are idempotent by construction — calling them twice with the same input produces the same end state.\n- Make POST\u002Fcreate idempotent where duplicates are a real risk: a natural unique key with `INSERT ... ON CONFLICT (key) DO NOTHING RETURNING ...`, or an `Idempotency-Key` request header backed by a dedupe table, following the draft semantics: same key + same payload → replay the stored response; same key + different payload → 422; a second request with the same in-flight key → 409; a required key that's missing → 400.\n- Concurrent read-modify-write: optimistic locking with a `version` column (`UPDATE ... SET ..., version = version + 1 WHERE id = $1 AND version = $2`; zero rows affected → 409\u002F412) or JPA `@Version` (java-persistence); or `SELECT ... FOR UPDATE` inside one transaction when the operation must serialize.\n\n## Compatibility\n\nEvolve additively; prefer a new optional field over renaming one in place; readers should ignore fields they don't recognise rather than failing closed (api-contract-openapi has the breaking-change procedure).\n\n## Formats\n\nRFC 3339 timestamps in UTC; money as a decimal string or integer minor units, never a float; ids as strings even when they're numeric internally, so a client never silently loses precision.\n\n## Worked Example\n\n```\n❌ POST \u002Ftasks twice with the same client-generated request → two rows, two 201s\n✅ POST \u002Ftasks with Idempotency-Key: \u003Cuuid> twice → first 201, second replays the same 201 body\n\n❌ GET \u002Ftasks?page=50 on a 2M-row table → OFFSET 500000, a sequential scan\n✅ GET \u002Ftasks?after=\u003Ccursor>&limit=50 → keyset WHERE, index-only scan\n```\n\n## Common Mistakes\n\n- Two different error shapes in the same service.\n- A list endpoint with a default page size but no enforced maximum.\n- A create endpoint with no idempotency story on a client that can legitimately retry (mobile, flaky network).\n- Offset pagination on a table that will outgrow a few thousand rows.\n- Money stored\u002Freturned as a float.\n\n## Red Flags\n\n- A 500 response body that is actually a validation failure.\n- `OFFSET` climbing past five digits in a hot path.\n- A `version`\u002F`@Version` field present on the entity but never checked in the update query.\n",{"name":5,"source":24,"category":25,"tech_stack":26,"description":7},"Zalando RESTful API Guidelines (CC-BY-4.0), IETF idempotency-key-header draft, RFC 9457, adapted","api","Go","main","910394a0b6db9fc8c9a8f36328ec421d3ebd8b38","catalog\u002Fagents\u002Fbackend-developer\u002Fskills\u002Fapi-design-conventions",18,"https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper","https:\u002F\u002Ftasktrooper.ai","https:\u002F\u002Fgithub.com\u002Fmakifbaysal","Senior Software Developer","2026-11-15 04:50:29",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add makifbaysal\u002Ftasktrooper --skill api-design-conventions",{"tool":42,"command":43},"bunx","bunx skills add makifbaysal\u002Ftasktrooper --skill api-design-conventions",{"tool":45,"command":46},"pnpm","pnpm dlx skills add makifbaysal\u002Ftasktrooper --skill api-design-conventions","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fbackend-developer\u002Fskills\u002Fapi-design-conventions\u002FSKILL.md",true,[],[51,57,64,71,78,85],{"skillNo":52,"name":53,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M7CSVEPQW6J6TD6CS2T5FPNZ","visual-craft","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fvisual-craft\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M7CSVAQG91ETHQ0HBNZDG5FR","ux-copy","Use when you write any words a user reads in a mockup or a hand-off - content language and voice, buttons, labels, errors, empty states, confirmations, numbers and dates, and the longest-string check","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fux-copy\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7CSV6H0J38659NDXHJQ8396","screen-mockup-html","Use when you draw screens as the design task's HTML mockup - ONE canvas document holding every screen and every variant side by side, the sanitizer-safe recipe, phone and wide frames, the states grid, static control states, and the loopback self-check with screenshots at 375, 768 and 1440 attached to the task","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fscreen-mockup-html\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7CSV3JFRF3BM3XK52M7YEYR","performance-awareness","How the performance score moves for your role. Use when the score context shows a declining trend, or before handing off work you have not self-checked against every criterion.","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fperformance-awareness\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7CSTZDH00YRF5SCT7BRT9QD","design-variants","Use when a screen design needs variants - how many, variants as side-by-side rows on the one canvas, what makes two variants genuinely different, recommending one, how the human's choice is read, and narrowing to the chosen one in revision","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-variants\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7CSTV6P3SM3PAE28DB0RF77","design-system-authoring","Use when you derive, change or extend a design system - where tokens live per stack, the DTCG token tree, role-based names for both themes, base vs layer vs drift, the DESIGN.md section order, the inventory format, the contrast check and the lint every proposal returns","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-system-authoring\u002FSKILL.md",[],[]]