agentleFS
thefrederiksenthefrederiksen/cc-director/.claude/skills/dead-code-finder/skill.md

dead-code-finder

Skill96 starsChanged 16 days agoMITView on GitHub

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.

  • Deletes or force-pushes

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 11 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Not referenced by any other project in the solution

    line 26
  2. Distinctive:

    Not an entry point (WPF app, console app)

    line 27
  3. Distinctive:

    Only referenced by other unused projects (chain detection)

    line 28
  4. Distinctive:

    All public classes/interfaces have zero external references

    line 33
  5. Distinctive:

    Not referenced in any other XAML file

    line 41
  6. Distinctive:

    Not the main window (MainWindow.xaml)

    line 42
  7. Distinctive:

    Use IDE tools or:

    line 83
  8. Distinctive:

    Never auto-delete: - Always review before removing code

    line 145
  9. Very specific:

    Build after removal: - Always run dotnet build cc-director.sln after removing code

    line 149
  10. Distinctive:

    When you've confirmed code is dead:

    line 153
  11. Distinctive:

    Update solution file: if removing projects

    line 157
  12. Distinctive:

    Run tests: if applicable

    line 159

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
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 logic
  • src/CcDirector.Wpf/ - WPF application
  • src/CcClick/ - CLI 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

  1. Never auto-delete - Always review before removing code
  2. Check git history - Some code may be recently added and not yet integrated
  3. Search for string references - Some code is loaded dynamically by name
  4. Check configuration files - Services may be registered in config
  5. Build after removal - Always run dotnet build cc-director.sln after removing code

Removal Workflow

When you've confirmed code is dead:

  1. Document the removal in the commit message
  2. Remove in order: Files first, then projects
  3. Update solution file if removing projects
  4. Build the solution to verify nothing breaks
  5. 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 app
  • CcClick - CLI tool
  • CcDirector.TestHarness - Test utility

Infrastructure Code:

  • App.xaml / App.xaml.cs
  • AssemblyInfo.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

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.