c4-code
Skill này làm gì
Công cụ này phân tích các thư mục mã để tạo tài liệu chi tiết về cách các hàm và lớp được tổ chức, chúng dùng dữ liệu gì và kết nối với nhau như thế nào. Nó giúp hiểu cấu trúc bên trong của một chương trình.
Khi nào nên dùng
- ✓Khi bắt đầu làm việc với một phần mới của mã.
- ✓Khi bạn cần hiểu cách một phần mã cụ thể hoạt động.
- ✓Khi tài liệu hóa một dự án cho các lập trình viên khác.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/c4-code/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
“Tài liệu hóa thư mục 'utils' của dự án, hiển thị các hàm, tham số và phụ thuộc của chúng.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ kiểm tra các tệp mã trong thư mục được chỉ định. Nó xác định hàm, lớp, tham số, giá trị trả về và các phần khác của mã mà chúng sử dụng. Sau đó, nó sắp xếp thông tin này một cách rõ rà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.
C4 Code Level: [Directory Name]
Use this skill when
- Working on c4 code level: [directory name] tasks or workflows
- Needing guidance, best practices, or checklists for c4 code level: [directory name]
Do not use this skill when
- The task is unrelated to c4 code level: [directory name]
- You need a different domain or tool outside this scope
Instructions
- Clarify goals, constraints, and required inputs.
- Apply relevant best practices and validate outcomes.
- Provide actionable steps and verification.
Overview
- Name: [Descriptive name for this code directory]
- Description: [Short description of what this code does]
- Location: [Link to actual directory path]
- Language: [Primary programming language(s)]
- Purpose: [What this code accomplishes]
Code Elements
Functions/Methods
functionName(param1: Type, param2: Type): ReturnType- Description: [What this function does]
- Location: [file path:line number]
- Dependencies: [what this function depends on]
Classes/Modules
ClassName- Description: [What this class does]
- Location: [file path]
- Methods: [list of methods]
- Dependencies: [what this class depends on]
Dependencies
Internal Dependencies
- [List of internal code dependencies]
External Dependencies
- [List of external libraries, frameworks, services]
Relationships
Optional Mermaid diagrams for complex code structures. Choose the diagram type based on the programming paradigm. Code diagrams show the internal structure of a single component.
Object-Oriented Code (Classes, Interfaces)
Use classDiagram for OOP code with classes, interfaces, and inheritance:
---
title: Code Diagram for [Component Name]
---
classDiagram
namespace ComponentName {
class Class1 {
+attribute1 Type
+method1() ReturnType
}
class Class2 {
-privateAttr Type
+publicMethod() void
}
class Interface1 {
<<interface>>
+requiredMethod() ReturnType
}
}
Class1 ..|> Interface1 : implements
Class1 --> Class2 : uses
### Functional/Procedural Code (Modules, Functions)
For functional or procedural code, you have two options:
**Option A: Module Structure Diagram** - Use `classDiagram` to show modules and their exported functions:
```mermaid
---
title: Module Structure for [Component Name]
---
classDiagram
namespace DataProcessing {
class validators {
<<module>>
+validateInput(data) Result~Data, Error~
+validateSchema(schema, data) bool
+sanitize(input) string
}
class transformers {
<<module>>
+parseJSON(raw) Record
+normalize(data) NormalizedData
+aggregate(items) Summary
}
class io {
<<module>>
+readFile(path) string
+writeFile(path, content) void
}
}
transformers --> validators : uses
transformers --> io : reads from
```
**Option B: Data Flow Diagram** - Use `flowchart` to show function pipelines and data transformations:
```mermaid
---
title: Data Pipeline for [Component Name]
---
flowchart LR
subgraph Input
A[readFile]
end
subgraph Transform
B[parseJSON]
C[validateInput]
D[normalize]
E[aggregate]
end
subgraph Output
F[writeFile]
end
A -->|raw string| B
B -->|parsed data| C
C -->|valid data| D
D -->|normalized| E
E -->|summary| F
```
**Option C: Function Dependency Graph** - Use `flowchart` to show which functions call which:
```mermaid
---
title: Function Dependencies for [Component Name]
---
flowchart TB
subgraph Public API
processData[processData]
exportReport[exportReport]
end
subgraph Internal Functions
validate[validate]
transform[transform]
format[format]
cache[memoize]
end
subgraph Pure Utilities
compose[compose]
pipe[pipe]
curry[curry]
end
processData --> validate
processData --> transform
processData --> cache
transform --> compose
transform --> pipe
exportReport --> format
exportReport --> processData
```
### Choosing the Right Diagram
…
Câu hỏi thường gặp
“C4 Code-level” là gì?
Đó là cách tài liệu hóa mã bằng cách tập trung vào các chi tiết nội bộ như hàm và lớp, để giúp hiểu cấu trúc của một thành phần cụ thể.
Công cụ có thể tạo loại sơ đồ nào?
Nó có thể tạo sơ đồ lớp cho mã hướng đối tượng, hoặc sơ đồ luồng và cấu trúc module cho mã theo hàm và thủ tục, tùy theo kiểu viết mã.
Tôi có cần biết về mô hình C4 để dùng công cụ này không?
Không nhất thiết. Công cụ tập trung vào chi tiết mã, là một cấp độ của mô hình C4, nhưng bạn không cần là chuyên gia về mô hình này để dùng nó.
Chi tiết
Mô tả gốc của tác giả
Expert C4 Code-level documentation specialist. Analyzes code directories to create comprehensive C4 code-level documentation including function signatures, arguments, dependencies, and code structure.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #4098
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
technical-documentation
394kGiúp agent của bạn viết và rà soát tài liệu kỹ thuật cùng file hướng dẫn cho agent, rõ ràng để mọi người và công cụ AI đều dễ làm theo.
architecture-decision-records
280kGiúp agent của bạn ghi lại các quyết định quan trọng về cấu trúc dự án, giúp hiểu lý do đằng sau các lựa chọn và giữ lịch sử thay đổi rõ ràng.
code-tour
280kGiúp agent của bạn tạo các hướng dẫn đọc code từng bước, có tham chiếu chính xác đến file và dòng, hữu ích cho phần giới thiệu, giải thích và rà soát.