goal-prompt
What it does
Drafts a single-line goal condition that keeps an agent working on a long task until a checkable finish line is met. It is for people who use goal mode in Claude Code or Codex.
When to use it
- βWhen a user wants to write or improve a /goal command for a long-running task.
- βWhen a user wants a goal condition compressed or cleaned up before pasting it.
- βWhen a user wants a finish line that an agent can check.
Skill link
https://github.com/trailofbits/skills/blob/main/plugins/goal-prompt/skills/goal-prompt/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βWrite me a /goal command that keeps working on migrating our auth code until the tests pass.β
5 new skills a week. 1 minute to read.
How it works
The skill writes a condition with an end state, a scope to read first, a stated check, the things that must not change, and a stop limit. It then formats it as one line under the character limit.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Goal Prompt
/goal keeps the agent working until a completion condition is met. Both Claude Code and Codex take it as one line, max 4,000 characters. In Claude Code a small model re-judges the condition after each turn from the transcript alone β it cannot run commands.
Draft a condition that can terminate, then format it. A goal fits work bigger than one turn with a checkable finish line; chain small goals with review between them rather than writing one giant goal.
Draft
Include, joined with AND β never "or", the loop takes the cheaper branch:
- End state, not activity β "all
legacyAuth()call sites useauth.verify()", not "migrate the auth code". An activity can be claimed; an end state is true or false. - Scope to read first β the files, issue, logs, or plan to read before acting.
- Stated check β the exact command and its observable result ("
npm testexits 0"), plus an instruction to run it and show the output; a result that never lands in the transcript does not exist to the evaluator. - Invariants β what must not change ("without modifying vendor/"), always including "do not weaken, skip, or edit the checks themselves".
- Stop bound or blocked clause β "or stop after 20 turns", "if blocked, stop and report the blocker". Without one, a mis-stated condition loops forever; the formatter warns when it is missing. (Claude Code resets the turn counter on session resume, so a turn bound silently extends across resumes.)
Keep it small. Every constraint narrows the state space the model can explore. Collapse to one terminating criterion when possible, move scope and definitions into a referenced file, and drop non-goals β a constraint earns its place only by closing a real easy-out.
For long goals, also name the final evidence (diff, report, artifact) and require a progress log file β durable state across compaction and resume. If the brief exceeds 4,000 characters, put the details in a GOAL.md and reference that file from the objective.
Never invent missing elements. Ground every element in the user's request, the conversation, or the repository β look things up rather than guessing. If an element cannot be filled from available information, still optimize and format what the user provided, leave the element out, and flag it as missing (see Format). A goal with an invented success condition terminates on the wrong contract.
Close the easy-outs
Before formatting, reread the drafted condition as a lazy model would: what is the cheapest way to make every check pass without doing the intended work? Close the cheapest ones β prefer pairing checks you already have over adding constraints, and do not enumerate every conceivable out into a non-goal list. The recurring outs:
- Delete or stub instead of fix β "search prints nothing" also holds when the callers are gone; pair such checks with one that proves the feature still works.
- Pass on a subset β running one test file, narrowing the search path, excluding directories from the check.
- Game the gate β skipping/xfail-ing tests, hardcoding expected outputs, special-casing the test inputs, editing the check (the invariants rule).
- Claim without running β declaring done or blocked with no check output in the transcript (the show-the-output rule).
Same discipline as above: an out you cannot close from available information goes in the Missing: list as a warning β an invented or absurd constraint is worse than a flagged gap.
Security research goals
Collapse audit goals to one terminating criterion, such as identifying, triggering, and validating one high-severity vulnerability valid under a referenced threat-model file. That file, not the goal, carries scope, attacker powers, severity baseline, and known findings to skip. Use neutral wording ("trigger and validate", not "prove this is exploitable"), require demonstrated preconditions β assumed attacker access is the most common false positive β and stop for human review after each finding rather than piling up untriaged reports. Validate findings with a second pass by a fresh agent, never the finder alone.
Format
Run uv run --no-project {baseDir}/scripts/format_goal_prompt.py --fenced on the draft (file or stdin). It collapses whitespace to one line, strips /goal prefixes, quotes, and fences, warns on a missing stop clause, and rejects output over 4,000 characters β shorten or move detail to a file and rerun.
Return exactly one fenced
FAQ
Why does a goal need a stop limit?
Without one, a badly stated condition can loop forever, so the skill adds a stop bound or a blocked clause.
Can the condition use or?
No. The skill says to join the conditions with AND, since an or lets the loop take the easier branch.
What is the length limit?
The skill says a goal is one line of up to 4,000 characters.
Details
Original description by the author
Drafts copy-paste-ready /goal commands for goal mode in Claude Code and Codex. Use when the user asks to create, write, rewrite, improve, compress, clean up, or prepare a goal prompt, goal condition, /goal command, goal-mode objective, or copy-ready long-running task objective.
repo: trailofbits/skills
Popularity
- GitHub stars
- 8.0k
- Ranking position
- #12682
- License
- CC-BY-SA-4.0
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
audit-context-building
8.0kHelps your agent learn an unfamiliar codebase before a security review, mapping what each function assumes, guarantees and depends on.
algorand-vulnerability-scanner
8.0kHelps your agent scan Algorand smart contracts, written in TEAL or PyTeal, for 11 common security problems such as rekeying attacks and unchecked fees.
audit-prep-assistant
8.0kHelps your agent get a codebase ready for an outside security review, with static analysis, test coverage, dead-code cleanup and clear documentation.
cairo-vulnerability-scanner
8.0kHelps your agent scan Cairo smart contracts on StarkNet for 6 serious problems, including arithmetic overflow, risky cross-layer messages and signature replay.
Similar skills
writing-skills
311kTeaches your agent to write new skills and test each one first, checking that the skill actually changes how the agent behaves.
writing-for-agents
310kExplains how to write clear instructions for AI agents, including skills, AGENTS.md, and CLAUDE.md files, so the agent behaves predictably.
bengali-nlp
280kHas your agent process Bengali text. It helps understand and work with the language, normalizing text and handling its unique characteristics.