/goal — The Gold Skill
Give your coding agent a completion condition and it keeps working, turn after turn, until the condition is met. No more babysitting every step.
"/goal is really insane! It's how you can get the most out of coding agents today." — @omarsar0 (opens in a new tab)
What it does
/goal transforms your agent from a turn-by-turn responder into an autonomous loop. You define a verifiable end state. The agent works a turn, an evaluator checks whether the goal is met, and if not — it loops again with guidance. When the condition is satisfied, the goal clears automatically.
You → /goal [completion condition]
↓
Agent works a turn
↓
Evaluator checks: met?
No → loop with guidance
Yes → goal clears ✓The 4-step loop
| Step | What happens |
|---|---|
| 1. Set the condition | Type /goal + a verifiable end state. First turn starts instantly. |
| 2. Agent works | It edits, runs tests, surfaces results in the conversation. |
| 3. Evaluator checks | A fast model reads the transcript and decides: met or not met. |
| 4. Loop or finish | "No" → another turn with guidance. "Yes" → goal clears automatically. |
Setup
Claude Code — built in, no install needed:
/goal tests in test/auth pass # set & start
/goal # check status: turns, tokens, reason
/goal clear # stop early
# headless / scriptable
$ claude -p "/goal ..."OpenAI Codex — enable once, then use:
$ codex features enable goals # enable once
/goal migrate to new stack, verify with Playwright
/goal pause
/goal resume
/goal clear # abandon goalHyperClaw / OpenClaw — install via ClawHub:
npx clawhub@latest install goalThen in your Claw conversation:
/goal all unit tests pass with no TypeScript errorsThe key insight: plan first
The most important thing to know about /goal comes from the tweet that put it on the map:
"For efficiency, I find it works best when you do planning before /goal. This ensures the agent has the right context and goal, which often only happens with careful planning."
Before setting a goal, spend one turn establishing context:
Here's what we're working on: [context about the codebase]
The task is: [what needs to change]
Constraints: [what should stay the same]
Success looks like: [measurable end state]
/goal [that measurable end state]Planning makes the evaluator's job easier and prevents the agent from optimising for the wrong outcome.
Writing a good goal
The goal must be verifiable — something a fast model can check by reading the transcript. Vague goals produce endless loops.
| Weak goal | Strong goal |
|---|---|
| "Fix the tests" | "All tests in test/auth pass" |
| "Clean up the code" | "No file exceeds 200 lines" |
| "Migrate the API" | "Every call site compiles and npm test exits 0" |
| "Do the refactor" | "Each module is under 5KB, git status is clean" |
Five rules for strong goals:
- Make it measurable — a test result, exit code, file count, or empty queue
- State the check — "npm test exits 0" or "git status is clean"
- Add constraints — "no other test file is modified"
- Bound the run — append "or stop after 20 turns" to cap runaway loops
- Pair with auto mode — remove per-tool prompts so turns run unattended
Great use cases
| Use case | Goal pattern |
|---|---|
| API migrations | "Every call site compiles and tests pass" |
| Design docs | "All acceptance criteria in the spec hold" |
| Refactors | "Every module is under budget, no regressions" |
| Issue backlogs | "The labeled issue queue is empty" |
| Eval loops | "Prompt score clears the threshold on 3 consecutive runs" |
Pair it with
- Grill Me — stress-test your goal definition before you run it. A goal that doesn't survive Grill Me questioning will probably produce a bad loop.
- Self-Improving Agent —
/goalhandles the loop, Self-Improving handles the evaluation and rewriting. Powerful combination for skill refinement. - Indexable Memory (QMD) — save what the agent discovered during a long goal run so the next session starts with full context.
Start with a goal you could verify yourself in 30 seconds. If you can't quickly tell whether the goal is met, the evaluator can't either — and you'll get an endless loop.
/goal works natively in Claude Code and OpenAI Codex. For HyperClaw and OpenClaw, install via ClawHub: npx clawhub@latest install goal