From codebrain
Use when scanning for dead code, unused imports, stub functions, duplicate logic, or general code quality issues. Runs automated detection tools and AI-powered analysis to find problems that linters miss.
npx claudepluginhub chrsmay/codebrain-plugin --plugin codebrainThis skill uses the workspace's default tool permissions.
Codebase quality scan for dead code, unused imports, stubs, duplicates, and tech debt.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Codebase quality scan for dead code, unused imports, stubs, duplicates, and tech debt.
/codebrain:quality [path]
Determine scope.
git ls-files)Detect project stack from config or auto-detect.
Run automated tools (based on stack):
ESLint (via MCP — structured results):
mcp__eslint__eslint_lint on the target scope for structured lint violationsTypeScript/JavaScript (via Bash):
npx tsc --noEmit 2>&1 | grep -c "error" — type errorsnpx knip --no-progress 2>&1 — unused files, exports, dependenciesPython (via Bash):
ruff check --select F401,F811,F841 . 2>&1 — unused imports, vars, redefinitionsTest Coverage (via MCP):
mcp__test_coverage__get_total_coverage for overall project coverage %mcp__test_coverage__get_uncovered_files to find files with zero or low coverageDependency Health (via MCP):
General (via Bash):
grep -rn "throw new Error.*not implemented\|raise NotImplementedError\|TODO\|FIXME" . — stubsSpawn verifier agent in quality mode with:
pass statements, throw new Error("not implemented")Present categorized findings.
Offer cleanup options:
If cleaning: remove safe items, then run build/test to confirm nothing broke.
Persist report to .codebrain/reviews/{date}-quality-scan.md.
# Quality Scan Report
**Scope:** [path or "full project"]
**Date:** [ISO date]
**Stack:** [auto-detected]
## Summary
| Category | Count | Severity |
|----------|-------|----------|
| Dead Code | 0 | Minor |
| Stubs | 0 | Major |
| Duplicates | 0 | Minor |
| Unused Dependencies | 0 | Minor |
| Low Coverage Files | 0 | Major |
| Unsafe Dependencies | 0 | Critical |
## Automated Tool Results
| Tool | Status | Output |
|------|--------|--------|
| ESLint | PASS/FAIL | [error count] |
| TypeScript | PASS/FAIL | [error count] |
| Knip/Ruff | PASS/FAIL | [unused count] |
| Coverage | N% | [threshold: 80%] |
| Socket | SAFE/WARN | [flagged count] |
## Findings
### Dead Code
| # | File:Line | Type | Description | Safe to Remove |
|---|-----------|------|-------------|----------------|
| 1 | src/old.ts:1-45 | Unused export | `formatLegacy()` has 0 callers | Yes |
### Stubs
| # | File:Line | Description |
|---|-----------|-------------|
| 1 | src/api.ts:88 | `throw new Error("not implemented")` |
### Duplicates
| # | File A | File B | Lines | Similarity |
|---|--------|--------|-------|------------|
| 1 | utils/format.ts:10-25 | helpers/fmt.ts:5-20 | 15 | 92% |
## Cleanup Classification
- **Safe (auto-removable):** unused imports, unreferenced exports, empty files
- **Needs Review:** stubs (may be intentional placeholders), low-coverage files
- **Manual Only:** duplicates (need architectural decision), unsafe deps (need replacement)