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 alivirgo/Major-AI-Skills --skill compact-guard-clausesgit clone --depth 1 https://github.com/alivirgo/Major-AI-SkillsWrote 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/alivirgo/major-ai-skills/compact-guard-clauses)<a href="https://agentmods.dev/skills/alivirgo/major-ai-skills/compact-guard-clauses"><img src="https://agentmods.dev/badge/skills/alivirgo/major-ai-skills/compact-guard-clauses/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/alivirgo/major-ai-skills/compact-guard-clauses"><img src="https://agentmods.dev/badge/skills/alivirgo/major-ai-skills/compact-guard-clauses.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.00026 | $0.01269 |
| Opus 5 | $0.00013 | $0.00634 |
| Sonnet 5 | $0.00005 | $0.00254 |
| Haiku 4.5 | $0.00003 | $0.00127 |
Grade A, and why
compact-guard-clauses 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 yesterday.
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.
How it starts
The opening of the file, as written. The whole thing — 126 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Compact Guard Clauses (Early-Return Pattern)
Overview
Default AI code generation often falls into the "Pyramid of Doom" anti-pattern: nesting execution logic 4 to 6 levels deep inside cascading if/else checks ("if user exists $\rightarrow$ if authorized $\rightarrow$ if has active plan $\rightarrow$ if payment valid...").
Deeply nested code increases cyclomatic complexity, wastes 2 to 6 tokens per line on leading indentation whitespace, and creates cognitive fatigue during subsequent code reviews and diff patching.
The Compact Guard Clause Protocol (also known as the Bouncer Pattern) checks for failure conditions at the very top of the function and returns/raises immediately, allowing the primary "happy path" to execute unnested at root indentation.
Nested Pyramid vs. Early-Return Guard Clauses
┌─────────────────────────────────────────────────────────────┐
│ Indentation & Nesting Impact │
│ │
│ Nested Pyramid of Doom (Deep Nesting / Token Bloat): │
│ function processOrder(order) { │
│ if (order !== null) { │
│ if (order.isValid) { │
│ if (order.items.length > 0) { │
│ // 25 lines indented 8 spaces deep... │
│ return executeCheckout(order); │
│ } else { return { err: "Empty items" }; } │
│ } else { return { err: "Invalid order" }; } │
│ } else { return { err: "Null order" }; } │
│ } │
│ │
│ Linear Guard Clauses (Bouncer Pattern - 40% Fewer Tokens): │
│ function processOrder(order) { │
│ if (!order) return { err: "Null order" }; │
│ if (!order.isValid) return { err: "Invalid order" }; │
│ if (!order.items.length) return { err: "Empty items" }; │
│ │
│ // Happy path executes flat at root level │
│ return executeCheckout(order); │
│ } │
└─────────────────────────────────────────────────────────────┘
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.
- yesterday Changed · -11 tokens per session b1cfb52f51e4
- 7d ago First seen · 126 lines · 37 tokens per session scan A e9dc90790b3d
compact-guard-clauses is a skill published in the GitHub repository alivirgo/Major-AI-Skills (1 stars, last pushed today), licensed MIT. It adds 26 tokens to every session and 1,269 once invoked, about $0.0001 per session on Opus 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-09-05.
Other skills, from other repositories
clean-code-detect-smells
This skill should be used when the user asks to "find code smells", "review code quality", mentions "code smells", "technical debt", discusses identifying problematic code patterns, or wants a systematic code quality assessment.
agenttrace-session-audit
Audit local AI coding-agent sessions with agenttrace for cost, tool failures, latency, anomalies, health, diffs, and CI gates.
systemic-issue-triage
Trigger: new issue, bug report, triage, backlog, issue flood, community report, root cause, dead-end, blocked user. Attack issues by root class, never one-by-one; fixes must shrink the system, not grow it.
issue-root-resolution
Trigger: root audit, atacar la raíz, issue roots, backlog roots, mechanism map, deletion-driven fix, resolver issues de raíz, close outdated issues. Audit and resolve issue clusters by verified root cause.
rdd-defect-workflow
Trigger: RDD, receipt-driven development, review authority, receipt/lineage, correction/recovery, delivery gate/kill switch, bounded review defects. Guide work.
autofix
Review and repair current local changes until they converge, or run Qwen Code Autofix issue and review workflows from GitHub Actions.