DEV Community

Cover image for From Beginner to Codex CLI Pro
Andrew Lee
Andrew Lee

Posted on

From Beginner to Codex CLI Pro

I've spent the last month living inside of Codex CLI. Here are the most helpful tips.

Copy Paste Images

I copy and paste images into Codex all the time. The easiest way to do this is to capture it into your clipboard and paste directly into the CLI

  1. Capture to clipboard: ⌃ (control) + ⌘ (command) + ⇧ (shift) + 4
  2. Past into Codex CLI: ⌃ (control) + v

/review

Client side review is a must before you push commits and merge PRs. You can trigger this with /review command. Codex is specifically trained to identify technical errors and it does not waste your time with a bunch of slop. Instead it focuses on 1-2 critical bugs.

I alternate between /review and please fix until there are no more issues detected. Then the code is ready to push.

Sectioned Checklist

Codex can work autonomous for over an hour. A trick to unlocking this is to create a plan and save it to a markdown file first. Then you can ask Codex to implement the markdown file.

Trick is to prime the context and then ask it go generate a sectioned checklist where each section is a phase that can be committed, prioritized by importance.

Here is a high level prompt I use to generate this plan for that is building on top of .

go ahead and do the following:
1. investigate <feature A>
2. think about how to implement <feature B>
3. create a sectioned checklist to implement <feature B> where each section is a phase can be committed.

then go ahead and implement each phase. commit and push after a phase is done before you move onto the next phase.
Enter fullscreen mode Exit fullscreen mode

Here is an example of a sectioned checklist that Codex created:

You can easily get Codex to work for over an hour using this strategy.

Codex Options

I have my alias set to the following to make sure every new session is using gpt-5-codex with high reasoning, has web search enabled, and has all permissions enabled.

alias c="codex -m gpt-5-codex -c model_resoning_effort='high' --search --yolo"
Enter fullscreen mode Exit fullscreen mode

Occasionally I will change the model/reasoning based on the task at hand, but I want to make sure that each new session has these defaults.

If you ever accidentally exist out a Codex session, you can always resume by selecting on previous sessions with the following command:

codex resume
Enter fullscreen mode Exit fullscreen mode

Codex Cloud

Do your important work on Codex CLI and get in the habit of offloading small bugs to Codex Cloud to parallelize your work. You can now do this on the CLI with:

codex cloud
Enter fullscreen mode Exit fullscreen mode

If you have good preview environment set up, it's a great way to knock out small bugs while you are focused on features.

Git Worktrees

You'll realize pretty quickly that Codex Cloud isn't meant for ambitious features. It will flat out refuse to do complex work. If you want to parallelize your ambition, you can use git worktrees to run multiple Codex CLI agents at the same time. It is possible to do it in the same branch but you'll find that Codex CLI agents will step on each other's toes without git worktrees.

It's a bit intimidating at first, but git worktrees are pretty simple after you try it.

Run the following command which will create a copy of your entire repo in ../new-feature under a git branch called new-feature which is branched off of your origin/main

git worktree add ../new-feature -b new-feature origin/main
Enter fullscreen mode Exit fullscreen mode

You can then cd into the copy.

cd ../new-feature
Enter fullscreen mode Exit fullscreen mode

Important to note that you'll have to install dependencies and set up your .env if you have one. After that initialize your codex there and push up to GitHub like any other branch.

Conclusion

Reminder that Codex is open source. Best way to improve is to look at the latest commits/releases. If you want more Codex tips you can follow me on X/Twitter here: andyrewlee.

Top comments (0)