refactor
Skill2 starsChanged 4 months agoMITView on GitHub
Behavior-preserving cleanup with proof - the suite runs green BEFORE and green again AFTER with the same test count, because a suite that shrinks during a refactor is the finding, not a detail. Stops when the tree is dirty, the baseline is red, or the suite is too thin to detect a behavior change, naming what to test first. Use when the user asks to refactor, clean up, restructure, or simplify existing code without changing what it does.
111 other projects use a version of this.
Adopted by
Most recently taken up by
- AllThingsSmitty/proven-skillstheir own version, first seen Oct 6, 2026
- GUOJIE-HONG/skillstheir own version, first seen Oct 5, 2026
- morodomi/dev-crewtheir own version, first seen Oct 5, 2026
- gilsmt/skillstheir own version, first seen Oct 4, 2026
- Integralist/agent-skillstheir own version, first seen Oct 4, 2026
- AlvaroVFon/skillstheir own version, first seen Oct 3, 2026
Used with
Projects with it also use modern-go, to-design and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
jidechaoSkillmodern-go
Modernize Go code by applying version-appropriate idioms and APIs (gofix-style transformations). Scans go.mod for the Go version, then transforms Go source files to use modern patterns—from Go 1.0 through 1.26+. Use when the user says "现代化","现代Go语言", "地道的", "idiomatic", "modernize", "modern-go", "update Go code", "gofix", or wants to upgrade Go idioms.
Also in 3 projects that use this
jidechaoSkillto-design
Generate a design document (design proposal) from a PRD, in the style of Go's official design proposals — Abstract / Background / Design / Rationale / Compatibility / Implementation, heavy on the 'why' and tradeoffs. Triggers on: to-design, prd-to-design, prd转设计文档, 生成设计文档, 写设计文档, design doc, design proposal, 设计提案, 技术设计文档.
Also in 3 projects that use this
chidekinaSkilltest-gen
Generate test cases from type constraints and specs. Creates boundary tests, edge cases, and fixtures automatically. Pact-lang inspired. Triggers on: generate tests, test from spec, create fixtures, boundary tests.
Also in 5 projects that use this
pvnarpSkillincident
Guides incident response and post-mortem analysis. Covers triage, mitigation, root cause analysis, and prevention. Use when responding to active incidents, writing post-mortems, or improving incident processes.
Also in 6 projects that use this
platformplatformSkilldb-query
Query the local Postgres database of the active Aspire worktree via psql.
Also in 3 projects that use this
JetBrainsSkillfix-bug
End-to-end bug fix workflow for the Exposed project. Accepts a GitHub issue (#NUMBER), YouTrack issue (EXPOSED-NUMBER), or YouTrack URL (https://youtrack.jetbrains.com/issue/EXPOSED-NUMBER). Fetches the issue, creates a failing reproducer test, commits on a new branch, implements the fix, validates, and opens a PR. Use this skill whenever the user wants to fix a bug from an issue tracker, mentions a EXPOSED issue number, or references a GitHub issue to fix.
Also in 6 projects that use this
- +2 more from jidechao
Other versions111 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 111
- github/awesome-copilot★ 40ksame name
- parcadei/Continuous-Claude-v3★ 3.9ksame name
- codeaholicguy/ai-devkit★ 1.6ksame name
- SethGammon/Citadel★ 922same name
- solatis/claude-config★ 909same name
- boshu2/agentops★ 447same name
- nwiizo/tfmcp★ 373same name
- smallnest/goal-workflow★ 287same name
- oasm-platform/open-asm★ 204same name
- sd0xdev/sd0x-harness★ 191same name
101 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository27 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- auditSkill
- challengeSkill
- contract-checkSkill
- depsSkill
- design-auditSkill
- designSkill
- doSkill
- eval-runSkill
- eval-specSkill
- healthSkill
- investigateSkill
- journalSkill
- learnSkill
- migrate-checkSkill
- plan-reviewSkill
- planSkill
- qaSkill
- resumeSkill
- retroSkill
- secureSkill
- shipSkill
- ticketSkill
- triageSkill
- verifySkill
- whySkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 94 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Run before the skill's steps — per invocation, not per session (4.36).
- Very specific: line 42
Never delete a decision. Supersede it: ~~old~~ → Verdict (YYYY-MM-DD): new call — reason.
- Distinctive: line 43
Never fix, tune, or delete a test or eval case to raise a score.
- Very specific: line 58
Green baseline, recorded: Run the suite and record the exact count (N passed, M skipped).
- Distinctive: line 62
A suite that could notice: Ask whether these tests would fail if the target code changed behavior.
- Distinctive: line 104
Compare test NAMES, not just counts,: when the count is unchanged but the suite was touched — equal totals hide a one-for-one swap.
“Common” is measured: kept by at least 6 in 10 of the 94 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/refactor — cleanup you can prove didn't change behavior
A refactor is the one change that promises nothing will be different. That promise is worthless unsupported: the failure mode is not a dramatic break, it is a small behavior change nobody notices for a month, or a test quietly deleted because it went red.
So this skill treats the suite as the instrument and refuses to work with a broken one. Green before, green after, same test count — a suite that shrinks during a refactor is the headline finding, not a footnote.
Adjacent skills: /audit tests (tells you whether the green is worth
anything — run it first on a suite you don't trust) · /investigate (why is
it BROKEN; /refactor requires it already works) · /do (feature work; a
refactor changes no behavior).
<!-- acstack:runtime -->Run before the skill's steps — per invocation, not per session (4.36); failures degrade to markdown:
link="$(readlink "$HOME/.claude/skills/health" 2>/dev/null || true)" # empty = not symlinked
pack="$(dirname "$(dirname "$link")")" # NEVER trust this unless $link was non-empty
if [ "${link#/}" != "$link" ] && [ -x "$pack/bin/acstack-config" ] && ! "$pack/bin/acstack-config" runtime | grep -q '=off'; then
"$pack/bin/acstack-config" || true # resolved keys, with sources
"$pack/bin/acstack-update-check" || true # ≤1 fetch/day; silent ONLY if already checked today
"$pack/bin/acstack-recall" || true # LEARNINGS.md + bug-class names, capped 3KB
else
echo "runtime off — proceeding without recall/update-check"
fi<!-- /acstack:runtime --><!-- acstack:principles -->Operating principles
- Be direct. Push back in writing when the plan or the user is wrong. No sycophancy.
- Never delete a decision. Supersede it:
~~old~~ → **Verdict (YYYY-MM-DD):** new call — reason. - Never fix, tune, or delete a test or eval case to raise a score. Log the miss honestly and leave the case unchanged.
- Name exact things: regex patterns, function signatures, model names, before → after numbers. Never "fixed bugs".
- Attribution: follow the project's
attributionsetting (defaultnone) — no AI-tool mentions in generated docs, no attribution trailers in commits or PRs. Commit with explicit-m/-Fmessages only. - Config: read
.claude/acstack.mdat the project root (fall back to~/.claude/acstack.md) before acting.## Settingskeys override pack defaults; a## <skill-name>section overrides both. Unknown keys and sections are ignored. - Docs: BRIEF.md (frozen seed) / PLAN.md (living plan) / JOURNAL.md (rolling journal). If the repo uses legacy names (PLANNING_PROMPT.md / PLANNING.md / STATUS.md), use those instead — never create both.
- Recall: if
LEARNINGS.mdexists at the project root, read it before starting. - Conduct: follow the
acstack-conductblock in this repo's AGENTS.md — the word is the mode; the user sets the pace. - Hackathon lane: if the project's AGENTS.md carries the
acstack:hackathon-laneblock, only/dochanges the repository during the event. Any other skill that would write a tracked file, commit or push says what it would have done and stops; a change that is not a task goes through the lane's operator route.
<!-- /acstack:principles -->Preconditions — all three, before touching anything
- Clean tree. Uncommitted changes make before/after unattributable: you cannot prove your refactor preserved behavior if something else was already in flight. Dirty → say so, name the files, stop.
- Green baseline, recorded. Run the suite and record the exact
count (
N passed, M skipped). Red baseline → stop: preservation cannot be proven against a broken instrument, and "it was already failing" is how a real regression gets absorbed. - A suite that could notice. Ask whether these tests would fail if the
target code changed behavior. If the answer is no — no tests cover the
target, or only assertion-free ones do — stop and name what to test
first. Refactoring under an instrument that cannot detect the failure
is not a safe operation, it is an unobserved one.
/audit testsis the full version of this question; run it when the suite is unfamiliar.
Stopping here is a success, not a failure to deliver: it converts an invisible risk into a stated one.
The sequence
- State the scope up front — which files and which transformations (extract, inline, rename, dedupe, move), and explicitly what will NOT change. The scope is a commitment the report is checked against.
- Refactor — behavior-preserving edits only, in small steps.
- Re-run the suite. Compare against the recorded baseline:
- Still green, same count → the promise held. Report the numbers.
- Red → the refactor changed behavior. Fix the code, never the test.
- Count DROPPED → the headline finding. A test was deleted, renamed out of collection, or skipped. Report which, and restore it.
- Count ROSE → say so and why. A refactor that adds tests is not wrong, but it is no longer only a refactor, and unremarked growth hides a swap (one deleted, one added, count unchanged is the case the count alone misses — compare NAMES, not just totals).
- Report with before → after numbers, never adjectives: the baseline count, the final count, the files touched, and the scope you committed to at step 1.
Hard rules
- Never delete, skip, weaken, or rewrite a test to make the suite green. This is the never-inflate rule pointed at refactoring: a test going red during a refactor is the instrument working. Changing it to pass converts a caught regression into a shipped one.
- No behavior changes smuggled in. A bug found mid-refactor is reported, not fixed in the same pass — fixing it changes behavior, which is exactly what this pass promised not to do. Propose it as separate work.
- No opportunistic scope. Adjacent code that is also ugly stays ugly unless it was in the stated scope. Reviewers cannot verify a diff whose boundary moved during the work.
- Compare test NAMES, not just counts, when the count is unchanged but the suite was touched — equal totals hide a one-for-one swap.
- The proof is the numbers. "Tests still pass" is not a report;
88 passed, 4 skipped → 88 passed, 4 skippedis.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

