Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add Cratis/AI --skill safeguarding-ai-generated-codegit clone --depth 1 https://github.com/Cratis/AIWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/cratis/ai/safeguarding-ai-generated-code)<a href="https://agentmods.dev/skills/cratis/ai/safeguarding-ai-generated-code"><img src="https://agentmods.dev/badge/skills/cratis/ai/safeguarding-ai-generated-code/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/cratis/ai/safeguarding-ai-generated-code"><img src="https://agentmods.dev/badge/skills/cratis/ai/safeguarding-ai-generated-code.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00045 | $0.00545 |
| Opus 5.5 | $0.00018 | $0.00218 |
| Sonnet 5.5 | $0.00009 | $0.00109 |
| Haiku 4.5 | $0.00005 | $0.00055 |
Grade A, and why
safeguarding-ai-generated-code scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Safeguarding AI-Generated Code
Use only in repositories that opted into cratis/codescene and have CodeScene MCP tools available; otherwise skip without blocking and say so. The Cratis policy in .cratis/ai/rules/codescene.md overrides this skill where they differ.
Overview
Use Code Health safeguards before declaring AI-touched code ready. The goal is to catch maintainability regressions early and prevent agents from normalizing technical debt.
When to Use
- The agent changed code and is about to suggest a commit.
- The user asks whether a branch or staged changes are safe to merge.
- The workflow needs a quality gate for AI-generated code.
Do not use this skill for broad refactoring discovery or project-level prioritization.
Quick Reference
code_health_review: Review each AI-modified file immediately after the change.pre_commit_code_health_safeguard: Check staged or modified files before commit.analyze_change_set: Check a branch or PR-style change set against a base ref.
Implementation
- After each AI modification to a file, run
code_health_reviewon that file. - If the review reports maintainability problems or regression risk, refactor the file in small steps and review it again.
- Run
pre_commit_code_health_safeguardbefore commit-oriented recommendations as a broader gate across staged or modified files. - Run
analyze_change_setbefore PR-oriented recommendations as a final branch-level gate. - If either later gate reports a regression, inspect the affected files with
code_health_reviewand keep iterating until the issue is removed or the user explicitly accepts the risk.
Common Mistakes
- Waiting until commit time to run the first Code Health check.
- Treating safeguard output as optional guidance instead of a release gate.
- Declaring work done after a failing safeguard.
- Jumping straight to broad rewrites instead of inspecting the flagged files first.
- Treating an accepted risk as invisible; call it out explicitly.
What ships with it
2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago Changed · -56 tokens per session 5e31ebcb0c7d
- 1mo ago Changed · +43 tokens per session 4cf47b0641ee
- 1mo ago Changed 3c8bbfb76788
- 1mo ago First seen · 45 lines · 58 tokens per session scan A 5efc92798ac6
safeguarding-ai-generated-code is a skill published in the GitHub repository Cratis/AI (4 stars, last pushed yesterday), licensed MIT. It adds 45 tokens to every session and 545 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-11.
safeguarding-ai-generated-code compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| safeguarding-ai-generated-codeCratis/AI | Skill | 4 | yesterday | MIT | A | 45 | Claude Code, Codex |
| local-ai-agentsmicrosoft/ai-agents-for-beginners | Skill | 82k | today | MIT | A | 200 | Claude Code, Codex |
| imagegenopenai/codex | Skill | 137k | today | Apache-2.0 | A | 113 | Codex |
| playwright-climicrosoft/playwright | Skill | 102k | today | Apache-2.0 | A | 19 | Claude Code |
| browser-automationopenclaw/openclaw | Skill | 396k | today | MIT | A | 36 | Claude Code |
| free-llm-apismnfst/awesome-free-llm-apis | Skill | 15k | today | CC0-1.0 | A | 113 | Claude Code, Codex |
| next-cache-components-adoptionvercel/next.js | Skill | 144k | today | MIT | A | 95 | Claude Code |