.agent/skills/api-integration/SKILL.md
Skill tich hop API backend vao frontend. Su dung khi can (1) nghien cuu API endpoint, (2) phan tich cau truc request/response, (3) ghep API vao frontend, (4) dong bo cau truc data khi backend thay doi. Skill nay nen duoc su dung khi nguoi dung cung cap duong dan file API backend hoac yeu cau lam viec voi API.
npx skillsauth add vuthuonghai-steve/KLTN-By_Thuong_Hai-Steve api-integrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Skill nay tu dong hoa qua trinh tich hop API tu backend (Agent-skill-api) vao frontend (Agent-skill-web). No thuc hien:
[Input: File API Backend]
|
v
[PHASE 1: Nghien Cuu & Phan Tich API]
- Doc file route.ts
- Xac dinh request params/body
- Xac dinh response structure
- Tao tai lieu API
|
v
[PHASE 2: Ghep API vao Frontend]
- Them endpoint constant
- Tao/cap nhat types
- Tao/cap nhat service method
|
v
[PHASE 3: Dong Bo & Kiem Tra]
- So sanh types backend vs frontend
- Cap nhat neu khong khop
- Xac nhan dong bo thanh cong
|
v
[Output: Frontend san sang su dung API]
Doc file API backend duoc cung cap (thuong la route.ts).
Tim cac thanh phan:
Trich xuat thong tin request:
Request Parameters:
- Query params: Tim trong searchParams hoac Zod schema
- Body: Tim trong request.json() hoac Zod schema
- Path params: Tim trong ten file [param] va function params
- Headers: Tim request.headers.get()
Ghi chu:
.optional() trong Zod.optional() hoac .default().min(), .max(), .email(), etc.Tim cau truc response trong:
successResponse(data, message) -> Lay cau truc datareturn NextResponse.json() -> Lay object tra veXac dinh cac truong response:
Tao thu muc va file:
docs/api/{feature-name}/
├── index.md # Tai lieu chinh
└── examples/ # Vi du request/response (tuy chon)
Su dung template tu assets/api-doc-template.md.
Tim file Agent-skill-web/src/api/endpoints.ts.
Them endpoint moi:
{FEATURE}: {
{ACTION}: '/api/v1/{path}',
}
Tim trong frontend:
Agent-skill-web/src/types/api/{feature}.types.ts
Agent-skill-web/src/types/{feature}.ts
Tao type moi neu chua co:
// Request type (tu Zod schema)
export interface {FeatureName}Request {
field1: string
field2?: number // optional
}
// Response type
export interface {FeatureName}Response {
success: boolean
data: {FeatureData}
message: string
}
// Data type
export interface {FeatureData} {
id: string
field1: string
field2: number
}
Tim hoac tao file:
Agent-skill-web/src/api/services/{feature}-service.ts
Tao method:
static async methodName(params: ParamsType): Promise<ResponseType> {
const response = await apiClient.{method}(
API_ENDPOINTS.{FEATURE}.{ACTION},
{ params } // hoac body cho POST
)
return response.data
}
So sanh cau truc:
Neu types khong khop:
Kiem tra:
/home/steve/Desktop/Intern/work/Flower/Agent-skill-api/src/app/api/v1/get-store/route.ts
docs/api/get-store/index.mdAgent-skill-web/src/types/Agent-skill-web/src/api/endpoints.tsAgent-skill-web/src/services/| Backend | Frontend |
|---------|----------|
| route.ts | {feature}-service.ts |
| z.object({}) | interface {} |
| successResponse | ApiResponse<T> |
| z.string().optional() | field?: string |
Backend:
- API: Agent-skill-api/src/app/api/v1/
- Lib: Agent-skill-api/src/lib/api-response.ts
- Types: Agent-skill-api/src/payload-types.ts
Frontend:
- Types: Agent-skill-web/src/types/api/
- Services: Agent-skill-web/src/api/services/
- Endpoints: Agent-skill-web/src/api/endpoints.ts
api-analysis-guide.md: Huong dan chi tiet phan tich API backendapi-doc-template.md: Template cho tai lieu APISkill nay duoc kich hoat khi nguoi dung:
tools
Automates end-to-end drawing of UI screens in Pencil canvas from module spec files. Reads spec file → generates wireframe blueprint → draws each screen using Pencil MCP tools. Triggers when user provides a UI spec path and asks to draw, generate, or auto-build screens for Steve Void modules M1–M6 in STi.pen.
testing
Extracts UI Screen Specs by analyzing Schema and Diagrams. Use when you need to bridge database logic and flow diagrams into intermediate UI component specifications for a given module. Trigger when user says "analyze UI for module X", "generate ui spec", "phân tích UI module", or invokes "ui-architecture-analyst --module M[X]".
development
Giải thích lỗi TypeScript một cách dễ hiểu bằng tiếng Việt. Sử dụng khi gặp lỗi type, generic, inference, hoặc bất kỳ lỗi TS nào cần được giải thích rõ ràng.
development
Skill phan tach yeu cau/tinh nang thanh cac phase, task va subtask cu the. Tao bo tai lieu planning clean, khong chua code mau, tap trung mo ta logic va nghiep vu. Su dung khi: (1) nhan yeu cau tinh nang moi can lap ke hoach, (2) co tai lieu nghien cuu can chuyen thanh task plan, (3) nguoi dung yeu cau phan tach cong viec, (4) can tao roadmap trien khai cho du an/tinh nang. Trigger: /task-planner, /plan-tasks, "phan tach task", "lap ke hoach", "tao plan", "chia phase".