Detects orphan functions, dangling imports, and unreachable code via GitNexus CLI Cypher queries on repo knowledge graph. For cleanup, pre-release checks, post-refactor verification.
From gitnexus-toolsnpx claudepluginhub terrylica/cc-skills --plugin gitnexus-toolsThis skill is limited to using the following tools:
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Optimizes cloud costs on AWS, Azure, GCP via rightsizing, tagging strategies, reserved instances, spot usage, and spending analysis. Use for expense reduction and governance.
CLI ONLY — no MCP server exists. Never use
readMcpResourcewithgitnexus://URIs.
Find orphan functions, dangling imports, isolated files, and unreachable code using the GitNexus knowledge graph.
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
For language-specific dead code tools (vulture, knip, clippy): use quality-tools:dead-code-detector instead. This skill uses the GitNexus graph for cross-file structural analysis.
The gitnexus binary is installed via npm/mise. The mise shim may fail if node isn't active in the current project. Run this pre-flight before any gitnexus command:
# Test if gitnexus is actually callable (not just a broken shim)
gitnexus --version 2>/dev/null || mise use node@25.8.0
All commands below run from the repo root. If multiple repos are indexed in the workspace, add --repo <repo-name> to specify the target. Otherwise --repo is optional.
gitnexus status
If stale (indexed commit ≠ HEAD), automatically reindex before proceeding — do not ask the user:
gitnexus analyze
Then re-check status to confirm index is current.
Run these 4 queries to detect different categories of dead code:
Functions with no incoming CALLS edges and not participating in any process:
gitnexus cypher "MATCH (f:Function) WHERE NOT EXISTS { MATCH ()-[:CALLS]->(f) } AND NOT EXISTS { MATCH ()-[:STEP_IN_PROCESS]->(f) } RETURN f.name, f.file, f.line ORDER BY f.file LIMIT 50"
Import edges with low confidence (< 0.5), indicating potentially broken references:
gitnexus cypher "MATCH (a)-[r:IMPORTS]->(b) WHERE r.confidence < 0.5 RETURN a.name, b.name, r.confidence, a.file ORDER BY r.confidence LIMIT 30"
Functions unreachable from any entry point — no callers and no process membership:
gitnexus cypher "MATCH (f:Function) WHERE NOT EXISTS { MATCH ()-[:CALLS]->(f) } AND NOT EXISTS { MATCH ()-[:STEP_IN_PROCESS]->(f) } AND NOT f.name STARTS WITH '_' AND NOT f.name STARTS WITH 'test_' RETURN f.name, f.file, f.line ORDER BY f.file LIMIT 50"
Files with no imports in or out:
gitnexus cypher "MATCH (f:File) WHERE NOT EXISTS { MATCH (f)-[:IMPORTS]->() } AND NOT EXISTS { MATCH ()-[:IMPORTS]->(f) } RETURN f.path ORDER BY f.path LIMIT 30"
Exclude false positives:
**/test_*, **/tests/*, **/*_test.*) — test functions are legitimately "uncalled"__init__ files — may be legitimately empty or used for re-exportsmain, cli, __main__) — called by the runtime, not by other code_ — may be used via dynamic dispatchPresent categorized by module/directory:
## Dead Code Report
### Orphan Functions (N found)
| Function | File | Line |
|----------|------|------|
| ... | ... | ... |
### Dangling Imports (N found)
| Source | Target | Confidence |
|--------|--------|------------|
| ... | ... | ... |
### Isolated Files (N found)
- path/to/file.py
- ...
### Summary
- Total orphans: N
- Total dangling: N
- Total isolated: N
quality-tools:dead-code-detector for language-specific analysis (vulture, knip, clippy) which complements this structural viewAfter this skill completes, reflect before closing the task:
Do NOT defer. The next invocation inherits whatever you leave behind.