dead-code-finder
Find dead code and unused files/components in CC Director. Use when you need to identify unused projects, classes, or services that can be safely removed to simplify the codebase.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 110
- Forks
- 12
01 前言 Front Matter
- name
- dead-code-finder
- description
- Find dead code and unused files/components in CC Director. Use when you need to identify unused projects, classes, or services that can be safely removed to simplify the codebase.
03 SKILL.md 正文
Dead Code Finder Skill
Find and identify dead code in the CC Director application to simplify maintenance and reduce codebase complexity.
Scope
INCLUDED directories:
src/CcDirector.Core/- Core business logicsrc/CcDirector.Wpf/- WPF applicationtools/cc-click/- command-line tool for UI automation
EXCLUDED directories:
src/CcDirector.Core.Tests/- Test projects (don't flag as dead code)src/CcDirector.TestHarness/- Test utilities
Analysis Types
1. Unused Project Detection
Find projects (.csproj) that are:
- Not referenced by any other project in the solution
- Not an entry point (WPF app, console app)
- Only referenced by other unused projects (chain detection)
2. Unused File Detection
Find C# files (.cs) where:
- All public classes/interfaces have zero external references
- File is not an entry point (Program.cs, App.xaml.cs)
- File is not a test file
3. Unused XAML Detection
Find XAML files (.xaml) where:
- UserControl or Window is never instantiated
- Not referenced in any other XAML file
- Not the main window (MainWindow.xaml)
4. Unused Service Detection
Find services where:
- Registered in DI (if applicable)
- But never injected or used
Manual Analysis Steps
Step 1: Find Unused Projects
# List all project references in solution
grep -r "ProjectReference" --include="*.csproj" src/
Compare against project list to find unreferenced projects.
Step 2: Find Unused Classes
# Find public classes
grep -r "public class " --include="*.cs" src/ | grep -v Tests
# For each class, search for references
grep -r "ClassName" --include="*.cs" --include="*.xaml" src/
Step 3: Find Unused XAML Components
# Find all XAML files
find src -name "*.xaml" -not -name "App.xaml" -not -name "*.Designer.xaml"
# For each UserControl, search for usage
grep -r "<local:ControlName" --include="*.xaml" src/
Step 4: Find Unused Methods
Use IDE tools or:
# Find public methods
grep -r "public.*\w\+\s*(" --include="*.cs" src/ | grep -v Tests
# Search for method name usage
grep -r "MethodName" --include="*.cs" src/
Output Format
The analysis produces a structured report:
================================================================================
DEAD CODE ANALYSIS REPORT
Generated: {timestamp}
================================================================================
SUMMARY
-------
Potentially unused projects: X
Potentially unused files: Y
Potentially unused controls: Z
================================================================================
SECTION 1: UNUSED PROJECTS (High Confidence)
================================================================================
Project: src/CcDirector.OldFeature/CcDirector.OldFeature.csproj
Status: NOT REFERENCED
Reason: No ProjectReference found in any other .csproj
Action: Review and delete if confirmed unused
---
================================================================================
SECTION 2: UNUSED FILES (High Confidence)
================================================================================
File: src/CcDirector.Core/Legacy/OldHelper.cs
Classes: OldHelper
References found: 0
Action: Review and delete if confirmed unused
---
================================================================================
SECTION 3: UNUSED XAML CONTROLS (High Confidence)
================================================================================
Control: OldDialog.xaml
Location: src/CcDirector.Wpf/Dialogs/
Usage search: <local:OldDialog found 0 times
Action: Review and delete if confirmed unused
---
Safety Guidelines
- Never auto-delete - Always review before removing code
- Check git history - Some code may be recently added and not yet integrated
- Search for string references - Some code is loaded dynamically by name
- Check configuration files - Services may be registered in config
- Build after removal - Always run
dotnet build cc-director.slnafter removing code
Removal Workflow
When you've confirmed code is dead:
- Document the removal in the commit message
- Remove in order: Files first, then projects
- Update solution file if removing projects
- Build the solution to verify nothing breaks
- Run tests if applicable
# Remove project from solution
dotnet sln cc-director.sln remove "src/path/to/project.csproj"
# Delete the project directory
rm -rf "src/path/to/project"
# Build to verify
dotnet build cc-director.sln
# Run tests
dotnet test src/CcDirector.Core.Tests
Common False Positives
Entry Points - These are NEVER dead code:
CcDirector.Wpf- Main WPF appCcClick- CLI toolCcDirector.TestHarness- Test utility
Infrastructure Code:
App.xaml/App.xaml.csAssemblyInfo.cs- Extension methods classes
- Attribute classes
XAML Resources:
- Styles defined in ResourceDictionaries
- Converters used via StaticResource
Skill Version: 1.0 Last Updated: 2026-02-14 Adapted from: sampleWeb dead-code-finder skill
04 同仓库更多 Skills
devthrottle-sessions
Talk to the other DevThrottle sessions running across your machines - list them, rename this one, send one of the rare queued messages, read the inbox, reply, open a new session, and close one down. Use when the task involves: message another session, ask another session, list sessions, what sessions are running, spawn a session, rename this session, close this session.
devthrottle-install
Hand the user the documented steps to install or update DevThrottle, and to connect a gateway afterwards. Use when the task involves: install DevThrottle, set up DevThrottle, update DevThrottle, connect a gateway, cc-devthrottle not found, where do the cc tools come from.
proof-covers-the-wrong-thing
A proof can be valid and still say nothing about what you changed - wrong surface, wrong reader, wrong caller, or an untested premise. Name what your evidence does NOT cover. Use when the task involves: prove it, by construction, root cause, reproduced it, repro, guard-local, skipped test, suite is green, premise, assumption, self review, it is settled.
destructive-sweeps-lean-to-keep
A destructive operation acts only on what it can positively prove is disposable. Enumerate what to DELETE, never what to skip - and refresh the safety signal on every real use. Use when the task involves: sweep, purge, cleanup, delete old, prune, reclaim space, stale files, retention, aged out, rm -rf, git clean, drop the table.
checks-that-fail-open
A check whose pass condition is an ABSENCE certifies a run that never happened. Restate it as a specific PRESENCE - and an empty result is a broken instrument, never a clean run. Use when the task involves: verify, prove it, sweep, grep returned nothing, zero hits, clean run, it passed, no defects, reviewed, delivered, double check, how do we know.
wingman-brief-reviewer
RETIRED 2026-09-16 - do not run it. It reviewed saved wingman turn BRIEFS, whose writer was retired in issue