Le Duy Khuong

Chuỗi: claude-code-20-p4 · Phần 2

Năng suất & công cụ dev

Tạo skill từ codebase (skill-from-repo)

Ý tưởng: phân tích repo → tạo skill; workflow tổng quát.

2026-03-145 phút đọcVI

Phần 2 của 540% hoàn thành

Tạo skill từ codebase (skill-from-repo)

English title: Create a Skill From Your Codebase

Bài 17 trong chuỗi 20 bài về Claude Code. Codebase chứa pattern, convention, cấu trúc; skill = bản tóm tắt để agent không phải đọc toàn bộ repo mỗi lần. Bài này: tại sao skill-from-repo, phân tích repo lấy gì, viết và duy trì skill.


1. Tại sao skill-from-repo

Repo "dạy" qua README, structure, vài file mẫu. Skill = procedure (trigger + steps) mô tả stack, convention, bước làm việc. Agent load skill thay vì đọc cả repo. Workflow: phân tích → extract pattern → viết skill → review; không phải tool tự động hoàn toàn. Chọn scope (folder, file type); đọc README, structure, 2–3 file điển hình; viết skill với trigger + steps, ghi nguồn (attribution).


2. Phân tích repo — lấy gì

Lấy: cấu trúc thư mục, naming, stack (framework, test, lint), convention (import, async), ví dụ điển hình. Nguồn: README, package.json, config, 2–3 file code; tránh copy nguyên văn dài. Ví dụ: skill "Backend API" — stack Node/Express, test Jest, convention async/await; nguồn README và một file lib đại diện.


3. Viết skill và duy trì

Skill có trigger rõ (vd. "khi thêm API mới"); steps: check convention, đặt file đúng chỗ, viết test, chạy lint. Format: trigger, scope, 3–5 bước, checklist. Skill ngắn (1–2 trang). Định kỳ (quarterly) đối chiếu skill với codebase; cập nhật khi release lớn. Bài 18: Multi-agent và đa service.


Bài tiếp: Multi-agent và đa service (bài 18).

LDK

Le Duy Khuong

AI Transformation & Digital Strategy. Writing about agentic systems, engineering leadership, and building in public.