Borrowing it
Nothing to install: this file belongs to stoa-platform/stoa. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/stoa-platform/stoa/main/.claude/skills/rewrite/SKILL.mdgit clone --depth 1 https://github.com/stoa-platform/stoaWrote 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/stoa-platform/stoa/rewrite)<a href="https://agentmods.dev/skills/stoa-platform/stoa/rewrite"><img src="https://agentmods.dev/badge/skills/stoa-platform/stoa/rewrite/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/stoa-platform/stoa/rewrite"><img src="https://agentmods.dev/badge/skills/stoa-platform/stoa/rewrite.svg" alt="Reviewed on agentmods" width="80" 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.1 | $0.00052 | $0.00971 |
| Opus 5.5 | $0.00021 | $0.00388 |
| Sonnet 5.5 | $0.00010 | $0.00194 |
| Haiku 4.5 | $0.00005 | $0.00097 |
Grade A, and why
rewrite 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 2mo 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 — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Rewrite — $ARGUMENTS
Invoked when Edit (patch) is the wrong tool. Research shows search/replace fails 20-30% on evolved code, and accumulated failed patches poison the context (Liu et al. "Lost in the Middle"; Databricks Mosaic). See
feedback_rewrite_after_fail.md.
When to use this skill
Triggered automatically via the hook post-edit-failure-tracker.sh at 2 consecutive Edit failures. Also invoke manually when:
- Diff estimated >30% of the file size
- Refactoring where structure changes, not just content
- File is small-to-medium (≤800 lines) and a clean rewrite is cheaper than hunting for correct search/replace anchors
- User says "just rewrite it"
Do NOT use for:
- Single-line changes (use Edit)
- Files >1500 lines (split first, or delegate to subagent)
- Files you haven't read yet in this session (read first, understand first)
Workflow
Step 1 — Parse arguments
Split $ARGUMENTS into:
FILE_PATH(first token, absolute path)INTENT(remainder — what the rewrite should accomplish)
If INTENT is empty, ask the user: "What should the rewrite accomplish? (e.g. 'fix the auth middleware bug', 'add tenant filtering')". Do NOT guess the intent from context alone.
Step 2 — Read the current file
Always Read the full file before rewriting. If >1500 lines, stop and suggest splitting or subagent delegation instead.
Step 3 — Check pollution signal
jq --arg path "$FILE_PATH" '[.[] | select(.path == $path)] | .[0]' .claude/state/edit-attempts.json
If consecutive_fails ≥ 2, the rewrite is warranted. If total ≥ 5 but consecutive_fails < 2, consider whether a subagent with fresh context would be better than an inline rewrite (Main context already has noise).
Step 4 — Rewrite strategy
Preserve by default:
- Public API surface (exported symbols, function signatures if referenced elsewhere)
- Import structure and file-level conventions
- Comments that explain non-obvious WHY (delete comments that explain WHAT)
- Type annotations, docstrings where they exist
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.
- 2mo ago First seen · 80 lines · 52 tokens per session scan A 8679b3ac87e2
rewrite is a skill published in the GitHub repository stoa-platform/stoa (9 stars, last pushed yesterday), licensed Apache-2.0. It adds 52 tokens to every session and 971 once invoked, about $0.0002 per session on Opus 5.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-31.
rewrite compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| rewritestoa-platform/stoa | Skill | 9 | yesterday | Apache-2.0 | A | 52 | Claude Code |
| lyrikgebruder/wirken | Skill | 194 | 2d ago | MIT | A | 15 | Claude Code |
| librariangebruder/wirken | Skill | 194 | 2d ago | MIT | A | 34 | Claude Code |
| notesgebruder/wirken | Skill | 194 | 2d ago | MIT | A | 10 | Claude Code |
| tdx-assetsgebruder/wirken | Skill | 194 | 2d ago | MIT | A | 58 | Claude Code |
| aggregatorgebruder/wirken | Skill | 194 | 2d ago | MIT | A | 30 | Claude Code |
| githubgebruder/wirken | Skill | 194 | 2d ago | MIT | A | 9 | Claude Code |