c4-architecture-c4-architecture
Skill này làm gì
Công cụ này tạo ra bản đồ chi tiết về kiến trúc mã của bạn, cho thấy các phần của chương trình kết nối với nhau như thế nào. Nó phân tích mã từ dưới lên, bắt đầu từ các chi tiết nhỏ nhất và xây dựng bức tranh tổng thể.
Khi nào nên dùng
- ✓Khi bắt đầu một dự án phần mềm mới và muốn tài liệu hóa cấu trúc của nó.
- ✓Khi cần hiểu cách một hệ thống phần mềm hiện có được tổ chức.
- ✓Khi muốn giải thích kiến trúc mã của bạn cho người khác.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/c4-architecture-c4-architecture/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ạo tài liệu kiến trúc C4 cho kho mã của tôi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ kiểm tra từng phần của mã, ghi lại các hàm và lớp. Sau đó nhóm các phần này thành các thành phần logic, rồi thành các container (như ứng dụng hoặc cơ sở dữ liệu), và cuối cùng là bối cảnh tổng thể của hệ thố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 Architecture Documentation Workflow
Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.
[Extended thinking: This workflow implements a complete C4 architecture documentation process following the C4 model (Context, Container, Component, Code). It uses a bottom-up approach, starting from the deepest code directories and working upward, ensuring every code element is documented before synthesizing into higher-level abstractions. The workflow coordinates four specialized C4 agents (Code, Component, Container, Context) to create a complete architectural documentation set that serves both technical and non-technical stakeholders.]
Use this skill when
- Working on c4 architecture documentation workflow tasks or workflows
- Needing guidance, best practices, or checklists for c4 architecture documentation workflow
Do not use this skill when
- The task is unrelated to c4 architecture documentation workflow
- 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
This workflow creates comprehensive C4 architecture documentation following the official C4 model by:
- Code Level: Analyzing every subdirectory bottom-up to create code-level documentation
- Component Level: Synthesizing code documentation into logical components within containers
- Container Level: Mapping components to deployment containers with API documentation (shows high-level technology choices)
- Context Level: Creating high-level system context with personas and user journeys (focuses on people and software systems, not technologies)
Note: According to the C4 model, you don't need to use all 4 levels of diagram - the system context and container diagrams are sufficient for most software development teams. This workflow generates all levels for completeness, but teams can choose which levels to use.
All documentation is written to a new C4-Documentation/ directory in the repository root.
Phase 1: Code-Level Documentation (Bottom-Up Analysis)
1.1 Discover All Subdirectories
- Use codebase search to identify all subdirectories in the repository
- Sort directories by depth (deepest first) for bottom-up processing
- Filter out common non-code directories (node_modules, .git, build, dist, etc.)
- Create list of directories to process
1.2 Process Each Directory (Bottom-Up)
For each directory, starting from the deepest:
Use Task tool with subagent_type="c4-architecture::c4-code"
Prompt: | Analyze the code in directory: [directory_path]
Create comprehensive C4 Code-level documentation following this structure:
- Overview Section:
- Name: [Descriptive name for this code directory]
- Description: [Short description of what this code does]
- Location: [Link to actual directory path relative to repo root]
- Language: [Primary programming language(s) used]
- Purpose: [What this code accomplishes]
- Code Elements Section:
- Document all functions/methods with complete signatures:
- Function name, parameters (with types), return type
- Description of what each function does
- Location (file path and line numbers)
- Dependencies (what this function depends on)
- Document all classes/modules:
- Class name, description, location
- Methods and their signatures
- Dependencies
- Document all functions/methods with complete signatures:
- Dependencies Section:
- Internal dependencies (other code in this repo)
- External dependencies (libraries, frameworks, services)
- Relationships Section:
- Optional Mermaid diagram if relationships are complex
Save the output as: C4-Documentation/c4-code-[directory-name].md Use a sanitized directory name (replace / with -, remove special chars) for the filename.
Ensure the documentation includes:
- Complete function signatures with all parameters and types
- Links to actual source code locations
- All dependencies (internal and external)
- Clear, descriptive names and descriptions
- Overview Section:
Expected output: c4-code-<directory-name>.md file in C4-Documentation/
Context: All files in the directory and its subdirectories
…
Câu hỏi thường gặp
Mô hình C4 là gì?
Mô hình C4 là cách mô tả kiến trúc phần mềm ở bốn mức độ chi tiết: Context (bối cảnh), Container (container), Component (thành phần) và Code (mã). Nó giúp hình dung và truyền đạt cấu trúc phần mềm.
Vì sao phân tích “từ dưới lên”?
Phân tích “từ dưới lên” nghĩa là bắt đầu với các chi tiết nhỏ nhất (mã) rồi đi lên tổng thể. Điều này đảm bảo không bỏ sót gì và tài liệu được xây dựng trên nền tảng thông tin chi tiết vững chắc.
Tài liệu sẽ được lưu ở đâu?
Tài liệu được tạo sẽ được lưu trong một thư mục mới tên `C4-Documentation/` ở thư mục gốc của kho mã.
Chi tiết
Mô tả gốc của tác giả
Generate comprehensive C4 architecture documentation for an existing repository/codebase using a bottom-up analysis approach.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #4097
- 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.