Skip to content
Back to skills

Api Design

ASecurity

Quy tắc thiết kế và review API REST cùng API contract OpenAPI 3 làm cầu nối FE-BE.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 10, 2026
developmentapi

Works with

  • api

Security analysis

A100/100

Scanned October 10, 2026

npx -y skills add vannt-dev/aiws-factory --skill api-design --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Api Design?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Api Design
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vannt-dev-api-design/badge)](https://www.skillsdirectory.com/skills/vannt-dev-api-design)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: api-design
description: Quy tắc thiết kế và review API REST cùng API contract OpenAPI 3 làm cầu nối FE-BE.
---

# API design

## Quy tắc chung
- Theo quy ước đã có trong aiws/knowledge/api-inventory.md (prefix, versioning, format lỗi). Không phát minh quy ước mới nếu chưa có quyết định được duyệt.
- Danh từ số nhiều cho resource: `/users`, `/users/{id}`, sub-resource `/users/{id}/roles`.
- Method: GET đọc, POST tạo, PUT thay thế, PATCH sửa một phần, DELETE xoá.
- Mã trạng thái: 200/201/204; 400 validation; 401/403 auth; 404 không tìm thấy; 409 xung đột.
- Body lỗi theo format đang có của dự án. Nếu dự án chưa có format thì dùng **RFC 9457 Problem Details** (`application/problem+json`: `type`, `title`, `status`, `detail`, `instance`, kèm field mở rộng như `errors`).
- Thời gian theo ISO 8601 / RFC 3339 (UTC); tên field nhất quán với API hiện có (camelCase hoặc snake_case, không trộn lẫn).
- Thay đổi phá tương thích phải nằm trong "Quyết định cần duyệt".

## api-contract.yaml
- OpenAPI 3.0.x; mọi endpoint mới/đổi có request schema, response schema cho từng mã trạng thái, ví dụ.
- Dùng `components/schemas` cho model dùng lại; `required` đầy đủ.
- Không đổi API: `paths: {}`.

## Review
- BE: path/method/schema/mã lỗi khớp contract.
- FE: gọi đúng path/method, gửi đúng body, xử lý mọi mã lỗi được khai báo.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.