Loading...
Loading...
Generates dead code detection configurations for loom plan verification. Provides language-specific commands, fail patterns, and ignore patterns for Rust, TypeScript, Python, Go, and JavaScript. Use when adding code quality checks to acceptance criteria or truths fields in loom plans. Dead code detection catches incomplete wiring by identifying code that exists but is never called.
npx skill4agent add cosmix/loom dead-code-checkcargo clippy -- -D warningsRUSTFLAGS="-D dead_code" cargo build 2>&1cargo clippy -- -D dead_codewarning: unuseddead_codeunused importunused variablenever usednever constructed#[allow(dead_code)]#[cfg(test)]fn main()# In acceptance criteria (recommended - catches more than just dead code)
acceptance:
- "cargo clippy -- -D warnings"
# In truths (more specific dead code check)
truths:
- "RUSTFLAGS=\"-D dead_code\" cargo build 2>&1 | grep -v 'Compiling' | grep -v 'Finished' | grep -q '^$'"
# Alternative: Check that clippy reports zero dead code warnings
truths:
- "! cargo clippy -- -D dead_code 2>&1 | grep -q 'warning:'"Cargo.toml.worktrees/my-stage/
└── loom/
└── Cargo.tomlworking_dir: "loom"npm install --save-dev ts-prune
# or
bun add --dev ts-prunenpx ts-prune --error
# or
bunx ts-prune --error--errorused in module but not exportedunused exportindex.ts.d.ts.tsprunerc{
"ignore": "index.ts|types.d.ts"
}# In acceptance criteria
acceptance:
- "bunx ts-prune --error"
# In truths (verify zero unused exports)
truths:
- "bunx ts-prune | wc -l | grep -q '^0$'"
# Alternative: Explicitly check for no unused exports
truths:
- "! bunx ts-prune | grep -q 'used in module'"package.jsontsconfig.jsonpip install vulture
# or
uv add --dev vulturevulture src/ --min-confidence 80--min-confidenceunused functionunused classunused variableunused importunreachable code__init__.py__all____str____repr____eq__pyproject.toml[tool.vulture]
min_confidence = 80
paths = ["src", "tests"]
ignore_names = ["setUp", "tearDown", "test_*"]# In acceptance criteria
acceptance:
- "vulture src/ --min-confidence 80"
# In truths (verify zero issues)
truths:
- "vulture src/ --min-confidence 80 | wc -l | grep -q '^0$'"
# Alternative: Check for specific patterns
truths:
- "! vulture src/ --min-confidence 80 | grep -q 'unused function'"
- "! vulture src/ --min-confidence 80 | grep -q 'unused import'"pyproject.tomlgo install honnef.co/go/tools/cmd/staticcheck@lateststaticcheck ./...U1000U1001is unusedfield .* is unusedfunc .* is unusedU1000U1001.staticcheck.confchecks = ["all", "-ST1000"]# In acceptance criteria
acceptance:
- "staticcheck ./..."
# In truths (verify no unused code)
truths:
- "! staticcheck ./... | grep -q 'U1000'"
- "! staticcheck ./... | grep -q 'is unused'"
# Alternative: Check exit code
truths:
- "staticcheck ./... 2>&1 | wc -l | grep -q '^0$'"go.modnpm install --save-dev unimported
# or
bun add --dev unimportednpx unimported
# or
bunx unimportedunresolved importunused file.eslintrc.jsjest.config.jsindex.jsmain.js.unimportedrc.json{
"entry": ["src/index.js", "src/server.js"],
"extensions": [".js", ".jsx"],
"ignorePatterns": ["**/node_modules/**", "**/*.config.js"]
}# In acceptance criteria
acceptance:
- "bunx unimported"
# In truths (verify no unused files)
truths:
- "bunx unimported | wc -l | grep -q '^0$'"
# Alternative: Check for specific issues
truths:
- "! bunx unimported | grep -q 'unused file'"
- "! bunx unimported | grep -q 'unresolved import'"package.jsonfn main()__all__main#[cfg(test)]test_*setUptearDown*_test.go#[derive(Serialize)]@dataclass@property#[allow(dead_code)]pub.tsprunerc__all__--features=allstages:
- id: integration-verify
name: "Integration Verification"
stage_type: integration-verify
working_dir: "loom"
acceptance:
- "cargo test"
- "cargo clippy -- -D warnings" # Includes dead code check
truths:
- "! cargo clippy -- -D dead_code 2>&1 | grep -q 'warning:'"stages:
- id: implement-auth
name: "Implement Authentication"
stage_type: standard
working_dir: "loom"
acceptance:
- "cargo test auth"
- "cargo clippy --package auth -- -D warnings"wiringstages:
- id: integration-verify
name: "Integration Verification"
stage_type: integration-verify
working_dir: "loom"
acceptance:
- "cargo clippy -- -D warnings"
wiring:
- source: "src/main.rs"
pattern: "Commands::NewCommand"
description: "New command registered in CLI enum"
- source: "src/commands/mod.rs"
pattern: "pub mod new_command"
description: "New command module exported"
truths:
- "loom new-command --help" # Functional verificationworking_dir.worktrees/my-stage/
├── loom/
│ ├── Cargo.toml <- Build tools expect this directory
│ └── src/
└── CLAUDE.md- id: verify
working_dir: "loom" # Where Cargo.toml exists
acceptance:
- "cargo clippy -- -D warnings"
truths:
- "test -f src/new_feature.rs" # Relative to working_dir (loom/)- id: verify
working_dir: "." # Wrong - no Cargo.toml here
acceptance:
- "cargo clippy -- -D warnings" # FAILS: could not find Cargo.tomlworking_dirtruths:
- description: |
Check for dead code like this:
```
cargo clippy -- -D warnings
```
command: "cargo clippy -- -D warnings"truths:
- "cargo clippy -- -D warnings" # Check for dead codetruths:
- description: "Check for dead code using clippy with all warnings as errors"
command: "cargo clippy -- -D warnings"grep-qtruths:
- "! cargo clippy -- -D dead_code 2>&1 | grep -q 'warning:'"!acceptance:
- "cargo clippy -- -D warnings" # Exits non-zero on warnings
- "staticcheck ./..." # Exits non-zero on issues
- "bunx ts-prune --error" # Exits non-zero on unused exportsrustccargocargo install clippybun add --dev ts-prunenpm install --save-dev ts-pruneuv add --dev vulturepip install vulturego install honnef.co/go/tools/cmd/staticcheck@latestbun add --dev unimportednpm install --save-dev unimportedknowledge-bootstrapstages:
- id: integration-verify
name: "Integration Verification"
stage_type: integration-verify
working_dir: "loom"
acceptance:
- "cargo test"
- "cargo clippy -- -D warnings"
- "cargo build --release"
truths:
- "test -f src/commands/new_feature.rs"
- "! cargo clippy -- -D dead_code 2>&1 | grep -q 'warning:'"
wiring:
- source: "src/main.rs"
pattern: "Commands::NewFeature"
description: "New feature command registered"stages:
- id: verify-api
name: "Verify API Implementation"
stage_type: integration-verify
working_dir: "api"
acceptance:
- "bun test"
- "bunx ts-prune --error"
- "bun run typecheck"
truths:
- "bunx ts-prune | wc -l | grep -q '^0$'"
- "curl -f http://localhost:3000/api/health"stages:
- id: verify-pipeline
name: "Verify Data Pipeline"
stage_type: integration-verify
working_dir: "pipeline"
acceptance:
- "pytest"
- "vulture src/ --min-confidence 80"
- "mypy src/"
truths:
- "! vulture src/ --min-confidence 80 | grep -q 'unused function'"
- "test -f src/pipeline/transform.py"
wiring:
- source: "src/main.py"
pattern: "from pipeline.transform import TransformStage"
description: "Transform stage imported in main pipeline"stages:
- id: verify-service
name: "Verify Microservice"
stage_type: integration-verify
working_dir: "service"
acceptance:
- "go test ./..."
- "staticcheck ./..."
- "go build"
truths:
- "! staticcheck ./... | grep -q 'U1000'"
- "! staticcheck ./... | grep -q 'is unused'"
- "test -f cmd/server/main.go"working_dir