一键导入
api-design
Design RESTful APIs following best practices
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Design RESTful APIs following best practices
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Systematic bug investigation and root cause analysis
Review code quality, patterns, and best practices
Generate commit messages following conventional commits with scope detection
Generate and update technical documentation
Break down features into implementable tasks
Review pull requests against team standards and best practices
| type | skill |
| name | Api Design |
| description | Design RESTful APIs following best practices |
| skillSlug | api-design |
| phases | ["P","R"] |
| generated | "2026-02-08T00:00:00.000Z" |
| status | filled |
| scaffoldVersion | 2.0.0 |
Use this skill when designing new routes or modifying existing endpoints in the Smart Farming application. The project uses Flask blueprints with server-rendered HTML (Jinja2 + HTMX), not a traditional REST JSON API.
The project uses these URL patterns:
| Action | Method | URL Pattern | Example |
|---|---|---|---|
| List/Dashboard | GET | /{domain} | /sensors-records |
| Create form | GET | /{domain}/create | /checklist-records/create |
| Create submit | POST | /{domain} | POST /plants |
| Edit form | GET | /{domain}/{id}/edit | /sensors-records/{id}/edit |
| Edit submit | PUT/POST | /{domain}/{id} | PUT /plants/{id} |
| Delete | DELETE | /{domain}/{id} | DELETE /checklist-records/{id} |
| Dashboard | GET | /{domain}/dashboard | /sensors-records/dashboard |
Each domain has its own blueprint in src/app/infra/views/{domain}_views/:
from flask import Blueprint
{domain}_views_bp = Blueprint("{domain}", __name__, url_prefix="/{domain}")
Register new blueprints in src/app/infra/views/__init__.py.
Views follow this standard pattern:
@bp.route("/path", methods=["GET"])
@login_required # if admin-only
def view_name():
# 1. Get use case from factory
use_case = create_{action}_use_case()
# 2. Extract params from request
params = request.args.get("param")
# 3. Execute use case
result = use_case.execute(params)
# 4. Render template with data
return render_template("pages/{domain}/page.html", data=result)
For partial page updates via HTMX:
hx-target and hx-swap attributeshx-trigger for custom events after mutations| Scenario | Response |
|---|---|
| Page render | render_template("pages/...") |
| HTMX partial | render_template("components/...") |
| Redirect after mutation | redirect(url_for("blueprint.view")) |
| Error page | render_template("pages/error/..."), status 4xx/5xx |
| CSV download | Response(csv_data, mimetype="text/csv") |
@login_required for admin-only operationsinfra/views/__init__.pysrc/ui/templates/pages/