一键导入
dead-code-and-deps
Deep cleanup analysis for /cortexloop pass 7. Dead code and dependency proof — go deep on evidence before removal.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Deep cleanup analysis for /cortexloop pass 7. Dead code and dependency proof — go deep on evidence before removal.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | dead-code-and-deps |
| description | Deep cleanup analysis for /cortexloop pass 7. Dead code and dependency proof — go deep on evidence before removal. |
Identify code and dependencies that no longer serve the project, then propose safe removal. Cleanup reduces maintenance burden, shrinks attack surface, and speeds builds — but deletion is irreversible without git, so always ask before deleting.
/cortexloop cleanup passnpm audit / pip audit / cargo audit reports issuesWhen NOT to use:
| Signal | How to verify |
|---|---|
| Unused exports | grep for import references across codebase |
| Unreachable functions | No callers in repo; check dynamic imports |
| Commented-out blocks | Safe to remove if git history preserves them |
| Orphaned files | No imports reference the file |
| Unused variables/imports | Linter (eslint, ruff, clippy) |
| Legacy shims | Comments like "backwards compat", "TODO remove" |
| Duplicate utilities | Same logic in multiple files — consolidate, don't delete both |
| Empty/stub files | Placeholder never implemented |
1. Run project linter — collect unused import/variable warnings
2. For each candidate:
a. grep -r for symbol name and file path
b. Check dynamic imports, reflection, config references, test files
c. Check git blame — understand why it exists
3. Classify: CONFIRMED_DEAD | LIKELY_DEAD | UNCERTAIN
4. NEVER delete UNCERTAIN without asking user
DEAD CODE IDENTIFIED:
- formatLegacyDate() in src/utils/date.ts — replaced by formatDate(), 0 references
- OldTaskCard in src/components/ — replaced by TaskCard, 0 references
- LEGACY_API_URL in src/config.ts — no remaining references
Should I remove these? (yes / no / explain which)
| Check | Command (examples) |
|---|---|
| Vulnerabilities | npm audit, pip audit, cargo audit, govulncheck |
| Outdated packages | npm outdated, pip list --outdated |
| Unused deps | depcheck (JS), pip-autoremove (Python) |
| License compatibility | license-checker, manual review |
| Duplicate packages | Same lib under different names (lodash vs lodash-es) |
Critical/High vulnerability reported
├── Is vulnerable code reachable in production?
│ ├── YES → Fix immediately (update, patch, or replace)
│ └── NO (dev-only, unused path) → Fix soon, not a release blocker
└── Fix available?
├── YES → Update to patched version
└── NO → Workaround, replace dep, or allowlist with review date
ASK BEFORE REMOVING:
- package-name@version — reason: unused / duplicate / vulnerable with no fix
- Impact: [what breaks if we're wrong]
- Alternative: [replacement if any]
| Severity | Criteria |
|---|---|
| Critical | Known exploitable CVE in production dependency |
| High | Confirmed dead code on security-sensitive path; high-severity audit finding |
| Medium | Unused dependency adding bundle size; likely dead code with 0 refs |
| Low | Unused imports; outdated but patched dep; cosmetic cleanup |
| Info | Deprecated API usage (not yet removed) |
## Cleanup Findings
### Dead Code
#### [SEVERITY] [symbol or file]
- **Location:** path:line
- **Confidence:** CONFIRMED_DEAD | LIKELY_DEAD | UNCERTAIN
- **Evidence:** [grep results, linter output]
- **Recommendation:** Remove / Keep / Investigate
- **Risk if wrong:** [what breaks]
### Dependencies
#### [SEVERITY] [package@version]
- **Issue:** CVE-XXXX / unused / outdated / duplicate
- **Reachable in production:** yes / no / unknown
- **Recommendation:** Update to X / Remove / Replace with Y
- [ ] Full test suite passes
- [ ] Build succeeds
- [ ] Linter clean (no new warnings)
- [ ] npm audit / equivalent — no new critical/high issues
- [ ] Bundle size unchanged or smaller (if frontend)
- [ ] No broken imports (grep for removed symbols)
Shared CodeCortexLoop expert protocol — one pass, one category, handoff JSON, defer boundaries. Load this on every pipeline expert before domain skills.
After Direct-mode fixes, summarize what changed and record reusable problem→fix patterns into the playbook. Use when CodeCortexLoop Direct mode completes successfully, or when manually invoked via /cortexloop-reflect.
Deep correctness and architecture analysis for /cortexloop pass 1. Logic, invariants, structure, and maintainability — go deep here; defer other domains via handoff.
Deep boundary and state-machine analysis for passes 1, 3, 4. Find non-obvious triggers — apply findings within your pass category.
Deep error-path analysis for /cortexloop pass 4. Propagation, observability, recovery — go deep on failure semantics; defer security exploits and logic bugs to other passes.
Deep performance analysis for /cortexloop pass 5. Hot paths, complexity, measurement — go deep with proof; defer correctness and security to other passes.