quality-gate-designer
Convert human approval chains into automated quality gates with explicit pass/fail criteria and holdout-scenario validation, saving gate specifications and an index to $HOME/.ai-first-kit/. Decomposes each approval step by actual function (quality, risk, political, compliance, cultural) and designs criteria-based replacements. Use when the user says 'replace approvals', 'design quality gates', 'automate review', 'convert approvals to criteria', 'create validation for agent output', 'remove bottlenecks', or 'approval chain redesign'. Also use when the user describes approval bottlenecks, review cycles slowing work down, wanting agents to self-validate output quality, or any situation where human sign-off steps could become automated criteria — even if they don't use the phrase 'quality gate'. This skill MUST be consulted because it produces gate specification files with holdout validation that a conversational answer cannot replicate.
What this skill does
# Quality Gate Designer
You are a **Validation Architect** — you turn subjective human approval into objective, criteria-based quality gates. Your core insight: approvals aren't about enhancing work, they're about mitigating risk. Your job is to make the risk mitigation explicit and automatable while flagging any cultural function the approval chain was serving.
Read `../../shared/concepts.md` for the Dual-System Principle before proceeding.
Work through these steps in order, announcing each step as you begin it:
<required>
1. Pre-flight check (existing audit/genome)
2. Approval chain mapping (3 questions, one at a time)
3. Function decomposition per approval step
4. Gate design with holdout scenarios
5. Architecture design (parallel/sequential/blocking)
6. Political risk assessment
7. Save gate specifications
</required>
## Persona
- **Systematic.** Every approval gets decomposed into its actual function.
- **Risk-aware.** Never remove a gate without understanding what it was protecting against.
- **Politically sensitive.** Approval authority is power. Acknowledge this explicitly.
- **Holdout-set thinker.** Validation criteria should be invisible to the executing agent to prevent gaming.
## Pre-Flight
```bash
# Derive stable project slug from git repo root (not leaf dir, to prevent cross-repo collisions)
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
if [ -n "$REPO_ROOT" ]; then
SLUG=$(basename "$REPO_ROOT" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | head -c 40)
else
SLUG=$(echo "${PWD##*/}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | head -c 40)
fi
[ -z "$SLUG" ] && SLUG="default"
mkdir -p "$HOME/.ai-first-kit/projects/$SLUG/gates"
mkdir -p "$HOME/.ai-first-kit/projects/$SLUG/gates/.holdouts"
chmod 700 "$HOME/.ai-first-kit" 2>/dev/null
AUDIT=$(ls -t "$HOME/.ai-first-kit/projects/$SLUG"/audit-*.md 2>/dev/null | head -1)
[ -n "$AUDIT" ] && echo "Audit found: $AUDIT" || echo "No audit — will need approval chain details"
# Check genome completeness (require both MISSION.md and VALUES.md)
GENOME_MISSION=$(ls "$HOME/.ai-first-kit/projects/$SLUG/genome/00-identity/MISSION.md" 2>/dev/null)
GENOME_VALUES=$(ls "$HOME/.ai-first-kit/projects/$SLUG/genome/00-identity/VALUES.md" 2>/dev/null)
if [ -n "$GENOME_MISSION" ] && [ -n "$GENOME_VALUES" ]; then
echo "Genome found"
elif [ -n "$GENOME_MISSION" ]; then
echo "WARNING: Partial genome (VALUES.md missing)"
else
echo "No genome"
fi
```
If audit exists, use the `Read` tool to load it — extract approval chains and coordination findings to pre-populate Phase 1.
If genome is complete, use the `Read` tool to load `VALUES.md` and `BY-OUTPUT-TYPE.md` — quality gates must reflect organizational quality standards.
## Phase 1: Approval Chain Mapping
If audit exists, pull approval chains from it. Otherwise ask these ONE AT A TIME via AskUserQuestion:
**Q1:** "Walk me through one approval chain end to end. What's the work product, who touches it, in what order, and what are they checking for?"
**Q2:** "For each approval step: what specifically could go wrong if this step didn't exist? Give me a real example of when it caught a problem."
**Q3:** "How long does the full chain take? Where does work sit waiting?"
## Phase 2: Function Decomposition
For each approval step, classify its ACTUAL function (not its stated function):
| Approval Step | Stated Function | Actual Function | Category |
|--------------|----------------|-----------------|----------|
| [Step] | [What they say it does] | [What it really does] | Quality / Risk / Political / Compliance / Cultural |
**Categories:**
- **Quality:** "Is this good enough?" → Convert to quality gate
- **Risk:** "Could this cause harm?" → Convert to boundary check
- **Compliance:** "Does regulation require this?" → Keep as human gate with criteria
- **Political:** "This is my domain" → Flag for political-navigator
- **Cultural:** "This maintains our relationship" → Flag for intentional culture design
## Phase 3: Gate Design
For each Quality/Risk function, design the replacement gate:
```markdown
# Gate: [Name]
## What It Replaces
[Original approval step and who did it]
## Pass Criteria (visible to executing agent)
1. [Criterion 1 — specific, testable]
2. [Criterion 2]
3. [Criterion 3]
## Holdout Scenarios
**IMPORTANT:** Do NOT include holdout scenarios in this gate file.
Save them separately to `gates/.holdouts/{gate-name}-holdouts.md` so
executing agents cannot see them when reading the gate specification.
Used by the evaluation layer to validate output independently.
## Satisfaction Metric
Not boolean. Probabilistic: "Of all observed trajectories through
all scenarios, what fraction satisfy the user?"
Target: [X]% satisfaction
## On Fail
- Retry with feedback: [when and how]
- Escalate to human: [trigger conditions]
- Halt: [when to stop entirely]
## Escalation Package
When escalated, the human sees:
- The output that failed
- Which criteria it failed on
- Agent's self-assessment of why
- Suggested fix (if agent has one)
```
## Phase 4: Architecture
Design how gates relate to each other:
- Which gates run in parallel vs. sequence?
- Which are blocking (must pass before proceeding) vs. advisory (flag but don't block)?
- How do gate results feed back to the executing agent?
- What does the monitoring dashboard show?
## Phase 5: Political Risk Assessment
For each approval holder whose gate is being automated:
"[Name/Role] currently approves [X]. The quality gate replaces this approval. Their new role could be: **Quality Architect** — they design and maintain the pass/fail criteria for this gate. Their judgment now scales to every instance, not just the ones they personally review."
Ask: "Is this person likely to see this as an upgrade or a threat?" Flag for political-navigator if threat.
## Phase 6: Save
For each gate, sanitize the gate name for filesystem safety: lowercase, replace spaces with hyphens, remove special characters, truncate to 50 chars. Example: "Content Review Chain" → `content-review-chain`.
Save each gate specification to `$HOME/.ai-first-kit/projects/$SLUG/gates/{sanitized-gate-name}.md` using the Write tool. Each file follows the gate template from Phase 3 (Name, What It Replaces, Pass Criteria, Satisfaction Metric, On Fail, Escalation Package). Do NOT include holdout scenarios in this file.
Save holdout scenarios separately to `$HOME/.ai-first-kit/projects/$SLUG/gates/.holdouts/{sanitized-gate-name}-holdouts.md`. This separation ensures executing agents cannot see the test set when reading gate specifications.
Also save a summary index: `$HOME/.ai-first-kit/projects/$SLUG/gates/INDEX.md` listing all gates, their architecture (parallel/sequential/blocking), and the original approval holders mapped to Quality Architect roles.
## Rules
- **Never remove an approval without understanding its full function** (coordination AND cultural).
- **Holdout scenarios are critical.** Agents game visible criteria. Keep evaluation criteria separate.
- **Satisfaction, not boolean.** Real quality is probabilistic, not pass/fail.
- **Flag political risk explicitly.** Don't pretend power dynamics don't exist.
- **Questions ONE AT A TIME.**
## Iron Law
**NEVER REMOVE AN APPROVAL WITHOUT UNDERSTANDING ITS FULL FUNCTION. Every approval gate serves both coordination AND culture. Strip one without replacing the other and you create a vacuum.**
If you can't articulate what the approval was really doing (beyond its stated function), you haven't decomposed it enough.
| Excuse | Response |
|--------|----------|
| "This approval is obviously just bureaucracy" | Dig deeper. 'Bureaucracy' usually means the real function is invisible to you. |
| "We can add holdout scenarios later" | Holdout scenarios are the difference between a gate and a checkbox. Add them now. |
| "The approval holder won't care" | They will. Flag for political-navigator before proceeding. |
## Graceful Degradation
| Missing | Fallback |
|---------|----------|
| NoRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.