Skip to content
Day 61: new resources are added every day. See what's new

Free guide

How to Prompt OpenAI Codex

Write prompts and set up projects so OpenAI Codex makes focused, tested, reviewable changes

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.

Updated

Built with love by Shushant Lakhyani. Building bestproductivityresources.com

The guide

Every section is a compact, self-contained card. Tap the link icon to share one section.

01

Where Codex runs

Codex CLI
In your terminal, on your machine
IDE extension
Inside editors such as VS Code
Codex cloud
Runs tasks in the cloud and opens pull requests

The same prompting principles work everywhere.

Codex works best with a clear task, a clear finish line, and good project instructions.

02

Set up AGENTS.md

AGENTS.md is a file in your repository that tells Codex how your project works. Codex reads it automatically. Include:

  • How to install, build, and run tests
  • Code style and conventions
  • Folders to avoid
  • How to check work before finishing
03

The structure of a good task

Goal
What should change
Location
Files, folders, or features involved
Constraints
What not to change, libraries to use
Verification
Tests or commands that prove it works
Output
Summary, pull request, or diff
04

Choose approvals and sandbox

  • Start with modes that ask before running commands or editing outside the project
  • Give more autonomy only in projects you trust
  • Never give it secrets it does not need

Mode names and options change between versions. Check Codex’s current settings.

05

Match reasoning effort to the task

  • Lower effort for small edits and questions
  • Higher effort for complex bugs and refactors
06

Feature prompts

Add CSV export to the reports page. Reuse the table data from src/reports/data.ts, follow the existing button styles, and add a test. Run the test suite and summarize the changes.

07

Bug fix prompts

The total in the cart is wrong when a discount and tax both apply. Reproduce it with a failing test first, then fix the calculation in src/cart/total.ts only. Run all cart tests.

08

Test and review prompts

  • “Write tests for this module covering edge cases. Do not change the source.”
  • “Review this pull request for bugs, security issues, and missing tests.”
  • “Explain this function and list what could break if it changes.”
09

Run tasks in parallel

  • Send several small, independent tasks to Codex cloud
  • Keep each task focused on one change
  • Review each pull request separately
  • Avoid parallel tasks that touch the same files
10

Review everything

  • Read the full diff
  • Run the tests yourself
  • Check for changes outside the task
  • Ask Codex to explain any change you do not understand
11

Common mistakes

  • Tasks that are too big or vague
  • No tests or commands to verify work
  • Missing AGENTS.md, so Codex guesses your setup
  • Merging without reading the diff

The golden rule

Do not ask Codex for a big rewrite. Give it 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.

Share this guide

Frequently asked questions

What does “How to Prompt OpenAI Codex” cover?
It has 11 sections, starting with “Where Codex runs”, “Set up AGENTS.md”, “The structure of a good 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.
When was this guide last updated?
It was last updated in October 2026.

Read next

More free guides, no signup.

Free Notion database

1,100+ ways people are making money online

Real online businesses, creators and projects, broken down by how they make money: apps, online stores, AI tools and more. Free on Gumroad.

Get the free database

Free Notion database

399+ ways to make money online

Hundreds of online income methods in one place, so you can compare options and pick one to try. Free on Gumroad.

Get the free list

For research and ideas only. Results vary and nothing here is a promise of income. See our Disclaimer.

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.

Join the newsletter

You sign up on Gumroad, which stores your email to send the newsletter. See our Privacy Policy.