brownfield-blast
Generate a detailed blast radius report showing all files affected if you change a given file.
Identify all dead code in the codebase: unused files and unused exports.
$ npx -y skills add wednesday-solutions/ai-agent-skills --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/brownfield-deadContext preview
What this command does when you run it.
Identify all dead code in the codebase: unused files and unused exports.
Identify all dead code in the codebase: unused files and unused exports.
Type: `/brownfield-dead`
---
const queries = require('./.claude/query-helpers.js');
const deadCode = queries.getAllDeadCode();Returns:
Each file record includes:
If graph coverage < 80%, add a caveat: > "⚠ Graph coverage is <X>%. Some 'dead' code may be dynamically imported or accessed via reflection. Verify before deleting."
**Safe to delete (no one owns them):**
**Needs investigation (high risk):**
**Format:**
# Dead Code Report **Total dead files:** <N> **Total unused exports:** <N> **Graph coverage:** <X>% --- ## Dead Files ### Safe to Delete [If any exist] | File | Size | Last Touch | Risk | Language | |------|------|-----------|------|----------| | <file> | <Bytes> | <Days ago> | Safe | <lang> | | ... | ... | ... | ... | ... | > These files are not imported by anything and don't pose risk. > Safe to delete immediately. ### Needs Review [If any exist] | File | Last Commit | Risk | Reason | Author | |------|------------|------|--------|--------| | <file> | <date> | <score> | High risk flag | <who> | | ... | ... | ... | ... | ... | > These have either recent activity or high risk scores. > Verify they're truly unused before deleting. --- ## Unused Exports ### By File **<file-1>** (imported by: 0) - `exportName1` — unused - `exportName2` — unused **<file-2>** (imported by: 0) - `someFunction` — unused [List all files with unused exports] --- ## Recommendations ### Delete Immediately ```bash rm <file-1> rm <file-2>
Update imports:
grep -r "import.*from.*<file>" --include="*.js" | wc -l # Should be 0 before deleting
/**
* @deprecated Use newFunction() instead. Remove by [date].
* This is scheduled for removal as it's not used internally.
*/
export function oldFunction() { ... }---
**Total debt to clean:** <N> files + <N> unused exports
**Estimated cleanup time:** <M> minutes
**Storage savings:** <KB> (if all deleted)
---
1. Verify each "safe to delete" file one more time 2. Search codebase for dynamic imports (harder to detect):
grep -r "require(.*variable.*)" --include="*.js" grep -r "import(.*variable.*)" --include="*.js"
3. Check configuration files for references 4. Delete verified dead files 5. Run full test suite to ensure nothing breaks 6. Commit with message: `chore: remove dead code (<N> files)`
--- ## Caveats ### If Coverage < 80%
⚠ Graph coverage is <X>%. These files may have: • Dynamic imports: require(variableName), import(path) • Reflection-based access: obj[dynamicKey] • String-based requires in config files • Entry points not detected (bin/cli.js, etc.)
Before deleting, verify with: grep -r "<filename>" --include="*.js" --include="*.json"
### If File Uses Reflection Files using `eval()`, `Function()`, or dynamic imports cannot be checked statically. Flag these:
⚠ <file> uses dynamic require/import. Cannot verify if truly dead.
### Cross-Language Dead Code If importing Swift/Go code from JS: - Dead code detection may miss cross-language references - Verify in the native project before deleting --- ## Fallback (if DB query fails) If the graph.db query fails, the codebase must be mapped first: ```bash wednesday-skills map --full
Once mapped, the DB will be populated with dead code analysis. The query layer will automatically:
---
| Situation | Action | |-----------|--------| | Dead code analysis not found | "Run `/brownfield-map` to generate dead code analysis." | | Graph coverage too low | "Add caveat: results may be incomplete. Manual verification required." | | File is entry point | "Do not delete — this is an entry point (even if no direct importers)." | | File has side effects | "Do not delete — this file may execute on import (e.g., register handlers)." | | Recent activity | "File was edited <N> days ago. Verify it's truly unused before deleting." |
---
Transform any repository into an AI-aware, intelligent environment — a codebase that any AI agent can jump into on day one without making junior-level mistakes.
Repo: wednesday-solutions/ai-agent-skills
Generate a detailed blast radius report showing all files affected if you change a given file.
Answer any structural, historical, or architectural question about the codebase without…
Run a risk assessment before editing any file in a brownfield codebase. Provides a risk card…
Run a complete brownfield analysis on the codebase and generate MASTER.md, summaries, risk…
Detailed risk scoring breakdown for a specific file. Shows all contributing factors and…
Generate a personalized onboarding brief for a new developer joining the project.