Codex IDE Extension skill for Codex

Hand Codex the code you are already looking at. Codex uses the editor deliberately: it pulls the exact selection or file into the chat, checkpoints git before and after edits, routes long work to a worktree or cloud environment, reviews diffs in place with /review, and keeps chatgpt.* editor settings separate from the shared config.toml so the IDE and CLI behave consistently.

  • Codex Mastery
  • $codex-ide-extension
  • 130 lines
  • 2 files
  • ~1,550 tokens
  • MIT
  • Updated

Install

curl -fsSL codexskills.dev/install.sh \  | sh -s -- codex-ide-extension

Installs to ~/.agents/skills/codex-ide-extension/ for every project on this machine.

104-line POSIX script. No sudo, no telemetry. Read install.sh

Use it in Codex

Start a prompt with $codex-ide-extension, or pick it from /skills. You can also just describe the task: Codex reads the description below and loads the playbook when your request matches.

What Codex reads before loading it

Works effectively with the Codex IDE extension in VS Code, Cursor and Windsurf (and Codex in JetBrains and Xcode), covering editor context (selections, open files, /ide-context, Add to Codex Thread), local versus cloud and worktree runs, in-editor diff review, /review, chatgpt.* editor settings, shared config.toml, WSL on Windows and keybindings. Use when the user works with Codex inside an editor, asks how to give Codex the code they are looking at, review its edits in place, delegate from the IDE to the cloud, or fix extension settings.

Use it when

  • Working with Codex inside VS Code, Cursor, Windsurf, JetBrains or Xcode
  • You want Codex to use the current selection or open files as context
  • Reviewing Codex edits in the editor before committing
  • Configuring chatgpt.* extension settings or WSL mode on Windows

Use something else when

How to check the result

/status in the editor shows the expected model and context use, the selection appears as context before sending, and the resulting diff stays within the files the prompt named.

The mistake it prevents

Opening a parent folder that holds several repositories, so Codex finds no project root and never loads each repo's AGENTS.md.

~/.agents/skills/codex-ide-extension/SKILL.md

--- name: codex-ide-extension description: Works effectively with the Codex IDE extension in VS Code, Cursor and Windsurf (and Codex in JetBrains and Xcode), covering editor context… license: MIT ---

IDE work is done well when Codex gets exactly the code the developer is looking at, edits land as small reviewable diffs with a git checkpoint on each side, and longer work is moved to a worktree or the cloud instead of blocking the editor.

Setup checklist

- [ ] Extension installed: VS Code, Cursor, Windsurf, VS Code Insiders use openai.chatgpt
- [ ] Signed in (ChatGPT account or API key) and the correct workspace selected
- [ ] Workspace folder is inside the git repo (not a parent folder holding many repos)
- [ ] Project trusted, otherwise project .codex/config.toml, hooks and rules are skipped
- [ ] Windows: repos in WSL2 -> chatgpt.runCodexInWindowsSubsystemForLinux = true
- [ ] Git working tree clean before the first task

JetBrains IDEs: open AI Chat and select Codex. Xcode: open the coding assistant, start a chat and choose Codex. The rest of this skill describes the VS Code-family extension.

Two settings layers

LayerWhereControls
Codex settings~/.codex/config.toml plus trusted project .codex/config.toml (gear icon > Codex Settings > Open config.toml)Model, reasoning effort, sandbox, approvals, MCP servers; shared with the CLI
Editor settingsVS Code settings, keys chatgpt.*Extension behaviour inside the editor

Useful editor settings:

KeyDefaultUse
chatgpt.followUpQueueModequeuesteer sends mid-run messages into the current run; Cmd/Ctrl+Shift+Enter inverts once
chatgpt.composerEnterBehaviorentercmdIfMultiline to stop accidental sends of long prompts
chatgpt.reviewDeliveryinlinedetached runs /review in a separate chat
chatgpt.commentCodeLensEnabledtrueCodeLens above TODO comments that hands them to Codex
chatgpt.openOnStartupfalseFocus the Codex sidebar on start
chatgpt.runCodexInWindowsSubsystemForLinuxfalseRun the agent in WSL2 (reloads the window)

Leave chatgpt.cliExecutable unset unless you develop Codex itself.

To make citations in Codex output open in the right editor, set file_opener in config.toml (vscode, vscode-insiders, windsurf, cursor or none).

