wf-structural-sweep

Detects dead code, duplication, and unconsumed data flow across a whole codebase.

Updated May 9, 2026
One-click install
npx skills add https://github.com/23min/aiwf --skill wf-structural-sweep-23min
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wf-structural-sweep
Source: https://github.com/23min/aiwf/tree/main/internal/skills/embedded-rituals/plugins/wf-rituals/skills/wf-structural-sweep
Command: npx skills add https://github.com/23min/aiwf --skill wf-structural-sweep-23min

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Per-diff code reviews and exact-clone linters structurally miss whole-graph defects: dead paths reachable only from other dead code, the same job implemented twice in textually different code, and values produced but never consumed. This Skill runs a deliberate, repeatable discovery pass that surfaces those findings before they calcify. ## Core Features & Use Cases - Four analysis lenses: whole-program reachability for dead paths, the clone detector's known-duplication catalogue, a convergence-scoring pass against a code-health rubric, and a producer-to-consumer data-flow trace for dropped values and orphan stages. - Ownership triage: every reachability hit is checked against tracked issues, decisions, and coupled specifications before any removal is proposed, preventing deletions that contradict recorded decisions. - Scorecard and issue candidates: emits a Strong/Weak/Missing scorecard with location evidence plus ranked, scoped tracked-issue candidates — it never edits code. - Use Case: Before a large refactor of a fast-moving Go codebase, run the sweep with deadcode (tests as roots) and the dupl linter to size the duplication the refactor must absorb and file each finding as its own issue. ## Quick Start Run a structural sweep over this repository and report dead paths, convergent duplication, and unconsumed data flow as a scorecard with issue candidates.

Frequently Asked Questions about wf-structural-sweep

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find dead code in a whole codebase?

Run a whole-program reachability analysis with tests treated as roots, such as the deadcode tool for Go. This catches code reachable only from other dead code, which package-scoped unused checks miss. Triage each hit against tracked ownership before proposing removal.

How to detect duplicate code that a clone linter misses?

Exact-clone detectors only match text, so score the codebase against a code-health rubric looking for the same job implemented in textually different code. Also check for shared helpers that exist but are bypassed by call sites re-implementing them inline.

What tools does this sweep use for Go projects?

For Go it uses the deadcode tool for whole-program reachability with tests as roots and the dupl linter for clone detection, with the convergence rubric pass done by hand. Other stacks substitute their equivalent dead-code analyzer and clone detector.

Does the structural sweep automatically fix or delete code?

No, the sweep is discovery only and never edits code. It emits a scorecard with location evidence and scoped tracked-issue candidates, leaving all changes to a separate change-and-review flow.

Why triage reachability hits before deleting dead code?

Reachability tools flag deliberately retained code identically to genuine orphans. Check for open issues, accepted decisions, or coupled specifications that keep the code on purpose, since deleting retained code preempts and half-does tracked work.

When should I run a structural sweep?

Run it when auditing an inherited codebase, after a stretch of fast machine-authored change, before a large refactor, or when a module feels heavy. It is triggered by situations and judgment, not a fixed schedule.