AgentSkillsCN

Backend API

遵循REST原则,以恰当的HTTP方法、状态码、基于资源的URL以及速率限制,设计并实现RESTful API端点。在创建或修改API端点、路由处理器、控制器,或任何后端API层代码时,可使用此技能。适用于处理定义API路由的文件(routes/*.ts、controllers/*.ts、api/*.ts、*Controller.cs),实现请求/响应处理器,制定API版本控制策略,或配置端点中间件。无论是构建Bun/Express API、ASP.NET Core Web API,还是Next.js API路由,此技能都能助你打造符合REST规范的API设计:清晰的资源导向型URL、统一的小写连字符命名规则、恰当的HTTP方法(GET、POST、PUT、PATCH、DELETE)、合理的状态码(200、201、400、404、500)、资源使用复数名词(如/users、/products)、适度的嵌套深度(最多2–3层)、支持查询参数以实现过滤、排序和分页,以及API版本控制策略和响应中的速率限制头。

SKILL.md
--- frontmatter
name: Backend API
description: Design and implement RESTful API endpoints following REST principles with proper HTTP methods, status codes, resource-based URLs, and rate limiting. Use this skill when creating or modifying API endpoints, route handlers, controllers, or any backend API layer code. Apply when working on files that define API routes (routes/*.ts, controllers/*.ts, api/*.ts, *Controller.cs), implement request/response handlers, establish API versioning, or configure endpoint middleware. Use when building Bun/Express APIs, ASP.NET Core Web APIs, or Next.js API routes. This skill ensures RESTful design with clear resource-based URLs, consistent lowercase hyphenated naming, appropriate HTTP methods (GET, POST, PUT, PATCH, DELETE), proper status codes (200, 201, 400, 404, 500), plural nouns for resources (/users, /products), limited nesting depth (2-3 levels max), query parameters for filtering/sorting/pagination, API versioning strategies, and rate limiting headers in responses.

Backend API

When to use this skill:

  • When creating new API endpoints or route definitions
  • When modifying existing API route handlers or controllers
  • When working on files that define REST API structure (routes/.ts, api/.ts, controllers/*.ts, *Controller.cs)
  • When implementing HTTP request/response handling logic
  • When designing URL structures and resource naming conventions
  • When adding query parameters for filtering, sorting, or pagination
  • When implementing API versioning strategies (URL path or headers)
  • When defining HTTP status codes for various response scenarios
  • When working on rate limiting or API middleware
  • When building Bun, Express, Hono, or ASP.NET Core Web API backends
  • When implementing Server Actions in Next.js for data mutations
  • When configuring CORS, request size limits, or authentication middleware

This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle backend API.

Instructions

For details, refer to the information provided in this file: backend API