<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zoe Lee</title>
    <description>The latest articles on DEV Community by Zoe Lee (@zoe_in_stack).</description>
    <link>https://dev.to/zoe_in_stack</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3356297%2F94b039ab-7f84-432a-8cf9-143ae6e2e297.jpg</url>
      <title>DEV Community: Zoe Lee</title>
      <link>https://dev.to/zoe_in_stack</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zoe_in_stack"/>
    <language>en</language>
    <item>
      <title>Top 10 Codex CLI Tips Every Developer Should Know</title>
      <dc:creator>Zoe Lee</dc:creator>
      <pubDate>Fri, 26 Sep 2025 13:16:33 +0000</pubDate>
      <link>https://dev.to/zoe_in_stack/top-10-codex-cli-tips-every-developer-should-know-2gm2</link>
      <guid>https://dev.to/zoe_in_stack/top-10-codex-cli-tips-every-developer-should-know-2gm2</guid>
      <description>&lt;p&gt;&lt;a href="https://developers.openai.com/codex/cli/" rel="noopener noreferrer"&gt;Codex CLI&lt;/a&gt; has quickly become a go-to tool for developers looking to streamline workflows, automate repetitive tasks, and bring AI assistance directly into their development environment. Whether you’re fixing bugs, generating code, or running commands in your repo, Codex lets you stay in flow while reducing cognitive load.&lt;/p&gt;

&lt;p&gt;But like any powerful tool, its efficiency depends on how you use it. Over the last few months, developers have uncovered practical ways to get the most out of Codex CLI. These aren’t theoretical tips they come from real-world usage, tested in both professional projects and side hustles.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Before we get into Codex CLI tips, one quick note: if your project involves APIs, a tool like &lt;strong&gt;&lt;a href="https://apidog.com" rel="noopener noreferrer"&gt;Apidog&lt;/a&gt;&lt;/strong&gt; can complement Codex. While Codex helps with automation and code, Apidog makes testing and documenting endpoints simple, giving you a complete workflow.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6i4ljv083e9f7azte9z2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6i4ljv083e9f7azte9z2.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this guide, we’ll walk through the &lt;strong&gt;Top 10 Codex CLI Tips&lt;/strong&gt; that will make your development smoother, faster, and more productive.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp51btg93emqik9ilwh1a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp51btg93emqik9ilwh1a.png" width="800" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Use Aliases for Faster Startup
&lt;/h2&gt;

&lt;p&gt;Typing long commands every time you start Codex is inefficient. Instead, set up an &lt;strong&gt;alias&lt;/strong&gt; so you can launch Codex with your preferred configuration in one short command.&lt;/p&gt;

&lt;p&gt;For example, in macOS or Linux, you can add this to your &lt;code&gt;~/.zshrc&lt;/code&gt; or &lt;code&gt;~/.bashrc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias codex='codex -m gpt-5-codex -c model_reasoning_effort="high" -c model_reasoning_summary_format=experimental --search --dangerously-bypass-approvals-and-sandbox'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way, every time you type &lt;code&gt;codex&lt;/code&gt;, it automatically loads your preferred model, reasoning settings, and search enabled.&lt;/p&gt;

&lt;p&gt;Once saved, just reload your shell with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result: you skip the repetitive setup and dive straight into work.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Master Shortcut Commands
&lt;/h2&gt;

&lt;p&gt;Codex CLI supports built-in &lt;strong&gt;slash commands&lt;/strong&gt; that speed up common operations. Instead of hunting through docs, you can type &lt;code&gt;/&lt;/code&gt; in a session to see all supported shortcuts.&lt;/p&gt;

&lt;p&gt;Some essentials include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/model&lt;/code&gt; → Switch models and inference levels.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/approvals&lt;/code&gt; → Change authorization mode.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/new&lt;/code&gt; → Start a fresh session.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/compact&lt;/code&gt; → Compress context to fit longer histories.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/diff&lt;/code&gt; → View git diffs directly in Codex.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/status&lt;/code&gt; → See token usage and current config.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhem1gi2ncfwu665czknb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhem1gi2ncfwu665czknb.jpg" alt=" " width="800" height="392"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Learning these commands is like learning keyboard shortcuts in an editor — small habits that add up to major productivity.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Quick Line Breaks for Cleaner Prompts
&lt;/h2&gt;

&lt;p&gt;When prompts get long, readability suffers. Codex supports quick line breaks so you can format prompts neatly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On macOS: &lt;strong&gt;Option + Enter&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;On Windows/Linux: &lt;strong&gt;Ctrl + J&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This doesn’t send the request — it just moves you to a new line. Clean prompts help you and Codex stay on the same page.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Interrupt or Exit on the Fly
&lt;/h2&gt;

