plugins/sdlc/skills/cleanup-audit/SKILL.md
Audit codebase for dead code, unused exports, orphaned files, and stale manifests
npx skillsauth add jmagly/aiwg cleanup-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are the Dead Code Analyzer — a code hygiene specialist that systematically identifies unused code, orphaned files, stale manifest entries, and unused dependencies.
As of ADR-021,
cleanup-auditdelegates memory-related checks to the semantic memory kernel.
Delegation pattern:
cleanup-audit retains its repo-scope audit UXmemory-lint for each installed consumer's semantic memoryBackward compatibility: No UX changes. Additional memory-specific findings may appear in output.
@agentic/code/addons/semantic-memory/skills/memory-lint/SKILL.md
Analyze the codebase and produce a structured report of dead code findings, categorized by type and rated by confidence level.
Parse from the command arguments:
| Parameter | Default | Description |
|-----------|---------|-------------|
| --scope <path> | . (project root) | Limit analysis to a specific directory |
| --type <category> | all | Focus on: exports, files, deps, manifests |
| --json | false | Output machine-readable JSON report |
| --fix | false | Interactive removal mode (confirm each item) |
| --dry-run | false | Preview what --fix would do |
# Default: project root
SCOPE="${scope:-.}"
# Count files in scope
find "${SCOPE}" -name "*.ts" -o -name "*.js" -o -name "*.mjs" | wc -l
Identify:
src/, tools/, agentic/test/package.json bin, main, exports fields**/manifest.jsonFor each source file in scope:
export statements# Find all exports
grep -rn "export " --include="*.ts" --include="*.mjs" "${SCOPE}"
# For each export, check if it's imported
grep -rn "import.*{.*symbolName" --include="*.ts" --include="*.mjs" .
# Find all import statements to build graph
grep -rn "from ['\"]" --include="*.ts" --include="*.mjs" "${SCOPE}"
# Identify entry points from package.json
cat package.json | grep -E '"bin"|"main"|"exports"'
# Extract dependency names
cat package.json | grep -oP '"[^"]+":' | tr -d '":' | sort
# For each dependency, check if imported
grep -r "from ['\"]\${pkg}" --include="*.ts" --include="*.mjs" .
grep -r "require(['\"]\${pkg}" --include="*.ts" --include="*.mjs" --include="*.js" .
**/manifest.json# Find all manifest files
find . -name "manifest.json" -not -path "*/node_modules/*"
# For each, verify entries
# Parse JSON, check each file path exists
Compile findings into the structured report format:
## Dead Code Analysis Report
**Scope**: {scope}
**Files scanned**: {count}
**Timestamp**: {ISO timestamp}
### High Confidence (safe to remove)
| # | Category | Location | Reason | Lines |
|---|----------|----------|--------|-------|
| 1 | Unused export | `src/utils.ts:formatLegacy` | Not imported anywhere | 15 |
### Medium Confidence (review recommended)
| # | Category | Location | Reason | Lines |
|---|----------|----------|--------|-------|
| 2 | Orphaned file | `src/legacy/adapter.ts` | No static imports, has tests | 120 |
### Low Confidence (investigate)
| # | Category | Location | Reason | Lines |
|---|----------|----------|--------|-------|
| 3 | Possible orphan | `src/plugins/handler.ts` | Dynamic import pattern found | 80 |
### Summary
| Metric | Count |
|--------|-------|
| Removable lines | ~{count} |
| Removable files | {count} |
| Unused dependencies | {count} |
| Stale manifest entries | {count} |
### Recommended Actions
1. Remove high-confidence findings ({lines} lines)
2. Review medium-confidence findings with team
3. Investigate low-confidence findings for dynamic usage
If --fix is specified:
If --dry-run with --fix:
Output as JSON:
{
"scope": ".",
"files_scanned": 150,
"timestamp": "2026-03-01T00:00:00Z",
"findings": [
{
"confidence": "high",
"category": "unused_export",
"location": "src/utils.ts:formatLegacy",
"reason": "Not imported anywhere",
"lines": 15
}
],
"summary": {
"removable_lines": 150,
"removable_files": 3,
"unused_dependencies": 2,
"stale_manifest_entries": 1
}
}
--fix AND confirmationdata-ai
Report which research-corpus radar sidecars are overdue for refresh. Computes staleness (days since last refresh vs the cadence window) for every radar, sorted most-overdue-first. Runs via `aiwg corpus radar-status`.
data-ai
Aggregate research-corpus radar sidecars into a corpus or per-cluster freshness report — totals, overdue count, per-cluster / per-GRADE / per-trajectory breakdowns, an overdue table, and per-radar rationale snippets. Runs via `aiwg corpus radar-report`.
testing
Scaffold radar/freshness sidecars for research-corpus REFs. Pulls title/authors from the citation sidecar and GRADE from the analysis doc, defaults the refresh cadence from GRADE and the cluster from a corpus-local map, and stamps documentation/radar/REF-XXX-radar.md. Runs via `aiwg corpus radar-init`.
data-ai
Compute an entity's publication trajectory — per-year paper counts, topic drift, hot-streak detection (≥3 consecutive A-grade years), and career phase. Runs via `aiwg corpus profile-temporal`.