1---2name: context-map-23description: Build a concise map of files relevant to a requested code change before implementation. Use when the user asks to identify affected files, plan changes, map dependencies, find tests, locate reference patterns, or assess risk before editing.4---56# Context map78Search the repository for task-relevant code, dependencies, tests, and patterns, then return a risk-aware map that guides later implementation without changing files. If an upstream template supplies `task_description`, treat it as the task text.910## When to invoke1112- "Create a context map for this task before coding."13- "Find the files I need to modify for this change."14- "Map dependencies and tests for this feature."15- "Assess implementation risk before making edits."1617## Discovery targets1819| Target | How to identify it | Include in map when |20| --- | --- | --- |21| Files to modify | Names, symbols, routes, commands, imports, configuration keys, or error text from the task. | The file owns behavior that must change. |22| Dependencies | Direct imports, exports, callers, generated types, schema references, or API contracts. | A modification may require a corresponding update. |23| Test files | Unit, integration, snapshot, e2e, fixture, or golden files near the affected behavior. | They verify or should verify the requested change. |24| Reference patterns | Existing code that solves a similar problem in the same repository. | It establishes style, architecture, or validation behavior to copy. |25| Risk items | Public APIs, migrations, configuration, concurrency, security, performance, or backward compatibility. | The change can break consumers or deployment. |2627## Procedure28291. Convert the user's task into searchable terms: domain nouns, function names, routes, CLI flags, UI labels, error messages, and config keys.302. Search for owning files first, then follow direct imports/exports and callers from those files.313. Search for tests using the same symbol names, fixtures, route names, snapshots, or directory conventions.324. Find at least one repository-native reference pattern when the task changes style-sensitive code.335. Stop at the smallest complete map; do not implement until the user or parent workflow asks for edits.3435## Risk assessment rules3637| Risk checkbox | Mark when |38| --- | --- |39| Breaking changes to public API | Function signatures, exported types, routes, CLI flags, schemas, or documented behavior may change. |40| Database migrations needed | Tables, columns, indexes, constraints, seed data, or persistence shape must change. |41| Configuration changes required | Environment variables, secrets, deployment manifests, feature flags, or package settings must change. |4243## Output template4445```markdown46## Context Map4748### Files to Modify49| File | Purpose | Changes Needed |50|------|---------|----------------|51| `path/to/file` | <description> | <what changes> |5253### Dependencies (may need updates)54| File | Relationship |55|------|--------------|56| `path/to/dep` | <imports/calls/exports affected symbol> |5758### Test Files59| Test | Coverage |60|------|----------|61| `path/to/test` | <behavior covered or missing> |6263### Reference Patterns64| File | Pattern |65|------|---------|66| `path/to/similar` | <example to follow> |6768### Risk Assessment69- [ ] Breaking changes to public API70- [ ] Database migrations needed71- [ ] Configuration changes required72```7374## Quality gate7576- [ ] Search terms came from the user's task, not generic repository browsing.77- [ ] Every proposed file to modify has a specific reason and expected change.78- [ ] Direct dependencies and tests were checked for each proposed modification area.79- [ ] At least one reference pattern is listed or the absence of a pattern is stated.80- [ ] Risk checkboxes reflect evidence from the repository.81- [ ] No implementation edits were made as part of the context map.