---
name: rigstate-integrity-gate
description: Handles the Pre-Deployment Compliance Gate, automated quality audits (Security/Performance), and generation of the Strategic Release Manifest. Use this whenever you are finishing a task or moving code towards completion.
version: "1.0.0"
specialist: Frank (The Orchestrator)
governance: SOFT_LOCK
---

---
name: rigstate-integrity-gate
description: Handles the Pre-Deployment Compliance Gate, automated quality audits (Security/Performance), and generation of the Strategic Release Manifest. Use this whenever you are finishing a task or moving code towards completion.
version: "1.0.0"
specialist: Frank (The Orchestrator)
governance: SOFT_LOCK
---

# 🎖️ Rigstate Integrity Gate Skill (Fortress Enabled)

This skill defines the high-level protocol for ensuring code quality and security before a task is marked as "COMPLETED". It orchestrates specialized agents (Sven, Sindre) and generates the audit trail known as the **Strategic Release Manifest**.

## 🔄 The Protocol Workflow

Whenever you are ready to complete a task, follow this mandatory 3-step sequence:

### 1. Audit (The Scan)
Run the `audit_integrity_gate` tool. This will trigger the **Fortress Matrix** checks:
- **SEC-SQL-01 (Parameterized Only):** Blocking any string-interpolated SQL.
- **SEC-RLS-01 (Mandatory RLS):** Validating RLS on all migration tables.
- **SEC-KEY-01 (Secret Scanner):** Scanning for hardcoded keys and tokens.
- **SEC-AUTH-04 (Identity Context):** Verifying ownership filters in API routes.

### 2. Decision (The Gate)
Evaluate the result from `audit_integrity_gate`:
- **Mode: OPEN:** All critical checks passed. You can proceed to completion.
- **Mode: SOFT_LOCK:** Warnings found (e.g. SEC-UI-01). Report to user.
- **Mode: HARD_LOCK:** Critical violations (SEC-SQL/RLS/KEY) detected. Completion is strictly blocked.

### 3. Manifest (The Release)
Upon passing the gate, use the `complete_roadmap_task` tool.
- Pass the **full JSON response** from the `audit_integrity_gate` into the `integrityGate` parameter.
- This automatically generates the **Strategic Release Manifest** in the Mission Report.

## 🛠️ Tools Used by this Skill

- `audit_integrity_gate`: Orchestrates the security and performance scans.
- `complete_roadmap_task`: Finalizes the task and attaches the quality certificate.

## 📝 Best Practices

- **Never skip the audit.** Even if you think the change is small, the Integrity Gate is our source of truth.
- **Explain violations clearly.** If in `SOFT_LOCK`, list the specific tables lacking RLS or the specific files with N+1 issues.
- **Summarize the Manifest.** After successful completion, tell the user: "Release Manifest generated with [X] security passes and [Y] performance checks."

---
*Provisioned by Rigstate CLI. Do not modify manually.*