codebase-pattern-analyzer
Skill này làm gì
Skill này hướng dẫn AI agent đọc một mã nguồn tham chiếu và mô tả kiến trúc có thể tái sử dụng của nó. Nó dành cho nhà phát triển muốn hiểu hoặc sao chép cấu trúc và quy ước của một dự án.
Khi nào nên dùng
- ✓Khi bạn cần hiểu một mã nguồn lớn được tổ chức thế nào trước khi sao chép nó.
- ✓Khi bạn muốn lấy một mẫu cụ thể, như lớp dịch vụ hoặc API proxy, từ một dự án tham chiếu.
- ✓Khi bạn bắt đầu một dự án mới nên theo quy ước của một dự án hiện có.
Liên kết skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/codebase-pattern-analyzer/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Nghiên cứu dự án tham chiếu này và mô tả các mẫu component, dịch vụ và API của nó để tôi xây một ứng dụng tương tự.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent lập bản đồ cấu trúc thư mục và phân loại từng thư mục theo vai trò, như component, service, config, style, utils và tầng API. Sau đó nó đọc các file của từng vai trò để mô tả mẫu bằng các thuật ngữ rõ ràng, có thể tái sử dụng.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Codebase Pattern Analyzer
Systematically analyze a reference codebase and extract reusable architectural patterns into structured descriptions. These descriptions become the raw material for new skills (via the skill-template-generator skill).
When to Use
- You need to understand how a large codebase is structured before replicating it
- You want to extract a specific pattern (component architecture, service layer, API proxy, etc.) from a reference project
- You are bootstrapping a new project that should follow the conventions of an existing one
Step 1: Map the Directory Structure
Read the top-level directory and identify the major code zones:
list_dir <project_root>
list_dir <project_root>/src
Classify each directory into one of these roles:
| Role | Typical Dirs | What to Look For |
|---|---|---|
| Components | src/components/ |
UI classes, base class inheritance, DOM manipulation |
| Services | src/services/ |
Data fetching, API calls, circuit breakers, caching |
| Config | src/config/ |
Constants, panel definitions, API endpoints, feature flags |
| Styles | src/styles/ |
CSS custom properties, theme variables, grid layout |
| Utils | src/utils/ |
Helper functions, formatting, DOM utilities |
| API Layer | api/, server/ |
Serverless functions, route handlers, CORS, proxy logic |
| Entry Point | src/main.ts |
Bootstrap, panel instantiation, scheduler setup |
Step 2: Identify the Component Pattern
Find the base component class (usually the most imported file in components/):
read_file <project_root>/src/components/Panel.ts
Extract these structural elements:
- Constructor options interface — what config each component accepts (id, title, className, etc.)
- DOM structure — how the element tree is built (header, content area, resize handles)
- Lifecycle methods — constructor, destroy, show/hide, refresh
- State management — loading/error/content states, fetching guards
- Data binding — how data flows from service → render → DOM
Record the pattern as:
COMPONENT PATTERN:
Base class: [name]
Options: [list of constructor params]
DOM tree: [element hierarchy]
States: [loading, error, content]
Lifecycle: [init → fetch → render → destroy]
Key methods: [getElement, showLoading, showError, setContent, refresh, destroy]
Step 3: Identify the Service Layer Pattern
Examine 2-3 service files to find the common structure:
read_file <project_root>/src/services/news.ts
read_file <project_root>/src/services/stock-market.ts
Look for:
- Circuit breaker / resilience — retry logic, cooldown, cached fallback
- Interface definitions — typed data shapes returned by each service
- Fetch pattern — how HTTP calls are made (direct fetch, proxy, batching)
- Caching strategy — TTLs, stale-while-revalidate, in-memory cache
- Error handling — what happens on failure, default return values
Record as:
SERVICE PATTERN:
Resilience: [circuit breaker with N failures → cooldown]
Cache: [in-memory, TTL=Xms]
Fetch: [browser fetch → /api/... proxy → external API]
Error: [catch → recordFailure → return default]
Exports: [async functions, not class instances]
Step 4: Identify the API Proxy Pattern
Read the server-side proxy layer:
list_dir <project_root>/api/
read_file <project_root>/api/_cors.js
read_file <project_root>/api/stocks.ts # or similar endpoint
Extract:
- File-per-endpoint structure — one file per API domain
- CORS handling — origin allowlist, preflight response
- API key isolation —
process.env.*usage, never exposed to frontend - Cache headers —
Cache-Control,s-maxage,stale-while-revalidate - Error wrapping — structured JSON errors, never raw upstream responses
- Input validation — query parameter checks before upstream call
Step 5: Identify the Styling System
read_file <project_root>/src/styles/main.css # first 100 lines for CSS variables
Extract:
- CSS custom properties — color tokens, font stacks, spacing
- Theme structure — dark/light mode switch mechanism
- Grid layout —
grid-template-columns,auto-fill,minmax()values - Component styles — panel base styles, header, content, scrollbar
- Semantic colors — positive/negative, severity levels, status indicators
- Typography — font family, sizes, letter-spacing, text-tr
Câu hỏi thường gặp
Agent phân loại thư mục như thế nào?
Nó gán mỗi thư mục một vai trò, như component, service hoặc tầng API, dựa trên tên và nội dung thông thường.
Đầu ra là gì?
Skill tạo ra các mô tả mẫu có cấu trúc, sau này có thể được chuyển thành skill độc lập.
Nó có thay đổi dự án tham chiếu không?
Skill là một phương pháp phân tích, nên nó đọc mã nguồn để mô tả chứ không sửa đổi.
Chi tiết
Mô tả gốc của tác giả
Analyze a reference codebase to discover and extract reusable architectural patterns. Produces structured pattern descriptions that can be turned into standalone skills. This is a meta-skill that bootstraps the skill evolution chain.
repo: HKUDS/AgentPilot
Độ phổ biến
- Sao GitHub
- 7.8k
- Vị trí xếp hạng
- #13039
- Giấy phép
- MIT
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
agentpilot
7.8kGiúp agent của bạn cải thiện dự án từng bước bằng cách chuẩn bị tác vụ và chạy vòng lặp AgentPilot, gồm đề xuất, kiểm thử và chấm điểm thay đổi.
openspace
7.8kGiúp agent của bạn thiết lập OpenSpace, công cụ lưu và lấy lại skill của agent, rồi kết nối nó với ứng dụng AI của bạn qua MCP.
rsi-arena
7.8kGiúp agent của bạn thiết lập và chạy các bài kiểm thử benchmark AI chuẩn, như AIME và Terminal-Bench, để so sánh các phương pháp cải tiến khác nhau.
experiment-guide
7.8kGiúp agent của bạn lên kế hoạch các thí nghiệm nhỏ, đọc kết quả và ghi lại phát hiện khi tìm cách cải thiện một chương trình.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.