dead-code-cleanup
Safely find and remove dead code from Swift files using an isolated git worktree.
Skill by bzellman
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/bzellman-dead-code-cleanup
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: documents
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/dead-code-cleanup
What's inside
- Skill name
dead-code-cleanup- Description
- Safely find and remove dead code from Swift files using an isolated git worktree. Creates a branch, runs analysis with build verification, and generates a report for review before merge.
- License
- MIT
- Instructions
- 140 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
---
name: dead-code-cleanup
description: Safely find and remove dead code from Swift files using an isolated git worktree. Creates a branch, runs analysis with build verification, and generates a report for review before merge.
---
# Dead Code Cleanup Skill
Safely removes dead code from Swift files using git worktree isolation.
## What This Does
1. Creates an isolated git worktree OUTSIDE the main repo (avoids IDE indexer conflicts)
2. Spawns a Dead Code Agent to scan and remove dead code
3. Verifies with builds after each removal
4. Generates a comprehensive report
5. Presents results for your review and merge decision
## Usage
```
/dead-code-cleanup [scope]
```
### Examples
```
/dead-code-cleanup # Full <YOUR_APP>/<YOUR_APP>/ directory
/dead-code-cleanup Features # Only Features/ subdirectory
/dead-code-cleanup Core/Services # Only Core/Services/
```
## What Gets Removed
| Category | Risk | Verification |
|----------|------|--------------|
| Unused imports | Low | Build only |
| Commented-out code blocks | Low | Build only |
| Unused private variables | Low | Build only |
| Unused private functions | Medium | Build + Test |
| Unreachable code | Medium | Build + Test |
| **Test-only functions** | High | Build + Test |
| Unused internal/public functions | High | Build + Test |
### Test-Only Functions
Functions that are ONLY called from test files (not production code) are dead code. The tests are testing dead code paths. Both the function and its tests should be removed.
## What Gets Skipped
- `@objc` functions (selector calls)
- Protocol conformance methods
- `Codable`/`Decodable` types
- `@IBAction`/`@IBOutlet` connections
- `override` functions
- View `body` properties (SwiftUI requirement)
- PreviewProvider structs (Xcode previews)
## Workflow
```
┌─────────────────────────────────────────────────────────────┐
│ Step 1: Create Isolated Worktree │
│ - Location: ../.worktrees/dead-code-TIMESTAMP │
│ - Branch: dead-code-cleanup-YYYYMMDD │
│ - OUTSIDE main repo to avoid Xcode indexer conflicts │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Step 2: Run Dead Code Agent │
│ - Scans .swift files in scope │
│ - Distinguishes production vs test usage │
│ - Removes confirmed dead code │
│ - Verifies with builds │
│ - Commits changes │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Step 3: Report & Review │
│ - Generates DEAD_CODE_REPORT.md │
│ - Shows summary of removals │
│ - User decides: merge / discard │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Step 4: Cleanup │
│ - Merge to main (if approved) │
│ - Remove worktree │
│ - Delete branch │
└─────────────────────────────────────────────────────────────┘
```
## After Completion
### To Merge
```bash
git checkout main
git merge dead-code-cleanup-YYYYMMDD
git worktree remove ../.worktrees/dead-code-TIMESTAMP
git branch -d dead-code-cleanup-YYYYMMDD
```
### To Discard
```bash
git worktree remove ../.worktrees/dead-code-TIMESTAMP --force
git branch -D dead-code-cleanup-YYYYMMDD
```
## Implementation Notes (for Claude)
When this skill is invoked:
### Step 1: Create Worktree
```bash
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
# Create worktree OUTSIDE the main repo to avoid IDE indexer confusion
WORKTREE_PATH="../.worktrees/dead-code-$TIMESTAMP"
BRANCH_NAME="dead-code-cleanup-$(date +%Y%m%d)"From bzellman/earp-kit, MIT.
More from bzellman/earp-kit
- 0.414score
ios-design
bzellman
Design and implement SwiftUI interfaces for <YOUR_APP> iOS app with design system compliance, Apple HIG principles, and visual references.
SkillDFreshness: DClaude Code +9 - 0.411score
ios-simulator-skill
bzellman
21 production-ready scripts for iOS app testing, building, and automation.
SkillDFreshness: DClaude Code +9 - 0.410score
install-tooling
bzellman
Use when installing new skills or agents from curated lists or GitHub repositories, when the user says "install", "add skill", "add agent", or wants to set up…
SkillDFreshness: DClaude Code +9 - 0.409score
brand-guidelines
bzellman
Applies <YOUR_APP>'s official brand colors and typography to any artifact.
SkillDFreshness: DClaude Code +9 - 0.401score
self-healing-deploy
bzellman
Self-healing merge-to-production pipeline.
SkillDFreshness: DClaude Code +9 - 0.399score
<YOUR_IOS_BUILD>
bzellman
Run <YOUR_APP> iOS builds and simulator tests through FULLSTACK_SCRIPTS/build-ios-formatted.sh and format-build-log.py.
SkillDFreshness: DClaude Code +9 - 0.397score
bug-to-pr
bzellman
End-to-end pipeline from bug report to merged fix PR.
SkillDFreshness: DClaude Code +9 - 0.385score
find-skills
bzellman
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express…
SkillDFreshness: DClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Apr 7, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/bzellman/earp-kit
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from bzellman
- 0.414score
ios-design
bzellman
Design and implement SwiftUI interfaces for <YOUR_APP> iOS app with design system compliance, Apple HIG principles, and visual references.
SkillDFreshness: DClaude Code +9 - 0.411score
ios-simulator-skill
bzellman
21 production-ready scripts for iOS app testing, building, and automation.
SkillDFreshness: DClaude Code +9 - 0.410score
install-tooling
bzellman
Use when installing new skills or agents from curated lists or GitHub repositories, when the user says "install", "add skill", "add agent", or wants to set up…
SkillDFreshness: DClaude Code +9 - 0.409score
brand-guidelines
bzellman
Applies <YOUR_APP>'s official brand colors and typography to any artifact.
SkillDFreshness: DClaude Code +9 - 0.401score
self-healing-deploy
bzellman
Self-healing merge-to-production pipeline.
SkillDFreshness: DClaude Code +9 - 0.399score
<YOUR_IOS_BUILD>
bzellman
Run <YOUR_APP> iOS builds and simulator tests through FULLSTACK_SCRIPTS/build-ios-formatted.sh and format-build-log.py.
SkillDFreshness: DClaude Code +9
Cite this page
dead-code-cleanup skill. Agent Mart. https://agentmart.dev/skills/bzellman-dead-code-cleanup (last updated 2026-10-24)