Write prompts and set up projects so OpenAI Codex makes focused, tested, reviewable changes
11 bite-sized sections
2 min read
Free, no signup
Short answer
A free guide to prompting OpenAI Codex in 2026: where Codex runs, AGENTS.md project instructions, the structure of a good task, approval and sandbox modes, reasoning effort, prompts for features, bugs, tests, and reviews, running parallel tasks in the cloud, reviewing pull requests, and common mistakes.
Runs tasks in the cloud and opens pull requests for you
The same prompting principles apply everywhere.
Codex does its best work with a clear task, a clear finish line, and solid project instructions.
02
Set up AGENTS.md
AGENTS.md is a file in your repository that explains to Codex how your project works. Codex reads it automatically. Cover:
How to install, build, and test
Code style and conventions
Folders to stay out of
How to check work before calling it done
03
Structure every task
Goal
What needs to change
Location
The files, folders, or features involved
Constraints
What to leave alone, and which libraries to use
Verification
Tests or commands that prove the change works
Output
A summary, pull request, or diff
04
Choose approvals and sandbox
Start in modes that ask before running commands or editing outside the project
Grant more autonomy only in projects you trust
Never hand it secrets it does not need
Mode names and options vary between versions. Check the current Codex settings.
05
Match reasoning effort to each task
Lower effort for small edits and quick questions
Higher effort for complex bugs and large refactors
06
Prompt for features
Add CSV export to the reports page. Reuse the table data in src/reports/data.ts, match the existing button styles, and add a test. Run the test suite, then summarize the changes.
07
Prompt for bug fixes
The cart total is wrong when a discount and tax apply together. First reproduce it with a failing test, then fix the calculation in src/cart/total.ts only. Run every cart test.
08
Prompt for tests and reviews
“Write tests for this module that cover edge cases. Leave the source unchanged.”
“Review this pull request for bugs, security problems, and missing tests.”
“Explain this function and list what could break if it changed.”
09
Run tasks in parallel
Hand several small, independent tasks to Codex cloud
Keep every task focused on one change
Review each pull request on its own
Skip parallel tasks that touch the same files
10
Review everything
Read the entire diff
Run the tests yourself
Look for changes outside the task
Ask Codex to explain any change you do not follow
11
Avoid common mistakes
Tasks that are too large or too vague
No tests or commands to verify the work
No AGENTS.md, so Codex has to guess your setup
Merging before reading the diff
The golden rule
Skip the big rewrite request. Give Codex small, verifiable tasks with clear instructions, then review every change.
AGENTS.md
Goal
Constraints
Verify
Approvals
Parallel
Review
Write an AGENTS.md for your project today, with build, test, and style instructions.
It has 11 sections, starting with “Know where Codex runs”, “Set up AGENTS.md”, “Structure every task” and “Choose approvals and sandbox”, plus 7 more sections.
How long does it take to read?
About 2 minutes. Every section is a short, self-contained card, so you can jump straight to the part you need.
Is this guide free?
Yes. The full guide is free to read on this page, with no sign-up.
For research and ideas only. Results vary and nothing here is a promise of income. See our Disclaimer.
See you Monday!
Weekly newsletter
Everything new, every Monday.
One short email every Monday with everything shipped that week: new free tools and websites, new guides, new free browser tools and what's new in my free Gumroad libraries, plus how the site is growing. Free, and you can unsubscribe anytime.
You sign up on Gumroad, which stores your email to send the newsletter. See our Privacy Policy.
Cookies and your choices
Visits are counted by Cloudflare Web Analytics, which sets no cookies and stores nothing on your device. An affiliate tracking script from Impact.com also loads on our pages and can set its own cookies so partner companies can credit us for sign-ups. Essential storage is always on so pages load and work correctly. You decide whether your browsing preferences are saved on your device. Read the Privacy Policy.