xiaohongshu
xiaohongshu
code-discovery-and-impact-analysis
Discover project patterns and find all code usages before making changes. Use BEFORE renaming, refactoring, moving files, changing signatures, or adding features to ensure completeness and follow project conventions. Prevents incomplete refactors and assumption-based coding.
Full skill instructions
Quick Reference: Discover patterns and find all usages before making changes.
This skill ensures Claude discovers both how to change code (patterns) and what needs changing (usages) before making modifications.
Two-Phase Process:
Prevents:
Automatically invoke BEFORE:
Manual invocation when:
CRITICAL: The tools behave differently based on maxResults:
contentIncluded: true)contentIncluded: false)Recommendation: Always use 1-3 for pattern discovery to see actual code
Recommendation: Use 10-15 by default, increase only if needed
Pattern Discovery: Returns one complete code example Usage Discovery: Returns one usage with context
Use when:
Pattern Discovery: Returns 2-3 complete code examples with variations Usage Discovery: Returns 2-3 usages with context
Use when:
Why 2-3 for patterns: This is the sweet spot - gets actual code content while showing variations
Pattern Discovery: ⚠️ NOT RECOMMENDED - returns metadata only, no code Usage Discovery: Returns 10-15 usages with full context
Use when:
⚠️ Context Management:
results.length == maxResults (indicates more exist)Ask yourself:
What am I changing?
What's the expected impact?
Which depth level?
Goal: Understand how to make changes correctly
Use search_code with appropriate maxResults (≤3 for code content):
// Find similar classes/functions
search_code({
query: "Service",
types: ["class"],
pathPattern: "services",
maxResults: 3 // get actual code content
})
// Find similar file types
search_code({
query: "repository",
pathPattern: "modules",
maxResults: 2 // light search, see variations
})
Document findings:
Goal: Find ALL places that need updating
Use find_usage with appropriate maxResults (context always included):
// Find all usages before renaming
find_usage({
identifier: "oldFunctionName",
maxResults: 15, // start here, increase if results.length == maxResults
exactMatch: true
})
// Find usages in specific area
find_usage({
identifier: "ClassName",
pathPattern: "modules/feature",
maxResults: 10 // context always included regardless of count
})
⚠️ Validate completeness:
results.length == maxResults: Increase limit and search againresults.length < maxResults: All usages foundCreate a comprehensive map:
// Verify old references are gone
find_usage({ identifier: "oldName", maxResults: 10 })
// Expected: 0 results
// Verify new references are correct
find_usage({ identifier: "newName", maxResults: 10 })
// Check for errors
check_errors({ pathPattern: "[affected area]" })
1. find_usage({ identifier: "oldFunctionName", maxResults: 15 })
(increase if results.length == 15)
2. Document all locations (file:line)
3. Update function definition
4. Update all call sites
5. Validate: find_usage("oldFunctionName") → 0 results
6. Validate: find_usage("newFunctionName") → all updated
1. Pattern discovery: search_code for similar modules (maxResults: 3)
Get actual code to see structure
2. Usage discovery: find_usage for module exports (maxResults: 15)
3. Map all imports and dependencies
4. Plan refactor following discovered patterns
5. Update all usages
6. Validate with check_errors
1. Pattern discovery: where do similar files live?
search_code({ query: "[file type]", maxResults: 2-3 })
Get code to see organization
2. Find all imports: find_usage for file exports (maxResults: 15)
3. Move file to new location
4. Update all import statements
5. Verify: check_errors()
1. find_usage({ identifier: "functionName", maxResults: 15 })
2. Analyze how function is currently called (context included in results)
3. Update function signature
4. Update every call site with new parameters
5. Validate with check_errors (catches missed call sites)
1. Pattern discovery: find similar features
search_code({ query: "[similar feature]", maxResults: 2-3 })
Get actual code to see implementation
2. Document patterns from code content:
- File organization
- Naming conventions
- Code structure
- Import patterns
3. Implement new feature following patterns
4. No usage discovery needed (new code)
Report discoveries using this format:
## Discovery & Impact Report
**Change:** [What I'm changing]
**Depth:** [quick/balanced/comprehensive]
**Impact:** [localized/module-wide/cross-cutting]
### Phase 1: Pattern Discovery
**Found:** [N] similar patterns
1. **File Organization:** [pattern]
- Location: [path pattern]
- Example: [file path]
2. **Naming:** [pattern]
- Examples: [list]
3. **Structure:** [description]
- Approach: [classes/functions/etc.]
4. **Dependencies:** [import pattern]
**Recommendation:** [How to structure the change]
### Phase 2: Usage Discovery
**Found:** [N] usages across [M] files
| File | Line | Context |
|------|------|---------|
| [path] | [line] | [usage] |
**Completeness:**
- [✓/⚠️] All usages found
- [✓/⚠️] Indirect dependencies checked
- [✓/⚠️] Test files included
### Impact Analysis
**Affected:** [modules/files]
**Complexity:** [low/medium/high]
**Risk:** [low/medium/high] - [reason]
**Changes Required:**
1. [file:line] - [change]
2. [file:line] - [change]
### Implementation Plan
1. [Step 1]
2. [Step 2]
**Validation:**
1. find_usage([old]) → 0 results
2. find_usage([new]) → all updated
3. check_errors() → no issues
**Ready:** [yes/need clarification]
Works alongside:
Workflow:
Before making changes:
After making changes:
Key Takeaways:
Remember: This skill prevents incomplete refactors and ensures changes follow project conventions. Use it proactively, not reactively.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience