agentleFS
weiweimhyweiweimhy/agent-skills/api-design/SKILL.md

api-design

Skill0 starsChanged 5 months agoMITView on GitHub

Design resource-oriented APIs, REST paths, request/response contracts, pagination, error formats, and compatibility plans. Use when creating or reviewing API endpoints, DTOs, OpenAPI specs, or integration contracts.

125 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use data-modeling, ci-pipeline and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • mmondoraSkill

    data-modeling

    Schema design, multi-tenant data isolation, and migration management. Firestore and PostgreSQL patterns, RLS, UUID v7 conventions. Use when designing database schemas, writing migrations, or implementing multi-tenant data access.

    Also in 7 projects that use this

  • vndeeSkill

    ci-pipeline

    Use when creating or updating CI/CD pipelines with GitHub Actions or GitLab CI for Go, Python, or React projects

    Also in 4 projects that use this

  • pluginagentmarketplaceSkill

    microservices

    Microservices architecture patterns and best practices. Service decomposition, inter-service communication, and distributed data management.

    Also in 4 projects that use this

  • kevinaimonsterSkill

    typescript-strict

    TypeScript strict mode and advanced type system assistant. Helps write strictly-typed TypeScript code with generics, type guards, utility types, conditional types, mapped types, and template literal types. Trigger when user says 'TypeScript types' 'type gymnastics' 'TypeScript generics' 'strict TypeScript' 'type guard' 'TS类型' 'TypeScript严格模式' '类型体操' '泛型怎么写' 'TS type help'. Keywords: TypeScript, strict mode, generics, type guard, utility types, conditional types, mapped types, template literal types, infer, extends, keyof, typeof, type narrowing, discriminated unions, type assertion, type predicate, type gymnastics, TS, 类型体操, 泛型, 类型守卫, 严格类型

    Also in 4 projects that use this

  • InfopibeSkill

    deployment-patterns

    Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications.

    Also in 10 projects that use this

  • DatabricksSkill

    load-testing

    Load test a Databricks App to find its maximum QPS. Use when: (1) User says 'load test', 'benchmark', 'QPS', 'throughput', or 'performance test', (2) User wants to find how many queries per second their app can handle, (3) User wants to set up load testing scripts for their agent, (4) User wants to view load test results/dashboard, (5) User wants to validate results or observe latency/error rate with MLflow tracing.

    Also in 4 projects that use this

The file

Files
SKILL.md

Skill: API Design

本 Skill 专注于后端 API 的外在接口设计,确保接口的一致性、易用性及符合行业标准的 RESTful 准则。

🎯 触发条件

当以下情况发生时启用:

  • "设计一个 RESTful 接口"
  • "帮我规范一下 API 路径"
  • "这个接口的返回格式该怎么写?"
  • "统一定义一下项目错误码"

👉 自动启用本 Skill

🎯 Purpose

提供专业的接口设计指导,减少前后端集成成本,建立清晰的资源导向型架构。

🧩 Capabilities

  • API 命名建议:遵循资源导向命名规范(名词、复数形式、避免动词进入路径,如 /api/v1/markets 代替 /api/v1/getMarkets)。
  • 资源建模规范:合理设计资源层级(嵌套 vs 扁平化)。
  • RESTful 结构设计:利用正确的 HTTP 动词 (GET, POST, PUT, PATCH, DELETE) 进行状态转换,并合理使用 HTTP 状态码。
  • 查询参数标准化:制定统一的过滤 (filtering)、排序 (sorting) 及分页 (pagination) 参数规范(如 ?limit=20&offset=100)。
  • 返回格式规范:统一的 JSON 响应封装,包含数据信封、元数据 (Meta) 及分页对象。
  • 错误码设计:设计具备自解释性的错误响应(错误码 + 错误信息 + 指引),确保错误链路可追踪。

🔍 能力溯源 (Source Mapping)

能力来源类型
RESTful 准则cc-skill-backend-patterns✅ 整合 GitHub 优质模式
分页与查询标准化google-api-design-guide✅ 参考行业顶级实践
响应格式封装json-api-spec✅ 参考行业标准规范

📚 参考资料 (References)

🧠 Usage

当以下情况发生时调用:

  • 设计新功能或模块的对外接口时。
  • 优化现有 API 的路径结构或参数设计时。
  • 定义全局统一的响应与错误处理规范时。

📥 Input

  • 业务资源模型描述。
  • 交互流(Action Flow)。

📤 Output

  • 详细的 API 路径结构图。
  • 响应报文与错误报文的示例。
  • API 变更(Breaking Changes)的影响分析。

⚠️ Constraints

  • ✅ 优先考虑开发者的集成体验。
  • ✅ 强制执行资源导向 (Resource-Oriented) 准则。
  • ✅ 命名一致性:整个 API 集合必须使用统一的命名风格(推荐 snake_case)。
  • ✅ 分页必选:对于可能返回列表的接口,必须设计分页参数。
  • ✅ 错误码必须全局唯一且有明确分类。
  • ✅ 破坏性变更显式化:任何 Breaking Change 必须在变更描述中明确标记。

🔗 Related Skills

  • backend-patterns: API 边界通常需要和模块边界一起设计。
  • validation-lint: 参数与响应结构落地后需要继续做一致性校验。
  • doc-generator: 接口设计完成后可继续生成文档与示例。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.