Codex Prompting Best Practices

Good prompts make Codex faster, safer, and more accurate.

Structure Of A Good Instruction

Include:

  • The desired outcome.
  • The relevant files, screenshots, URLs, or constraints.
  • What should be verified.
  • What should not be changed.

Seven High-Hit-Rate Tips

  1. State the end state, not only the first step.
  2. Mention constraints and non-goals.
  3. Ask Codex to inspect before broad edits.
  4. Give examples when style matters.
  5. Request verification commands.
  6. Keep unrelated refactors out of scope.
  7. Ask for a concise handoff.

Use Structured Input

Bullets, tables, screenshots, and file references help Codex disambiguate the task.

Bad vs Good Examples

Weak: "Fix the page."

Better: "Update the homepage cards to match the attached screenshot. Keep the existing routes and nav. Verify the local page at /index.html."

Keep Long Tasks On Track

For long work, ask for a plan, checkpoints, or a goal. Keep acceptance criteria visible.

Extra Tips For CLI Users

Use explicit working directories, mention test commands, and keep prompts reproducible for scripts.

Next Steps

Continue with Advanced Tips.

评论