Install in seconds
Install this skill
Copy the command and run it in your terminal. You can review the source before installing.
terminal
git clone https://github.com/val1813/kwcode

Works with Git. The repository opens in your current directory.

🌐
AI EngineeringPython

API Expert

by val1813

Provides REST API design best practices and auto-generates endpoints with framework-specific routing, validation, and error handling.

676 stars92 forksAdded 2026/07/14

Documentation

README

领域知识

  • 资源命名用复数名词(/users, /orders),避免动词
  • HTTP方法语义:GET查询、POST创建、PUT全量更新、PATCH部分更新、DELETE删除
  • 状态码:200成功、201已创建、204无内容、400参数错误、401未认证、403无权限、404不存在、409冲突、422验证失败、500服务端错误
  • 分页:支持 ?page=1&size=20,响应包含 total/pages/current 元数据
  • 错误响应统一格式:{"code": int, "message": str, "details": [...]}
  • 认证:Bearer Token 放 Authorization header,不放 URL 参数
  • 版本控制:URL前缀 /api/v1/ 或 Accept header
  • 自动检测框架(Flask/FastAPI/Express/Spring)并适配对应路由注册方式
  • FastAPI 优先用 Pydantic model 做请求/响应校验
  • Express 用 router.route() 链式注册同路径不同方法

经验规则(自动生成)