2026 AI Coding in Practice: A Practical Guide to Codex and Claude Code Automation
If you are not a professional developer, or if repetitive coding tasks eat up a significant portion of your workday, this guide is for you. Today, automation engines like Codex (OpenAI’s desktop AI coding agent) and Claude Code (Anthropic’s command-line tool) are mature enough to handle substantial development work. By connecting external tools through MCP (Model Context Protocol), coordinating multiple agents (subagents), and setting up automated workflows (Skills + Automations + Hooks), you can achieve a “set once, benefit long” setup.
With this system in place, daily development, documentation, and maintenance tasks can become noticeably more efficient. This guide is based on the current AI programming ecosystem and walks you through a practical, step-by-step process to build your own automation workflow. All instructions are drawn from real, usable tools and configurations.
1. Which Tool to Choose? A Dual-Use Strategy
Codex and Claude Code are two of the more capable AI coding tools available today. They each have their strengths, but what is particularly useful is that they can share project-level configurations. You can place an AGENTS.md or CLAUDE.md file in your project root, and both tools will respect it. This means that even if your team mixes Codex and Claude Code users, migration costs are minimal.
In practice, you can choose based on the task: Codex’s desktop app offers a graphical interface and is more intuitive for interactive sessions; Claude Code is lightweight and efficient for terminal-based work. Using both together allows you to leverage the strengths of each.
2. Installation and Environment Verification
Installing Codex Desktop App
-
Visit the Codex official website or search for “Codex” in the Microsoft Store to download. -
Install the client for your operating system (macOS or Windows). -
After installation, log in using your ChatGPT account (a Plus or Pro subscription is recommended for full functionality). -
On first launch, follow the prompts to select your trusted project working folder. This ensures the AI only accesses directories you have authorised, maintaining code security.
Installing Claude Code
If you are using macOS, Linux, or WSL (Windows Subsystem for Linux), run the following command in your terminal:
curl -fsSL https://claude.ai/install.sh | bash
For Windows users, open PowerShell (running as administrator is recommended) and execute:
powershell -Command "irm https://claude.ai/install.ps1 | iex"
After installation, verify that it works:
# Check the installed version
claude --version
# Start interactive mode (you will be prompted to log in to your Anthropic account on first run)
claude
Once logged in, you can start interacting with Claude Code directly in your terminal.
3. Core Practice: Giving Your AI a “Universal Socket” (MCP)
MCP (Model Context Protocol) is the backbone of this automation system. Its purpose is to break down the isolation between AI and external environments, allowing the AI to safely read and write local files, access GitHub repositories, control browsers, and more. In short, MCP gives the AI real-world operational capabilities.
Method 1: Using Desktop Extensions (One-Click Install)
For Claude Desktop users, the easiest approach is to use the built‑in extensions feature:
-
Open Claude Desktop, go to Settings>Extensions. -
Click Browse extensionsto see the directory of Anthropic-approved plugins. -
Find the tool you need, such as Filesystem (for file operations) or GitHub integration. Click Installand configure the required keys (e.g., your GitHub personal access token). -
After installation, restart Claude Desktop for the changes to take effect.
Method 2: Manual MCP Server Configuration (More Flexible)
Global Configuration for Claude Desktop
Go to Settings > Developer > Edit Config. This opens the global configuration file claude_desktop_config.json. Edit it to include something like the following:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/absolute/path/to/your/project/folder"
]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "YOUR_GITHUB_PERSONAL_ACCESS_TOKEN"
}
}
}
}
⚠️ Windows users: Paths in the configuration file must use double backslashes
\\or forward slashes/, e.g.,C:\\Users\\yourname\\projectsorC:/Users/yourname/projects.
After saving the file, you must completely quit Claude Desktop (using Task Manager to end all processes) and restart it for the configuration to apply.
Project-Level Configuration for Claude Code
For Claude Code, it is recommended to create a .claude/mcp.json file in your project root. This allows the configuration to be shared via Git with your team, ensuring consistency. Example:
{
"mcpServers": {
"project-db": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sqlite", "--db-path", "./data/app.db"]
},
"my-github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"]
}
}
}
Alternatively, you can add MCP services quickly from your project terminal:
# Add GitHub MCP service
claude mcp add github -- npx -y @modelcontextprotocol/server-github
# Add filesystem MCP service (restrict access to the ./src directory)
claude mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem ./src
Configuration for Codex
Codex’s global configuration is located at ~/.codex/config.toml. For a specific project, you can override it by creating .codex/config.toml in the project root. For example, to add Notion and Playwright services:
[mcp_servers.notion]
command = "npx"
args = ["-y", "@notionhq/notion-mcp-server"]
[mcp_servers.notion.env]
NOTION_TOKEN = "ntn_your_notion_integration_token"
You can also quickly add Playwright browser automation support using the CLI:
codex mcp add playwright -- npx @playwright/mcp@latest
Recommended MCP Services to Install in 2026
| MCP Service | What it does | Example invocation |
|---|---|---|
| GitHub / GitLab MCP | Deep repository operations, such as reading issues and creating PRs | “Use GitHub MCP to check issue #123 on the main branch, summarise the cause, and automatically create a fix PR.” |
| Filesystem MCP | Safely read and write files within your project folder | Avoid manual copy-pasting; AI can directly read and modify project files |
| Playwright / Browser-use MCP | Control a real web browser for automated interactions | “Use Playwright to open localhost:3000, check if the new login component works, and save a screenshot.” |
| Notion MCP | Sync with Notion for task management and documentation | “Use Notion MCP to turn this refactoring plan into a task page in our project database.” |
| Figma MCP | Read design layers and generate front-end component code | Connect via OAuth; AI can read design files and produce corresponding code |
| Sentry MCP | Fetch error monitoring data to assist with debugging | “Use Sentry MCP to get the latest crash stack trace, locate the affected file, and fix it.” |
4. Building Your AI Team: Multi‑Agent Systems
When tasks become complex, a single AI may struggle. A multi‑agent approach can help: one main agent handles overall planning and result aggregation, while specialised sub‑agents work in parallel on specific subtasks. This can significantly improve efficiency and robustness for complex workflows.
Setup Steps
First, create a dedicated folder for agent configurations in your project root:
mkdir -p .codex/agents
You can then adjust scheduling parameters in your project configuration, such as setting max_threads = 8 to limit the number of parallel agents. Next, create a separate .toml description file for each role inside .codex/agents/.
Defining Three Core Roles
Role 1: Researcher (researcher.toml)
name = "researcher"
description = "Professional researcher agent focused on analysis, requirements, and reporting – never modifies code directly"
developer_instructions = """
You are a meticulous researcher.
Responsibilities:
1. Deeply analyse user requirements and technical approaches.
2. Investigate existing codebase, architecture docs, and dependency versions.
3. Output structured research reports and implementation plans with risk assessments and alternatives.
Critical constraint: You operate in a read‑only sandbox. Never propose concrete code changes or edit files directly. Prefer exploration tools. Always return results using report_agent_job_result.
"""
model = "gpt-5.4"
model_reasoning_effort = "high"
sandbox_mode = "read-only"
This agent handles analysis and research without modifying code, preventing unintended changes during the investigation phase.
Role 2: Coder (coder.toml)
name = "coder"
description = "Coding expert focused on high‑quality implementation"
developer_instructions = """
You are a top‑tier software engineer.
Responsibilities:
1. Receive the researcher’s report and implementation plan, then write or modify code to meet requirements.
2. Follow the principle of minimal necessary change.
3. Always write or update unit tests before implementing new logic.
"""
model = "gpt-5.4"
sandbox_mode = "workspace-write"
The coder is responsible for actual code implementation, emphasising quality and test‑first practice.
Role 3: Reviewer (reviewer.toml)
name = "reviewer"
description = "Reviewer agent that finds security and performance issues before commit"
developer_instructions = """
You are a strict code reviewer.
Responsibilities:
1. Deeply analyse code changes made by the Coder.
2. Identify potential security flaws, edge‑case bugs, and performance risks.
3. If issues are found, reject approval and provide specific improvement suggestions.
"""
model = "gpt-5.4"
model_reasoning_effort = "high"
sandbox_mode = "read-only"
The reviewer acts as a quality gate, catching issues before code is committed.
How to Deploy These Agents
Once configured, sub‑agents automatically inherit the MCP tools configured for the main agent. In daily conversation, you can direct them using natural language. For example:
“First analyse the underlying pain points of this new feature, then have the coder implement the business logic, and finally call the reviewer for security and boundary checks.”
The main agent will interpret your intent, break down the task, distribute it to the relevant sub‑agents, and return a consolidated result.
5. Skills and Hooks: Building Automated Workflows
1. Agent Skills – Reusable “Playbooks”
Do you find yourself typing the same long prompts repeatedly? Skills solve that. You can create standard skill files in your project root, encapsulating common workflows into reusable “playbooks.”
For example, create .claude/skills/fix-bug/SKILL.md (or the equivalent path for Codex) to define a standardised bug‑fixing process:
---
name: fix-bug
description: Standard bug‑fix pipeline – reads issue, analyses root cause, fixes, tests, and creates PR
---
# Bug Fix Standard Playbook
1. Automatically call GitHub MCP to read the error context from the specified Issue.
2. Dispatch the Researcher sub‑agent to examine the codebase and produce a root‑cause analysis.
3. Wake the Coder to modify the affected local files and supplement unit tests.
4. After write operations, trigger the automated post‑processing pipeline.
5. Dispatch the Reviewer sub‑agent for final quality and security review.
6. Once all checks pass, use GitHub MCP to create a remote PR with a clear Changelog.
After defining the skill, you can simply say: “Use the fix-bug skill for issue #456” – the AI team will follow the playbook automatically, without you guiding each step.
2. Hooks – Unattended Automation Pipelines
Hooks let you trigger scripts automatically when certain events occur. For instance, after the AI edits code, you can run formatting, execute tests, and even block the commit if tests fail.
Create .claude/settings.json in your project root:
{
"hooks": {
"PostToolUse": [{
"matcher": "Edit|Write|MultiEdit",
"hooks": [{ "type": "command", "command": "./scripts/ai-post-edit.sh" }]
}]
}
}
This configuration means: whenever the AI performs an edit or write operation, the script ./scripts/ai-post-edit.sh will be executed.
Below is a robust post‑processing script example (./scripts/ai-post-edit.sh):
#!/bin/bash
set -e # Any error stops the process immediately – prevents committing broken code
echo "=== Automated workflow: post‑processing after AI edit ==="
# 1. Auto‑format and fix linting issues
npx eslint --fix . || true
# 2. Run local unit tests (if they fail, exit 2 triggers set -e, aborting the process)
npm run test -- --passWithNoTests || exit 2
# 3. Auto‑commit changes locally if all tests pass
git add -A
git commit -m "chore: auto commit after AI edit [$(date '+%Y-%m-%d %H:%M')]" || echo "No new changes to commit"
echo "✅ Hook pipeline executed safely!"
This script automatically formats code, runs tests, and commits changes only if tests pass. If any step fails, the whole process stops, preventing broken commits.
6. A Complete End‑to‑End Example: From Issue to PR
Let’s walk through a full automation scenario. Suppose a GitHub issue (#789) reports a bug that needs fixing.
Step 1: Give the high‑level instruction
You type one macro command in your terminal or app interface:
“Run the fix-bug skill for GitHub issue #789, using Researcher + Coder + Reviewer in parallel, and finally create a PR automatically.”
Step 2: The AI factory runs autonomously
Behind the scenes, the following steps execute automatically:
-
Fetch context: The main agent uses GitHub MCP to retrieve the error details and discussion from issue #789. -
Analyse root cause: The Researcher agent (in read‑only mode) examines the local codebase based on the issue and produces a report with root cause and fix suggestions. -
Execute fix: The Coder agent modifies the relevant local files and simultaneously writes/updates unit tests. -
Post‑processing hook: When files are saved, the PostToolUsehook triggers:-
Runs eslint --fixto format code. -
Executes npm run testto run the test suite. -
If tests fail, the pipeline is immediately interrupted and an error is reported. -
If tests pass, the changes are committed to the local Git repository.
-
-
Quality review: The Reviewer agent performs security and performance checks on the modified code. -
Create PR: After all checks succeed, the AI pushes the code to a remote branch, creates a Pull Request on GitHub, and automatically fills in a clear change log.
The entire cycle is highly automated – you only need to perform a final manual review and approve the PR.
7. Advanced Tips and Pitfalls to Avoid
Context Management
-
Problem: Feeding dozens of source files to the AI at once can cause it to “lose its way” in the long context, generating hallucinations and consuming large amounts of tokens. -
Recommendation: Use “Plan Mode” (exploration mode) and let the AI fetch files on‑demand via the Filesystem MCP, rather than dumping everything upfront. -
Practice: Regularly use /clearto reset conversation history, or start fresh sessions to keep the AI’s reasoning sharp.
Establishing a Project “Constitution”
If your team uses both Codex and Claude Code, place a CLAUDE.md (highest priority for Claude Code) or AGENTS.md (generic, compatible with tools like Cursor and Aider) in the project root. In this file, define hard rules such as:
-
“Must use TypeScript strict mode.” -
“Direct pushes to the main branch are forbidden.”
AI tools will load these rules automatically on each start and enforce them strictly.
Security and Cost Control
-
High‑risk operation confirmation: For actions like production deployments or sensitive database schema changes, enable a “human‑in‑the‑loop” confirmation mode. Ensure that critical changes are approved by you before execution. -
Cost testing: When first experimenting with multi‑agent setups, start with small tasks to gauge token consumption and workflow behaviour. Once you are comfortable, scale up to larger projects.
Frequently Asked Questions (FAQ)
Q1: I’m not a developer – can I still use these tools?
Absolutely. These tools are designed to lower the technical barrier. Even if you don’t code, you can ask the AI to handle many tasks like changing copy, adjusting UI styles, or fixing simple bugs using natural language.
Q2: Which is better, Codex or Claude Code?
They complement each other. Codex has a desktop GUI that is more visual; Claude Code is lightweight and works well in the terminal. Since they can share project configurations, you can install both and choose the one that fits your current task.
Q3: Is manual MCP configuration always required?
Not necessarily. Claude Desktop users can install many MCP services via the built‑in extension marketplace with one click. Manual configuration offers more flexibility for custom needs.
Q4: Could the AI accidentally break my project?
You can restrict its scope using sandbox modes (e.g., read-only or workspace-write). Combine that with version control and the automated testing hooks described above – any problematic changes will be caught before they cause harm.
Q5: What are the ongoing costs?
Costs come from two sources: subscription fees for ChatGPT Plus/Pro or Anthropic, and token usage for API calls. Start with small tasks to understand your consumption before moving to larger projects.
Q6: How can my team keep AI configurations consistent?
Commit project‑level configuration files (like .claude/mcp.json, AGENTS.md, etc.) to your Git repository. After pulling, every team member will have the same settings, ensuring consistent behaviour.
Once you have configured the MCP connections, multi‑agent roles, and Skills/Hooks automation, you will have moved from being an occasional AI user to effectively managing a small AI‑powered development team. Through clear instructions, you can delegate research, coding, and review tasks, while automated pipelines handle quality checks and commits.
Start by setting up two core MCP services in your local project, then write your first Skill playbook and run a Hook script. Hands‑on practice will give you the clearest sense of how this automation system can change your daily workflow.

