prompt-rewrite
Skill3 starsChanged 8 months agoMITView on GitHub
Rewrites a thin coding prompt into a deep one before it runs: same scope, plus the raw material to start from, the tools an expert would use, an existing file to copy, and a proof a third party can check. Covers refactoring, performance, UI, UX, API, frontend, debugging, testing, security, accessibility, docs, and planning, for a session, a `claude -p` run, a subagent brief, or a system prompt. Use when the user says "rewrite my prompt", "improve this prompt", "make this prompt better", "deeper version of this task", or pastes a rough task and asks for a proper prompt.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- varelaia/claude-skills-publictheir own version, first seen Nov 1, 2026
- orrrrli/clawd-harnesstheir own version, first seen Oct 20, 2026
- orrrrli/ai-engineering-stacktheir own version, first seen Oct 11, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- orrrrli/ai-engineering-stack★ 2same name
- orrrrli/clawd-harness★ 2same name
- varelaia/claude-skills-public★ 0same name
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 repository17 other files it gives its agents.
- api-securitySkill
- ascii-artSkill
- code-readabilitySkill
- gotchasSkill
- llm-agent-securitySkill
- nextjs-app-routerSkill
- plain-docsSkill
- product-marketingSkill
- react-performanceSkill
- react-testingSkill
- seoSkill
- spa-performanceSkill
- tailwind-design-systemSkill
- typescript-safetySkill
- ux-copySkill
- wcag-accessibilitySkill
- webgpuSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Every line added must name a file, a tool, a number, a check, or a reason.
- Distinctive: line 53
Ask, maybe: If an answer would change the prompt (the target number, what must not change, who the users are), ask 1 to 4 grounded …
“Common” is measured: kept by at least 6 in 10 of the 3 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
Prompt rewrite
Turn a thin prompt into one that gets expert work. Deeper, not bigger. The rewrite keeps the same scope. It adds what a top practitioner would start from, what they would reach for, and what proof shows the result is right.
Every line added must name a file, a tool, a number, a check, or a reason. If a line could be pasted into any prompt ("write clean, robust, best-in-class code"), delete it.
Source checks: SOURCES.md. Test cases for this skill: evals.md.
Procedure
draft prompt
|
v
1. look first -------> open the code, data, docs it points at
|
v
2. size it ----------> one-sentence diff? -> short prompt
| multi-file / unclear -> full prompt + plan gate
| new feature, open design -> interview prompt
v
3. ask (maybe) ------> 1 to 4 questions, only if an answer changes the prompt
|
v
4. four answers -----> pros do / raw material / tools / proof
|
v
5. fill template ----> resources/template.md
|
v
6. hand back --------> four answers, the prompt, how to enforce the proof- Look first. Read what the draft points at: the files,
package.jsonscripts, the test setup, docs that govern the area. Take the package manager from the lockfile (pnpm-lock.yaml,yarn.lock,bun.lock,package-lock.json); with no lockfile, writenpm run. Find one existing file that already does this kind of thing well; it becomes the exemplar. Never invent a path, script, or number. When something is out of reach, write a marked placeholder (<path to the slow page>). - Size it. Pick one shape from template.md:
- Already good: the draft names the change, the files, and a proof that can fail. Say so, change at most one line (usually the proof), and hand it back. A rewrite that only adds words makes it worse.
- Short: the diff fits in one sentence. Return 3 to 6 lines: the change, the exemplar, the proof.
- Full: multi-file, unfamiliar code, or the approach is unclear. Use the full template and add "plan first and wait for approval".
- Interview: a new feature with open design questions. Return Claude Code's interview prompt seeded with what you found, ending in a SPEC.md and a fresh session to build it.
- Ask, maybe. If an answer would change the prompt (the target number, what must not change, who the users are), ask 1 to 4 grounded questions with AskUserQuestion. Skip anything the repo already answers. If nothing would change, don't ask.
- Answer the four questions, one or two lines each, grounded in step 1. Use the row in lenses.md as a starting point:
- What would top professionals do here that the draft does not ask for?
- What is the rawest material they would start from, instead of what has already been digested (a summary, a score, "users say")?
- What specific method and tools would they use? Name them.
- What, other than the model or the user, would show the result is right? That is the proof.
- Fill the template. Raw material goes above the task. The method is a toolbox, not a recipe: name the tools and evidence, let the model choose the order. Use ordered steps only when order is the point (a migration, a database change, a repro before a fix).
- Hand back, in this order, then stop:
- the four answers, short
- the rewritten prompt in one code block, ready to paste
- how to enforce the proof if the run will be long or unattended: put it in the prompt, set it as a
/goalcondition, or make it a Stop hook - a suggested effort level only if it is not the default (
highfor multi-file or unclear work)
Offer to run it. Do not run the task unless asked.
Worked rewrites: examples.md.
Rules for the rewrite
| Do | Do not |
| Name the proof as a command, number, or pass/fail, and ask for its output as evidence | "Double-check your work" (adds cost on models that already self-check, and proves nothing) |
| Make sure the proof can fail: new tests fail before the change, numbers beat run-to-run noise, the check hits the real thing | A proof a stub, mock, or lucky run would pass anyway |
| Give the reason behind a constraint | Bare "NEVER" rules; absolute words are for true invariants only |
| Say what to do ("reply in plain paragraphs") | Only what not to do ("no markdown"), which leaves the target open |
| Name the tools and the evidence available | A fixed step list the model must follow (current models plan better than a prescribed order) |
| Point at one exemplar file to follow | Describe a pattern the repo already shows |
| Say "change the code" when edits are wanted | "Suggest improvements" when you want edits |
| Keep scope; list non-goals; bugs found along the way go in a follow-up list | Quietly widen the task |
| If the request looks mistaken, say so in a sentence and carry on as asked | Stop and wait over a disagreement the user can see in the summary |
| Stop and report when a test itself looks wrong | Bend code, or the test, until it passes |
| Ask for a general fix, not one tuned to the test inputs | Accept hard-coded values that pass the suite |
| New tests only where the repo keeps them for this kind of change | Add test files the task did not ask for; scratch checks need not be kept |
| For audits and reviews: report every finding, filter in a second pass | Ask it to report only the important ones (it filters too early and drops real findings) |
| Wrap each pasted log, ticket, or trace in its own open and close tag | Paste raw blocks inline with instructions |
For long unattended runs, add one line: a fresh subagent reviews the diff against the proof and reports gaps that affect correctness only.
Where it runs
Who reads the prompt changes what it must carry. Step 3's questions are only possible when someone can answer them.
| Runs as | Can it ask the user? | What the prompt must carry |
| A message in an interactive session | Yes | The four answers. Questions can wait for the run. |
claude -p in a script or CI | No, nobody is there | Every answer up front, the output format (--output-format json with a schema if a script reads it), and what to do when a check fails. |
| A subagent brief | No, and it sees none of the conversation | What was already found or ruled out, the files, the scope, and what to send back. |
A system prompt or --append-system-prompt | Not per task | Lasting rules and a role, with no "today" or "the bug we just found". |
Review checklist
- Same scope as the draft; anything wider is a non-goal or a follow-up
- A draft that was already good came back nearly unchanged
- The prompt carries what its runner cannot ask for (see Where it runs)
- Shape matches size: short prompt for a one-sentence diff, plan gate for multi-file work
- Every path, script, and tool was seen in the repo or is a marked placeholder
- Raw material is raw (trace, log, code, data, recording), not a summary, and an exemplar file is named
- The proof is something a third party could run, with a number or a pass/fail
- The proof can fail: if a stub, mock, or missing tool would let it pass regardless, the prompt says so
- No constraint fights the task, and no two instructions contradict each other
- No filler adjectives without a check behind them
- Length follows the material: a short draft rarely needs more than 35 lines, but a full spec can run longer
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.

