AI Code Governance
Use this skill to turn an AI coding agent into a project maintainer: inspect first, reuse existing architecture, make the smallest useful change, verify it, and leave the project easier to continue.
This skill applies both when starting a new project and when joining an existing project midstream.
Choose The Mode
- Project adoption: Use when the user asks to add, install, initialize, or improve AI coding governance for a repo, including Codex or Claude Code setup.
- Engineering task: Use when the user asks for feature work, bug fixes, refactors, reviews, dependency changes, build/tooling changes, or cleanup of AI-generated code.
- If both apply, do project adoption first, then do the engineering task.
Project Adoption Workflow
When adding this skill to an existing project, do not assume the templates describe reality. Build the rules from the actual codebase.
- Inspect the current repo:
README, package/build config, test config, source tree, existing AGENTS.md, CLAUDE.md, CODEX.md, and docs/.
- Identify authoritative implementations: request/client layer, routing, state, UI primitives, hooks/composables, services, utilities, types, design tokens, tests, and scripts.
- Create or update project rules:
AGENTS.md: shared coding-agent rules.
CLAUDE.md: Claude Code entry point; point to or import AGENTS.md.
CODEX.md: Codex entry point; point to AGENTS.md.
docs/architecture.md: architecture contract and layer boundaries.
docs/project-index.md: real reusable modules and ownership map.
docs/dependency-policy.md: approved dependencies and prohibited duplicates.
docs/coding-standards.md: project-specific coding rules.
docs/agent-workflows.md: task, review, refactor, and dependency workflows.
- Replace template examples with real project paths. If a fact is unknown, mark it as
TBD or needs confirmation; never present a guessed path as authoritative.
- If governance files already exist, merge conservatively. Preserve project-specific rules and remove only clear duplication.
- Recommend quality scripts, but do not modify
package.json or lockfiles unless the user approves the dependency/tooling change.
- End with an adoption report: files created/updated, discovered reusable modules, unresolved unknowns, recommended next checks.
For Claude Code project-level installation, the same skill can also live at .claude/skills/ai-code-governance/SKILL.md. For personal Claude Code use, install it at ~/.claude/skills/ai-code-governance/SKILL.md.
Engineering Task Workflow
- Read available project rules:
AGENTS.md, CLAUDE.md, CODEX.md, docs/architecture.md, docs/project-index.md, docs/dependency-policy.md, docs/coding-standards.md, and docs/agent-workflows.md.
- Search before writing. Prefer
rg/rg --files and inspect existing components, hooks/composables, services, stores, utils, types, styles, tests, and scripts.
- Form a concise implementation plan that names the files to reuse and change. If the user explicitly asks for plan-only or approval-first work, stop after the plan. Otherwise proceed with the smallest safe implementation.
- Reuse or extend existing modules. Add a new module only when there is no suitable owner and the new file has one clear responsibility.
- Gate dependency changes. Before modifying
package.json or lockfiles, explain why existing tools are insufficient and ask for confirmation.
- Keep the change scoped. Do not modify unrelated files, rewrite large modules, or create parallel implementations.
- Verify with the project's available commands. Common checks include
npm run lint, npm run typecheck, npm run test, npm run format, npm run dupcheck, npm run unused, and npm run check.
- Update governance docs when the change creates or removes an authoritative reusable module, public workflow, dependency decision, or architecture rule.
- End with a change report: what changed, what was reused, dependency impact, verification results, and remaining risks.
Non-Negotiables
- Do not duplicate an existing component, hook/composable, service, store, utility, type, request wrapper, date library, validation layer, modal/button/loading/empty component, or state-management approach.
- Do not add unapproved dependencies.
- Do not keep mock, temporary, fallback, compatibility, or experimental code unless the user explicitly asked for it.
- Do not bypass checks by weakening lint, type, or test rules.
- Do not claim a command passed if it was not run or does not exist.
- Do not hardcode style values when the project has design tokens or a style system.
Search Checklist
Search using task-specific names plus these generic terms:
component
hook
composable
service
store
utils
helper
type
interface
request
client
api
format
validate
modal
button
loading
empty
error
storage
token
Output Shapes
For approval-first work, use this plan shape:
## Understanding
...
## Existing Implementation
- ...
## Reuse Plan
- ...
## Change Plan
- Modify: ...
- Add: ...
- Remove: ...
## Dependency Impact
No new dependencies. / Needs approval because ...
## Verification
- ...
## Risks
- ...
For completed work, use this summary shape:
## Summary
...
## Files
- Modified: ...
- Added: ...
- Removed: ...
## Reuse
...
## Deduplication
...
## Dependencies
...
## Verification
- ...
## Risks / Next Steps
...
Supporting Resources
templates/: starter project governance files for AGENTS, Claude Code, Codex, and docs.
prompts/: reusable prompts for preflight, implementation, refactor, and review workflows.
snippets/: optional quality-check config examples.
1---2name: ai-code-governance3description: Governance workflow for AI coding agents such as Codex, Claude Code, Cursor, and Copilot Workspace. Use when implementing features, fixing bugs, refactoring, reviewing AI-generated code, adopting governance in an existing project, creating or updating AGENTS.md, CLAUDE.md, CODEX.md, architecture docs, project indexes, dependency policies, and coding standards. Enforces search-before-write, reuse of existing components/hooks/services/stores/utils/types, dependency control, small maintainable changes, verification, and clear change reports.4---56# AI Code Governance78Use this skill to turn an AI coding agent into a project maintainer: inspect first, reuse existing architecture, make the smallest useful change, verify it, and leave the project easier to continue.910This skill applies both when starting a new project and when joining an existing project midstream.1112## Choose The Mode1314- **Project adoption**: Use when the user asks to add, install, initialize, or improve AI coding governance for a repo, including Codex or Claude Code setup.15- **Engineering task**: Use when the user asks for feature work, bug fixes, refactors, reviews, dependency changes, build/tooling changes, or cleanup of AI-generated code.16- If both apply, do project adoption first, then do the engineering task.1718## Project Adoption Workflow1920When adding this skill to an existing project, do not assume the templates describe reality. Build the rules from the actual codebase.21221. Inspect the current repo: `README`, package/build config, test config, source tree, existing `AGENTS.md`, `CLAUDE.md`, `CODEX.md`, and `docs/`.232. Identify authoritative implementations: request/client layer, routing, state, UI primitives, hooks/composables, services, utilities, types, design tokens, tests, and scripts.243. Create or update project rules:25 - `AGENTS.md`: shared coding-agent rules.26 - `CLAUDE.md`: Claude Code entry point; point to or import `AGENTS.md`.27 - `CODEX.md`: Codex entry point; point to `AGENTS.md`.28 - `docs/architecture.md`: architecture contract and layer boundaries.29 - `docs/project-index.md`: real reusable modules and ownership map.30 - `docs/dependency-policy.md`: approved dependencies and prohibited duplicates.31 - `docs/coding-standards.md`: project-specific coding rules.32 - `docs/agent-workflows.md`: task, review, refactor, and dependency workflows.334. Replace template examples with real project paths. If a fact is unknown, mark it as `TBD` or `needs confirmation`; never present a guessed path as authoritative.345. If governance files already exist, merge conservatively. Preserve project-specific rules and remove only clear duplication.356. Recommend quality scripts, but do not modify `package.json` or lockfiles unless the user approves the dependency/tooling change.367. End with an adoption report: files created/updated, discovered reusable modules, unresolved unknowns, recommended next checks.3738For Claude Code project-level installation, the same skill can also live at `.claude/skills/ai-code-governance/SKILL.md`. For personal Claude Code use, install it at `~/.claude/skills/ai-code-governance/SKILL.md`.3940## Engineering Task Workflow41421. Read available project rules: `AGENTS.md`, `CLAUDE.md`, `CODEX.md`, `docs/architecture.md`, `docs/project-index.md`, `docs/dependency-policy.md`, `docs/coding-standards.md`, and `docs/agent-workflows.md`.432. Search before writing. Prefer `rg`/`rg --files` and inspect existing components, hooks/composables, services, stores, utils, types, styles, tests, and scripts.443. Form a concise implementation plan that names the files to reuse and change. If the user explicitly asks for plan-only or approval-first work, stop after the plan. Otherwise proceed with the smallest safe implementation.454. Reuse or extend existing modules. Add a new module only when there is no suitable owner and the new file has one clear responsibility.465. Gate dependency changes. Before modifying `package.json` or lockfiles, explain why existing tools are insufficient and ask for confirmation.476. Keep the change scoped. Do not modify unrelated files, rewrite large modules, or create parallel implementations.487. Verify with the project's available commands. Common checks include `npm run lint`, `npm run typecheck`, `npm run test`, `npm run format`, `npm run dupcheck`, `npm run unused`, and `npm run check`.498. Update governance docs when the change creates or removes an authoritative reusable module, public workflow, dependency decision, or architecture rule.509. End with a change report: what changed, what was reused, dependency impact, verification results, and remaining risks.5152## Non-Negotiables5354- Do not duplicate an existing component, hook/composable, service, store, utility, type, request wrapper, date library, validation layer, modal/button/loading/empty component, or state-management approach.55- Do not add unapproved dependencies.56- Do not keep mock, temporary, fallback, compatibility, or experimental code unless the user explicitly asked for it.57- Do not bypass checks by weakening lint, type, or test rules.58- Do not claim a command passed if it was not run or does not exist.59- Do not hardcode style values when the project has design tokens or a style system.6061## Search Checklist6263Search using task-specific names plus these generic terms:6465```text66component67hook68composable69service70store71utils72helper73type74interface75request76client77api78format79validate80modal81button82loading83empty84error85storage86token87```8889## Output Shapes9091For approval-first work, use this plan shape:9293```md94## Understanding95...9697## Existing Implementation98- ...99100## Reuse Plan101- ...102103## Change Plan104- Modify: ...105- Add: ...106- Remove: ...107108## Dependency Impact109No new dependencies. / Needs approval because ...110111## Verification112- ...113114## Risks115- ...116```117118For completed work, use this summary shape:119120```md121## Summary122...123124## Files125- Modified: ...126- Added: ...127- Removed: ...128129## Reuse130...131132## Deduplication133...134135## Dependencies136...137138## Verification139- ...140141## Risks / Next Steps142...143```144145## Supporting Resources146147- `templates/`: starter project governance files for AGENTS, Claude Code, Codex, and docs.148- `prompts/`: reusable prompts for preflight, implementation, refactor, and review workflows.149- `snippets/`: optional quality-check config examples.