Matrix Nuke
This skill should be used when the user asks to "nuke dead code", "find unused exports", "clean up imports", "find orphaned files", "detect circular deps", "cleanup codebase", "find unused packages", "remove dead code", "nuke this", "nuke unused", or needs comprehensive codebase hygiene analysis.
What this skill does
# Matrix Nuke
Comprehensive codebase hygiene analysis. Detects dead code, unused imports, orphaned files, circular dependencies, stale TODOs, unnecessary comments, overengineered dependencies, and more across 11 categories.
> **Tip:** This skill runs in a **forked context** for unbiased analysis - clean slate, no conversation history bias.
## Architecture
```
ORCHESTRATOR (parse mode, dispatch agents, aggregate report)
|
+-- STRUCTURAL AGENT --> dead exports, orphaned files, unused imports
+-- CIRCULAR DEP AGENT --> import cycle detection
+-- DEPENDENCY AGENT --> unused npm packages, overengineered deps
+-- GENERATIVE AGENT --> comments, console.log, copy-paste, TODOs
+-- TRIAGE AGENT --> confidence scoring, safety filtering, tiering
```
## Usage
Parse user arguments from the skill invocation (text after the trigger phrase).
**Expected format:** `/nuke [mode] [path]`
### Modes
| Mode | Command | Behavior |
|------|---------|----------|
| Scan | `/nuke` or `/nuke scan` | Report only - touch nothing (default) |
| This | `/nuke this <file>` | Single file analysis |
| Safe | `/nuke safe` | Report HIGH confidence only (>90%) |
| Aggressive | `/nuke aggressive` | Report MEDIUM+ confidence (>70%) |
### Path Filtering
Append a path to any mode to limit scope:
- `/nuke scan src/api/` - only scan src/api/
- `/nuke this src/utils/auth.ts` - single file
### Examples
```
/nuke # Full scan, report only
/nuke scan # Same as above
/nuke this src/utils/auth.ts # Single file analysis
/nuke scan src/api/ # Scan specific directory
/nuke safe # High-confidence findings only
/nuke aggressive # Medium+ confidence findings
```
## Pipeline
Follow the orchestration detailed in `references/nuke-pipeline.md`:
1. **Pre-flight** - Check index availability (`matrix_index_status`), detect entry points from package.json, parse mode
2. **Structural Analysis** - Use `matrix_find_dead_code` for dead exports + orphaned files
3. **Circular Dep Detection** - Use `matrix_find_circular_deps` for import cycles
4. **Dependency Analysis** - Read package.json, cross-reference with actual imports via `Grep`
5. **Generative Analysis** - AI inspection of files for comments, console.log, duplication, TODOs
6. **Triage** - Apply safety rules, assign confidence scores, classify into tiers
7. **Report** - Generate formatted output per `references/output-format.md`
**Early exit for `/nuke this`:** Only run Structural + Generative agents on that single file. Skip dependency and circular dep analysis.
**Graceful degradation:** If index is unavailable, fall back to Grep-based analysis. Report reduced accuracy.
## What Gets Detected (11 Categories)
### Structural (deterministic, via MCP tools)
1. **Dead exports** - exported symbols with zero callers across the codebase
2. **Orphaned files** - files that nothing imports (excluding entry points)
3. **Circular dependencies** - import cycles in the dependency graph
4. **Unused npm packages** - in package.json but never imported
5. **Unused imports** - imports brought in but never referenced in the file
### Generative (AI judgment required)
6. **Unnecessary comments** - obvious/redundant comments (`// increment i`, `// constructor`)
7. **Commented-out code** - dead code hiding in comments (contains `{`, `=`, `function`, `return`)
8. **Console.log leftovers** - `console.log` and `console.debug` left from debugging (NOT `console.error`)
9. **Overengineered deps** - libraries replaceable with native APIs (`lodash.get` -> `?.`, `moment` -> `Intl`)
10. **Copy-paste duplication** - near-identical code blocks (5+ similar consecutive lines)
11. **Stale TODO/FIXME** - ancient TODOs with no linked issues and old git blame dates
## Safety Rules
See `references/safety-rules.md` for full details. Key rules:
- **Never flag entry points** - index.ts, main.ts, bin/*, package.json main/module/exports
- **Never flag framework conventions** - pages/*, routes/*, app/*, *.config.*, migrations/*
- **Never flag dynamically imported modules** - import(), require() references
- **Never flag public API surface** - root barrel exports, @public JSDoc
- **Respect .nukeignore** - if present, honor it like .gitignore
## Additional Resources
- **`references/nuke-pipeline.md`** - Full orchestrator pipeline
- **`references/agents/structural-agent.md`** - Dead code detection via MCP tools
- **`references/agents/generative-agent.md`** - AI-judged detection patterns
- **`references/agents/dependency-agent.md`** - Package analysis and native alternatives
- **`references/agents/triage-agent.md`** - Confidence scoring and safety filtering
- **`references/safety-rules.md`** - Entry point detection, what NOT to flag
- **`references/output-format.md`** - Report template
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.