Adaptive Triple AI validation for OpenSpec proposals and code implementation.
This skill adds Triple AI validation to OpenSpec workflows, combining Claude's decision-making with Gemini's technical review and creative challenge capabilities.
┌─────────────────────────────────────────────────────────┐
│ TRIPLE AI ARCHITECTURE │
├─────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ │
│ │ CLAUDE │ 60% - Author + Final Decision │
│ │ (Orchestrator) │
│ └──────┬──────┘ │
│ │ │
│ ┌─────┴─────┐ │
│ ▼ ▼ │
│ ┌──────┐ ┌──────────┐ │
│ │Gemini│ │ Gemini │ 20% each │
│ │Review│ │Challenger│ (or Validator in Apply) │
│ └──────┘ └──────────┘ │
│ │
└─────────────────────────────────────────────────────────┘
Not every task needs full validation. The skill intelligently routes based on complexity:
| Confidence | Route | When Used |
|---|---|---|
| HIGH (90%+) | Claude Only | Standard patterns, proven solutions |
| MEDIUM (60-89%) | + Reviewer | New patterns, needs validation |
| LOW (<60%) | Full Triple AI | Complex, uncertain, multiple approaches |
10-step workflow for validating proposals before implementation:
- Creates
proposal.md,design.md,tasks.md - Validates Clean Architecture compliance
- Ensures TDD strategy completeness
- Gemini Challenger proposes alternatives with conviction scores
9-step workflow for validated code implementation:
- Layer-based parallel execution (Domain → App → Infra+UI)
- TDD enforcement (RED → GREEN → REFACTOR)
- Deviation detection and handling
- Quality gates at each phase
- Clean Architecture: 4-layer separation with inward dependencies
- TDD First: Tests before implementation, coverage targets per layer
- Parallel Execution: Work distributed by architectural layer
- Highest Standards: No shortcuts, production-quality code
# Clone this repo
git clone https://github.com/YOUR_USERNAME/openspec-triple-ai-skill.git
# Copy skill to your project
cp -r openspec-triple-ai-skill/gemini-claude-loop YOUR_PROJECT/.claude/skills/# Add to your shell profile (.bashrc, .zshrc, etc.)
export GEMINI_API_KEY="your-api-key-here"Get your API key from Google AI Studio.
# CLAUDE.md
When "skill" keyword is mentioned during openspec work:
- Use gemini-claude-loop for Triple AI validation
- Follow PROPOSAL_LOOP.md for proposals
- Follow APPLY_LOOP.md for implementationopenspec proposal skill
or in conversation:
"Create a proposal for user authentication feature using skill"
openspec apply skill
or in conversation:
"Apply the approved proposal using skill"
Design review workflow with confidence-based AI routing.
┌─────────────────────────────────────────────────────────────────────────────┐
│ PROPOSAL LOOP WORKFLOW │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 1: CREATE DOCUMENTS │ │
│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
│ │ │ proposal.md │ │ design.md │ │ tasks.md │ │ │
│ │ │ What & Why │ │ Architecture │ │ TDD Tasks │ │ │
│ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 2: CONFIDENCE ASSESSMENT │ │
│ │ │ │
│ │ Claude evaluates complexity and determines routing: │ │
│ │ ┌─────────────────────────────────────────────────┐ │ │
│ │ │ Per-Section Analysis → Overall Score (0-100%) │ │ │
│ │ └─────────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌───────────────────────┼───────────────────────┐ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
│ │ HIGH (90%+) │ │ MEDIUM (60-89%) │ │ LOW (<60%) │ │
│ │ ══════════════ │ │ ══════════════ │ │ ══════════════ │ │
│ │ │ │ │ │ │ │
│ │ Claude Only │ │ Claude │ │ Claude │ │
│ │ ┌────────────┐ │ │ ┌────────────┐ │ │ ┌────────────┐ │ │
│ │ │ Claude │ │ │ │ Claude │ │ │ │ Claude │ │ │
│ │ │ (100%) │ │ │ │ (60%) │ │ │ │ (60%) │ │ │
│ │ └────────────┘ │ │ └─────┬──────┘ │ │ └─────┬──────┘ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ ▼ │ │ ┌────┴────┐ │ │
│ │ │ │ ┌──────────┐ │ │ ▼ ▼ │ │
│ │ │ │ │ Reviewer │ │ │ ┌────────┐ ┌─────────┐ │
│ │ │ │ │ (20%) │ │ │ │Reviewer│ │Challenger│ │
│ │ │ │ └──────────┘ │ │ │ (20%) │ │ (20%) │ │
│ │ │ │ │ │ └────────┘ └─────────┘ │
│ │ │ │ │ │ Parallel Run │
│ │ ───── FAST ────▶│ │ │ │ │ │
│ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │
│ │ │ │ │
│ │ ┌──────┴──────┐ ┌──────┴──────┐ │
│ │ ▼ │ ▼ │ │
│ │ ┌─────────────────┐ │ ┌─────────────────┐│ │
│ │ │ STEP 4: SYNTH │ │ │ STEP 4: SYNTH ││ │
│ │ │ Compare Results │ │ │ + Conviction ││ │
│ │ └────────┬────────┘ │ └────────┬────────┘│ │
│ │ │ │ │ │ │
│ │ ▼ │ ▼ │ │
│ │ ┌─────────────────┐ │ ┌─────────────────┐│ │
│ │ │ STEP 5: VALIDATE│ │ │ STEP 5: VALIDATE││ │
│ │ │ Accept/Modify/ │ │ │ High Conviction ││ │
│ │ │ Skip Feedback │ │ │ (8+) = MUST FIX ││ │
│ │ └────────┬────────┘ │ └────────┬────────┘│ │
│ │ │ │ │ │ │
│ │ ▼ │ ▼ │ │
│ │ ┌─────────────────┐ │ ┌─────────────────┐│ │
│ │ │ STEP 6: REVISE │ │ │ STEP 6: REVISE ││ │
│ │ │ Update Docs │ │ │ Update Docs ││ │
│ │ └────────┬────────┘ │ └────────┬────────┘│ │
│ │ │ │ │ │ │
│ │ ▼ │ ▼ │ │
│ │ ┌─────────────────┐ │ ┌─────────────────┐│ │
│ │ │ STEP 7: RE-REV? │ │ │ STEP 7: RE-REV? ││ │
│ │ │ Critical Issue? │ │ │ Max 3 iterations││ │
│ │ │ ─► Loop Back │ │ │ ─► Loop Back ││ │
│ │ └────────┬────────┘ │ └────────┬────────┘│ │
│ │ │ │ │ │ │
│ └─────────────┴──────────────┴───────────┴─────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 8: LGTM │ │
│ │ ┌─────────────────────────────────────────────────────────────┐ │ │
│ │ │ "I validated and confirm LGTM" - Claude (ONLY decision maker)│ │ │
│ │ └─────────────────────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 9: CONSISTENCY CHECK │ │
│ │ │ │
│ │ proposal.md ←→ design.md ←→ tasks.md │ │
│ │ │ │
│ │ MATCH? ─────► Continue │ │
│ │ MISMATCH? ──► User decides which doc is authoritative │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 10: USER CONFIRMATION │ │
│ │ ┌─────────────────────────────────────────────────────────────┐ │ │
│ │ │ "Apply openspec?" ─► Yes ─► Apply Loop │ │ │
│ │ └─────────────────────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
Code implementation workflow with TDD and layer-based parallel execution.
┌─────────────────────────────────────────────────────────────────────────────┐
│ APPLY LOOP WORKFLOW │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 1: PLAN PHASE │ │
│ │ │ │
│ │ Load approved proposal and identify: │ │
│ │ • Architectural layers and their tasks │ │
│ │ • Dependencies between layers │ │
│ │ • TDD strategy and coverage targets │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 2: LAYER DISTRIBUTION │ │
│ │ │ │
│ │ PHASE 1 PHASE 2 PHASE 3 │ │
│ │ ════════ ════════ ════════ │ │
│ │ ┌────────┐ ┌────────────┐ ┌─────────┐ ┌────────┐ │ │
│ │ │ DOMAIN │ ────► │APPLICATION │ ────► │ INFRA │ │ UI │ │ │
│ │ │ 90%cov │ │ 85%cov │ │ 80%cov │ │ 70%cov │ │ │
│ │ └────────┘ └────────────┘ └─────────┘ └────────┘ │ │
│ │ D-001,D-002 A-001,A-002 I-001 U-001 │ │
│ │ (parallel) (sequential) (parallel with UI) │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 3-6: IMPLEMENT EACH TASK (Repeat per layer) │ │
│ │ │ │
│ │ ┌───────────────────────────────────────────────────────────┐ │ │
│ │ │ TDD CYCLE (per task) │ │ │
│ │ │ │ │ │
│ │ │ ┌─────────┐ ┌─────────┐ ┌──────────┐ │ │ │
│ │ │ │ RED │ ───► │ GREEN │ ───► │ REFACTOR │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ Write │ │ Minimal │ │ Improve │ │ │ │
│ │ │ │ Failing │ │ Code to │ │ Quality │ │ │ │
│ │ │ │ Test │ │ Pass │ │ │ │ │ │
│ │ │ └─────────┘ └─────────┘ └──────────┘ │ │ │
│ │ │ │ │ │ │ │
│ │ │ ▼ ▼ │ │ │
│ │ │ npm test npm test │ │ │
│ │ │ → FAIL ✓ → PASS ✓ │ │ │
│ │ └───────────────────────────────────────────────────────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌───────────────────────────────────────────────────────────┐ │ │
│ │ │ CONFIDENCE ROUTING │ │ │
│ │ │ │ │ │
│ │ │ HIGH (90%+) MEDIUM LOW (<60%) │ │ │
│ │ │ │ │ │ │ │ │
│ │ │ ▼ ▼ ▼ │ │ │
│ │ │ Skip Review ┌─────────┐ ┌─────────────────┐ │ │ │
│ │ │ │ │Reviewer │ │Reviewer+Validator│ │ │ │
│ │ │ │ │Technical│ │ (parallel) │ │ │ │
│ │ │ │ │ Check │ │ │ │ │ │
│ │ │ │ └────┬────┘ └────────┬─────────┘ │ │ │
│ │ │ │ │ │ │ │ │
│ │ │ └────────────────┴────────────────────┘ │ │ │
│ │ └───────────────────────────────────────────────────────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌───────────────────────────────────────────────────────────┐ │ │
│ │ │ STEP 5: DEVIATION HANDLING (if plan mismatch) │ │ │
│ │ │ │ │ │
│ │ │ MINOR Auto-approve, update tasks.md │ │ │
│ │ │ MODERATE Claude decides, notify user │ │ │
│ │ │ MAJOR User approval required │ │ │
│ │ │ CRITICAL STOP - User decision blocking │ │ │
│ │ └───────────────────────────────────────────────────────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌───────────────────────────────────────────────────────────┐ │ │
│ │ │ STEP 6: QUALITY GATE (ALL must pass) │ │ │
│ │ │ │ │ │
│ │ │ ┌──────────┐ ┌──────────┐ ┌────────┐ ┌───────┐ │ │ │
│ │ │ │npm test │ │typecheck │ │ lint │ │ build │ │ │ │
│ │ │ │ PASS │ │ PASS │ │ PASS │ │ PASS │ │ │ │
│ │ │ └──────────┘ └──────────┘ └────────┘ └───────┘ │ │ │
│ │ │ │ │ │
│ │ │ FAIL? ─► Fix and repeat Step 3-6 │ │ │
│ │ └───────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 7: PHASE COMPLETE │ │
│ │ │ │
│ │ ┌──────────────────────────────────────────────────────────┐ │ │
│ │ │ Domain Phase Complete! │ │ │
│ │ │ ├─ D-001: ✓ TDD Complete, 94% coverage │ │ │
│ │ │ └─ D-002: ✓ TDD Complete, 91% coverage │ │ │
│ │ │ │ │ │
│ │ │ Next: Application Phase ─────────────────────► Loop │ │ │
│ │ └──────────────────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ (Repeat for all phases) │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 8: FINAL LGTM │ │
│ │ │ │
│ │ ┌──────────────────────────────────────────────────────────┐ │ │
│ │ │ All Phases Complete: │ │ │
│ │ │ ├─ Phase 1 (Domain): ✓ COMPLETE │ │ │
│ │ │ ├─ Phase 2 (Application): ✓ COMPLETE │ │ │
│ │ │ └─ Phase 3 (Infra + UI): ✓ COMPLETE │ │ │
│ │ │ │ │ │
│ │ │ "I validated and confirm LGTM" - Claude │ │ │
│ │ └──────────────────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ STEP 9: DOCUMENT SYNC │ │
│ │ │ │
│ │ Update: │ │
│ │ • tasks.md ─► Mark complete, actual coverage │ │
│ │ • design.md ─► Document any deviations │ │
│ │ • proposal.md ─► Add implementation notes │ │
│ │ │ │
│ │ ══════════════════════════════════════════════════════ │ │
│ │ IMPLEMENTATION COMPLETE │ │
│ │ ══════════════════════════════════════════════════════ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ │
│ PROPOSAL LOOP (Design) APPLY LOOP (Code) │
│ ══════════════════════ ═════════════════ │
│ │
│ 1. Create Docs 1. Plan Layers │
│ 2. Confidence Check ─┐ 2. Distribute Tasks │
│ │ │ 3. TDD: RED─GREEN─REFACTOR │
│ ├─ HIGH ──► LGTM │ 4. AI Review (by confidence) │
│ ├─ MEDIUM ► +Rev │ 5. Handle Deviations │
│ └─ LOW ───► +Rev+Chall 6. Quality Gate │
│ 3-7. Review Cycle │ 7. Phase Complete ─► Loop │
│ 8. LGTM │ 8. Final LGTM │
│ 9. Consistency │ 9. Sync Docs │
│ 10. "Apply?" ────────┴─────────────► │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
| Script | Role | Temperature | Purpose |
|---|---|---|---|
gemini-reviewer.cjs |
Technical Validator | 0.3 | Feasibility, security, Clean Architecture |
gemini-challenger.cjs |
Creative Disruptor | 0.7 | Alternatives, conviction scores |
gemini-validator.cjs |
Compliance Checker | 0.3 | Plan compliance, deviation handling |
# Technical review
node .claude/skills/gemini-claude-loop/scripts/gemini-reviewer.cjs "Review this: [content]"
# Creative challenge
node .claude/skills/gemini-claude-loop/scripts/gemini-challenger.cjs "Challenge this: [content]"
# Compliance validation
node .claude/skills/gemini-claude-loop/scripts/gemini-validator.cjs "[implementation]" "[plan]"Challenger provides conviction scores to prioritize feedback:
| Score | Meaning | Required Action |
|---|---|---|
| 9-10 | Critical flaw in current approach | MUST address |
| 7-8 | Significant improvement possible | SHOULD address |
| 5-6 | Notable benefits | Consider |
| 3-4 | Minor improvement | Optional |
| 1-2 | Current approach is fine | AGREE allowed |
gemini-claude-loop/
├── SKILL.md # Main skill definition
├── PROPOSAL_LOOP.md # 10-step proposal workflow
├── APPLY_LOOP.md # 9-step implementation workflow
└── scripts/
├── gemini-reviewer.cjs # Technical validation
├── gemini-challenger.cjs # Creative alternatives
└── gemini-validator.cjs # Plan compliance
- Claude Code CLI
- OpenSpec installed in project
- Gemini API Key (gemini-3-pro-preview model)
- Node.js 18+ (for running scripts)
| Layer | Default Target |
|---|---|
| Domain | 90% |
| Application | 85% |
| Infrastructure | 80% |
| UI | 70% |
- Maximum 3 iterations per review cycle
- After 3: escalate to user decision
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
MIT License - see LICENSE for details.
- OpenSpec - Spec-driven development framework
- Claude Code - Anthropic's CLI for Claude
Built for the OpenSpec community to enable higher-quality AI-assisted development through multi-model validation.