Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/nerds-odd-e/doughnut/post-change-refactornpx skills add nerds-odd-e/doughnut --skill post-change-refactorgit clone --depth 1 https://github.com/nerds-odd-e/doughnutWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/nerds-odd-e/doughnut/post-change-refactor)<a href="https://agentmods.dev/skills/nerds-odd-e/doughnut/post-change-refactor"><img src="https://agentmods.dev/badge/skills/nerds-odd-e/doughnut/post-change-refactor.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00123 | $0.02708 |
| Opus 5 | $0.00062 | $0.01354 |
| Sonnet 5 | $0.00025 | $0.00542 |
| Haiku 4.5 | $0.00012 | $0.00271 |
Grade A, and why
post-change-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 271 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Purpose: Local wrap-up gate required by execute-plan / /gsd-execute-phase
(see .cursor/rules/gsd-coexistence.mdc). Structure-only: no new behavior.
Output: Refactored tree + ## REFACTOR COMPLETE, or an impact report +
## REFACTOR JIDOKA STOP. Do not commit — the caller commits after success
(and pushes when closing a slice).
Scope is concept-bounded, not file-bounded. A candidate must be triggered by an issue introduced, exposed, or materially aggravated by the current change or highly related code. Such code represents the same concept, duplicates the same knowledge, or must change to leave it coherent. Dependency adjacency alone is neither required nor sufficient.
Find the smallest complete set of representations, callers, tests, fixtures, and configuration needed for coherence, including untouched code when needed. Every edit must serve that candidate; do not initiate nearby cleanup.
Discover scope:
git status
git diff
git diff --cached
Whitespace hygiene: scripts/check_diff_whitespace.sh (not raw git diff --check) —
excludes generated API artifacts under packages/generated/donut-backend-api/**
and open_api_docs.yaml.
Git does not use the Nix prefix. All other repo tooling does:
CURSOR_DEV=true nix develop -c …
Plan justification (decision boundary):
Keep code justified by the current change or the immediate next
slice in the active plan
(.planning/phases/*/, .planning/quick/*/).
Anything justified only by a later slice, or by "we might need it later",
is speculative — remove it. No plan → justification comes only from the
current change. The immediate next slice may justify retaining code, but
does not independently trigger unrelated refactoring.
Subsystem boundary: Backend production code, frontend production code, CLI, MCP server, and database schema are separate subsystems. Tests, E2E, fixtures, generated artifacts, and configuration following one production seam do not alone create a crossing. Existing behavior work spanning subsystems also does not trigger the gate; the refactoring itself must require coordinated production edits across boundaries.
Optional caller context (when spawned from execute-plan):
- Plan path and current slice text (for the immediate-next-slice justification boundary)
Invokers: execute-plan (fresh sub-agent before commit), bug-fixing,
test-optimization, or on-demand developer request.
<preflight_gate name="discover_scope">
Run the git discovery commands above. If there is no uncommitted change,
report empty scope and emit ## REFACTOR COMPLETE with no edits.
</preflight_gate>
<preflight_gate name="map_concept_impact"> Before editing, perform a fast read-only pass over every check. For each candidate, record:
- The triggering issue and its connection to the current change.
- The minimum concept-bounded edit set needed for coherent completion.
- The production subsystems that edit set would touch.
Use references as navigation, not automatic scope. Do not inventory general repository cleanup. </preflight_gate>
<preflight_gate name="cross_subsystem_jidoka"> If a candidate requires production refactoring in more than one subsystem, stop before editing unless the human explicitly authorized that named concept and those subsystems. Generic "clean up" or "refactor" requests do not qualify.
Return the <output> Jidoka report; do not enter the edit/test pass or
substitute a partial refactoring. If discovered while editing, stop before the
first cross-subsystem edit and leave no partial candidate: reverse only this
agent's edits for that candidate, never pre-existing user changes.
</preflight_gate>
After the gates, decide first: if map_concept_impact recorded no edit
candidates (and the cross-subsystem gate did not stop), skip the edit steps
and confirm_related_tests; report "none — already clean" and emit
## REFACTOR COMPLETE. Do not run related tests as a pre-triage gate.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 271 lines · 123 tokens per session scan A 6207fb8bed64
post-change-refactor is a skill published in the GitHub repository nerds-odd-e/doughnut (49 stars, last pushed today), licensed MIT. It adds 123 tokens to every session and 2,708 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
auto-perf-optimize
Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.
chat-perf
Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.
chat-pet-sprite-creation
Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.
cpu-profile-analysis
Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…