home / skills / willsigmon / sigstack / dead-code-eliminator

dead-code-eliminator skill

/plugins/app-dev/skills/dead-code-eliminator

This skill identifies and removes dead code in a TypeScript project by detecting unused guards, enhanced variants, and deprecated files.

npx playbooks add skill willsigmon/sigstack --skill dead-code-eliminator

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
699 B
---
name: Dead Code Eliminator
description: Find and delete unused files, disabled code blocks, Enhanced variants, deprecated features, test files in production for Leavn app
allowed-tools: Read, Edit, Grep, Glob, Bash
---

# Dead Code Eliminator

Find and delete dead code:

1. **Find candidates**:
   - Files with `#if false`
   - *Enhanced.swift variants
   - NavigationCoordinator (unused)
   - *Stub.swift files

2. **Verify unused**:
   ```bash
   grep -r "ClassName" LeavnApp/Sources/
   ```

3. **Delete safely**:
   - Remove from Xcode project
   - Delete file
   - Run build to verify
   - Commit deletion

Use when: Code cleanup, unused files, deprecated features, reducing codebase size

Overview

This skill scans a TypeScript-based Leavn app to find and remove dead code such as unused files, disabled code blocks, enhanced variants, deprecated features, and test artifacts present in production. It focuses on safe identification, verification, and deletion so you can shrink the codebase and reduce maintenance overhead. The workflow emphasizes non-destructive checks, build verification, and clean commits.

How this skill works

The tool locates candidate dead code by pattern and naming conventions (e.g., files containing conditional disables, *Enhanced variants, NavigationCoordinator, *Stub.swift). It verifies usage with targeted grep-style searches across the Sources tree to confirm absence of references. Once verified, it removes the file from project configuration, deletes the file, runs a full build, and produces a ready-to-commit change set.

When to use it

  • After a refactor that may have left orphaned files or variants
  • When removing deprecated features or feature flags no longer needed
  • To shrink the production bundle by removing test files and stubs accidentally included
  • As part of periodic codebase hygiene or pre-release cleanup
  • When you spot patterns like #if false or *Stub/*Enhanced file variants

Best practices

  • Always verify candidates with a repo-wide reference search before deletion
  • Remove files from the project or module manifest first, then delete from disk
  • Run a clean build and unit/integration tests after deletion to catch regressions
  • Keep deletions small and well-documented in commit messages to simplify rollbacks
  • Prefer conservative deletion: archive copies or feature branches if uncertain

Example use cases

  • Identify and remove *Enhanced.swift variants that were generated during an experimental feature
  • Find files wrapped in #if false blocks and safely delete them after verifying no references remain
  • Remove NavigationCoordinator or other unused coordinator classes discovered during code audits
  • Delete *Stub.swift test doubles that were accidentally shipped in production sources
  • Clean up deprecated feature folders before a release to reduce binary size

FAQ

How do you confirm a file is truly unused?

Search the entire source tree for class, function, and symbol references; run static analysis and a full build to ensure no link or runtime errors.

What if I delete something accidentally?

Keep deletions in small commits or feature branches so you can revert easily; consider creating a backup branch before sweeping deletions.