AgentSkillsCN

api-design-pro

当审查架构边界、依赖关系方向,或跨模块进行多层设计决策时,可选用此技能。

SKILL.md
--- frontmatter
name: api-design-pro
description: Use when designing, reviewing, or modifying backend API endpoints, schemas, validation, and API documentation.

API Design Pro

Intent

Ensure the backend API is robust, scalable, and well-documented. Applies FastAPI-specific patterns (Dependency Injection, Background Tasks, Pydantic Schemas).

Checklist

  1. Pydantic Validation: Are all request/response models strictly typed?
  2. Error Handling: Are meaningful HTTP exceptions (400, 404, 500) used correctly?
  3. Dependency Injection: Use Depends() for database sessions, authentication, and service instances.
  4. Performance: Check for N+1 query problems in SQLAlchemy/Tortoise and ensure async/await is used properly.
  5. Security: Ensure OAuth2/JWT tokens are verified where necessary.

Output Format

API Specification Review

  • Endpoint: [METHOD] /path
  • Schema Validation: [Comments on Pydantic models]
  • Security Check: [Pass/Fail]
  • FastAPI Pro-Tip: [A specific FastAPI feature that could improve the code]