Claude Cursor Skill

write-codex-goal

Use when the user wants a prompt to paste into Codex so it keeps working on its own: an overnight or unattended run, a /goal prompt, using leftover Codex quota before it resets, or a long cleanup, audit or refactor Codex should finish without them. Checks the installed Codex for

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Download heyvhuang-copybook-skills-plugins_skills_skills_write-codex-goal-c2e4cc2.zip · 14 KB

Install

skills CLI npx skills add https://github.com/Heyvhuang/copybook-skills/tree/main/plugins/skills/skills/write-codex-goal
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install heyvhuang-copybook-skills@llmmart
Git git clone https://github.com/Heyvhuang/copybook-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole heyvhuang/copybook-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Write a Codex /goal prompt

A message that starts with /goal sets a goal. While the goal is active and within its limits, Codex starts another turn whenever one ends unfinished, and it is told to check the evidence before marking the goal complete. Without /goal, Codex answers once and stops, which is the overnight run lost. Without a finish it can check, the goal has nothing to prove.

1. Check the Codex that will run it

Run codex --version and codex features list, and find the goals row:

  • true: write /goal as a fact, never "if your build has it".
  • false: the start command adds --enable goals.
  • No goals row, or the command fails: this Codex cannot run a goal. Say so, tell the user to update Codex and run the check again, and do not hand over a /goal prompt as if it will work.

Then read the repo: AGENTS.md for the test, lint and build commands, package.json scripts (or the project's equivalent) to confirm they exist, and git status --short to see whether the user has uncommitted work.

Find every skill the user named in the list Codex itself will load: from the repo root, run codex debug prompt-input and read its skills section. Each entry gives the skill's exact name (a plugin's skill reads plugin:skill) and a short path whose root is in the skill roots table above it; join the two for the full path of its SKILL.md, and check that the file can be read. This covers the repo's .agents/skills/, ~/.agents/skills/, ~/.codex/skills/ and installed plugins. codex plugin list does not give these paths: a remote plugin there can have no folder at all. If a named skill has no readable SKILL.md, do not write the goal without it: tell the user which skill is missing and that it needs installing or enabling first.

If the user asked for the prompt only, or you cannot run commands, run nothing and list each check above as not run, with the command the user can run.

2. Write the objective

The whole prompt is one message. Its first line starts with /goal and everything after it is the objective. Keep the objective under 4,000 characters: Codex rejects a longer one typed inline, and a short objective is easier to check.

  • The job, in one sentence first. What to clean up, audit or untangle, and where.
  • Each skill by $name and by path. A goal's objective does not load skills the way a typed message does, so start with "Before anything else, read .agents/skills/write-tests-first/SKILL.md and follow it", one line per skill with the path you found, then use $write-tests-first at the step that needs it. Never /name.
  • Read-only or write. An audit or report changes no files and ends with the report. A job that edits code works in a clean place: if git status showed changes, the prompt tells Codex to work in a new worktree from the last commit, never in the user's checkout. Small batches, the test command after each, and a failed batch undone by reverting only the changes Codex made in that batch; never discard changes it did not make. Don't push, merge or deploy.
  • Unattended. Decide routine things alone; when one item is stuck, note it and move on instead of waiting.
  • What it must not touch. Public interfaces, stored data, anything outside the repo, deleting files that are not provably unused. These go on a list for the user.
  • A finish a command can check. Name each command and the result that proves done: npm test exits 0, npm run lint reports no errors, a named file exists, a count reaches zero. Codex is asked to check each requirement against files and command output before it marks the goal complete, so every requirement needs a check it can run. "Until it's really done" gives it nothing to prove.
  • The report. What changed, the final command results, what was undone or left for the user, and where any file it wrote is.

Leave out anything only Claude Code understands: CLAUDE.md, the Task tool, /agents, subagent wording, "ultrathink", claude commands.

3. Give the start command

The user starts Codex's interactive session from the repo root with the command below, types /goal and pastes the objective after it (everything after /goal in the block), then presses Enter. The goal then holds the objective word for word. Pasting the whole block at once can also start a goal, but a long paste arrives as an ordinary message, and Codex may set the goal itself, in its own words.

  • Read-only job: codex --sandbox read-only --ask-for-approval never. Nothing is written, and a command that would need more fails instead of waiting overnight for an answer.
  • Write job: codex --approve-for-me. Say what it allows: Codex edits files in the repo (its .git folder stays protected), and an automatic reviewer may approve actions outside that sandbox, such as creating a branch; it can also deny one, which leaves that step undone. Add --worktree to run in a new managed Git worktree.

