协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
testing-qa【开发与工程】Implements intelligent testing qa with multi-factor skill selection, fallback chains, and adherence to the 5 Laws of Elegant Defense
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: testing-qa compatibility: opencode completeness: 95 content-types:
Orchestrates intelligent skill selection and execution for testing qa workflows. Applies the 5 Laws of Elegant Defense to guide data naturally through the orchestration pipeline, preventing errors before they occur. Selects optimal skills based on multi-factor scoring including text similarity, historical performance, and system availability.
┌───────────────────────────────────────────────────────────────────────────────┐ │ Orchestration Flow │ └───────────────────────────────────────────────────────────────────────────────┘
User Request ↓ ┌─────────────────┐ │ Parse Request │ │ & Extract │ │ Features │ └────────┬────────┘ ↓ ┌─────────────────────────────────────────────────────────────────────┐ │ Evaluate Available Skills │ │ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │ │ Skill A │ │ Skill B │ │ Skill C │ │ │ │ - Match Score│ │ - Match Score│ │ - Match Score│ │ │ │ - Confidence │ │ - Confidence │ │ - Confidence │ │ │ │ - History │ │ - History │ │ - History │ │ │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │ │ │ │ │ │ │ └─────────────────┴─────────────────┘ │ │ ↓ │ │ Select Best Skill │ └─────────────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────┐ │ Execute Skill │ └────────┬────────┘ ↓ ┌─────────────────┐ │ Handle Result │ └────────┬────────┘ ↓ ┌─────────────────────────────────────────────────────────────────────┐ │ Error Handling & Fallback │ │ │ │ Success? ────────► Return Result │ │ │ │ Fail? ────────┐ │ │ ↓ │ │ ┌──────────────────────────────────────────────────────────┐ │ │ │ Fallback Chain │ │ │ │ │ │ │ │ 1. Retry with adjusted parameters │ │ │ │ 2. Try Alternative Skill (if available) │ │ │ │ 3. Defer to Human Operator (if critical) │ │ │ │ 4. Log & Return Error │ │ │ └──────────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────────┘
Use this skill when:
Avoid this skill for:
Parse and Analyze Request - Extract intent, entities, and constraints from user input. Checkpoint: All required parameters must be present and in valid format before proceeding.
Score Available Skills - Calculate match scores using multi-factor algorithm:
Checkpoint: Skip to fallback if no skill scores above threshold.
Select Optimal Skill - Choose skill with highest score that meets minimum confidence. Checkpoint: Verify skill has not been disabled or deprecated.
Execute with Fallback - Run skill execution wrapped in retry and fallback logic. Checkpoint: Log all execution attempts for audit trail.
Return or Fallback - Either return successful result or apply fallback chain:
related-skillsCheckpoint: Record outcome with timing and confidence metadata.
def route_test_suite(
code_changes: List[Dict],
test_registry: Dict[str, List[str]],
flaky_history: Dict[str, float]
) -> Dict[str, List[str]]:
"""Route appropriate test suites based on code changes and historical reliability.
Analyzes diff paths to trigger relevant test categories (unit, integration, e2e).
Applies confidence scoring based on flakiness history and recent failure rates.
Returns a prioritized mapping of test suites to execute.
"""
if not code_changes:
return {"full_regression": test_registry.get("full_regression", [])}
triggered_suites = set()
confidence_scores = {}
for change in code_changes:
path = change.get("path", "")
if "/tests/" in path or "test_" in path:
triggered_suites.update(test_registry.get("unit", []))
confidence_scores["unit"] = 0.95
elif "api/" in path or "server/" in path:
triggered_suites.update(test_registry.get("integration", []))
confidence_scores["integration"] = 0.85
elif "ui/" in path or "frontend/" in path:
triggered_suites.update(test_registry.get("e2e", []))
confidence_scores["e2e"] = 0.75
# Filter out high-flakiness suites unless explicitly requested
prioritized = {}
for suite in triggered_suites:
flake_rate = flaky_history.get(suite, 0.0)
if flake_rate < 0.2:
prioritized[suite] = test_registry.get(suite, [])
else:
prioritized[suite] = test_registry.get(suite, []) + ["--flaky-retry"]
return {"suites": list(prioritized.keys()), "confidence": confidence_scores}
def execute_qa_pipeline(
test_suites: List[str],
env_config: Dict,
fallback_strategy: str = "parallel_retry"
) -> Dict:
"""Execute QA test pipeline with intelligent fallback for failures.
Runs selected test suites against the target environment.
Implements fallback chains: retry flaky tests, switch to parallel execution,
or escalate to manual review if critical paths fail.
Returns structured results with pass/fail metrics and latency.
"""
results = {"suites_executed": [], "failures": [], "fallbacks_applied": []}
for suite in test_suites:
try:
output = run_test_runner(suite, env_config)
parsed = parse_test_output(output)
if parsed["status"] == "passed":
results["suites_executed"].append({"suite": suite, "status": "passed"})
else:
# Fallback: Retry flaky tests with increased timeout
if parsed.get("flaky", False) and fallback_strategy == "parallel_retry":
retry_output = run_test_runner(suite, env_config, timeout_multiplier=2.0)
retry_parsed = parse_test_output(retry_output)
if retry_parsed["status"] == "passed":
results["fallbacks_applied"].append(f"{suite}: flaky retry succeeded")
results["suites_executed"].append({"suite": suite, "status": "passed"})
continue
results["failures"].append({"suite": suite, "errors": parsed["errors"]})
except EnvironmentError as e:
# Fallback: Switch to isolated container environment
results["fallbacks_applied"].append(f"{suite}: env fallback to isolated container")
try:
isolated_output = run_test_runner(suite, env_config.copy(), isolated=True)
results["suites_executed"].append({"suite": suite, "status": "passed", "fallback": "isolated"})
except Exception as fallback_err:
results["failures"].append({"suite": suite, "errors": [str(fallback_err)], "escalated": True})
return results
code-philosophy (5 Laws of Elegant Defense) in all logicWhen applying this skill, produce:
Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.
| Skill | Purpose | |