awesome-docs
Generate, convert, and maintain animated GitHub-safe Markdown documents with animated SVG diagrams. Covers four SVG patterns…
Generate and enforce policy gates for AI coding agents (Copilot, Claude Code) — real-time session hooks that deny protected-path edits and dangerous commands, plus a merge-time backstop for anything that bypasses them. Use when asked to "govern AI agents", "block AI from
Claude Code
$ npx -y skills add nitinjain999/platform-skills --skill ai-governance --agent claude-code
Codex
$ npx skills add nitinjain999/platform-skills --skill ai-governance -a codex -y
Cursor
$ npx skills add nitinjain999/platform-skills --skill ai-governance -a cursor -y
Gemini CLI
$ npx skills add nitinjain999/platform-skills --skill ai-governance -a gemini-cli -y
GitHub Copilot
$ npx skills add nitinjain999/platform-skills --skill ai-governance -a github-copilot -y
OpenCode
$ npx skills add nitinjain999/platform-skills --skill ai-governance -a opencode -y
Windsurf
$ npx skills add nitinjain999/platform-skills --skill ai-governance -a windsurf -y
name: ai-governance description: Generate and enforce policy gates for AI coding agents (Copilot, Claude Code) — real-time session hooks that deny protected-path edits and dangerous commands, plus a merge-time backstop for anything that bypasses them. Use when asked to "govern AI agents", "block AI from touching secrets", "add an AI policy gate", or "why did the AI agent hook not fire". argument-hint: "[generate|check|audit|explain] [path]" title: "AI Governance Command" sidebar_label: "ai-governance" custom_edit_url: null
Generate and enforce a policy gate for AI coding agents operating on this repo: real-time session hooks for Copilot and Claude Code, plus a merge-time GitHub Actions check that catches anything the hooks miss.
Read `references/ai-governance.md` before responding.
---
When invoked with no arguments, ask before proceeding:
**Q1 — Mode?**
What do you need? 1. generate — scaffold policy, evaluator, hooks, and merge-time check 2. check — dry-run the evaluator against a path, command, or diff 3. audit — scan repos in an org for policy presence, tier, and drift 4. explain — plain-English translation of an existing .ai-governance.yaml Enter 1-4 or mode name:
**Q2 — Context** (after mode selected, one at a time):
Then proceed into the relevant mode below.
---
Scaffold the policy file, evaluator, session hooks, and merge-time check for this repo.
Steps:
1. Detect which AI tools are configured (`.github/copilot/`, `.claude/`, `.cursor/`, `.codex/` if present) and which CI system is in use — reuse the scan approach `setup-agents.md` already implements; do not reimplement it.
2. Write `.ai-governance.yaml` with the chosen default pack. All packs share this shape; only `protected_paths` differs:
**generic:**
version: 1
source: local
enforcement: audit
protected_paths:
- ".github/workflows/**"
- ".github/hooks/**"
- ".claude/settings.json"
- ".ai-governance.yaml"
- ".ai-governance/**"
- "**/secrets/**"
denied_commands:
- "rm -rf"
- "git push --force"
max_diff_files: 25
require_disclosure: true**terraform** (adds): `"**/*.tfstate"`, `"iam/**"` to `protected_paths`; adds `"terraform apply"` to `denied_commands`.
**kubernetes** (adds): `"**/rbac/**"`, `"**/*secret*.yaml"` to `protected_paths`; adds `"kubectl delete"` to `denied_commands`.
**blank**: same shape, empty `protected_paths`/`denied_commands` — for a team that wants to author its own list from the CODEOWNERS-mandatory paths onward.
3. Copy `examples/ai-governance/evaluate.sh` into `.ai-governance/evaluate.sh` in the target repo, executable bit set (`chmod +x`).
4. Check for `yq` v4 (`command -v yq && yq --version`). If it is missing, stop and ask the user to install it: Homebrew (`brew install yq`) on macOS, their distribution's package, or a release binary from github.com/mikefarah/yq/releases checked against its published checksum. Never install it yourself. It needs `sudo`, and this binary parses the file that decides what the agent may touch, so where it comes from is the user's call. In CI, `ubuntu-latest` already ships yq v4, and `examples/ai-governance/ai-governance-check.yml` pins and verifies its own copy.
5. Write `.github/hooks/preToolUse.json`:
{
"version": 1,
"hooks": {
"preToolUse": [
{"type": "command", "bash": ".ai-governance/evaluate.sh --mode=hook --platform=copilot --event=preToolUse", "timeoutSec": 10}
]
}
}And `.github/hooks/postToolUse.json` (same shape, `--event=postToolUse`). This one is not a second gate. `--event=postToolUse` short-circuits before the policy is even loaded: it appends one `completed` line to the audit log, emits no decision, and exits 0. It never re-evaluates `protected_paths` or `denied_commands` — the call has already run by then, and re-deciding would duplicate the audit line `preToolUse` already wrote for the same call under `audit` or `warn`:
{
"version": 1,
"hooks": {
"postToolUse": [
{"type": "command", "bash": ".ai-governance/evaluate.sh --mode=hook --platform=copilot --event=postToolUse", "timeoutSec": 10}
]
}
}**On Claude Code, prefer the plugin:** with `platform-guardrails@platform-skills` enabled, the `PreToolUse`/`PostToolUse` gate already ships from the plugin and switches on in any project that commits `.ai-governance.yaml`. Skip the settings merge below in that case (a second wiring would evaluate every call twice), and keep only the policy file and `.ai-governance/` assets in the repository.
6. **Merge, never overwrite** `.claude/settings.json`.
Claude Code's `settings.json` hook registration is **three levels deep**, not two: each event key holds an array of *matcher-group* objects, and each matcher group holds its own inner `hooks` array of handler objects. `matcher` is optional — omitting it means "match every tool call", which is what this policy wants (every call gets evaluated, not just one tool):
{
"hooks": {
"PreToolUse": [
{
"hooks": [
{"type": "command", "command": ".ai-governance/evaluate.sh --mode=hook --platform=claude --event=PreToolUse"}
]
}
]
}
}Merge into that structure with `jq`, appending a new matcher group whether or not the event key already has entries, and skipping the append if this exact command is already registered so re-running `generate` is idempotent:
A production-grade field handbook for platform, DevOps, SRE, and cloud engineers covering Kubernetes, Flux CD, Terraform, GitHub Actions, AWS, OPA/Rego, KEDA, Karpenter, supply chain security, Falco, observability, and more.
Generate, convert, and maintain animated GitHub-safe Markdown documents with animated SVG diagrams. Covers four SVG patterns…
Manage AWS profiles for MCP servers — discover SSO, Granted and role-chain profiles, check authentication with STS, switch…
Structured guidance for AWS CloudFront distributions, WAF web ACLs, Lambda@Edge, CloudFront Functions, Firewall Manager…
Azure identity (Workload Identity, OIDC, Entra ID), resource tagging, AKS platform patterns, RBAC scoping, and…
Back up and restore Kubernetes workloads with Velero, and prove recovery works. Covers Velero on EKS via Flux (IRSA, S3 backup…
Design, run, and debug Chaos Engineering experiments on Kubernetes using Litmus Chaos v3 and Chaos Mesh v2. Covers fault…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.