Give Codex the right context

Want Codex to seeDo
A specific function or blockSelect it, run Add to Codex Thread (chatgpt.addToThread)
A whole filechatgpt.addFileToThread, or reference it from the composer
Whatever is open and selected, automaticallyLeave IDE context on; /ide-context toggles it
Nothing from the editor (avoid bias)Turn IDE context off with /ide-context
Editor context from a terminal TUI session/ide in the Codex CLI

Prompt pattern for selection-based work:

Write unit tests for the selected function. Follow the conventions in the
nearest existing *.test.ts file. Cover the empty-input and timeout branches.
Run only this test file and report the result.

Close unrelated tabs before a task when automatic context is on; open files are context too.

Workflow for an edit

  1. Checkpoint: git status clean, or commit/stash.
  2. Choose where it runs: /local (default), /worktree (separate checkout, keeps your editor tree untouched), or /cloud with /cloud-environment for long jobs.
  3. Prompt with the selection, the constraint and the done-criteria.
  4. Review the diff in the editor: read the summary, open each changed file, keep only the hunks you want.
  5. Run the project’s checks yourself or ask Codex to (npm test, pytest -q).
  6. Run /review for a second pass against uncommitted changes or a base branch.
  7. Commit. Repeat with a new checkpoint for the next change.

Commands worth binding

Assign keys via Preferences: Open Keyboard Shortcuts, search the command id.

Command idDefaultAction
chatgpt.newChatCmd+N / Ctrl+N (in Codex)New chat
chatgpt.addToThreadnoneAdd selection to current chat
chatgpt.addFileToThreadnoneAdd current file
chatgpt.openSidebarnoneOpen the Codex sidebar
chatgpt.openCommandMenunoneCodex command menu
chatgpt.newCodexPanelnoneExtra Codex panel

IDE slash commands include /model, /reasoning, /plan, /goal, /review, /compact, /status (chat id, context use, rate limits), /fork, /side, /worktree, /local, /cloud, /mcp, /init and /fast when the model offers it.

Delegating to the cloud

Plan locally with full editor context, then click the cloud icon under the composer (or /cloud), pick an environment, and send the next prompt; the cloud chat carries the conversation and local changes. Cloud agent phases are offline unless the environment enables internet access. Pull the result locally to test before merging.

Gotchas

  • Opening a parent folder that contains several repositories (no .git of its own) means Codex finds no project root: it reads AGENTS.md only from that folder and misses each repo’s instructions. Open the repository itself, or set project_root_markers if the repo uses another VCS marker.
  • The extension and CLI share config.toml; a profile or -c flag used in the terminal does not apply to editor chats.
  • Plugins are not available in the IDE extension; skills and MCP servers are.
  • The review pane reflects git state, so it shows changes Codex did not make. Commit before delegating to see only Codex’s edits.
  • In workspace-write, .git is read-only: Codex asks for approval to commit. Approve deliberately or commit yourself.
  • On Windows without WSL mode, the agent runs with native Windows sandbox semantics; repos living in WSL should use the WSL setting.
  • Two chats editing the same files in the same window overwrite each other; use /worktree for the second one.

Verification

  • /status in the IDE shows the expected model, context use and chat id.
  • Selected code appears in the chat context chip before sending.
  • The final diff touches only the files the prompt allowed, and the project’s checks pass.

What the zip contains

SKILL.md plus the interface file below. Nothing runs on install.

agents/openai.yamlgenerated from this page

Gives the Codex app a display name, a one-line description and a starter prompt for this skill.

interface:
  display_name: "Codex IDE Extension"
  short_description: "Hand Codex the code you are already looking at"
  default_prompt: "$codex-ide-extension Write tests for the function I have selected in VS Code"

About this skill

Written and maintained by the Codex Skills editors to the same editorial standard as every skill here: a selective description, a real workflow, known pitfalls and a way to verify the work. First published , last updated . MIT licensed. Something wrong or out of date? Tell us.

esc
New

Introducing Codex Skills Pro

79 professional skills that take Codex through complete engagements, each with its own scripts, references and a report that verifies the result.

All-AccessOne-time payment, no subscription
$49
Get All-AccessOr browse individual skills from $2.99 →

Secure checkout by Creem