governance-check
Skill4 starsChanged 6 months agoMITView on GitHub
Run governance fitness function checks against staged changes or the full project. Validates code quality, security, and architecture standards.
- Reads credentials
- Deletes or force-pushes
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- plugin/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- plugin/CLAUDE.mdCLAUDE.md
- create-adrSkill
- eu-ai-act-checkSkill
- governance-setupSkill
- iso-42001-checkSkill
- spec-driven-devSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Run the requested governance check category.
- Distinctive: line 23
Consequence classification: If the task involves irreversible operations (production deploy, data migration, credential rotation), classify …
- Distinctive: line 27
Before running checks, detect the project's primary language:
- Distinctive: line 36
If multiple indicators exist, check all relevant languages.
- Distinctive: line 73
Check the full branch diff against base:
- Very specific: line 120
When a check maps to a DSGAI control, include the reference in the output line (e.g., [DSGAI02]).
- Distinctive: line 122
If all checks pass, congratulate the user.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Governance Fitness Function Check
Run the requested governance check category. Default to all if no argument provided.
Scope and When to Use
This is a QUICK checklist tool — single-category, fast pass/fail, actionable remediation. Use for:
- Pre-commit spot checks on staged changes
- Quick validation before pushing
- Verifying a specific category (secrets, file size, etc.)
For deep multi-file review with severity grading and domain invariant analysis, use the governance-reviewer agent instead.
Consequence classification: If the task involves irreversible operations (production deploy, data migration, credential rotation), classify as In-the-Loop regardless of task type. [DSGAI19]
Project Type Detection
Before running checks, detect the project's primary language:
| Indicator | Language |
package.json | JS/TS |
pyproject.toml, requirements.txt, setup.py | Python |
go.mod | Go |
Cargo.toml | Rust |
If multiple indicators exist, check all relevant languages. If none match, apply generic checks.
Check Categories
pre-commit
Scan staged/changed files for:
- Hardcoded secrets — Search for patterns:
API_KEY=,password=,sk-,sk-ant-,ghp_,AKIA, hardcoded token strings,-----BEGIN PRIVATE KEY-----, JWT tokens (eyJ...), Google API keys (AIza...), Azure connection strings, MongoDB URIs. PII patterns (email, SSN, credit card) generate warnings [DSGAI01]. Usegit diff --cachedorgit diffto get changed content. - Input validation — New API endpoints/route handlers MUST have input validation. Check for language-appropriate validation:
- JS/TS: Zod, joi, yup, express-validator
- Python: pydantic, marshmallow, cerberus
- Go: go-validator, custom validation functions
- Rust: serde with validation, validator crate
- Parameterized queries — Database queries must use parameterized queries, not string interpolation. Search for SQL string concatenation patterns.
- File size — No file should exceed 800 lines. Use
wc -lon changed files. - Function length — No function should exceed 50 lines. Use Grep to find function definitions and count lines.
- Immutability — Check for direct mutation patterns (
.push(,obj.prop =on shared state,delete obj.prop). - Debug prints — No debug prints in production code (allow in test files):
- JS/TS:
console.log - Python:
print((excluding logging) - Go:
fmt.Println(excluding structured logging) - Rust:
println!
- JS/TS:
- Dangerous functions — Flag usage of:
- JS/TS:
eval(),innerHTML - Python:
eval(),exec(),pickle.loads() - Go:
unsafe.Pointer - Rust:
unsafeblocks
- JS/TS:
- Agent credentials — Check for hardcoded OAuth tokens, bearer tokens, refresh tokens, client secrets in code and config files. Patterns:
Bearer,oauth_token=,refresh_token=,client_secret=,Authorization: Bearer. Reference: [DSGAI02]. - AI model artifacts — Flag committed model files (
.onnx,.safetensors,.gguf,.pt,.pkl,.bin>10MB). These should be tracked via Git LFS or external artifact registry, not committed directly. [DSGAI04] - Unsafe deserialization — Flag
torch.load(),pickle.load(),pickle.loads(),yaml.unsafe_load(),joblib.load()without safe alternatives (weights_only=True,safetensors). [DSGAI04] - AI dependency pinning — In requirements.txt/pyproject.toml, flag unpinned AI packages (torch, transformers, openai, anthropic, langchain) using
>=or no version pin. [DSGAI04] - Telemetry hygiene — Flag patterns logging full prompts/contexts in production:
log.*prompt,log.*context,logger.*user_input,console.log.*messages,logging.*completion. Allow in test/debug files. [DSGAI14] - Telemetry redaction — If observability configs exist (OpenTelemetry, Datadog, Sentry), verify PII/prompt scrubbing is configured. [DSGAI14]
pre-pr
Check the full branch diff against base:
- Conventional commits — All commits on this branch must follow format:
type: descriptionwhere type is one of: feat, fix, refactor, docs, test, chore, perf, ci. Usegit log --oneline. - DOMAIN.md — If entity schemas changed (new fields, new entities, changed types), DOMAIN.md must be updated.
- Breaking changes — API contract changes (removed fields, changed types, removed endpoints) must be documented in an ADR.
- Test coverage — Changed files should have corresponding test files. Check for test file existence.
- TODO context — All TODO comments must include context about what needs to be done and why.
architecture
Periodic architecture review:
- Service boundaries — No direct cross-service database access. Services communicate through APIs.
- Error message safety — Error responses must not leak stack traces, internal paths, or sensitive data.
- Authentication — All non-health-check endpoints require authentication.
- Rate limiting — Public endpoints should have rate limiting configured.
- Cache consistency — Cache TTL policies are documented and consistent.
- Plugin/MCP security — If the project uses Claude Code plugins or MCP servers: (a) plugins are from trusted sources, (b) MCP tool permissions follow least-privilege (no
"allowed-tools": ["*"]), (c).mcp.jsoncontains no hardcoded credentials. Check.claude/settings.jsonand MCP configs. Reference: [DSGAI06]. - Context minimization — Verify that session-start hooks stay under ~500 tokens, CLAUDE.md does not contain secrets or PII, and rules files do not embed real credentials as examples. Reference: [DSGAI15].
- Agent credential hygiene — Verify agent
.mdfiles and skill frontmatter contain no embedded credentials or API keys. Reference: [DSGAI02]. - Shadow AI policy — If project has
shadow-ai-policy.md, verify approved AI tooling is documented. Flag references to unsanctioned AI tool endpoints in source code or configs. [DSGAI03] - Irreversible operation safeguards — Scripts/code performing destructive operations (DROP TABLE,
rm -rf, force push, production deploy) must have confirmation gates or dry-run modes. [DSGAI19] - Session isolation — Agent memory/state must be scoped per-project and per-user. Cache keys must include user/project/session scope. Flag global state stores without scope qualifiers. [DSGAI11]
- Multi-tenant data separation — In multi-tenant code, verify tenant ID is included in all database queries, cache keys, and file paths. Flag shared state without tenant scoping. [DSGAI11]
Output Format
Present results as a structured checklist:
## Governance Check: [category]
### Passed
- [x] No hardcoded secrets found
- [x] File sizes within limits
### Failed
- [ ] FAIL: `src/api/handler.ts` — 923 lines (max 800)
- [ ] FAIL: Missing input validation in `POST /api/users`
### Warnings
- [!] `src/utils/helper.ts:45` — TODO without context
### Summary
Passed: X/Y | Failed: Z | Warnings: WWhen a check maps to a DSGAI control, include the reference in the output line (e.g., [DSGAI02]). For compliance mapping, see docs/compliance/DSGAI-MAPPING.md [DSGAI08]. Data classification guidance: examples/DATA-CLASSIFICATION.md.example [DSGAI07].
If all checks pass, congratulate the user. If any fail, provide specific file paths, line numbers, and remediation guidance.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

