Skip to content
Back to skills

Rules To Hooks Auditor

ASecurity

Use when auditing CLAUDE.md / AGENTS.md / rules and migrating probabilistic processes to deterministic hooks — stop, pre-tool-use, post-tool-use, start-session, sub-agent-stop. Triggers on "auditoria rules hooks", "converter rules em hooks", "hooks create skill", "garantias determinísticas", "test enforcement", ".env block", "security hooks", "stop hook tests".

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 19, 2026
ai-agentsgorailsgitsecurity

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned September 19, 2026

npx -y skills add majinmagros/magros.ai-skills --skill rules-to-hooks-auditor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rules To Hooks Auditor?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rules To Hooks Auditor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majinmagros-rules-to-hooks-auditor/badge)](https://www.skillsdirectory.com/skills/majinmagros-rules-to-hooks-auditor)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rules-to-hooks-auditor
description: Use when auditing CLAUDE.md / AGENTS.md / rules and migrating probabilistic processes to deterministic hooks — stop, pre-tool-use, post-tool-use, start-session, sub-agent-stop. Triggers on "auditoria rules hooks", "converter rules em hooks", "hooks create skill", "garantias determinísticas", "test enforcement", ".env block", "security hooks", "stop hook tests".
metadata:
  origin: ECC
  source_docs:
    - https://github.com/coleam00/hooks-create-skill (referenciado no vídeo Cole Medin)
    - https://docs.anthropic.com/en/docs/claude-code/hooks
    - https://context7.com/anthropic/claude-code
  skills_used:
    - hookify-rules
    - agent-guardrails
    - criar-skill
---

# Rules to Hooks Auditor — Auditoria Automatizada Rules → Hooks

Converte **regras probabilísticas** (em `CLAUDE.md`, `AGENTS.md`, `.claude/rules/`) em **hooks determinísticos** que garantem execução (exit code 0/2) — baseado no framework do vídeo do Cole Medin "Watch This If Your Coding Agent is Ignoring Your Rules (You Need Hooks)".

## Quando usar (gatilhos concretos)

- "Audite meus rules e me diga quais virar hooks"
- "Converta CLAUDE.md em hooks determinísticos"
- "Meu agente ignora rules — preciso de garantias"
- "Bloquear leitura de .env / comandos perigosos"
- "Garantir que testes rodem no final da conversa"
- "Injetar contexto no start da sessão"
- "Observar ações do agente (post-tool-use logging)"

## Quando NÃO usar

- Criar hooks do zero sem rules base (use `hookify-rules` direto)
- Events não mapeados em rules existentes
- Hooks para ferramentas customizadas não cobertas por rules

## Pipeline (baseado no vídeo + docs oficiais)

### 1. Descoberta & Parsing (Input)
Lê arquivos de rules do projeto:
- `CLAUDE.md` (raiz + path-specific)
- `AGENTS.md` (se existir)
- `.claude/rules/**/*.md` (rules modulares)
- `.claude/settings.json` (hooks já existentes)

Extrai **linhas/seções** que nomeiam **eventos** (processos) vs **judgments** (convenções).

### 2. Classificação (Core Logic)
Para cada regra extraída, classifica:

| Tipo | Exemplo | Ação |
|---|---|---|
| **Judgment/Convention** | "money is integer cents never floats" | **Manter como rule** (encode judgment) |
| **Process/Event** | "after implementing run the tests" | **→ Stop Hook** |
| **Process/Event** | "never read .env file" | **→ PreToolUse Hook** |
| **Process/Event** | "when session starts read decisions.md" | **→ StartSession Hook** |
| **Process/Event** | "before editing routes read rag/citations.py" | **→ PreToolUse Hook (file coupling)** |
| **Process/Event** | "log every command you run" | **→ PostToolUse Hook** |
| **Process/Event** | "never run recursive force delete" | **→ PreToolUse Hook (security)** |
| **Vago/Inútil** | "write clean code" | **Deletar** (modelo já sabe) |

**Heurística**: "Is this naming an event or encoding a judgment?" (pergunta do vídeo)

### 3. Geração de Hook (Output)
Para cada **Process/Event** identificado, gera:

## Exemplo

```text
CLAUDE.md: "after implementing run the tests" (processo) → Stop hook (exit 2 se falha)
"money is integer cents" (judgment) → mantém como rule; "write clean code" → deleta
"never read .env" → PreToolUse block; "log every command" → PostToolUse
```

Files in this skill

  • SKILL.md3.2 KB
  • references/hook-templates/posttool-log-actions.py2.4 KB
  • references/hook-templates/pretool-block-env.py3.4 KB
  • references/hook-templates/pretool-block-rm-rf.py2.9 KB
  • references/hook-templates/startsession-inject-context.py3.5 KB
  • references/hook-templates/stop-run-tests.py6.4 KB
  • references/hook-templates/subagentstop-audit.py4.3 KB
  • references/rule-classifier.md5.7 KB
  • references/settings-patch-examples.json1.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…