Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/samqin123/claude_skill_pool/api-first-developmentgit clone --depth 1 https://github.com/samqin123/Claude_skill_poolWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00024 | $0.01318 |
| Opus 5 | $0.00012 | $0.00659 |
| Sonnet 5 | $0.00005 | $0.00264 |
| Haiku 4.5 | $0.00002 | $0.00132 |
Grade B, and why
api-first-development scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Sends data to an external URLmediumData exfiltration
A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.
curl -X POST .../api/v1/xxx -H "Content-Type: application/json" -d '{...}' Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
curl -X POST .../api/v1/xxx -H "Content-Type: application/json" -d '{...}' How it starts
The opening of the file, as written. The whole thing — 124 lines — stays where its author put it; the contents beside it link to each section on GitHub.
API-First 模块化开发框架
当项目涉及前后端分离、全栈开发、或任何需要多层协作的场景时,本规则自动生效。
核心架构:三层分离
前端层(Frontend) 中间层(Glue/BFF) 后端API包(Backend)
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ 页面 & 组件 │ ←API→ │ 跨API编排 │ ←API→ │ 独立业务模块 │
│ 只调API+渲染 │ │ 数据聚合适配 │ │ 内聚逻辑封装 │
│ 不含业务逻辑 │ │ 耦合逻辑处理 │ │ 对外只暴露API │
└──────────────┘ └──────────────┘ └──────────────┘
后端 API 包标准开发流程
每个后端功能必须走完以下闭环:
开发(Implement) → Checkfix(Lint/Build) → 封装(Module/Class) → API暴露(Endpoint) → API文档(Doc)
- 一个 API 包只做一件事,对外只暴露 API 端点
- 完成开发后必须执行 Checkfix 闭环(参考 code-debugger 技术栈检查表)
- 封装为独立模块后暴露 REST/GraphQL/RPC 端点
- 必须生成 API 文档(见下方模板),前端开发者仅依据此文档调用
API 文档标准模板
每个 API 包完成后,在 docs/api/ 或模块目录下生成:
# [模块名] API 文档
## 端点概览
| 方法 | 路径 | 功能 | 认证 |
|------|------|------|------|
| POST | /api/v1/xxx | 描述 | Bearer Token |
## 详细接口
### [接口名称]
- **路径**: `POST /api/v1/xxx`
- **描述**: 功能说明
**请求参数**:
| 参数 | 位置 | 类型 | 必填 | 说明 |
|------|------|------|------|------|
| field | body | string | 是 | 描述 |
**响应格式**:
成功 (200):
```json
{ "code": 0, "data": { ... }, "message": "success" }
失败 (4xx/5xx):
{ "code": 错误码, "data": null, "message": "错误描述" }
错误码:
| 错误码 | 含义 | 处理建议 |
|---|
调用示例:
curl -X POST .../api/v1/xxx -H "Content-Type: application/json" -d '{...}'
## 前端开发规范
- 前端只负责:页面渲染 + 调用后端 API + 用户交互
- 业务逻辑全部在后端 API 包内,前端不重复实现
- 依据 API 文档开发,可与后端并行
## 中间层/全栈规范
- 只处理多个 API 包之间的编排和聚合
- 只处理前端特殊需求的数据适配(BFF 模式)
- 不重复实现后端已有的业务逻辑
## 跨层任务自动分解协议
当收到涉及多个层级的开发/debug 需求时(如"增加 SSE 流式输出"),必须按以下协议分解:
### Step 1: 层级识别
判断任务涉及哪些层:后端?前端?中间层?
### Step 2: 按 API 边界拆分子任务
子任务 1 [后端]: 开发 API 包(开发→Checkfix→封装→API端点→API文档) 子任务 2 [API文档]: 确保 API 契约清晰(请求/响应/错误码/示例) 子任务 3 [前端]: 依据 API 文档实现页面功能 子任务 4 [集成]: 验证前后端契约一致性
### Step 3: 严格按序执行
后端 API 包先行 → API 文档产出 → 前端/中间层消费 → 集成验证
## Debug 边界规则
| Bug 表现 | 归属层 | Debug 范围 | 禁止行为 |
|----------|--------|-----------|----------|
| API 返回错误数据 | 后端 | 只查 API 包内部逻辑 | 不改前端来"绕过" |
| 页面不显示/显示异常 | 前端 | 只查页面逻辑+API调用参数 | 不改后端API契约来迁就 |
| 多API协作异常 | 中间层 | 查编排逻辑+各API契约一致性 | 不进入单个API包内部改逻辑 |
| 前后端数据不匹配 | 集成 | 对照API文档检查契约一致性 | 先确定谁违反了契约再改 |
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 124 lines · 24 tokens per session scan B 449638f5e067
api-first-development is a cursor rule published in the GitHub repository samqin123/Claude_skill_pool (2 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 24 tokens to every session and 1,318 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 2 findings (sends data to an external url, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
typescript
Changes to these high-fan-out internals can affect every message, delta, element, or rerun. Keep work in them minimal, and benchmark changes with representative stress-test apps.
coolify-ai-docs
Master reference to all Coolify AI documentation in .ai/ directory.
python_lib
Tips and guidelines specific to the development of the Streamlit Python library, not applicable to scripts and e2e tests.
specs
This directory contains product and tech specs for Streamlit features.