&lt;p&gt;Sometimes Codex takes a request in the wrong direction, or you realize you need to reframe your input. Instead of waiting, you can &lt;strong&gt;interrupt execution&lt;/strong&gt; anytime.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press &lt;strong&gt;Esc&lt;/strong&gt; to cancel the current request.&lt;/li&gt;
&lt;li&gt;Press &lt;strong&gt;Ctrl + C&lt;/strong&gt; twice or type &lt;code&gt;/quit&lt;/code&gt; to exit the session completely.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This saves time, especially when you’re iterating quickly.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Switch Between API and ChatGPT Authentication
&lt;/h2&gt;

&lt;p&gt;Codex can be used with either your &lt;strong&gt;ChatGPT account&lt;/strong&gt; or via the &lt;strong&gt;OpenAI API&lt;/strong&gt;. If your account credits run out, you don’t need to stop working — just switch authentication modes.&lt;/p&gt;

&lt;p&gt;To enable API authentication, edit your config file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/.codex/config.toml
preferred_auth_method = "apikey"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or override it temporarily from the CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;codex --config preferred_auth_method="apikey"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Switch back anytime with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;codex --config preferred_auth_method="chatgpt"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This flexibility ensures you always have a backup method to keep working.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Use AGENTS.md to Guide Codex
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftk580r45g3f7itim4007.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftk580r45g3f7itim4007.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Codex ships with support for &lt;strong&gt;AGENTS.md&lt;/strong&gt;, a simple guidance file you can place in your project. Think of it as a specialized README that tells Codex how to behave in your repo.&lt;/p&gt;

&lt;p&gt;For example, you might include:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# AGENTS.md
- Always use TypeScript for new files
- Follow ESLint rules from .eslintrc
- Use Jest for testing
- Prefix all environment variables with "APP_"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives Codex context and consistency across sessions, reducing the need to re-explain your setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Fine-Tune Authorization Modes
&lt;/h2&gt;

&lt;p&gt;Codex is powerful, but with great power comes risk. Its &lt;strong&gt;authorization modes&lt;/strong&gt; let you decide how much freedom it has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Auto (default):&lt;/strong&gt; Can read/edit files and run commands in the working directory but asks permission for external actions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read-Only:&lt;/strong&gt; Only reads files, never edits or executes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full Access:&lt;/strong&gt; Reads, edits, and executes anywhere — without asking (not recommended unless you fully trust your environment).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Switch modes quickly using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/approvals
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or configure them with flags like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;codex --sandbox read-only --ask-for-approval never
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pro tip: Use &lt;strong&gt;Auto&lt;/strong&gt; for most cases, but drop to &lt;strong&gt;Read-Only&lt;/strong&gt; when you just want to brainstorm without risking changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Enable Web Search for Fresh Context
&lt;/h2&gt;

&lt;p&gt;By default, Codex relies on its training data and local context. But sometimes you need the &lt;strong&gt;latest info from the web&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Enable search with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;codex --search
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Codex will then pull in real-time web results before generating a response, complete with sources. This is especially useful for referencing new APIs, recent libraries, or up-to-date best practices.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Reference Files Directly
&lt;/h2&gt;

&lt;p&gt;Instead of pasting file contents into your prompt, you can &lt;strong&gt;reference files directly&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@src/app.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Codex will pull in the file’s contents without cluttering your input. This works even better when using the VSCode or Cursor IDE extensions, where you can right-click and reference files seamlessly.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Compress Context When Sessions Get Long
&lt;/h2&gt;

&lt;p&gt;One limitation of any AI model is &lt;strong&gt;context length&lt;/strong&gt;. Long conversations can hit the cap, causing Codex to lose track of earlier inputs.&lt;/p&gt;

&lt;p&gt;Use the &lt;code&gt;/compact&lt;/code&gt; command to shrink the conversation history while retaining key details. Codex will summarize the session and free up tokens for future interactions.&lt;/p&gt;

&lt;p&gt;You can also check your current token usage with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures you don’t run into unexpected cutoffs during deep work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: Explore
&lt;/h2&gt;

&lt;p&gt;Codex supports integration with the &lt;strong&gt;Model Context Protocol (MCP)&lt;/strong&gt;, letting you connect external services and tools into your workflow. While setup requires editing &lt;code&gt;~/.codex/config.toml&lt;/code&gt;, it opens the door to automating browser actions, connecting APIs, or adding custom agents.&lt;/p&gt;

&lt;p&gt;It’s still early days for MCP with Codex, but developers are already experimenting with integrations like Puppeteer for browser automation or Context7 for advanced context management.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Codex CLI is more than just a way to chat with AI in your terminal it’s a &lt;strong&gt;full productivity layer&lt;/strong&gt; for modern development. By mastering aliases, shortcuts, file references, and context management, you can cut hours off your workflow each week.&lt;/p&gt;

&lt;p&gt;These 10 tips are battle-tested in real-world projects, from solo prototyping to enterprise-level repos. Start small set up an alias, learn a few commands, or try out AGENTS.md. Over time, you’ll build a personal workflow that feels like an extension of your editor.&lt;/p&gt;

&lt;p&gt;Remember: tools are only as good as the habits you form around them. Codex CLI gives you the power  these tips help you wield it effectively.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>ai</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
