Review and reorganize AI coding agent configuration and instruction files across Claude Code, Codex, Copilot, and OpenCode. Use when the user says "clean up agent config", "organize agent files", "standardize agent instructions", "set up agent config", "review agent config", "consolidate agent files", or mentions reorganizing CLAUDE.md, AGENTS.md, settings.json, or copilot-instructions.md. Also use when the user wants to deduplicate or rationalize agent instruction files across tools.
How this skill is triggered — by the user, by Claude, or both
Slash command
/clean-up-agent-config:clean-up-agent-configThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Review, consolidate, and organize AI coding agent configuration and instruction files across four tools: Claude Code, OpenAI Codex, GitHub Copilot (CLI agent and code review), and OpenCode.
Review, consolidate, and organize AI coding agent configuration and instruction files across four tools: Claude Code, OpenAI Codex, GitHub Copilot (CLI agent and code review), and OpenCode.
Consult the reference files in this skill's references/ directory for detailed information about each tool's file formats, precedence rules, and unique capabilities:
references/agent-instruction-files.md -- CLAUDE.md, AGENTS.md, copilot-instructions.md, SKILL.md comparisonreferences/agent-config-files.md -- settings.json, config.toml, opencode.json, VS Code settings comparisonRead these references before starting work. They contain tool-specific details about file precedence, loading behavior, and cross-tool compatibility that inform every decision in this workflow.
The goal is a hub-and-spoke model: shared instructions in one canonical file, tool-specific configuration in each tool's hidden directory.
Pick one scoped-instructions layout per repo. The two layouts below are mutually exclusive alternatives, not files that should coexist.
Flat layout (convenient for one or two scoped files):
repo/
+-- AGENTS.md # Single source of truth (all tools)
+-- CLAUDE.md -> AGENTS.md # Symlink for Claude Code
+-- .claude/
| +-- rules/
| +-- *.md # Claude-specific rules (auto-loaded)
+-- .github/
+-- copilot-instructions.md # Copilot repo-wide review rules
+-- *.instructions.md # Copilot path-scoped rules
Nested layout (scales better when there are many scoped files, or to keep .github/ uncluttered):
repo/
+-- AGENTS.md # Single source of truth (all tools)
+-- CLAUDE.md -> AGENTS.md # Symlink for Claude Code
+-- .claude/
| +-- rules/
| +-- *.md # Claude-specific rules (auto-loaded)
+-- .github/
+-- copilot-instructions.md # Copilot repo-wide review rules
+-- instructions/
+-- *.instructions.md # Copilot path-scoped rules
Both are read by Copilot and both honor applyTo frontmatter. Choose based on how many scoped files the repo needs and stick with that choice; do not mix the two.
repo/
+-- .mcp.json # Shared MCP servers (Claude Code, OpenCode)
+-- opencode.json # OpenCode project config (if used)
+-- .claude/
| +-- settings.json # Team-shared: permissions, hooks, env vars
| +-- settings.local.json # Personal: model, telemetry (gitignored)
+-- .codex/
+-- config.toml # Codex project config (if used)
| Content type | Location | Reason |
|---|---|---|
| Project overview, tech stack, commands | AGENTS.md | Read by all four tools |
| Directory-scoped conventions | Subdirectory AGENTS.md (Codex, Copilot) and CLAUDE.md or symlink per subdir (Claude) | Scoped by directory; Claude requires CLAUDE.md in each scoped directory |
| Claude-specific (MCP hints, subagent patterns) | .claude/rules/*.md | Auto-loaded, Claude-only |
| Copilot code review rules | .github/copilot-instructions.md | Copilot code review agent |
| File-type-specific review rules | .github/*.instructions.md or .github/instructions/*.instructions.md | Copilot's applyTo glob scoping |
| Team permissions and hooks | .claude/settings.json | Committed, shared with team |
| Personal model/telemetry/privacy | .claude/settings.local.json | Gitignored, personal |
| MCP servers (team) | .mcp.json at project root | Committed, shared |
| MCP servers (personal) | .claude/settings.local.json | Gitignored |
| Codex sandbox/approval policy | .codex/config.toml | Codex-specific |
| OpenCode model/instruction paths | opencode.json | OpenCode-specific |
Scan the repository for all known agent-related files.
AGENTS.md (root and subdirectories)AGENTS.override.md (root and subdirectories)CLAUDE.md (root and subdirectories).claude/CLAUDE.md.claude/rules/*.md.github/copilot-instructions.md.github/*.instructions.md (flat path-scoped layout).github/instructions/*.instructions.md (nested path-scoped layout).github/prompts/*.prompt.md.github/chatmodes/*.chatmode.md.github/agents/*.agent.md.claude/settings.json.claude/settings.local.json.mcp.json.codex/config.tomlopencode.jsonls -la CLAUDE.md AGENTS.md to detect symlinks and their targets..claude/settings.local.json is gitignored (Claude Code does this automatically, but confirm).Report which files exist, which are missing, which are symlinks, and what each file contains at a high level.
Read each found file and categorize its contents into:
@import references, Claude-only tool restrictionsexcludeAgent scopingFor .claude/settings.json and .claude/settings.local.json, specifically classify each setting:
Belongs in settings.json (team-shared, committed):
$schema referencepermissions.allow rules for team-standard tool patternspermissions.deny rules for protecting sensitive pathshooks definitions (pre/post tool use enforcement)env vars for team conventions (attribution, survey suppression, etc.)attribution settingsBelongs in settings.local.json (personal, gitignored):
ANTHROPIC_MODEL, CLAUDE_CODE_MAX_TURNS)DISABLE_TELEMETRY, DISABLE_ERROR_REPORTING)mcpServersspinnerTipsEnabled and similar personal preferencesNote: Claude Code writes to settings.local.json by default when users change settings interactively. This means team-appropriate settings often end up in the local file and need to be moved to settings.json.
For each .github/*.instructions.md and .github/instructions/*.instructions.md file, check:
applyTo: "<glob>". Flag files missing the frontmatter or the applyTo key.# Lean PR Review Instructions, # TypeScript Frontend Instructions). Flag files with no top-level heading or one that does not reflect the scope.git ls-files or a Glob tool call) to confirm the applyTo pattern matches at least one tracked file. Flag scoped files whose glob matches nothing as stale: either the code they targeted has been removed, the glob was mistyped, or the file was copied from another repo without being updated.applyTo glob to every other scoped file's applyTo. If two scoped files match the same file (e.g., one has **/*.ts and another has **/*.tsx, but a .ts file matches the first only -- fine; but two files both globbing **/*.lean is a conflict). Flag overlaps where two files would both apply to the same source file without a clear separation of concerns..github/copilot-instructions.md should mention the scoped files (so a contributor reading the general file discovers them); each scoped file should reference the general file for repo-wide context. Flag missing cross-references..github/*.instructions.md (flat) and .github/instructions/*.instructions.md (nested), flag the inconsistency and propose consolidating on one layout.Present the user with a concrete plan before making any changes:
Show the proposed final file tree and get explicit user approval before proceeding.
Recommend CLAUDE.md -> AGENTS.md (AGENTS.md is the real file) when:
Recommend keeping CLAUDE.md as the real file (no symlink) when:
@import references that other tools wouldn't understandFollow whichever recommendation applies. The Phase 3 plan approval gives the user a chance to override the choice.
Execute the approved plan in this order:
Create or update AGENTS.md with shared instructions consolidated from all sources. Structure with clear headings:
# Project Name
## Overview
Brief project description and key architectural decisions.
## Development Environment
- Package manager and runtime versions
- Key commands: build, test, lint, dev server
## Code Conventions
- Language-specific patterns and preferences
- Error handling approach
- Testing conventions and location
## Git Workflow
- Branch naming and commit format
- Pre-commit requirements
Keep it under 200 lines. If more detail is needed, keep it in .claude/rules/ files (Claude) or reference supporting docs.
Do not include code style rules that linters enforce (formatting, indentation). Those belong in .editorconfig, .prettierrc, etc.
# If AGENTS.md is the source of truth:
ln -sfn AGENTS.md CLAUDE.md
If CLAUDE.md previously had Claude-specific content, extract those sections to .claude/rules/ files before replacing with the symlink.
Move Claude-specific instructions to focused rule files:
.claude/rules/
+-- mcp-servers.md # How to use project MCP servers
+-- testing.md # Claude-specific test runner patterns
+-- security.md # Paths to protect, secrets handling
Each file is auto-loaded alongside CLAUDE.md. Keep files focused on one topic.
Only create these if there are genuine Claude-specific instructions. Do not create empty rule files.
Create or update with team-appropriate settings:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": [],
"deny": []
}
}
Move team settings here from settings.local.json. Remove personal settings to settings.local.json.
Move personal settings here from settings.json. Verify it is gitignored.
If settings.local.json does not exist and there are no personal settings to move, do not create an empty file.
Create or update with Copilot-specific content. This file should NOT duplicate AGENTS.md. Instead, use the pointer pattern: a cross-reference to AGENTS.md plus Copilot-specific PR review rules.
# GitHub Copilot Instructions
For full project conventions, see AGENTS.md in the repository root.
## Scoped Instructions
Flat-layout example -- path-scoped Copilot instructions live alongside this file:
- [`lean.instructions.md`](lean.instructions.md) -- Lean source files (`**/*.lean`).
- [`ts.instructions.md`](ts.instructions.md) -- TypeScript files (`**/*.ts`, `**/*.tsx`).
If the repo uses the nested layout under `.github/instructions/`, link to `instructions/lean.instructions.md` and `instructions/ts.instructions.md` instead.
## PR Review
When reviewing pull requests, do not flag the following patterns as issues.
Each is an intentional project convention:
- **Convention name**: Brief explanation of why this is intentional.
Cross-reference the scoped files. When the repo has any .github/*.instructions.md (or .github/instructions/*.instructions.md) files, list them in a ## Scoped Instructions section in the general file with their applyTo glob noted. This makes the scoped surface discoverable to humans reading the general file. Omit the section if there are no scoped files.
Keep concise. GitHub recommends keeping instruction files short and putting the most important rules first. Start with a focused set of review rules and add more iteratively.
The "do not flag" pattern. The PR Review section documents project conventions that Copilot commonly misidentifies as issues during PR reviews. Each item uses the bold-key format (**Convention name**: explanation). To populate this section for an existing project:
Section heading. Use ## PR Review as the heading. Some repos use ## PR Review Checklist (CRITICAL) or ## Code Review -- all are acceptable. The key requirement is that PR review rules appear early in the file.
.github/*.instructions.md)Create path-scoped instruction files only when the project structure warrants them. Use Copilot's applyTo glob for file-type or directory scoping.
Layout. Two locations are valid; pick one per repo:
.github/<scope>.instructions.md -- convenient for one or two scoped files..github/instructions/<scope>.instructions.md -- scales better when there are several scoped files.If both layouts are present, consolidate on one. Do not mix.
Required structure. Every scoped file MUST have:
applyTo: "<glob>".# Lean PR Review Instructions, not # Instructions).copilot-instructions.md (or AGENTS.md) for repo-wide context.---
applyTo: "**/*.lean"
---
# Lean PR Review Instructions
For repo-wide conventions, see [`copilot-instructions.md`](copilot-instructions.md) and `AGENTS.md` at the repository root.
## PR Review
- **Entrypoint manifest**: Each module under `MyLib/` has a sibling test module under `MyLibTest/`. Do not flag the test module as duplicating the source module.
- **No line-length limit**: Mathlib's ~100-char wrap is not enforced. Do not flag long lines.
- **Single-line comment paragraphs**: `--` and `/-- -/` comments are intentionally single long lines per paragraph.
Naming. Name scoped files by what they scope to: lean.instructions.md, ts.instructions.md, frontend.instructions.md, tests.instructions.md. Avoid generic names like extra.instructions.md or more.instructions.md.
Good candidates for scoped files:
applyTo: "**/*.lean" carrying Mathlib-aware review rules)Use excludeAgent to control whether instructions apply to the coding agent, code review, or both:
excludeAgent: copilot-code-review -- coding agent onlyexcludeAgent: copilot-coding-agent -- code review onlyexcludeAgent -- bothValidate the glob. Before committing a scoped file, confirm the applyTo pattern matches at least one tracked file in the repo. A glob that matches nothing is a strong signal the file is stale (pasted from another repo, target code removed, or pattern mistyped). Either fix the glob, delete the file, or document why the file is being kept ahead of code that does not yet exist.
Avoid silent overlap. Two scoped files whose globs both match the same source file create ambiguous review rules. If overlap is intentional (e.g., one applies broadly, another narrows for a subdirectory), make the relationship explicit in the narrower file's prose.
Do not create path-scoped files if the project has a flat structure or uniform conventions. The general copilot-instructions.md is enough.
Only create if the team uses Codex. Include team-appropriate defaults:
#:schema https://developers.openai.com/codex/config-schema.json
approval_policy = "on-request"
sandbox_mode = "workspace-write"
project_doc_fallback_filenames = ["CLAUDE.md"]
The project_doc_fallback_filenames line lets Codex fall back to CLAUDE.md when AGENTS.md is not present.
If CLAUDE.md is a symlink to AGENTS.md, omit project_doc_fallback_filenames to avoid Codex ingesting the same instructions twice.
Only create if the team uses OpenCode. Reference the instruction files:
{
"instructions": ["AGENTS.md"]
}
Add glob patterns for subdirectory AGENTS.md files in monorepos:
{
"instructions": ["AGENTS.md", "packages/*/AGENTS.md"]
}
Symlinks resolve correctly:
ls -la CLAUDE.md
readlink CLAUDE.md
No duplicated instructions across AGENTS.md, copilot-instructions.md, and .claude/rules/
Scoped Copilot instructions are well-formed:
.github/*.instructions.md (or .github/instructions/*.instructions.md) starts with applyTo frontmatter and a top-level heading naming the scopeapplyTo glob matches at least one tracked file (no stale files)copilot-instructions.md lists the scoped files; each scoped file references the general fileSettings split is clean:
Gitignore covers .claude/settings.local.json
Show final file tree of all agent-related files with a brief note on each file's purpose
Report summary as a table:
| File | Action | Notes |
|---|---|---|
AGENTS.md | Created/Updated | Consolidated from X sources |
CLAUDE.md | Symlinked | Points to AGENTS.md |
.claude/settings.json | Updated | Moved N settings from local |
| ... | ... | ... |
CLAUDE.md > .claude/rules/*.md > user ~/.claude/CLAUDE.md > subdirectory CLAUDE.md@path/to/file syntax to pull in other files without copying content.md files auto-loaded alongside CLAUDE.md. Use for Claude-specific instructions that shouldn't pollute the cross-tool AGENTS.md.project_doc_fallback_filenames in config.toml makes Codex read CLAUDE.md or other files as instruction sourcesproject_doc_max_bytes (default 32 KiB). Raise in config.toml if needed.[profiles.name]) for switching between careful review and fast iteration. Unique to Codex.excludeAgent..github/instructions/*.instructions.md with applyTo globs offers file-type-level granularity that no other tool matches. This is Copilot's strongest unique feature.instructions array in opencode.json supports glob patterns (e.g., packages/*/AGENTS.md).mcpServers, same format as Claude Code's .mcp.json.applyTo frontmatter: Add the frontmatter using a glob inferred from the file's name and content (e.g., lean.instructions.md -- applyTo: "**/*.lean"). If the intended scope is unclear, ask.applyTo glob matches no tracked files: Flag as stale. Either fix the glob, delete the file, or (rarely) keep it with a comment explaining that it covers code that does not yet exist..github/*.instructions.md) and nested (.github/instructions/*.instructions.md) layouts: Propose consolidating on one. Default to the layout already used by the majority of the scoped files; if tied, prefer flat for one or two files, nested for three or more.copilot-instructions.md does not reference the scoped files (or vice versa): Add the cross-references. The general file gets a ## Scoped Instructions section listing each scoped file with its applyTo glob; each scoped file gets a one-line pointer to the general file and AGENTS.md.Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub cboone/agent-harness-plugins --plugin clean-up-agent-config