From codebase-analysis
Orchestrate a full codebase analysis using all static analysis tools (knip, dependency-cruiser, jscpd) and synthesize findings.
How this skill is triggered — by the user, by Claude, or both
Slash command
/codebase-analysis:analysis-orchestratorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Coordinate all static analysis tools and synthesize their output into a unified picture of codebase health.
Coordinate all static analysis tools and synthesize their output into a unified picture of codebase health.
# Run everything
pnpm analyze:all
# Or individually per tool
pnpm analyze:deps:validate
pnpm analyze:dead
pnpm analyze:dupes
pnpm analyze:deps:validate
Expected clean output:
✔ no dependency violations found
If violations appear, investigate before proceeding.
pnpm analyze:dead
knip exits code 1 when findings exist — this is expected, not a failure.
pnpm analyze:dupes
HTML reports are written to /tmp/jscpd-report/html/. Open them for detailed side-by-side diff views.
After running all tools, look for cross-tool patterns:
Pattern A: Bypassed utility
knip: "helperFn" — unused export
jscpd: helperFn clones inline code elsewhere
→ A utility exists, nobody imports it, and the logic was written inline elsewhere.
Pattern B: Missing route or export
knip: "getItemById" — unused export
(no matching route/handler)
→ A service function was written but never wired up.
Pattern C: Orphaned feature
knip: multiple unused exports in same file cluster
jscpd: no clones (unique implementations)
→ A complete subsystem with no callers.
Use a findings document (e.g., docs/ANALYSIS_FINDINGS.md). When updating it:
| Signal | Meaning | Action |
|---|---|---|
| knip unused + jscpd duplicate | Bypassed utility | Wire the caller to use the utility |
| knip unused + no route | Missing route | Add the route, don't delete the service |
| knip multiple unused + no clones | Orphaned subsystem | Document as future feature |
app/page.tsx, app/layout.tsx, app/route.tscomponents/**/*.tsxhooks/**/*.ts, hooks/**/*.tsxapp/actions.ts, lib/actions.tsapp/ are entry points via routing, not importspages/_app.tsx, pages/_document.tsxpages/api/**/*.tscomponents/**/*.tsxsrc/index.tssrc/components/**/*.tsxsrc/hooks/**/*.ts, src/hooks/**/*.tsxsrc/lib/**/*.tssrc/index.ts, src/main.tshandlers/ → actions/ → services/components/ui/ in jscpd (auto-generated boilerplate)cn() utilitylib/utils.ts uses template strings for class names - knip won't trace these### P[N] — [Short description]
**File**: `path/to/file.ts:line`
**Status**: [A | B | B (bypassed) | C]
[What the symbol/function does]
[What the tool output showed]
[Why this matters]
**Action needed**: [Specific recommended fix]
Before marking anything as new, check existing findings:
**Codebase Analysis — [project name]**
**Run date**: 2026-03-29
**Architecture**: ✔ No violations
**Dead code summary**:
- N unused files, N unused exports, N unused dependencies
**New findings since last run**: [symbols not previously documented]
**Previously documented findings still open**:
- P1: [description]
- P2: [description]
**Cross-tool signals**:
- [Any bypassed utility patterns]
**Recommendation**: [highest priority action]
See docs/ANALYSIS_FINDINGS.md for full details.
See individual skill docs for:
.jscpd.json — Duplicate code detection configknip.json — Dead code analysis config.dependency-cruiser.cjs — Architecture validation configFor Next.js App Router projects, use these recommended settings:
{
"format": ["typescript", "tsx"],
"output": "/tmp/jscpd-app",
"ignore": [
"**/__tests__/**",
"**/*.test.tsx",
"**/node_modules/**",
"app/**/page.tsx",
"app/**/layout.tsx",
"components/ui/**"
]
}
{
"entry": ["app/page.tsx", "app/layout.tsx", "app/route.ts"],
"project": ["app/**/*.ts", "app/**/*.tsx", "components/**/*.ts", "components/**/*.tsx", "lib/**/*.ts"],
"ignore": ["components/ui/**", "app/**/page.tsx", "app/**/layout.tsx", "app/**/not-found.tsx", "app/**/error.tsx", "**/__tests__/**"],
"ignoreDependencies": ["clsx", "tailwind-merge", "class-variance-authority"],
"ignoreExportsUsedInFile": true
}
module.exports = {
forbidden: [
{
name: "no-circular",
severity: "error",
from: {},
to: { circular: true }
}
],
options: {
doNotFollow: { path: "node_modules" },
tsConfig: { fileName: "tsconfig.json" }
}
};
npx claudepluginhub kylebrodeur/codebase-analysis --plugin codebase-analysisRuns static tools like tsc, semgrep, knip to analyze codebase for dead code, test quality, duplicates, complexity, security, architecture. Full TS/JS support; limited Python/Go/Rust. Stores structured reports.
Analyzes JavaScript/TypeScript codebases for unused code (files/exports/types/deps), duplication, circular dependencies, complexity hotspots, architecture violations, and feature flags via static (free) and optional runtime layers.
Detects dead code, unused exports, orphaned files, circular dependencies, unused packages, stale TODOs, and hygiene issues across 11 categories. Use scan, safe, aggressive modes on full codebase or paths.