AgentSkillsCN

Backend API

以恰当的 HTTP 方法、状态码及一致的命名规范设计并实现 RESTful API 端点。在创建或修改 API 路由、端点,或服务器端请求处理器时,务必运用这一技能。适用于 src/pages/api/ 目录下的各类文件:包含 API 路由定义的文件、实现 REST 端点的文件、处理 HTTP 请求与响应的文件、用于 API 请求的服务器中间件、API 认证与授权逻辑,以及定义 API 版本控制策略的文件。在设计资源的 URL 结构、实现查询参数的过滤/排序/分页功能、为 API 端点设置速率限制,或配置 CORS 与 API 安全性头部时,同样需要运用此技能。

SKILL.md
--- frontmatter
name: Backend API
description: Design and implement RESTful API endpoints with proper HTTP methods, status codes, and consistent naming conventions. Use this skill when creating or modifying API routes, endpoints, or server-side request handlers. When working on files in src/pages/api/, files containing API route definitions, files implementing REST endpoints, files handling HTTP requests and responses, server middleware for API requests, API authentication and authorization logic, and files defining API versioning strategies. When designing URL structures for resources, implementing query parameter handling for filtering/sorting/pagination, setting up rate limiting for API endpoints, or configuring CORS and API security headers.

Backend API

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.

When to use this skill

  • When creating or editing API route files (e.g., src/pages/api/*.ts, src/pages/api/*.js)
  • When implementing RESTful endpoints with GET, POST, PUT, PATCH, DELETE methods
  • When designing resource-based URL structures and route hierarchies
  • When handling query parameters for filtering, sorting, pagination, or search functionality
  • When defining API response formats and HTTP status codes
  • When implementing API versioning strategies (URL path or header-based)
  • When setting up rate limiting, throttling, or API quota management
  • When configuring API security headers, CORS policies, or authentication middleware
  • When writing server-side request handlers or middleware functions
  • When working on API documentation or OpenAPI/Swagger specifications

Instructions

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