AgentSkillsCN

laboratory-patterns

通过假设检验、并行 PoC 执行与严谨验证,探索多种实现方案的科学实验模式。实验室指挥官常用此模式,以构建系统化的研究工作流程。

SKILL.md
--- frontmatter
description: Scientific experimentation patterns for exploring implementation approaches through hypothesis testing, parallel PoC execution, and rigorous verification. Used by laboratory command for systematic research workflows.
name: laboratory-patterns
allowed-tools: ["Read", "Grep", "Glob", "WebSearch", "WebFetch"]

Laboratory Patterns Skill

Scientific experimentation patterns for exploring implementation approaches.

Overview

This skill provides patterns and templates for the /serena-refactor:laboratory command, which applies scientific methodology to code implementation:

  • Problem Decomposition: Breaking complex problems into testable units
  • Approach Collection: Gathering solutions from multiple sources
  • Creative Generation: Novel approaches beyond documentation
  • Hypothesis Formation: Structuring testable experiments
  • Parallel Experimentation: Running multiple PoCs concurrently
  • Rigorous Verification: Testing with edge cases and reproducibility
  • Learning from Failure: Recording what doesn't work and why

Core Philosophy

"Apply scientific methodology to code implementation"

  1. Decompose - Break problems into smaller, testable units
  2. Hypothesize - Form clear, testable hypotheses
  3. Experiment - Run controlled experiments (PoCs)
  4. Verify - Test rigorously with edge cases
  5. Learn - Record successes AND failures

References

ReferencePurpose
creative-approaches.mdPatterns for unconventional solutions
query-templates.mdTemplates for LLM consultation
verification-criteria.mdStandards for experiment verification

7-Stage Workflow

code
1. Problem Decomposition  [User Approval]
      ↓
2. Existing Approaches Collection
      ↓
3. Creative Approaches Generation
      ↓
4. Hypothesis Formation  [User Approval]
      ↓
5. PoC Experiments (Parallel, max 5)  [User Approval]
      ↓
6. Verification
      ↓
7. Result Report

Agent Roles

AgentRolePhases
lab-analystProblem analysis, hypothesis design1, 4
lab-experimenterPoC implementation, parallel coordination5
lab-verifierTesting, verification, reporting6, 7
source-fetcherExternal info collection2
creative-generatorNovel approach generation3
llm-consultantExternal LLM consultation2-3, 6
edge-case-hunterEdge case discovery4, 6

Information Sources (Priority)

  1. GitHub Issues/Discussions - Real developer solutions
  2. Stack Overflow - Community-vetted approaches
  3. Official Docs (Context7) - Standard methods

Verification Criteria

CriterionRequired
Test PassYes
Edge Case CoverageYes
ReproducibilityYes
PerformanceIf specified

State Files

FilePhasePurpose
.lab-problem-defined1Problem decomposed
.lab-approaches-collected2-3Approaches gathered
.lab-hypotheses-approved4Hypotheses confirmed
.lab-experiments-running5In progress
.lab-experiments-done5Complete
.lab-verified6Verified
.lab-report-generated7Report created

Output Locations

  • Reports: docs/lab-reports/YYYY-MM-DD-{topic}.md
  • Memory: .serena/memories/lab-{topic}.md
  • Experiments: experiments/hypothesis-{id}/