---
name: API Expert
slug: api-expert
category: AI Engineering
description: Provides REST API design best practices and auto-generates endpoints with framework-specific routing, validation, and error handling.
github: "https://github.com/val1813/kwcode/tree/master/kaiwu/builtin_experts/api"
language: Python
stars: 676
forks: 92
install: "git clone https://github.com/val1813/kwcode"
added: 2026-07-14T01:49:55.023Z
last_synced: 2026-07-14T01:49:55.023Z
canonical_url: "https://dirskills.com/skills/api-expert"
---

# API Expert

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

**Install:** `git clone https://github.com/val1813/kwcode`

## 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() 链式注册同路径不同方法

## 经验规则（自动生成）