Check each flag against the help of the command it belongs to: codex --help for the interactive session, codex exec --help for exec. A wrong value can still pass --help, so check a feature name against codex features list. --full-auto is gone from today's Codex and exits with an error. Do not offer --dangerously-bypass-approvals-and-sandbox.

Without a window, save the prompt to a file and run codex exec --approve-for-me - < goal.txt for a write job, or codex exec -c 'approval_policy="never"' --sandbox read-only - < goal.txt for a read-only one. codex exec has no --ask-for-approval, and without that setting the user's config can still let a read-only run ask to escalate; codex debug prompt-input -c 'approval_policy="never"' -c 'sandbox_mode="read-only"' rejects a wrong value and should say the approval policy is never. Add --enable goals to either when the goals row is false. Never put the prompt inside double quotes on a command line: the shell would run its backticks and strip its $name words. In exec the /goal line reaches the model as plain text, and the model creates the goal and words its objective itself, so check that a goal was created before relying on it. --ephemeral blocks goals.

While it runs: /goal alone shows the goal and its status, /goal pause and /goal resume stop and restart it, /goal clear drops it.

4. Check, then hand over

Before replying, check the prompt itself:

  1. The first line starts with /goal , and the objective is under 4,000 characters.
  2. Every skill appears as $name with a line to read its SKILL.md by the path in Codex's skills list, and no named skill was dropped.
  3. Every command in the finish line exists in the repo's scripts.
  4. A read-only job gets the read-only start command, and every flag passed the help of its own command.

Reply with the prompt in one code block, the start command under it, and one line on each check that was not run.

Based on Copybook original (CC BY 4.0), rewritten by Copybook.

