一键导入
code-generator
Use when implementing new modules from design documents, adding features to existing code, or generating structured implementations
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when implementing new modules from design documents, adding features to existing code, or generating structured implementations
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | code-generator |
| description | Use when implementing new modules from design documents, adding features to existing code, or generating structured implementations |
| version | 1 |
Structured workflow for implementing code from design documents with clear phase separation, cost estimation, and modification tracking.
Use this skill when you need to:
Read and understand:
Use this format:
## 📋 [ProjectName] Implementation Plan
### Execution Capability Statement
| Operation | Capability |
|-----------|------------|
| Code generation | ✅ Can execute |
| Database operations | ❌ Cannot execute (user handles) |
| Git/SVN operations | ❌ Do not execute |
| Compilation | ❌ Do not execute (user triggers) |
### Phase [N]: [Phase Name]
| Order | File | Path | Operation | Content | Time | Token Cost |
|-------|------|------|-----------|---------|------|------------|
| 1 | `FileName.h` | `Path/` | Create/Modify | Brief description | X min | ~X,XXX |
**Phase Subtotal**: ~X,XXX tokens
### Modification Preview
For modify operations only:
`FileName.h`:
```cpp
// Before: [current state or "None"]
// After: [new code to be added]
Phase 1 ──► Phase 2 ──► Phase 3
| Phase | Time | Token Cost |
|---|---|---|
| 1 | X min | ~X,XXX |
| 2 | X min | ~X,XXX |
| Total | X hours | ~XX,XXX |
### Step 3: Execute Phase by Phase
After user approval with "Approve plan":
1. **Announce current phase**
2. **Execute operations** in order
3. **Report progress** after each file
4. **Confirm phase completion** before next phase
### Step 4: Completion Report
```markdown
## ✅ Implementation Complete
### Generated Files
| File | Path | Lines |
|------|------|-------|
| `File.h` | `Path/` | XXX |
### Modified Files
| File | Path | Changes |
|------|------|---------|
| `File.cpp` | `Path/` | Added X methods |
### Next Steps (User Action Required)
1. [Database setup, compilation, etc.]
### Token Usage
- **Estimated**: ~XX,XXX
- **Actual**: ~XX,XXX
| File Type | Lines | Estimated Tokens |
|---|---|---|
| Header (declaration) | 50-100 | 500-1,000 |
| Implementation | 200-300 | 2,000-4,000 |
| Simple modification | - | 300-800 |
| Complex modification | - | 1,000-2,000 |
| CSV/Data file | 20-50 | 200-500 |
| Test file | 100-200 | 1,000-2,000 |
## 📋 PlayerSystem Implementation Plan
### Execution Capability Statement
| Operation | Capability |
|-----------|------------|
| Code generation | ✅ Can execute |
| Database operations | ❌ Cannot execute |
| Git/SVN operations | ❌ Do not execute |
| Compilation | ❌ Do not execute |
### Phase 1: Data Structures
| Order | File | Path | Operation | Content | Time | Token Cost |
|-------|------|------|-----------|---------|------|------------|
| 1 | `SystemDefines.h` | `Project/` | Create | Enums and utilities | 5m | ~500 |
| 2 | `SystemInstance.h` | `Project/` | Create | Struct with Save/Load | 10m | ~800 |
**Phase 1 Subtotal**: ~1,300 tokens
### Phase 2: Core Implementation
| Order | File | Path | Operation | Content | Time | Token Cost |
|-------|------|------|-----------|---------|------|------------|
| 3 | `PlayerSystem.h` | `Project/` | Create | Class declaration | 10m | ~1,000 |
| 4 | `PlayerSystem.cpp` | `Project/` | Create | Core methods | 30m | ~3,500 |
**Phase 2 Subtotal**: ~4,500 tokens
### Phase 3: Integration
| Order | File | Path | Operation | Content | Time | Token Cost |
|-------|------|------|-----------|---------|------|------------|
| 5 | `Player.h` | `Project/` | Modify | Add accessor method | 5m | ~300 |
**Modification Preview**:
`Player.h`:
```cpp
// Before: No System member
class Player {
// existing members
};
// After: Added System
class Player {
// existing members
public:
PlayerSystem& GetSystem() { return mSystem; }
private:
PlayerSystem mSystem;
};
Phase 3 Subtotal: ~300 tokens
| Phase | Time | Token Cost |
|---|---|---|
| 1 | 15m | ~1,300 |
| 2 | 40m | ~4,500 |
| 3 | 5m | ~300 |
| Total | 1 hour | ~6,100 |
## Anti-Patterns
### ❌ Don't
- Start coding without user approval
- Skip modification previews for modify operations
- Omit token cost estimation
- Perform Git/database/compilation operations
- Combine multiple phases without checkpoint
### ✅ Do
- Wait for "Approve plan" before execution
- Show before/after for all modifications
- Estimate costs conservatively
- Stay within code generation scope only
- Execute phase by phase with progress reports
## Integration with Other Skills
- **mvp-design**: Use as input (design doc → implementation)
- **code-analysis**: Verify existing files before modification
- **skill-creator**: Extract patterns into reusable skills
## Quick Reference
### Cost Estimation Formula
Header file: 10 tokens per line Implementation: 15 tokens per line Modification: 20 tokens per line (includes context) Test file: 12 tokens per line
### Modification Preview Format
```cpp
// File: Path/Filename.ext
// Before: [describe current state]
[code snippet or "None - new addition"]
// After: [describe new state]
[code snippet to be added/modified]
// Key changes:
// - Change 1
// - Change 2
Use when the current Agent LLM cannot process images directly and visual analysis is needed — bridges images through KimiCode CLI print mode to a multimodal Kimi model for text description
Use when building HUDs, menus, inventory screens, settings panels, or any widget-based interface in Unreal Engine 5. Also use when connecting C++ logic to UMG Blueprint visuals, handling gamepad or keyboard focus navigation, managing UI state, creating widget animations, or troubleshooting UMG performance issues like frame drops, hitches, or widget memory leaks.
Use when working in a DevFlow project with .devflow/ directory and gate-based step-by-step workflows
Use when contributing new skills to the skill-lib repository, installing skills locally, or verifying skill compliance with repository standards
Use when analyzing unfamiliar code modules, understanding system architecture, or preparing for refactoring
Use when recording work sessions, tracking decisions and outcomes, or documenting lessons learned