Practical Examples
Three end-to-end scenarios from simple to advanced, showing how AGENTS.md, sandbox, Skills, and MCP combine.
Example 1: Legacy module refactor
Background: legacy/billing.js is a 2000-line file with no tests.
Steps
- Branch and AGENTS.md
In legacy/AGENTS.md:
- Read-only exploration (optional subagent or first pass)
- Implement refactor
- Review
Takeaway: Separate explore and implement phases + directory-scoped AGENTS.md.
Example 2: Automated pre-commit review Skill
Goal: Run a fixed checklist on staged diff before every PR.
Create Skill .agents/skills/pre-commit-review/SKILL.md
Usage
Extension: Add GitHub MCP steps to compare against the base branch diff.
Example 3: Issue → branch → PR (Cloud + local)
Background: GitHub Issues track work; Codex Cloud implements async; local is for acceptance.
Cloud
- Connect the repo at chatgpt.com/codex
- Match environment (Node version, test command) to AGENTS.md
- Start task: “Fix #42: login timeout does not refresh token”
Local
PR comment
On the PR: @codex add regression test for token refresh for follow-up iteration.
Takeaway: Same AGENTS.md on Cloud and CLI avoids environment drift.
Example 4: Release notes in CI
Takeaway: CI uses read-only + no approvals; checkout should be write-restricted.
Anti-patterns (avoid)
Next steps
- Resources: official docs and community
- Agent Skills: package Example 2 as a Plugin