Files (copybook-skills)
  • CHANGES.md 6.7 KB
    Loading…
  • example.md 5.6 KB
    Loading…
  • LICENSE 18.2 KB · in bundle
  • SKILL.md 7.5 KB
    ---
    name: write-codex-goal
    description: "Use when the user wants a prompt to paste into Codex so it keeps working on its own: an overnight or unattended run, a /goal prompt, using leftover Codex quota before it resets, or a long cleanup, audit or refactor Codex should finish without them. Checks the installed Codex for goals and its flags, writes one /goal prompt under 4,000 characters that names each skill as $name with the path of its SKILL.md and ends on a finish a command can check, and gives a start command that keeps a read-only job read-only. Not for doing the cleanup, audit or refactor in this session."
    license: CC-BY-4.0 (see LICENSE)
    ---
    
    # Write a Codex /goal prompt
    
    A message that starts with `/goal` sets a goal. While the goal is active and within its limits, Codex starts another turn whenever one ends unfinished, and it is told to check the evidence before marking the goal complete. Without `/goal`, Codex answers once and stops, which is the overnight run lost. Without a finish it can check, the goal has nothing to prove.
    
    ## 1. Check the Codex that will run it
    
    Run `codex --version` and `codex features list`, and find the `goals` row:
    
    - `true`: write `/goal` as a fact, never "if your build has it".
    - `false`: the start command adds `--enable goals`.
    - No `goals` row, or the command fails: this Codex cannot run a goal. Say so, tell the user to update Codex and run the check again, and do not hand over a `/goal` prompt as if it will work.
    
    Then read the repo: `AGENTS.md` for the test, lint and build commands, `package.json` scripts (or the project's equivalent) to confirm they exist, and `git status --short` to see whether the user has uncommitted work.
    
    Find every skill the user named in the list Codex itself will load: from the repo root, run `codex debug prompt-input` and read its skills section. Each entry gives the skill's exact name (a plugin's skill reads `plugin:skill`) and a short path whose root is in the skill roots table above it; join the two for the full path of its `SKILL.md`, and check that the file can be read. This covers the repo's `.agents/skills/`, `~/.agents/skills/`, `~/.codex/skills/` and installed plugins. `codex plugin list` does not give these paths: a remote plugin there can have no folder at all. If a named skill has no readable `SKILL.md`, do not write the goal without it: tell the user which skill is missing and that it needs installing or enabling first.
    
    If the user asked for the prompt only, or you cannot run commands, run nothing and list each check above as not run, with the command the user can run.
    
    ## 2. Write the objective
    
    The whole prompt is one message. Its first line starts with `/goal ` and everything after it is the objective. Keep the objective under 4,000 characters: Codex rejects a longer one typed inline, and a short objective is easier to check.
    
    - **The job, in one sentence first.** What to clean up, audit or untangle, and where.
    - **Each skill by `$name` and by path.** A goal's objective does not load skills the way a typed message does, so start with "Before anything else, read `.agents/skills/write-tests-first/SKILL.md` and follow it", one line per skill with the path you found, then use `$write-tests-first` at the step that needs it. Never `/name`.
    - **Read-only or write.** An audit or report changes no files and ends with the report. A job that edits code works in a clean place: if `git status` showed changes, the prompt tells Codex to work in a new worktree from the last commit, never in the user's checkout. Small batches, the test command after each, and a failed batch undone by reverting only the changes Codex made in that batch; never discard changes it did not make. Don't push, merge or deploy.
    - **Unattended.** Decide routine things alone; when one item is stuck, note it and move on instead of waiting.
    - **What it must not touch.** Public interfaces, stored data, anything outside the repo, deleting files that are not provably unused. These go on a list for the user.
    - **A finish a command can check.** Name each command and the result that proves done: `npm test` exits 0, `npm run lint` reports no errors, a named file exists, a count reaches zero. Codex is asked to check each requirement against files and command output before it marks the goal complete, so every requirement needs a check it can run. "Until it's really done" gives it nothing to prove.
    - **The report.** What changed, the final command results, what was undone or left for the user, and where any file it wrote is.
    
    Leave out anything only Claude Code understands: CLAUDE.md, the Task tool, `/agents`, subagent wording, "ultrathink", `claude` commands.
    
    ## 3. Give the start command
    
    The user starts Codex's interactive session from the repo root with the command below, types `/goal ` and pastes the objective after it (everything after `/goal ` in the block), then presses Enter. The goal then holds the objective word for word. Pasting the whole block at once can also start a goal, but a long paste arrives as an ordinary message, and Codex may set the goal itself, in its own words.
    
    - **Read-only job:** `codex --sandbox read-only --ask-for-approval never`. Nothing is written, and a command that would need more fails instead of waiting overnight for an answer.
    - **Write job:** `codex --approve-for-me`. Say what it allows: Codex edits files in the repo (its `.git` folder stays protected), and an automatic reviewer may approve actions outside that sandbox, such as creating a branch; it can also deny one, which leaves that step undone. Add `--worktree` to run in a new managed Git worktree.
    
    Check each flag against the help of the command it belongs to: `codex --help` for the interactive session, `codex exec --help` for `exec`. A wrong value can still pass `--help`, so check a feature name against `codex features list`. `--full-auto` is gone from today's Codex and exits with an error. Do not offer `--dangerously-bypass-approvals-and-sandbox`.
    
    Without a window, save the prompt to a file and run `codex exec --approve-for-me - < goal.txt` for a write job, or `codex exec -c 'approval_policy="never"' --sandbox read-only - < goal.txt` for a read-only one. `codex exec` has no `--ask-for-approval`, and without that setting the user's config can still let a read-only run ask to escalate; `codex debug prompt-input -c 'approval_policy="never"' -c 'sandbox_mode="read-only"'` rejects a wrong value and should say the approval policy is never. Add `--enable goals` to either when the `goals` row is false. Never put the prompt inside double quotes on a command line: the shell would run its backticks and strip its `$name` words. In `exec` the `/goal` line reaches the model as plain text, and the model creates the goal and words its objective itself, so check that a goal was created before relying on it. `--ephemeral` blocks goals.
    
    While it runs: `/goal` alone shows the goal and its status, `/goal pause` and `/goal resume` stop and restart it, `/goal clear` drops it.
    
    ## 4. Check, then hand over
    
    Before replying, check the prompt itself:
    
    1. The first line starts with `/goal `, and the objective is under 4,000 characters.
    2. Every skill appears as `$name` with a line to read its `SKILL.md` by the path in Codex's skills list, and no named skill was dropped.
    3. Every command in the finish line exists in the repo's scripts.
    4. A read-only job gets the read-only start command, and every flag passed the help of its own command.
    
    Reply with the prompt in one code block, the start command under it, and one line on each check that was not run.
    
    Based on Copybook original (CC BY 4.0), rewritten by Copybook.
    

Comments

Sign in to join the conversation.

No comments yet. Start the conversation.

Reviews (0)

No reviews yet.