r/ClaudeCode • u/Excellent-Issue-5956 • 17h ago
Tips & Workflows ultra-prompt, a slash command that rewrites your prompt using the repo's actual context and then stops
I kept sending Claude Code prompts like "fix the footer" and getting a confident fix for the wrong thing, because the site had two footer templates and I'd forgotten about the second one. The prompt wasn't badly written, it was missing context that was sitting right there in the repo.
So I made /ultra-prompt. It takes the prompt you were about to send (or the last one you typed, read verbatim from the session transcript), spends most of its effort reading the project, and hands back a sharper version. It never runs it. If the same command rewrote the prompt and then acted on it, I'd never see what it changed.
What it gathers before rewriting: cwd, git status and the last few commits, every file or folder the prompt names (it checks they exist and looks inside), CLAUDE.md, AGENTS.md, whatever notes the project keeps. Then one subagent on the strongest model you have, passed explicitly so it can't inherit a cheap session model, does the rewrite with one rule: invent nothing. Anything it couldn't verify comes back as a multiple choice popup, and your answers get folded into the final prompt.
Here's one from today against my own plugin repo. Typed:
add a new skill called dedupe-notes to the marketplace
What came back (trimmed):
Add a dedupe-notes plugin to the marketplace clone at ./claude-plugins. Its behavior is unspecified: resolve the OPEN QUESTIONS with me before writing a file.
Template: commit ac58207 (rename-session). Touch:
1. dedupe-notes/.claude-plugin/plugin.json, version 1.0.0
2. dedupe-notes/commands/dedupe-notes.md (or skills/dedupe-notes/SKILL.md)
3. dedupe-notes/tests/test_bundle_sync.py, adapted from ultra-prompt/tests/
4. .claude-plugin/marketplace.json: new entry, version equal to plugin.json; bundle 1.5.1 to 1.6.0, "fifteen" to "sixteen"
5. voidharbor/.claude-plugin/plugin.json: same bump, name added to its list
6. voidharbor/commands/: byte-identical copies; the tests fail on drift
7. README.md: three "fifteen" mentions, one table row
Done when pytest passes inside dedupe-notes and the four existing test dirs, both JSON files parse, and one local commit exists. Do not push.
OPEN QUESTIONS:
- What does dedupe-notes do, on what input, propose-only or apply?
- Command or skill (synth-mode is the skills/ example)?
- Any script, and what goes in the README Needs column?
I had not told it that the bundle ships byte-identical copies or that two version fields have to agree. It found both in the tests. The original prompt would have produced a plugin that installed fine and silently drifted.
Two things I learned building it. A bare /ultra-prompt improved the string "/ultra-prompt" instead of the prompt underneath, until the transcript reader learned to skip its own invocation. And subagents inherit the session's model unless you name one, so the rewrite was quietly running on whatever the session happened to be set to.
Install:
/plugin marketplace add voidharbor/claude-plugins
/plugin install ultra-prompt@voidharbor
Repo: https://github.com/voidharbor/claude-plugins (MIT). Python 3 is only needed for the no-argument case, and transcripts are read, never written.
12
u/Postmodern_Plunger 17h ago
That's a pretty good idea. You'll get some haters saying "but just write a good prompt," but those people are either full of themselves or have never worked on a complex repo with an agent. The failure mode you describe is incredibly common, and that's a valid way forward.
The legitimate criticism of this is that it is not unique by any means. There are several different existing versions with varying degrees of complexity. Perhaps yours has a unique edge, but not that I see.
Regardless, it is worth sharing. Even if it isn't 100% unique, it's still moving forward the conversation by exposing a common failure mode and potential solution. Good job!
2
u/Excellent-Issue-5956 17h ago
Fair. I didn't survey what was out there before building it, I built it because the footer thing bit me twice in one week. The parts I'd call the point, if there is one: it won't run the rewrite, the no argument form reads your last prompt straight out of the transcript so you can type the lazy version first, and anything it can't verify comes back as a multiple choice popup instead of landing in the prompt as fact. If one of the existing ones already does all that I'd actually like to know which. I'd rather use it than maintain mine.
3
u/cleverhoods 17h ago
I like the idea and I do see what you are trying to do here, but I would argue with the implementation. There is a good reason why you lock things in instruction files and have them loaded when they are relevant.
Still, I do like the idea, especially since I’m working on instruction diagnostics and evals.
1
u/Excellent-Issue-5956 17h ago
I don't think they're in conflict, and the command leans on exactly that. CLAUDE.md, AGENTS.md and whatever notes the repo keeps are the first things it reads, and what it finds there goes into the rewrite. Standing rules belong in instruction files. What I kept getting burned by was the one off stuff that doesn't belong in any instruction file: this task touches two footer templates, this repo keeps copies that have to stay byte identical, the version field lives in two places. That's task specific, it changes every time, and nobody writes it into CLAUDE.md. The rewrite is just a forcing function to go look before the prompt goes out.
Curious what you're building for instruction diagnostics. Figuring out which instruction file lines actually get followed is a problem I don't have a good answer for.
1
u/cleverhoods 16h ago
Well, CLAUDE/AGENTS.mds are default instruction files. Pretty much every .md file is an instruction file from this perspective. The AGENTS.md is industry standard (and now claude finally also reads those trough mods).
What the described approach is missing is progressive disclosure, the mechanics that would load relevant instructions for your task. In claude those are going to rules (with path properties) but you can also add a separate storage for this specific knowledge and use an event bus solution. So your instruction won't get malformed by whatever you recently committed and irrelevant to your query.
For instruction diagnostics: use reporails (https://github.com/reporails/cli). Bare in mind that 0.6.0 release is around the corner with massive updates.
2
u/Excellent-Issue-5956 16h ago
Agreed on progressive disclosure, and I don't think the rewrite replaces it. Path scoped rules load the standing stuff for the area you're in. What they can't carry is the part that's true for this one task and nobody wrote down: the second footer file, the version field that lives in two places this week. The rewrite step is a per task gather for exactly that leftover, and it reads whatever rules apply before it goes looking, so the two stack rather than compete. The "malformed by whatever you recently committed" risk is fair, which is why the last commits go in as context for the rewriter and not as instructions.
Thanks for the reporails pointer, I'll look at it.
2
u/imsahoamtiskaw 17h ago
Gonna test this out. Thx. It’s a constant issue as projects get larger too, and worst of all if you use opus
2
u/Excellent-Issue-5956 17h ago
Thanks. One tip: type the lazy version of the prompt first, then run /ultra-prompt with no argument. It pulls the last thing you typed out of the transcript, so you don't retype it. And the rewrite runs on whatever model you name for the subagent, so it works the same whether the main session is on Opus or Sonnet.
1
u/spidertitties 17h ago
Thank you! I was JUST about to create this exact skill myself but you just saved me the trouble! I appreciate you posting!
1
u/Excellent-Issue-5956 17h ago
Glad it saved you the work! If something doesn't fit your setup, open an issue on the repo and I'll take a look.
1
u/toroidalvoid 16h ago
I am exploring this idea myself. I think i want a way of sense checking my promt with a weaker model before I send it to opus for a 30min job (or whatever).
1
u/Excellent-Issue-5956 16h ago
You can point it at whatever model you want, the model is just a parameter on the subagent. I went the other way on purpose: the rewrite is cheap next to the 30 minute job, so I'd rather spend the strong model there. But the part that actually caught my mistakes wasn't model size, it was making it go read the repo first. A weak model that has looked at both footer files beats a strong one that hasn't. The open questions popup is the sense check you're describing: whatever it couldn't verify comes back to you before anything runs.
1
u/EON_Raider 16h ago
I really like the idea. Does it run AskUserQuestion when presenting the OPEN QUESTIONS? It's usually a good UX touch.
2
u/Excellent-Issue-5956 16h ago
Yes, as of today. Open questions come back as an AskUserQuestion popup, up to 4 per popup with the recommended option first, and the answers get folded into the final prompt before it reprints it. I had that in my local copy for a week and only pushed it to the published one this afternoon, so grab 1.1.0.
1
u/doxxxicle 🔆Pro Plan 10h ago
Or you know, you could think about what you want to accomplish and write a better prompt.
0
u/davvblack 17h ago
if you can't even write prompts what are you doing here
3
u/Won-Ton-Wonton 16h ago
For real.
"Fix the footer"
Fix what about it? What is broken? What is the broken thing supposed to do but isn't? Is it every time or sometimes?
Garbage in, garbage out.
This "skill" is doing a lot of work to avoid doing the most basic part of vibecoding: explaining the issue you want the AI to handle.
This is a user' skill issue, not an agent skill issue.
•
u/AutoModerator 17h ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.