Sweep for One Named Defect

Name one kind of defect and ask for every instance. The narrower the name, the easier the diffs are to review.

The prompt

"do a deep scan of all hot paths and fix any unnecessary sequential async…" (@_dylanga)

The follow-ups use the same form, one defect each: load only the columns you read instead of whole rows; remove needless new URL() parsing; compile regexes once at module level instead of inside functions and loops; and promote a hot key out of a large jsonb column into a real column. That last one cut queries that read over 20 GB to fetch a few kilobytes. Source: X/@_dylanga, 2026-11-02 A reply added "remove all lodash". Source: X/@DanielLockyer, 2026-11-03

Why it works

A broad request ("make it faster", "clean this up") lets the agent pick whatever is easiest to change. A named defect has a test: an await either waits on something the next line needs or it does not. The agent can search for every instance, fix each one the same way, and stop. The diffs come out small and uniform, so a human can review them quickly, and each fix is safe to reject alone.

Jarred Sumner's prompts work one level up. They name a design change instead of a defect: rewrite toward data-oriented design, replace hash tables with flat arrays indexed by integers, use a structure of arrays, use a bitset instead of an array of bools, and delete caches instead of adding them, because "caching is cope for a slow design". Source: X/@jarredsumner, 2026-11-01

The cleanup version splits a codebase pass into eight named sweeps, one subagent each: deduplicate, consolidate shared types, remove unused code with knip, untangle circular imports with madge, replace weak types, remove defensive try/catch that hides errors, delete legacy and fallback paths, and strip AI-written stubs and stale comments. Source: X/@shawmakesmagic, 2026-04-15

When to use it

  • After a feature lands, as a cheap pass with high yield.
  • When profiling points at a class of cost (waits, allocations, over-fetching) rather than one function.
  • When the codebase was written fast by agents and nobody has read it whole.

Run one defect per pass. Mixing them brings back the review problem the prompt was meant to remove.

Which skill runs it

perf runs the performance sweeps under its evidence rules: measure first, change one thing, keep the numbers. Its "Named sweeps" section lists the defects above. vibe-code-doctor and codebase-design run the cleanup sweeps.

A simpler goal: less code

Matt Pocock's version drops the named defect and keeps one number: make review keep reducing code while holding cyclomatic complexity low. Less code means less to maintain and fewer bugs, and agents do well with goals that simple even when meeting them takes ingenuity. The thread suggests separate contexts for implementing, reducing and reviewing. Source: X/@mattpocockuk, 2026-08-31 Ponytail packages the same instinct as a skill.

A one-line cleanup skill in the same family: clean up the code, KISS and DRY, copy the local style, and be concise and efficient. Its author notes that even strong models still hand-roll buttons instead of reaching for the repo's components, which is why the instruction to copy local style matters. Source: X/@imbabybrooklyn, 2026-08-10

The same idea applied to review: one agent writes the code, then separate agents each review one named dimension (security, performance, concurrency, data integrity, accessibility, failure handling). The first pass builds it; the named passes make it trustworthy. Source: X/@webdevcody, 2026-07-17


Timeline