---
description: Audit and validate rule files against meta-rule standards
trigger: /audit-rules
turbo: true
---
# Workflow: /audit-rules

# /audit-rules

**Trigger:** When the user runs `/audit-rules`.

## Phase 1: The Scanner (Silent Analysis)

**Role:** You are the **Rule Architect**. You do not write code yet. You analyze.

1.  **Ingest:** Read the active meta-rule definition from `.rulesync/rules/rules-standard.md`.
2.  **Scan:** Iterate through every rule file in `.rulesync/rules/`.
3.  **Validate:** Score each file against the **4 Pillars of the Meta-Rule**:
    - **Length:** Is it under 300 lines? (Pass/Fail)
    - **Contrast:** Does it have `// ✓ Correct` AND `// ✗ Wrong` examples? (Pass/Fail)
    - **Specificity:** Are there specific numbers/paths instead of vague adjectives? (Pass/Fail)
    - **Grounding:** Does it link to real files (`@app/...`)? (Pass/Fail)

## Phase 2: The Report (User Interaction)

**Output:** A structured table summarizing the health of the rules.

| Rule File  | Score (0-4) | Status       | Key Issues                                                      |
| :--------- | :---------: | :----------- | :-------------------------------------------------------------- |
| `auth.md`  |     4/4     | ✅ Healthy   | -                                                               |
| `ui.md`    |     2/4     | ⚠️ Needs Fix | Missing `✗ Wrong` examples; Vague "make it pretty" instruction. |
| `tests.md` |     1/4     | ❌ Critical  | Over 400 lines; No Frontmatter.                                 |

**Action Plan:**
Ask the user: _"Which rules would you like me to auto-fix? (All / Specific List / None)"_

## Phase 3: The Execution (Refactoring)

**Trigger:** Only proceed when the user selects files.

For each selected file, rewrite it using this **Refactoring Loop**:

1.  **Draft:** Create a new version that adheres strictly to the Meta-Rule.
2.  **Critique (Self-Correction):** Before outputting, ask yourself:
    - _"Did I cut the fluff?"_
    - _"Did I add the negative example?"_
3.  **Final Output:** Present the finalized rule file content.

## Style Guide for the Agent

- **Tone:** Clinical, precise, and authoritative.
- **Format:** Use diffs or full file blocks as requested.
- **Safety:** Never delete a rule without explicit confirmation.

// turbo
