chore(agent): configure AI agents and tools
Add configuration for BMad, Claude, OpenCode, and other AI agent tools and workflows.
This commit is contained in:
125
.agent/skills/Confidence Check/SKILL.md
Normal file
125
.agent/skills/Confidence Check/SKILL.md
Normal file
@@ -0,0 +1,125 @@
|
||||
---
|
||||
name: Confidence Check
|
||||
description: Pre-implementation confidence assessment (≥90% required). Use before starting any implementation to verify readiness with duplicate check, architecture compliance, official docs verification, OSS references, and root cause identification.
|
||||
allowed-tools: Read, Grep, Glob, WebFetch, WebSearch
|
||||
---
|
||||
|
||||
# Confidence Check Skill
|
||||
|
||||
## Purpose
|
||||
|
||||
Prevents wrong-direction execution by assessing confidence **BEFORE** starting implementation.
|
||||
|
||||
**Requirement**: ≥90% confidence to proceed with implementation.
|
||||
|
||||
**Test Results** (2025-10-21):
|
||||
- Precision: 1.000 (no false positives)
|
||||
- Recall: 1.000 (no false negatives)
|
||||
- 8/8 test cases passed
|
||||
|
||||
## When to Use
|
||||
|
||||
Use this skill BEFORE implementing any task to ensure:
|
||||
- No duplicate implementations exist
|
||||
- Architecture compliance verified
|
||||
- Official documentation reviewed
|
||||
- Working OSS implementations found
|
||||
- Root cause properly identified
|
||||
|
||||
## Confidence Assessment Criteria
|
||||
|
||||
Calculate confidence score (0.0 - 1.0) based on 5 checks:
|
||||
|
||||
### 1. No Duplicate Implementations? (25%)
|
||||
|
||||
**Check**: Search codebase for existing functionality
|
||||
|
||||
```bash
|
||||
# Use Grep to search for similar functions
|
||||
# Use Glob to find related modules
|
||||
```
|
||||
|
||||
✅ Pass if no duplicates found
|
||||
❌ Fail if similar implementation exists
|
||||
|
||||
### 2. Architecture Compliance? (25%)
|
||||
|
||||
**Check**: Verify tech stack alignment
|
||||
|
||||
- Read `CLAUDE.md`, `PLANNING.md`
|
||||
- Confirm existing patterns used
|
||||
- Avoid reinventing existing solutions
|
||||
|
||||
✅ Pass if uses existing tech stack (e.g., Supabase, UV, pytest)
|
||||
❌ Fail if introduces new dependencies unnecessarily
|
||||
|
||||
### 3. Official Documentation Verified? (20%)
|
||||
|
||||
**Check**: Review official docs before implementation
|
||||
|
||||
- Use Context7 MCP for official docs
|
||||
- Use WebFetch for documentation URLs
|
||||
- Verify API compatibility
|
||||
|
||||
✅ Pass if official docs reviewed
|
||||
❌ Fail if relying on assumptions
|
||||
|
||||
### 4. Working OSS Implementations Referenced? (15%)
|
||||
|
||||
**Check**: Find proven implementations
|
||||
|
||||
- Use Tavily MCP or WebSearch
|
||||
- Search GitHub for examples
|
||||
- Verify working code samples
|
||||
|
||||
✅ Pass if OSS reference found
|
||||
❌ Fail if no working examples
|
||||
|
||||
### 5. Root Cause Identified? (15%)
|
||||
|
||||
**Check**: Understand the actual problem
|
||||
|
||||
- Analyze error messages
|
||||
- Check logs and stack traces
|
||||
- Identify underlying issue
|
||||
|
||||
✅ Pass if root cause clear
|
||||
❌ Fail if symptoms unclear
|
||||
|
||||
## Confidence Score Calculation
|
||||
|
||||
```
|
||||
Total = Check1 (25%) + Check2 (25%) + Check3 (20%) + Check4 (15%) + Check5 (15%)
|
||||
|
||||
If Total >= 0.90: ✅ Proceed with implementation
|
||||
If Total >= 0.70: ⚠️ Present alternatives, ask questions
|
||||
If Total < 0.70: ❌ STOP - Request more context
|
||||
```
|
||||
|
||||
## Output Format
|
||||
|
||||
```
|
||||
📋 Confidence Checks:
|
||||
✅ No duplicate implementations found
|
||||
✅ Uses existing tech stack
|
||||
✅ Official documentation verified
|
||||
✅ Working OSS implementation found
|
||||
✅ Root cause identified
|
||||
|
||||
📊 Confidence: 1.00 (100%)
|
||||
✅ High confidence - Proceeding to implementation
|
||||
```
|
||||
|
||||
## Implementation Details
|
||||
|
||||
The TypeScript implementation is available in `confidence.ts` for reference, containing:
|
||||
|
||||
- `confidenceCheck(context)` - Main assessment function
|
||||
- Detailed check implementations
|
||||
- Context interface definitions
|
||||
|
||||
## ROI
|
||||
|
||||
**Token Savings**: Spend 100-200 tokens on confidence check to save 5,000-50,000 tokens on wrong-direction work.
|
||||
|
||||
**Success Rate**: 100% precision and recall in production testing.
|
||||
171
.agent/skills/Confidence Check/confidence.ts
Normal file
171
.agent/skills/Confidence Check/confidence.ts
Normal file
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
* Confidence Check - Pre-implementation confidence assessment
|
||||
*
|
||||
* Prevents wrong-direction execution by assessing confidence BEFORE starting.
|
||||
* Requires ≥90% confidence to proceed with implementation.
|
||||
*
|
||||
* Test Results (2025-10-21):
|
||||
* - Precision: 1.000 (no false positives)
|
||||
* - Recall: 1.000 (no false negatives)
|
||||
* - 8/8 test cases passed
|
||||
*/
|
||||
|
||||
export interface Context {
|
||||
task?: string;
|
||||
duplicate_check_complete?: boolean;
|
||||
architecture_check_complete?: boolean;
|
||||
official_docs_verified?: boolean;
|
||||
oss_reference_complete?: boolean;
|
||||
root_cause_identified?: boolean;
|
||||
confidence_checks?: string[];
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assess confidence level (0.0 - 1.0)
|
||||
*
|
||||
* Investigation Phase Checks:
|
||||
* 1. No duplicate implementations? (25%)
|
||||
* 2. Architecture compliance? (25%)
|
||||
* 3. Official documentation verified? (20%)
|
||||
* 4. Working OSS implementations referenced? (15%)
|
||||
* 5. Root cause identified? (15%)
|
||||
*
|
||||
* @param context - Task context with investigation flags
|
||||
* @returns Confidence score (0.0 = no confidence, 1.0 = absolute certainty)
|
||||
*/
|
||||
export async function confidenceCheck(context: Context): Promise<number> {
|
||||
let score = 0.0;
|
||||
const checks: string[] = [];
|
||||
|
||||
// Check 1: No duplicate implementations (25%)
|
||||
if (noDuplicates(context)) {
|
||||
score += 0.25;
|
||||
checks.push("✅ No duplicate implementations found");
|
||||
} else {
|
||||
checks.push("❌ Check for existing implementations first");
|
||||
}
|
||||
|
||||
// Check 2: Architecture compliance (25%)
|
||||
if (architectureCompliant(context)) {
|
||||
score += 0.25;
|
||||
checks.push("✅ Uses existing tech stack (e.g., Supabase)");
|
||||
} else {
|
||||
checks.push("❌ Verify architecture compliance (avoid reinventing)");
|
||||
}
|
||||
|
||||
// Check 3: Official documentation verified (20%)
|
||||
if (hasOfficialDocs(context)) {
|
||||
score += 0.2;
|
||||
checks.push("✅ Official documentation verified");
|
||||
} else {
|
||||
checks.push("❌ Read official docs first");
|
||||
}
|
||||
|
||||
// Check 4: Working OSS implementations referenced (15%)
|
||||
if (hasOssReference(context)) {
|
||||
score += 0.15;
|
||||
checks.push("✅ Working OSS implementation found");
|
||||
} else {
|
||||
checks.push("❌ Search for OSS implementations");
|
||||
}
|
||||
|
||||
// Check 5: Root cause identified (15%)
|
||||
if (rootCauseIdentified(context)) {
|
||||
score += 0.15;
|
||||
checks.push("✅ Root cause identified");
|
||||
} else {
|
||||
checks.push("❌ Continue investigation to identify root cause");
|
||||
}
|
||||
|
||||
// Store check results
|
||||
context.confidence_checks = checks;
|
||||
|
||||
// Display checks
|
||||
console.log("📋 Confidence Checks:");
|
||||
checks.forEach((check) => console.log(` ${check}`));
|
||||
console.log("");
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for duplicate implementations
|
||||
*
|
||||
* Before implementing, verify:
|
||||
* - No existing similar functions/modules (Glob/Grep)
|
||||
* - No helper functions that solve the same problem
|
||||
* - No libraries that provide this functionality
|
||||
*/
|
||||
function noDuplicates(context: Context): boolean {
|
||||
return context.duplicate_check_complete ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check architecture compliance
|
||||
*
|
||||
* Verify solution uses existing tech stack:
|
||||
* - Supabase project → Use Supabase APIs (not custom API)
|
||||
* - Next.js project → Use Next.js patterns (not custom routing)
|
||||
* - Turborepo → Use workspace patterns (not manual scripts)
|
||||
*/
|
||||
function architectureCompliant(context: Context): boolean {
|
||||
return context.architecture_check_complete ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if official documentation verified
|
||||
*
|
||||
* For testing: uses context flag 'official_docs_verified'
|
||||
* For production: checks for README.md, CLAUDE.md, docs/ directory
|
||||
*/
|
||||
function hasOfficialDocs(context: Context): boolean {
|
||||
// Check context flag (for testing and runtime)
|
||||
if ("official_docs_verified" in context) {
|
||||
return context.official_docs_verified ?? false;
|
||||
}
|
||||
|
||||
// Fallback: check for documentation files (production)
|
||||
// This would require filesystem access in Node.js
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if working OSS implementations referenced
|
||||
*
|
||||
* Search for:
|
||||
* - Similar open-source solutions
|
||||
* - Reference implementations in popular projects
|
||||
* - Community best practices
|
||||
*/
|
||||
function hasOssReference(context: Context): boolean {
|
||||
return context.oss_reference_complete ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if root cause is identified with high certainty
|
||||
*
|
||||
* Verify:
|
||||
* - Problem source pinpointed (not guessing)
|
||||
* - Solution addresses root cause (not symptoms)
|
||||
* - Fix verified against official docs/OSS patterns
|
||||
*/
|
||||
function rootCauseIdentified(context: Context): boolean {
|
||||
return context.root_cause_identified ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get recommended action based on confidence level
|
||||
*
|
||||
* @param confidence - Confidence score (0.0 - 1.0)
|
||||
* @returns Recommended action
|
||||
*/
|
||||
export function getRecommendation(confidence: number): string {
|
||||
if (confidence >= 0.9) {
|
||||
return "✅ High confidence (≥90%) - Proceed with implementation";
|
||||
}
|
||||
if (confidence >= 0.7) {
|
||||
return "⚠️ Medium confidence (70-89%) - Continue investigation, DO NOT implement yet";
|
||||
}
|
||||
return "❌ Low confidence (<70%) - STOP and continue investigation loop";
|
||||
}
|
||||
Reference in New Issue
Block a user