跳到主要内容
哒哒星球DADA PLANET

Skill · 已公开版本

context-map · 改动前生成代码上下文地图

在实施改动前分析代码库,列出需修改文件、依赖、相关测试与可参考模式,并给出风险评估。

先看看示例

作者提供的示例,实际效果取决于你的输入和使用工具。

输入

为「给订单接口增加取消状态」生成上下文地图,列出服务文件、依赖、测试与破坏性变更风险。

输出

预期交付:Markdown 上下文地图:待修改文件表、依赖表、测试文件表、参考模式表与风险评估清单。(编辑说明,非实际运行结果)

方法说明

---
name: context-map
description: 'Generate a map of all files relevant to a task before making changes'
---

# Context Map

Before implementing any changes, analyze the codebase and create a context map.

## Task

{{task_description}}

## Instructions

1. Search the codebase for files related to this task
2. Identify direct dependencies (imports/exports)
3. Find related tests
4. Look for similar patterns in existing code

## Output Format

```markdown
## Context Map

### Files to Modify
| File | Purpose | Changes Needed |
|------|---------|----------------|
| path/to/file | description | what changes |

### Dependencies (may need updates)
| File | Relationship |
|------|--------------|
| path/to/dep | imports X from modified file |

### Test Files
| Test | Coverage |
|------|----------|
| path/to/test | tests affected functionality |

### Reference Patterns
| File | Pattern |
|------|---------|
| path/to/similar | example to follow |

### Risk Assessment
- [ ] Breaking changes to public API
- [ ] Database migrations needed
- [ ] Configuration changes required
```

Do not proceed with implementation until this map is reviewed.