[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-635c7bc9-9ff6-4d60-9962-a1112ba598e9":3,"$f7M-ULxJBAnXltIliFVF56Vrm5MBVQ9f01o6Q8FntDeE":42},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":33},"635c7bc9-9ff6-4d60-9962-a1112ba598e9","api-patterns","API设计原则和决策。REST与GraphQL与tRPC选择，响应格式，版本控制，分页。","cat_coding_backend","mod_coding","sickn33,coding","---\nname: api-patterns\ndescription: \"API design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.\"\nrisk: unknown\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# API Patterns\n\n> API design principles and decision-making for 2025.\n> **Learn to THINK, not copy fixed patterns.**\n\n## 🎯 Selective Reading Rule\n\n**Read ONLY files relevant to the request!** Check the content map, find what you need.\n\n---\n\n## 📑 Content Map\n\n| File | Description | When to Read |\n|------|-------------|--------------|\n| `api-style.md` | REST vs GraphQL vs tRPC decision tree | Choosing API type |\n| `rest.md` | Resource naming, HTTP methods, status codes | Designing REST API |\n| `response.md` | Envelope pattern, error format, pagination | Response structure |\n| `graphql.md` | Schema design, when to use, security | Considering GraphQL |\n| `trpc.md` | TypeScript monorepo, type safety | TS fullstack projects |\n| `versioning.md` | URI\u002FHeader\u002FQuery versioning | API evolution planning |\n| `auth.md` | JWT, OAuth, Passkey, API Keys | Auth pattern selection |\n| `rate-limiting.md` | Token bucket, sliding window | API protection |\n| `documentation.md` | OpenAPI\u002FSwagger best practices | Documentation |\n| `security-testing.md` | OWASP API Top 10, auth\u002Fauthz testing | Security audits |\n\n---\n\n## 🔗 Related Skills\n\n| Need | Skill |\n|------|-------|\n| API implementation | `@[skills\u002Fbackend-development]` |\n| Data structure | `@[skills\u002Fdatabase-design]` |\n| Security details | `@[skills\u002Fsecurity-hardening]` |\n\n---\n\n## ✅ Decision Checklist\n\nBefore designing an API:\n\n- [ ] **Asked user about API consumers?**\n- [ ] **Chosen API style for THIS context?** (REST\u002FGraphQL\u002FtRPC)\n- [ ] **Defined consistent response format?**\n- [ ] **Planned versioning strategy?**\n- [ ] **Considered authentication needs?**\n- [ ] **Planned rate limiting?**\n- [ ] **Documentation approach defined?**\n\n---\n\n## ❌ Anti-Patterns\n\n**DON'T:**\n- Default to REST for everything\n- Use verbs in REST endpoints (\u002FgetUsers)\n- Return inconsistent response formats\n- Expose internal errors to clients\n- Skip rate limiting\n\n**DO:**\n- Choose API style based on context\n- Ask about client requirements\n- Document thoroughly\n- Use appropriate status codes\n\n---\n\n## Script\n\n| Script | Purpose | Command |\n|--------|---------|---------|\n| `scripts\u002Fapi_validator.py` | API endpoint validation | `python scripts\u002Fapi_validator.py \u003Cproject_path>` |\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,108,1010,"2026-05-16 13:03:27",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":25,"skillCount":32,"createdAt":26},"后端开发","backend","mdi-server","API、数据库、服务端架构",296,[34],{"id":35,"skillId":4,"version":36,"fileName":37,"fileSize":38,"filePath":39,"fileHash":40,"manifest":41,"createdAt":19},"801b3edc-170c-41fe-ae7e-bf621f879ccc","1.0.0","api-patterns.zip",10288,"uploads\u002Fskills\u002F635c7bc9-9ff6-4d60-9962-a1112ba598e9\u002Fapi-patterns.zip","5505a36140103a451e64b0fc50cb29f04acb74fd8fb632681c03d071c50d84d9","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":2870},{\"path\":\"api-style.md\",\"isDirectory\":false,\"size\":1155},{\"path\":\"auth.md\",\"isDirectory\":false,\"size\":576},{\"path\":\"documentation.md\",\"isDirectory\":false,\"size\":549},{\"path\":\"graphql.md\",\"isDirectory\":false,\"size\":977},{\"path\":\"rate-limiting.md\",\"isDirectory\":false,\"size\":726},{\"path\":\"response.md\",\"isDirectory\":false,\"size\":921},{\"path\":\"rest.md\",\"isDirectory\":false,\"size\":1280},{\"path\":\"scripts\u002Fapi_validator.py\",\"isDirectory\":false,\"size\":7593},{\"path\":\"security-testing.md\",\"isDirectory\":false,\"size\":2892},{\"path\":\"trpc.md\",\"isDirectory\":false,\"size\":801},{\"path\":\"versioning.md\",\"isDirectory\":false,\"size\":651}]",{"code":43,"message":44,"data":45},200,"success",{"items":46,"stats":47,"page":50},[],{"averageRating":48,"totalRatings":48,"ratingCounts":49},0,[48,48,48,48,48],{"limit":51,"offset":48,"hasMore":52,"nextOffset":51,"ratedOnly":16},15,false]