AGENT SKILL

rule-delivery-gate

Pre-commit gate over staged trait and role injections. Use when composing a role that carries the `ai-hats-dev` trait, or when diagnosing why the rule-delivery hook blocked a commit.

License 许可
MIT
所属仓库
muratovv/ai-hats
最近更新
2026-11-05
Stars
★ 3
Forks
1

01 前言 Front Matter

name
rule-delivery-gate
ai_hats
{ "type": "skill", "schema_version": 1 }
license
MIT
description
Pre-commit gate over staged trait and role injections. Use when composing a role that carries the `ai-hats-dev` trait, or when diagnosing why the rule-delivery hook blocked a commit.

02 资源文件 1

03 SKILL.md 正文

Rule Delivery Gate

Pure-infrastructure hook-carrier skill. It contributes one git pre-commit hook that enforces the rule-delivery contract: a see rule X pointer in a delivered trait/role injection must name a rule the agent can actually read. There is no agent-side decision logic here — the value is delivered entirely through composition.

What it gates

  • Scope: fires only when a commit stages a trait/role injection — {ai_hats_library,library}/**/config.yaml: the monorepo package, or the pre-monorepo library/ the e2e fixtures use. The check then scans that library root at the checkout, because a pointer's validity depends on rule existence across the library, not a single diff. With no library root at the checkout the gate is a loud, journalled skip.
  • Not a consumer's libraries/: this skill ships in the ai-hats-dev layer, which is addressed to the ai-hats repository, not to a consuming project.
  • Invariant: every see rule X must resolve to a rule that exists in the library. A pointer to a non-existent rule blocks the commit.
  • Effect: the same pure function the G2 unit test uses (python -m ai_hats.rule_delivery <library root>) returns non-zero → commit blocked with the offending source: see rule X lines.

Because the scope is the changed files, the gate only fires on commits that touch an injection — it never retro-blocks the pre-existing library.

Who gets it

Whatever composes this skill, and nothing else: the hook is written into .githooks/pre-commit.d/ at composition time, so a role that does not carry it never sees the gate. The server-side counterpart is the G2 unit test, run by CI on every PR/push to master.

How to bypass

Fix the pointer — create the missing rule in the library or drop the pointer — or, after confirming the pointer is intentional, ask the supervisor to skip the gate for a single commit: AI_HATS_RULE_DELIVERY_ACK=1, exported in the shell that runs the commit. Writing it onto your own command line is refused — see safety-guard.

If python / the ai_hats package is unavailable the hook is a loud no-op (fail-open): it prints a SKIPPED notice and allows the commit, so a missing dev tool never wedges work. Inside an ai-hats dev/agent env the package is present, so the gate is live.

Overrides

  • AI_HATS_RULE_DELIVERY_ACK=1 — allow the current commit despite findings.
  • AI_HATS_RULE_DELIVERY_CMD — override the checker invocation (default: -m ai_hats.rule_delivery under the checkout's own .venv/bin/python3, else python3 on PATH); used by the test suite to inject a stub.

04 同仓库更多 Skills

muratovv
muratovv/ai-hats

tool-evaluation-protocol

Time-bounded protocol for evaluating new tools, libraries, or methodologies before adoption. Use when evaluating a candidate dependency for the project, researching a methodology (e.g. ML/LLM frameworks, testing approaches), or following up on a hype-driven recommendation.

★ 3
muratovv
muratovv/ai-hats

systematic-debugging

4-phase bug-fix protocol (evidence, pattern, hypothesis, verify). Use when investigating any error, failure, or unexpected behavior, handling bug reports from users or monitoring, or diagnosing test failures with non-obvious causes.

★ 3
muratovv
muratovv/ai-hats

skill-template

Canonical template and validation guide for ai-hats skills. Use when creating a new skill, reviewing an existing one for structural compliance, or deciding which pattern fits a new behavior.

Skill与智能体开发
★ 3
muratovv
muratovv/ai-hats

skill-optimization

Audit and refactor library components to eliminate redundancy and staleness. Use during periodic library maintenance, after adding multiple new skills or rules, when a role's token budget is too high, or after retrospectives identify component issues.

Skill与智能体开发
★ 3
muratovv
muratovv/ai-hats

silent-fallback-gate

PreToolUse hook — refuses an Edit or Write that adds an inert broad except. Use when a Python edit was blocked for a silent fallback.

★ 3
muratovv
muratovv/ai-hats

retro-to-framework

Convert an observation about agent behavior — from a retrospective or from a single incident — into a framework-level change (hook, rule, skill, skill update). Use after a retrospective identifies problems that are not project-specific, after an incident where an agent misapplied a component it had read, when CLAUDE.md band-aids accumulate (more than 3 per-project rules that could be generic), or when the same problem recurs across multiple projects.

Skill与智能体开发
★ 3