c4-component
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseC4 Component Level: [Component Name]
C4组件级:[组件名称]
Use this skill when
使用本Skill的场景
- Working on c4 component level: [component name] tasks or workflows
- Needing guidance, best practices, or checklists for c4 component level: [component name]
- 处理C4组件级:[组件名称]相关任务或工作流时
- 需要C4组件级:[组件名称]的指导、最佳实践或检查清单时
Do not use this skill when
请勿使用本Skill的场景
- The task is unrelated to c4 component level: [component name]
- You need a different domain or tool outside this scope
- 任务与C4组件级:[组件名称]无关时
- 需要超出此范围的其他领域或工具时
Instructions
操作说明
- Clarify goals, constraints, and required inputs.
- Apply relevant best practices and validate outcomes.
- Provide actionable steps and verification.
- If detailed examples are required, open .
resources/implementation-playbook.md
- 明确目标、约束条件及所需输入。
- 应用相关最佳实践并验证结果。
- 提供可执行步骤及验证方法。
- 若需要详细示例,打开。
resources/implementation-playbook.md
Overview
概述
- Name: [Component name]
- Description: [Short description of component purpose]
- Type: [Component type: Application, Service, Library, etc.]
- Technology: [Primary technologies used]
- 名称:[组件名称]
- 描述:[组件用途的简短描述]
- 类型:[组件类型:应用程序、服务、库等]
- 技术栈:[使用的主要技术]
Purpose
用途
[Detailed description of what this component does and what problems it solves]
[详细描述该组件的功能及解决的问题]
Software Features
软件功能
- [功能1]:[描述]
- [功能2]:[描述]
- [功能3]:[描述]
Code Elements
代码元素
This component contains the following code-level elements:
- c4-code-file-1.md - [Description]
- c4-code-file-2.md - [Description]
该组件包含以下代码级元素:
- c4-code-file-1.md - [描述]
- c4-code-file-2.md - [描述]
Interfaces
接口
[Interface Name]
[接口名称]
- Protocol: [REST/GraphQL/gRPC/Events/etc.]
- Description: [What this interface provides]
- Operations:
- - [Description]
operationName(params): ReturnType
- 协议:[REST/GraphQL/gRPC/事件等]
- 描述:[该接口提供的功能]
- 操作:
- - [描述]
operationName(params): ReturnType
Dependencies
依赖项
Components Used
使用的组件
- [Component Name]: [How it's used]
- [组件名称]:[使用方式]
External Systems
外部系统
- [External System]: [How it's used]
- [外部系统]:[使用方式]
Component Diagram
组件图
Use proper Mermaid C4Component syntax. Component diagrams show components within a single container:
mermaid
C4Component
title Component Diagram for [Container Name]
Container_Boundary(container, "Container Name") {
Component(component1, "Component 1", "Type", "Description")
Component(component2, "Component 2", "Type", "Description")
ComponentDb(component3, "Component 3", "Database", "Description")
}
Container_Ext(externalContainer, "External Container", "Description")
System_Ext(externalSystem, "External System", "Description")
Rel(component1, component2, "Uses")
Rel(component2, component3, "Reads from and writes to")
Rel(component1, externalContainer, "Uses", "API")
Rel(component2, externalSystem, "Uses", "API")
**Key Principles** (from [c4model.com](https://c4model.com/diagrams/component)):
- Show components **within a single container** (zoom into one container)
- Focus on **logical components** and their responsibilities
- Show **component interfaces** (what they expose)
- Show how components **interact** with each other
- Include **external dependencies** (other containers, external systems)
使用标准Mermaid C4Component语法。组件图展示单个容器内的组件:
mermaid
C4Component
title Component Diagram for [Container Name]
Container_Boundary(container, "Container Name") {
Component(component1, "Component 1", "Type", "Description")
Component(component2, "Component 2", "Type", "Description")
ComponentDb(component3, "Component 3", "Database", "Description")
}
Container_Ext(externalContainer, "External Container", "Description")
System_Ext(externalSystem, "External System", "Description")
Rel(component1, component2, "Uses")
Rel(component2, component3, "Reads from and writes to")
Rel(component1, externalContainer, "Uses", "API")
Rel(component2, externalSystem, "Uses", "API")核心原则(来自c4model.com):
- 展示单个容器内的组件(聚焦单个容器)
- 关注逻辑组件及其职责
- 展示组件接口(对外暴露的内容)
- 展示组件之间的交互方式
- 包含外部依赖(其他容器、外部系统)
Master Component Index Template
组件总索引模板
markdown
undefinedmarkdown
undefinedC4 Component Level: System Overview
C4 Component Level: System Overview
System Components
System Components
[Component 1]
[Component 1]
- Name: [Component name]
- Description: [Short description]
- Documentation: c4-component-name-1.md
- Name: [Component name]
- Description: [Short description]
- Documentation: c4-component-name-1.md
[Component 2]
[Component 2]
- Name: [Component name]
- Description: [Short description]
- Documentation: c4-component-name-2.md
- Name: [Component name]
- Description: [Short description]
- Documentation: c4-component-name-2.md
Component Relationships
Component Relationships
[Mermaid diagram showing all components and their relationships]
undefined[Mermaid diagram showing all components and their relationships]
undefinedExample Interactions
示例交互
- "Synthesize all c4-code-*.md files into logical components"
- "Define component boundaries for the authentication and authorization code"
- "Create component-level documentation for the API layer"
- "Identify component interfaces and create component diagrams"
- "Group database access code into components and document their relationships"
- "将所有c4-code-*.md文件整合为逻辑组件"
- "为认证与授权代码定义组件边界"
- "为API层创建组件级文档"
- "识别组件接口并创建组件图"
- "将数据库访问代码分组为组件并记录其关系"
Key Distinctions
关键区别
- vs C4-Code agent: Synthesizes multiple code files into components; Code agent documents individual code elements
- vs C4-Container agent: Focuses on logical grouping; Container agent maps components to deployment units
- vs C4-Context agent: Provides component-level detail; Context agent creates high-level system diagrams
- 与C4-Code agent对比:将多个代码文件整合为组件;Code agent负责记录单个代码元素
- 与C4-Container agent对比:聚焦逻辑分组;Container agent负责将组件映射到部署单元
- 与C4-Context agent对比:提供组件级细节;Context agent负责创建高层系统图
Output Examples
输出示例
When synthesizing components, provide:
- Clear component boundaries with rationale
- Descriptive component names and purposes
- Comprehensive feature lists for each component
- Complete interface documentation with protocols and operations
- Links to all contained c4-code-*.md files
- Mermaid component diagrams showing relationships
- Master component index with all components
- Consistent documentation format across all components
整合组件时,需提供:
- 清晰的组件边界及依据
- 描述性的组件名称与用途
- 每个组件的完整功能列表
- 包含协议与操作的完整接口文档
- 所有关联c4-code-*.md文件的链接
- 展示关系的Mermaid组件图
- 包含所有组件的组件总索引
- 所有组件保持一致的文档格式