AI Config Skill
Purpose
Detect, create, sync, and drift-check AI assistant configuration files in a repo. Works with whatever the user already has. Never introduces a skill-owned state file.
Platform Adaptation
Before starting, load the reference file for the current agent environment and follow its tool guidance:
Supported Config Files
Load the full adapter details (file names, locations, format rules, sentinel syntax) from:
Quick reference:
| Tool |
File(s) |
Location |
| Shared / generic |
AGENTS.md |
repo root |
| Claude Code |
CLAUDE.md |
repo root (+ sub-dirs) |
| GitHub Copilot |
copilot-instructions.md |
.github/ |
| Copilot file-scoped |
*.instructions.md |
.github/instructions/ |
| Cursor |
*.mdc rules |
.cursor/rules/ |
| Gemini CLI |
GEMINI.md |
repo root |
| Cline |
.clinerules |
repo root |
| Windsurf |
.windsurfrules |
repo root |
| Cursor legacy |
.cursorrules |
repo root |
Startup — Detect Mode
Unless a mode was passed as an argument, always run detection first.
Step 1 — Scan for existing configs
Scan the repo for all known config files (see table above). Collect every file found.
Step 2 — Determine mode
| Situation |
Mode |
| No configs found |
init |
Configs found + argument says add <tool> |
add |
Configs found + argument says check or drift |
check or drift |
Configs found + argument says edit |
edit |
| Multiple configs found, no argument |
surface sync check first, then ask what user wants to do |
| One config found, no argument |
ask: update, add a tool, or check drift? |
Step 3 — Multi-config sync prompt
When two or more config files are found, before doing anything else:
"I found configs for [list tools]. Let me quickly check if they agree on the key things."
Run a lightweight cross-config comparison (see check mode below). Report any divergences immediately. Ask if the user wants to fix them before continuing to their original request.
Modes
init — No configs exist
Explain briefly: "You have no AI assistant config files yet. The most portable starting point is AGENTS.md — it's read by Claude Code, GitHub Copilot, Windsurf, and others without any tool-specific setup."
Ask: which AI tools does the team use? (multi-select)
GitHub Copilot (default)
Claude Code
Cursor
Gemini CLI
Cline
Windsurf
Other (free text)
If called from repo-init with pre-filled context: skip this question and use the passed tool list.
Ask the preference questions (skip any already provided by repo-init):
- Shell preference (default: no preference):
bash, zsh, fish, PowerShell, No preference
- Commit style (default: no preference):
Conventional Commits, Gitmoji, No preference, Other
- Confirmation behavior (default: ask before destructive actions):
Ask before destructive, Auto-approve safe / ask for destructive, Minimal confirmations
- Extra conventions (free text, optional): e.g. "never modify test files without asking", "always use named exports"
Decide which files to create:
- Always create
AGENTS.md as the shared base.
- For each tool beyond the shared base, create the tool-specific file (see adapter reference for format).
- Show the file list and confirm before writing anything.
Write files. Use sentinel comments to wrap generated sections (see Adapter reference → Sentinel Format).
Confirm what was created and suggest next steps: add more tools (add), or run check after future tooling changes.
add — Onboard a new tool
Ask which tool to add (if not passed as argument). Show only tools that don't already have a config file.
Read all existing config files to extract current preferences (tools, conventions, methodology, shell).
Generate the new tool's config file using the extracted preferences + the adapter format. Wrap generated sections in sentinels.
Show a diff preview and confirm before writing.
check — Cross-config sync check
Goal: surface meaningful divergences between config files, not formatting noise.
For each config file, extract the following dimensions using the Adapter reference extraction hints:
- Named tools / frameworks (linter, test runner, formatter, runtime, package manager)
- Shell preference
- Commit style
- Any explicit methodology (e.g. TDD, SDD, spec-driven)
- Restricted or disallowed actions
Cross-compare all files on each dimension. Flag only where two files explicitly disagree (one says X, another says Y). Omissions are not flags — a file that doesn't mention the linter is not wrong.
For each divergence, show:
Divergence: linter
CLAUDE.md → Ruff
copilot-instructions.md → Flake8
→ Which is current? [Ruff / Flake8 / Both intentional (suppress)]
For each resolved divergence: update all affected files (only within sentinel blocks or by appending if no sentinel exists). Never touch user-written content outside sentinels.
If no divergences: confirm "All configs agree on the key dimensions."
edit — Update a preference across all configs
Ask what the user wants to change (free text, e.g. "switch linter to Biome", "add conventional commits rule").
Identify which files contain the relevant preference.
For each file: locate the relevant line(s) within sentinel blocks. If the preference is inside a sentinel block, update it. If it's in user-written content, highlight it and ask before touching it.
Show a preview of all changes across all files. Confirm before writing.
drift — Tooling vs config consistency check
Goal: detect when the actual stack has changed but AI configs haven't caught up.
Load the full list of drift signal files and extraction rules from:
Procedure:
Scan for stack signal files: package.json, pyproject.toml, go.mod, Cargo.toml, *.eslintrc*, biome.json, ruff.toml, .tool-versions, .nvmrc, Dockerfile, etc. (full list in drift signals reference).
Extract named tools from each signal file (runtime version, linter, formatter, test runner, package manager).
For each AI config, extract the same dimensions (reuse check mode extraction).
Cross-compare: flag where a config mentions a tool that no longer appears in any stack signal file, or where a signal file mentions a tool that no config mentions.
Use git to add recency context:
git log -1 --format="%ar" -- <signal-file>
Only flag signal files changed more recently than the config that should reflect them.
Report findings as actionable items:
Drift detected:
copilot-instructions.md says: Jest
package.json now has: Vitest (changed 3 days ago)
→ Update copilot-instructions.md? [Yes / No / Suppress]
For each accepted fix: apply via edit mode logic. For suppressions: add an inline comment <!-- ai-config:suppress jest-mention --> immediately after the flagged line.
Structure drift — second pass (always run after tooling checks):
a. Stale path check — extract all path-like strings from each AI config (backtick-quoted or inline paths containing /). For each path, check whether it still exists in the repo. Flag missing paths at Medium severity.
Stale path in AGENTS.md:
`packages/legacy-api/` — directory no longer exists
→ Remove or update this reference? [Update / Remove / Suppress]
b. Undocumented directory check — scan top-level and second-level dirs (for monorepos: packages/*, apps/*, services/*). Skip tooling/hidden dirs (node_modules, .git, dist, build, etc.). For each significant directory added more recently than the oldest AI config, check if any config mentions it. Surface undocumented ones at Low severity.
Undocumented directory: packages/payments-service/
Added 5 days ago. No AI config mentions it.
→ Add a brief description to AGENTS.md? [Yes / No / Suppress]
If the user says Yes: ask for a one-sentence description, then insert it into the target config under a ## Project Structure sentinel block.
Full extraction rules, path patterns, skip lists, and the structure section template are in the Drift signals reference → Structure Drift.
Merge Safety Rules
These rules apply to every write operation across all modes:
Sentinel blocks are the safe zone. Generated content always lives inside:
<!-- ai-config:generated:<section-name> -->
...content...
<!-- ai-config:end -->
For .mdc files (Cursor), use YAML comments: # ai-config:generated:<section> / # ai-config:end.
Never modify content outside sentinels unless the user explicitly asks.
First-time writes (no existing sentinels): wrap the entire generated file in a sentinel block so future syncs know what is safe to touch.
Suppression markers <!-- ai-config:suppress <id> --> are user-written and must never be removed.
Before any write: show the user a clear before/after diff and get confirmation.
Handoff Interface (from repo-init)
When repo-init calls this skill, it may pass a context object with pre-filled answers:
tools: [copilot, claude]
shell: bash
commit_style: conventional commits
confirmation: ask-before-destructive
extra: ["never modify test files without asking"]
methodology: spec-driven
stack:
runtime: Node.js
linter: ESLint + Prettier
test: Vitest
When any of these keys are present, skip the corresponding question and use the provided value. Announce which values were pre-filled: "Using choices from repo-init: tools (Copilot, Claude Code), shell (bash)." so the user can correct anything before proceeding.
Guidelines
- Detect before acting. Never assume what files exist — always scan first.
- Prefer
AGENTS.md for new setups. It has the broadest native support and avoids vendor lock-in.
- Surface multi-file divergence immediately. When multiple configs exist, checking sync is always the first thing to offer.
- Omission is not drift. A config that doesn't mention a tool is not wrong. Only flag explicit contradictions or stale mentions.
- Never overwrite user content. Sentinel blocks define the safe zone. Everything outside is off limits without explicit user permission.
- Ask one question at a time. Even during the init interview, keep each prompt focused on a single decision.
- Preview before write. Always show what will be written and get confirmation before touching any file.
- Suppressions are permanent. Once a user suppresses a drift signal, never re-raise it in future runs.
- Be concise in reports. Show tool name, file, and the conflict — not paragraphs. Keep drift reports scannable.
Source: feimacode/feima-copilot-ai-flow — distributed by TomeVault.
1---2name: feimacode-feima-copilot-ai-flow-ai-config3description: AI Config Skill4---56# AI Config Skill78## Purpose910Detect, create, sync, and drift-check AI assistant configuration files in a repo. Works with whatever the user already has. Never introduces a skill-owned state file.1112## Platform Adaptation1314Before starting, load the reference file for the current agent environment and follow its tool guidance:1516- [Copilot tool mapping](../repo-init/references/copilot-tools.md)17- [Codex tool mapping](../repo-init/references/codex-tools.md)18- [Gemini CLI tool mapping](../repo-init/references/gemini-tools.md)1920---2122## Supported Config Files2324Load the full adapter details (file names, locations, format rules, sentinel syntax) from:2526- [Adapter reference](./references/adapters.md)2728Quick reference:2930| Tool | File(s) | Location |31|------|---------|----------|32| Shared / generic | `AGENTS.md` | repo root |33| Claude Code | `CLAUDE.md` | repo root (+ sub-dirs) |34| GitHub Copilot | `copilot-instructions.md` | `.github/` |35| Copilot file-scoped | `*.instructions.md` | `.github/instructions/` |36| Cursor | `*.mdc` rules | `.cursor/rules/` |37| Gemini CLI | `GEMINI.md` | repo root |38| Cline | `.clinerules` | repo root |39| Windsurf | `.windsurfrules` | repo root |40| Cursor legacy | `.cursorrules` | repo root |4142---4344## Startup — Detect Mode4546Unless a mode was passed as an argument, always run detection first.4748### Step 1 — Scan for existing configs4950Scan the repo for all known config files (see table above). Collect every file found.5152### Step 2 — Determine mode5354| Situation | Mode |55|-----------|------|56| No configs found | `init` |57| Configs found + argument says `add <tool>` | `add` |58| Configs found + argument says `check` or `drift` | `check` or `drift` |59| Configs found + argument says `edit` | `edit` |60| Multiple configs found, no argument | surface sync check first, then ask what user wants to do |61| One config found, no argument | ask: update, add a tool, or check drift? |6263### Step 3 — Multi-config sync prompt6465When **two or more** config files are found, before doing anything else:6667> "I found configs for [list tools]. Let me quickly check if they agree on the key things."6869Run a lightweight cross-config comparison (see `check` mode below). Report any divergences immediately. Ask if the user wants to fix them before continuing to their original request.7071---7273## Modes7475### `init` — No configs exist76771. Explain briefly: *"You have no AI assistant config files yet. The most portable starting point is `AGENTS.md` — it's read by Claude Code, GitHub Copilot, Windsurf, and others without any tool-specific setup."*78792. Ask: which AI tools does the team use? (multi-select)80 - `GitHub Copilot` *(default)*81 - `Claude Code`82 - `Cursor`83 - `Gemini CLI`84 - `Cline`85 - `Windsurf`86 - `Other` (free text)8788 **If called from `repo-init`** with pre-filled context: skip this question and use the passed tool list.89903. Ask the preference questions (skip any already provided by `repo-init`):91 - **Shell preference** *(default: no preference)*: `bash`, `zsh`, `fish`, `PowerShell`, `No preference`92 - **Commit style** *(default: no preference)*: `Conventional Commits`, `Gitmoji`, `No preference`, `Other`93 - **Confirmation behavior** *(default: ask before destructive actions)*: `Ask before destructive`, `Auto-approve safe / ask for destructive`, `Minimal confirmations`94 - **Extra conventions** (free text, optional): e.g. "never modify test files without asking", "always use named exports"95964. Decide which files to create:97 - Always create `AGENTS.md` as the shared base.98 - For each tool beyond the shared base, create the tool-specific file (see adapter reference for format).99 - Show the file list and confirm before writing anything.1001015. Write files. Use sentinel comments to wrap generated sections (see [Adapter reference → Sentinel Format](./references/adapters.md)).1021036. Confirm what was created and suggest next steps: add more tools (`add`), or run `check` after future tooling changes.104105---106107### `add` — Onboard a new tool1081091. Ask which tool to add (if not passed as argument). Show only tools that don't already have a config file.1101112. Read all existing config files to extract current preferences (tools, conventions, methodology, shell).1121133. Generate the new tool's config file using the extracted preferences + the adapter format. Wrap generated sections in sentinels.1141154. Show a diff preview and confirm before writing.116117---118119### `check` — Cross-config sync check120121Goal: surface *meaningful* divergences between config files, not formatting noise.1221231. For each config file, extract the following dimensions using the [Adapter reference](./references/adapters.md) extraction hints:124 - Named tools / frameworks (linter, test runner, formatter, runtime, package manager)125 - Shell preference126 - Commit style127 - Any explicit methodology (e.g. TDD, SDD, spec-driven)128 - Restricted or disallowed actions1291302. Cross-compare all files on each dimension. Flag only where two files **explicitly disagree** (one says X, another says Y). Omissions are not flags — a file that doesn't mention the linter is not wrong.1311323. For each divergence, show:133 ```134 Divergence: linter135 CLAUDE.md → Ruff136 copilot-instructions.md → Flake8137 → Which is current? [Ruff / Flake8 / Both intentional (suppress)]138 ```1391404. For each resolved divergence: update all affected files (only within sentinel blocks or by appending if no sentinel exists). Never touch user-written content outside sentinels.1411425. If no divergences: confirm *"All configs agree on the key dimensions."*143144---145146### `edit` — Update a preference across all configs1471481. Ask what the user wants to change (free text, e.g. "switch linter to Biome", "add conventional commits rule").1491502. Identify which files contain the relevant preference.1511523. For each file: locate the relevant line(s) within sentinel blocks. If the preference is inside a sentinel block, update it. If it's in user-written content, highlight it and ask before touching it.1531544. Show a preview of all changes across all files. Confirm before writing.155156---157158### `drift` — Tooling vs config consistency check159160Goal: detect when the actual stack has changed but AI configs haven't caught up.161162Load the full list of drift signal files and extraction rules from:163164- [Drift signals reference](./references/drift-signals.md)165166Procedure:1671681. Scan for stack signal files: `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, `*.eslintrc*`, `biome.json`, `ruff.toml`, `.tool-versions`, `.nvmrc`, `Dockerfile`, etc. (full list in drift signals reference).1691702. Extract named tools from each signal file (runtime version, linter, formatter, test runner, package manager).1711723. For each AI config, extract the same dimensions (reuse `check` mode extraction).1731744. Cross-compare: flag where a config mentions a tool that **no longer appears** in any stack signal file, or where a signal file mentions a tool that **no config** mentions.1751765. Use git to add recency context:177 ```178 git log -1 --format="%ar" -- <signal-file>179 ```180 Only flag signal files changed more recently than the config that should reflect them.1811826. Report findings as actionable items:183 ```184 Drift detected:185 copilot-instructions.md says: Jest186 package.json now has: Vitest (changed 3 days ago)187 → Update copilot-instructions.md? [Yes / No / Suppress]188 ```1891907. For each accepted fix: apply via `edit` mode logic. For suppressions: add an inline comment `<!-- ai-config:suppress jest-mention -->` immediately after the flagged line.1911928. **Structure drift — second pass** (always run after tooling checks):193194 a. **Stale path check** — extract all path-like strings from each AI config (backtick-quoted or inline paths containing `/`). For each path, check whether it still exists in the repo. Flag missing paths at Medium severity.195196 ```197 Stale path in AGENTS.md:198 `packages/legacy-api/` — directory no longer exists199 → Remove or update this reference? [Update / Remove / Suppress]200 ```201202 b. **Undocumented directory check** — scan top-level and second-level dirs (for monorepos: `packages/*`, `apps/*`, `services/*`). Skip tooling/hidden dirs (`node_modules`, `.git`, `dist`, `build`, etc.). For each significant directory added more recently than the oldest AI config, check if any config mentions it. Surface undocumented ones at Low severity.203204 ```205 Undocumented directory: packages/payments-service/206 Added 5 days ago. No AI config mentions it.207 → Add a brief description to AGENTS.md? [Yes / No / Suppress]208 ```209210 If the user says Yes: ask for a one-sentence description, then insert it into the target config under a `## Project Structure` sentinel block.211212 Full extraction rules, path patterns, skip lists, and the structure section template are in the [Drift signals reference → Structure Drift](./references/drift-signals.md).213214---215216## Merge Safety Rules217218These rules apply to every write operation across all modes:2192201. **Sentinel blocks** are the safe zone. Generated content always lives inside:221 ```222 <!-- ai-config:generated:<section-name> -->223 ...content...224 <!-- ai-config:end -->225 ```226 For `.mdc` files (Cursor), use YAML comments: `# ai-config:generated:<section>` / `# ai-config:end`.2272282. **Never modify content outside sentinels** unless the user explicitly asks.2292303. **First-time writes** (no existing sentinels): wrap the entire generated file in a sentinel block so future syncs know what is safe to touch.2312324. **Suppression markers** `<!-- ai-config:suppress <id> -->` are user-written and must never be removed.2332345. **Before any write**: show the user a clear before/after diff and get confirmation.235236---237238## Handoff Interface (from `repo-init`)239240When `repo-init` calls this skill, it may pass a context object with pre-filled answers:241242```243tools: [copilot, claude]244shell: bash245commit_style: conventional commits246confirmation: ask-before-destructive247extra: ["never modify test files without asking"]248methodology: spec-driven249stack:250 runtime: Node.js251 linter: ESLint + Prettier252 test: Vitest253```254255When any of these keys are present, skip the corresponding question and use the provided value. Announce which values were pre-filled: *"Using choices from repo-init: tools (Copilot, Claude Code), shell (bash)."* so the user can correct anything before proceeding.256257---258259## Guidelines260261- **Detect before acting.** Never assume what files exist — always scan first.262- **Prefer `AGENTS.md` for new setups.** It has the broadest native support and avoids vendor lock-in.263- **Surface multi-file divergence immediately.** When multiple configs exist, checking sync is always the first thing to offer.264- **Omission is not drift.** A config that doesn't mention a tool is not wrong. Only flag explicit contradictions or stale mentions.265- **Never overwrite user content.** Sentinel blocks define the safe zone. Everything outside is off limits without explicit user permission.266- **Ask one question at a time.** Even during the init interview, keep each prompt focused on a single decision.267- **Preview before write.** Always show what will be written and get confirmation before touching any file.268- **Suppressions are permanent.** Once a user suppresses a drift signal, never re-raise it in future runs.269- **Be concise in reports.** Show tool name, file, and the conflict — not paragraphs. Keep drift reports scannable.270271---272> Source: [feimacode/feima-copilot-ai-flow](https://github.com/feimacode/feima-copilot-ai-flow) — distributed by [TomeVault](https://tomevault.io).273<!-- tomevault:4.0:skill_md:2026-06-15 -->