c4-code by sickn33/antigravity-awesome-skills
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill c4-coderesources/implementation-playbook.md。functionName(param1: Type, param2: Type): ReturnType
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
ClassName
对于复杂的代码结构,可选择使用 Mermaid 图表。根据编程范式选择图表类型。代码图表展示单个组件的内部结构。
对于包含类、接口和继承的 OOP 代码,使用 classDiagram:
---
title: [组件名称] 的代码图表
---
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
对于函数式或过程式代码,您有两种选择:
选项 A:模块结构图 - 使用 classDiagram 来展示模块及其导出的函数:
---
title: [组件名称] 的模块结构
---
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
选项 B:数据流图 - 使用 flowchart 来展示函数管道和数据转换:
---
title: [组件名称] 的数据管道
---
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
选项 C:函数依赖关系图 - 使用 flowchart 来展示函数间的调用关系:
---
title: [组件名称] 的函数依赖关系
---
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
| 代码风格 | 主要图表类型 | 使用时机 |
|---|---|---|
| OOP(类、接口) | classDiagram | 展示继承、组合、接口实现关系 |
| FP(纯函数、管道) | flowchart | 展示数据转换和函数组合 |
| FP(带导出的模块) | 带 <<module>> 的 classDiagram | 展示模块结构和依赖关系 |
| 过程式(结构体 + 函数) | classDiagram | 展示数据结构和关联的函数 |
| 混合范式 | 组合使用 | 如果需要,可使用多个图表 |
注意:根据 C4 模型,通常仅在需要为复杂组件提供说明时才创建代码图表。大多数团队发现系统上下文图和容器图已足够。请选择最能清晰传达代码结构的图表类型,无论采用何种范式。
[任何额外的上下文或重要信息]
分析代码时,请提供:
每周安装数
94
代码仓库
GitHub 星标数
27.4K
首次出现
2026年1月28日
安全审计
安装于
gemini-cli88
opencode88
codex86
github-copilot84
claude-code80
cursor80
resources/implementation-playbook.md.functionName(param1: Type, param2: Type): ReturnType
ClassName
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.
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
| Code Style | Primary Diagram | When to Use |
| -------------------------------- | -------------------------------- | ------------------------------------------------------- |
| OOP (classes, interfaces) | `classDiagram` | Show inheritance, composition, interface implementation |
| FP (pure functions, pipelines) | `flowchart` | Show data transformations and function composition |
| FP (modules with exports) | `classDiagram` with `<<module>>` | Show module structure and dependencies |
| Procedural (structs + functions) | `classDiagram` | Show data structures and associated functions |
| Mixed | Combination | Use multiple diagrams if needed |
**Note**: According to the [C4 model](https://c4model.com/diagrams), code diagrams are typically only created when needed for complex components. Most teams find system context and container diagrams sufficient. Choose the diagram type that best communicates the code structure regardless of paradigm.
## Notes
[Any additional context or important information]
```
## Example Interactions
### Object-Oriented Codebases
- "Analyze the src/api directory and create C4 Code-level documentation"
- "Document the service layer code with complete class hierarchies and dependencies"
- "Create C4 Code documentation showing interface implementations in the repository layer"
### Functional/Procedural Codebases
- "Document all functions in the authentication module with their signatures and data flow"
- "Create a data pipeline diagram for the ETL transformers in src/pipeline"
- "Analyze the utils directory and document all pure functions and their composition patterns"
- "Document the Rust modules in src/handlers showing function dependencies"
- "Create C4 Code documentation for the Elixir GenServer modules"
### Mixed Paradigm
- "Document the Go handlers package showing structs and their associated functions"
- "Analyze the TypeScript codebase that mixes classes with functional utilities"
## Key Distinctions
- **vs C4-Component agent**: Focuses on individual code elements; Component agent synthesizes multiple code files into components
- **vs C4-Container agent**: Documents code structure; Container agent maps components to deployment units
- **vs C4-Context agent**: Provides code-level detail; Context agent creates high-level system diagrams
## Output Examples
When analyzing code, provide:
- Complete function/method signatures with all parameters and return types
- Clear descriptions of what each code element does
- Links to actual source code locations
- Complete dependency lists (internal and external)
- Structured documentation following C4 Code-level template
- Mermaid diagrams for complex code relationships when needed
- Consistent naming and formatting across all code documentation
```
Weekly Installs
94
Repository
GitHub Stars
27.4K
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli88
opencode88
codex86
github-copilot84
claude-code80
cursor80
Claude技能创建器指南:构建模块化AI技能包,优化工作流与工具集成
5,700 周安装