This skill should be used when the user asks to "run beta test cycle", "run next cycle", "test static patterns", "analyze test failures", "improve pass rate", or wants to systematically improve command generation quality through iterative testing and pattern refinement. Provides structured workflow for running test cycles, analyzing failures, implementing fixes, and documenting results.
This skill provides a systematic workflow for improving static pattern matchers through iterative test cycles. Use this approach to:
Core principle: Fix patterns systematically by understanding specificity hierarchy and matching logic, not by adding more patterns.
Activate this skill when:
Example triggers:
Execute the test suite and capture results:
# Build the project
cargo build --release
# Run test suite
./target/release/caro test --backend static --suite .claude/beta-testing/test-cases.yaml > /tmp/cycle-N-results.txt
# Review results
cat /tmp/cycle-N-results.txt
Key metrics to track:
Categorize each failure into one of these root causes:
Pattern Ordering Issue: More general pattern matches before more specific pattern
Pattern Over-Matching: Pattern matches queries it shouldn't
Pattern Under-Matching: Pattern doesn't match intended queries
Missing Pattern: No pattern exists for this query type
Priority: Address ordering issues first (highest ROI), then over/under-matching, finally missing patterns.
Apply fixes based on root cause analysis:
Move specific patterns before general patterns. See references/pattern-ordering-strategy.md for detailed specificity calculation.
Quick specificity guide:
Example reordering:
// Before (Pattern 46 at end, Pattern 1 at beginning)
Pattern 1: "files modified today" (3 keywords: file, modified, today)
...
Pattern 46: "Python files modified today" (4 keywords: python, file, modified, today)
// After (reorder Pattern 46 → Pattern 1)
Pattern 1: "Python files modified today" (4 keywords) ← More specific, checks first
Pattern 2: "files modified today" (3 keywords) ← General fallback
Remove optional keywords when pattern over-matches:
// Before (over-matching English queries)
PatternEntry {
required_keywords: vec![],
optional_keywords: vec!["find".to_string(), "files".to_string()],
regex_pattern: Some(Regex::new(r"[ぁ-んァ-ヶー一-龯]").unwrap()),
// ...
}
// After (regex-only matching)
PatternEntry {
required_keywords: vec![],
optional_keywords: vec![], // Empty forces regex-only
regex_pattern: Some(Regex::new(r"[ぁ-んァ-ヶー一-龯]").unwrap()),
// ...
}
Remove restrictive required keywords when pattern under-matches:
// Before (requires English "find" for Japanese query)
required_keywords: vec!["find".to_string()]
// After (no English keywords required)
required_keywords: vec![]
Tighten or loosen regex patterns as needed. See references/pattern-ordering-strategy.md for regex design patterns.
After implementing fixes:
# Build
cargo build --release
# Run tests
./target/release/caro test --backend static --suite .claude/beta-testing/test-cases.yaml
# Save results
./target/release/caro test --backend static --suite .claude/beta-testing/test-cases.yaml > /tmp/cycle-N-results.txt
Verification checklist:
Create cycle documentation following the template in references/cycle-documentation.md.
Required sections:
Key metrics to document:
See examples/cycle-analysis.md for a real example from Cycle 8.
Commit changes with descriptive message:
# Stage changes
git add src/backends/static_matcher.rs .claude/beta-testing/cycles/cycle-N-*.md
# Commit with detailed message
git commit -m "fix(static): [Cycle N] <summary>
- Fix 1 description
- Fix 2 description
- Category X: before% → after% (+N tests)
- Overall pass rate: before% → after% (passing/total tests, N complete categories)
- Pattern count: before → after
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>"
# Push to remote
git push origin main
Understanding how patterns match is critical for effective fixes. The matching logic in static_matcher.rs follows this hierarchy:
optional_count > 0 OR pattern.regex_pattern.is_none()Key insight: Optional keywords act as a fallback when regex doesn't match. For patterns that should ONLY match via regex (like i18n), remove all optional keywords.
Based on matching logic, three pattern types emerge:
Regex-only patterns: Empty required_keywords + empty optional_keywords + regex
Keyword-only patterns: Keywords + no regex (or very loose regex)
Hybrid patterns: Keywords + regex (both must be relevant)
Track these metrics across cycles:
Per-Cycle Metrics:
Cumulative Metrics:
Efficiency Indicators:
✅ Prioritize reordering over adding patterns
✅ Batch related reorderings together
✅ Remove optional keywords for specialized patterns
✅ Document specificity reasoning
✅ Test after every change
❌ Don't add patterns without exhausting reordering options
❌ Don't adjust keywords without understanding matching logic
❌ Don't batch unrelated changes
❌ Don't skip documentation
❌ Don't ignore false positives
Scenario: Test "find Python files modified today" matches generic "files modified today"
Fix: Move file-type-specific pattern before general pattern
Success rate: 100% (never fails when applied correctly)
Scenario: Test "disk usage by directory, sorted" matches "disk usage by folder"
Fix: Move pattern with more constraints before pattern with fewer
Success rate: 100% (specificity hierarchy)
Scenario: i18n pattern with optional English keywords matches English queries
Fix: Remove all keywords to force regex-only matching
optional_keywords: vec!["find", "files"]optional_keywords: vec![]Success rate: 100% (eliminates keyword fallback)
Consider automating these tasks with scripts in scripts/:
See scripts/ directory for available automation utilities.
For detailed guidance, consult:
references/pattern-ordering-strategy.md - Comprehensive pattern specificity calculation, ordering rules, and reordering workflowreferences/cycle-documentation.md - Template and guidelines for documenting cycle resultsreferences/matching-logic-deep-dive.md - Detailed analysis of StaticMatcher matching logicReal-world examples in examples/:
examples/cycle-analysis.md - Complete Cycle 8 analysis showing all sectionsexamples/pattern-reordering.md - Before/after examples of successful reorderingsUtilities in scripts/:
scripts/run-cycle.sh - Automated cycle execution workflowscripts/analyze-failures.sh - Parse test output and categorize failuresMost Specific (check first)
↓
File-type + Time + Location + Size
File-type + Time
File-type + Location
File-type
General query
↓
Least Specific (check last)
| Problem | Fix | Example | |---------|-----|---------| | General matches before specific | Reorder by keyword count | Python files (4 kw) before files (3 kw) | | Over-matching English queries | Remove optional keywords | i18n pattern: empty optional_keywords | | Under-matching target queries | Remove restrictive required kw | Japanese pattern: remove "find" requirement | | Conflicting specific forms | Swap + tighten regex | 1GB with-exec before 1GB without-exec |
To run a beta test cycle:
.claude/beta-testing/test-cases.yamlTarget: Each cycle should improve pass rate by 3-10 percentage points through surgical fixes.
Milestone: Aim for 80%+ pass rate (product delivers on promises), then 85%+ (excellent), then category completions.
Focus on pattern reordering and strategic keyword adjustments over pattern proliferation for maximum efficiency and maintainability.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer