Skip to content
Skills Library
Programming · Analysis

dead-code-finder

/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.

Repository
devthrottle ↗
Licence
MIT
Last repository change
27.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

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.

Original author 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.

How it works

  1. Scope
  2. Analysis Types
  3. Manual Analysis Steps
  4. Output Format
  5. Safety Guidelines
  6. Removal Workflow
  7. Common False Positives
Original SKILL.md headings · 193 lines, 649 words
SKILL.md preview
---
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.
---

# 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

```bash
# 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

```bash
# 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

```bash
# 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:

```bash
# 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

```bash
# 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

Versions

The database has no other skills named dead-code-finder.

Database snapshot: 13.11.2026 · package version c8c05bfe6e58 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100dead-code-removal
    Use when unused functions, classes, exports, or files need to be identified and safely deleted.
  • 100find-dead-code
    Find unused functions, classes, imports, and unreachable code paths. Use when the user asks to find dead code, unused code, cleanup candidates, or wants to reduce codebase size.
  • 84analyze-dead-code
    Find and remove dead code — unused exports, unreachable modules, and stale files. Always use this skill whenever the user says "find dead code", "remove unused code", "clean up unused exports", "what code can we delete", "detect unreachable code", "what files are no longer…
  • 100dead-code-analysis
    Find potentially unused functions, methods, services, routes, or features using Ontoly dead-code and entrypoint capabilities. Use when asked what code appears unreachable or safe to remove.
  • 100run-ts-cleanup
    Use if cleaning up a TypeScript codebase — dead code, unused deps, AI slop, weak types.
  • 100knip
    Run knip to find and remove unused files, dependencies, and exports. Use for cleaning up dead code and unused dependencies.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.