Skill: russellfei/class-seven (version 1.0.0)

--- name: class_seven description: Multi-agent development team workflow skill. Use when coordinating complex development tasks requiring multiple specialized roles - PM, Architect, Developer, Tester, Debugger. Orchestrates sub-agents as a development team with main session as manager. Supports flexible tool selection (Claude Code, Kimi, native tools) based on task characteristics. --- # Class Seven - Multi-Agent Development Team Class Seven (七班) is a structured multi-agent workflow that treats sub-agents as specialized development team members. ## When to Use Use this skill when: - Complex development tasks requiring multiple perspectives/roles - Tasks needing PM planning + architecture + implementation + testing - Debugging scenarios requiring systematic investigation - Code review and quality assurance workflows - Projects requiring end-to-end delivery (plan → build → test → deploy) ## Team Structure ``` Main Session (Manager) ├── PM Agent (产品经理) ├── Architect Agent (架构师) ├── Developer Agent (开发工程师) ├── Tester Agent (测试工程师) └── Debugger Agent (调试专家) ``` ## Workflow Phases ### Phase 1: Task Analysis & Planning 1. **Manager (Main Session)** analyzes task complexity 2. Spawn **PM Agent** for requirement clarification 3. PM returns: requirements doc, scope, acceptance criteria ### Phase 2: Architecture & Design 1. Spawn **Architect Agent** with PM output 2. Architect returns: tech stack, module design, interfaces ### Phase 3: Implementation 1. Spawn **Developer Agent** with architecture specs 2. Developer returns: implemented code ### Phase 4: Quality Assurance 1. Spawn **Tester Agent** with code + requirements 2. Tester returns: test plan, test cases, bugs found ### Phase 5: Debugging (if needed) 1. Spawn **Debugger Agent** with bug reports 2. Debugger returns: root cause analysis, fixes ### Phase 6: Integration & Delivery 1. Manager reviews all outputs 2. Integrates final deliverable 3. Validates against acceptance criteria ## Tool Selection Matrix | Task Type | Primary Tool | Secondary Tool | Reason | |-----------|-------------|----------------|--------| | Complex architecture | Claude Code | Kimi | Deep reasoning, context management | | Quick prototyping | Kimi | Native | Fast iteration, lower latency | | Deep debugging | Claude Code | Kimi | Multi-file analysis, bug tracing | | Code review | Kimi | Claude Code | Pattern recognition, best practices | | Testing | Native | Kimi | Deterministic execution | | Documentation | Kimi | Native | Chinese/English bilingual | ## Agent Personas ### PM Agent ``` Role: 产品经理 Expertise: Requirements analysis, user stories, acceptance criteria Output: PRD, user stories, scope definition Tools: Kimi (for Chinese context), Claude Code (for complex products) ``` ### Architect Agent ``` Role: 架构师 Expertise: System design, tech stack selection, API design Output: Architecture doc, module diagrams, interface specs Tools: Claude Code (preferred for architecture), Kimi (for validation) ``` ### Developer Agent ``` Role: 开发工程师 Expertise: Code implementation, refactoring, optimization Output: Production-ready code Tools: Claude Code (complex logic), Kimi (quick implementation), Native (boilerplate) ``` ### Tester Agent ``` Role: 测试工程师 Expertise: Test design, edge case identification, quality assurance Output: Test cases, test scripts, bug reports Tools: Native (execution), Kimi (test design), Claude Code (complex scenarios) ``` ### Debugger Agent ``` Role: 调试专家 Expertise: Root cause analysis, performance profiling, bug fixing Output: RCA report, patches, prevention recommendations Tools: Claude Code (deep analysis), Kimi (pattern matching) ``` ## Execution Modes ### Mode A: Full Team (Full Orchestration) All 5 phases executed sequentially. Use for complex projects. ### Mode B: Sprint Team (Dev + Test) Skip PM/Architect phases. Use when requirements are clear. ### Mode C: Firefighter (Debug Only) Debugger agent only. Use for urgent bug fixes. ### Mode D: Review Board (PM + Tester) Code review workflow. Use for quality gates. ## Quick Commands ```bash # Full team deployment class_seven deploy --mode=full --task="<description>" # Sprint mode class_seven deploy --mode=sprint --specs="<requirements>" # Debug mode class_seven deploy --mode=debug --bug="<bug description>" ``` ## Best Practices 1. **Always start with task analysis** - Determine mode and required agents 2. **Pass context explicitly** - Each agent receives relevant previous outputs 3. **Set clear boundaries** - Define what each agent should/shouldn't do 4. **Use appropriate timeout** - Complex tasks need longer timeouts 5. **Review before integration** - Manager validates all outputs ## Error Handling If an agent fails or produces insufficient output: 1. Analyze failure reason 2. Respawn with clearer instructions or different tool 3. Consider breaking task into smaller sub-tasks 4. Escalate to human if stuck after 2 retries ## References - Detailed workflow patterns: See [references/workflows.md](references/workflows.md) - Tool integration guide: See [references/tools-guide.md](references/tools-guide.md) - Example projects: See [references/examples.md](references/examples.md)

path: references/examples.md
content: # Class Seven - Example Projects

## Example 1: REST API Development

### Task
Build a user management REST API with authentication

### Team Deployment
```
Manager: You (Main Session)
├─ PM: Define API requirements, endpoints, auth strategy
├─ Architect: Design data models, middleware structure
├─ Developer: Implement FastAPI app with JWT auth
├─ Tester: Write pytest tests, test coverage
└─ [No Debugger needed - clean build]
```

### Tool Selection
| Agent | Tool | Reason |
|-------|------|--------|
| PM | Kimi | Bilingual requirements doc |
| Architect | Claude Code | Design pattern decisions |
| Developer | Kimi | Fast implementation |
| Tester | Native | Deterministic test execution |

### Execution
```python
# Main Session
pm_spec = sessions_spawn(
    task="Design REST API for user management with JWT auth",
    model="kimi-coding/k2p5",
    label="pm-api"
)

arch_design = sessions_spawn(
    task=f"Design FastAPI architecture for: {pm_spec.output}",
    model="anthropic/claude-sonnet-4-5",
    label="arch-api"
)

code = sessions_spawn(
    task=f"Implement FastAPI app based on: {arch_design.output}",
    model="kimi-coding/k2p5",
    label="dev-api"
)

test_result = sessions_spawn(
    task=f"Write tests for: {code.output}",
    label="test-api"
)
```

## Example 2: Bug Investigation

### Task
Investigate intermittent 500 errors in production

### Team Deployment
```
Manager: You (Main Session)
├─ Debugger: Analyze logs, identify root cause
├─ Developer: Implement fix
└─ Tester: Verify fix, regression tests
```

### Tool Selection
| Agent | Tool | Reason |
|-------|------|--------|
| Debugger | Claude Code | Deep log analysis |
| Developer | Kimi | Quick patch |
| Tester | Native | Automated testing |

### Execution
```python
# Main Session
rca = sessions_spawn(
    task="""Analyze these production logs for 500 errors:
    <logs attached>
    Identify root cause and provide fix strategy""",
    model="anthropic/claude-sonnet-4-5",
    label="debugger-500"
)

fix = sessions_spawn(
    task=f"Implement fix for: {rca.root_cause}",
    model="kimi-coding/k2p5",
    label="dev-fix"
)

verify = sessions_spawn(
    task=f"Verify fix and write regression tests: {fix.output}",
    label="test-verify"
)
```

## Example 3: Code Review Workflow

### Task
Review PR #42 for security and best practices

### Team Deployment
```
Manager: You (Main Session)
├─ PM: Check against requirements
├─ Architect: Review design patterns
└─ Tester: Check test coverage, edge cases
```

### Tool Selection
| Agent | Tool | Reason |
|-------|------|--------|
| PM | Kimi | Requirement alignment |
| Architect | Claude Code | Pattern analysis |
| Tester | Kimi | Edge case identification |

### Execution
```python
# Fetch PR content first
pr_content = fetch_pr(42)

reviews = [
    sessions_spawn(
        task=f"Review PR against requirements: {pr_content}",
        model="kimi-coding/k2p5",
        label="review-pm"
    ),
    sessions_spawn(
        task=f"Review design patterns: {pr_content}",
        model="anthropic/claude-sonnet-4-5",
        label="review-arch"
    ),
    sessions_spawn(
        task=f"Review tests and edge cases: {pr_content}",
        model="kimi-coding/k2p5",
        label="review-test"
    )
]

consolidated = consolidate_reviews(reviews)
```

## Example 4: Legacy Code Migration

### Task
Migrate Python 2 codebase to Python 3

### Team Deployment
```
Manager: You (Main Session)
├─ PM: Define migration scope, risk assessment
├─ Architect: Design migration strategy
├─ Developer: Execute migration (multiple spawns for modules)
├─ Tester: Comprehensive test suite
└─ Debugger: Handle edge cases, compatibility issues
```

### Tool Selection
| Agent | Tool | Reason |
|-------|------|--------|
| PM | Kimi | Scope definition |
| Architect | Claude Code | Strategy design |
| Developer | Claude Code | Complex refactoring |
| Tester | Native | Batch testing |
| Debugger | Claude Code | Compatibility fixes |

### Execution
```python
# Phase 1: Planning
scope = sessions_spawn("Define migration scope", model="kimi-coding/k2p5")
strategy = sessions_spawn(f"Design strategy for: {scope}", model="anthropic/claude-sonnet-4-5")

# Phase 2: Parallel migration
modules = identify_modules("./legacy-code")
migration_results = []
for module in modules:
    result = sessions_spawn(
        task=f"Migrate {module} using strategy: {strategy}",
        model="anthropic/claude-sonnet-4-5",
        label=f"dev-migrate-{module}"
    )
    migration_results.append(result)

# Phase 3: Testing & Debugging
all_code = merge_results(migration_results)
tests = sessions_spawn(f"Test migrated code: {all_code}")

if tests.failed:
    fixes = sessions_spawn(f"Fix failures: {tests.failures}")
```

## Example 5: New Feature - Full Pipeline

### Task
Add "advanced search" feature to existing app

### Complete Workflow
```python
# Main Session orchestration

def class_seven_full_pipeline(task_description):
    """Execute full Class Seven workflow"""
    
    # Phase 1: PM
    prd = sessions_spawn(
        task=f"""As PM, create PRD for: {task_description}
        Include: user stories, acceptance criteria, scope""",
        model="kimi-coding/k2p5",
        label="pm-prd"
    )
    
    # Phase 2: Architect
    design = sessions_spawn(
        task=f"""As Architect, design system for:
        {prd.output}
        Include: tech stack, data models, API specs""",
        model="anthropic/claude-sonnet-4-5",
        label="arch-design"
    )
    
    # Phase 3: Developer
    code = sessions_spawn(
        task=f"""As Developer, implement:
        {design.output}
        Follow coding standards, add comments""",
        model="kimi-coding/k2p5",
        label="dev-impl"
    )
    
    # Phase 4: Tester
    qa = sessions_spawn(
        task=f"""As Tester, verify:
        Code: {code.output}
        Against: {prd.acceptance_criteria}
        Include: test cases, bug report if any""",
        model="kimi-coding/k2p5",
        label="test-qa"
    )
    
    # Phase 5: Debug (conditional)
    if qa.bugs:
        fixed = sessions_spawn(
            task=f"Fix these bugs: {qa.bugs}",
            model="anthropic/claude-sonnet-4-5",
            label="debug-fix"
        )
        code = fixed.output
    
    # Integration
    deliverable = {
        "prd": prd.output,
        "design": design.output,
        "code": code.output,
        "tests": qa.test_cases,
        "status": "complete" if not qa.bugs else "fixed"
    }
    
    return deliverable

# Execute
result = class_seven_full_pipeline("Add advanced search with filters and sorting")
```

## Success Metrics

Track these for workflow optimization:

| Metric | Target | Measurement |
|--------|--------|-------------|
| Delivery rate | >90% | Completed / Attempted |
| Bug escape rate | <5% | Production bugs / Total bugs |
| Time to delivery | Varies by complexity | From task to deliverable |
| Cost per task | Optimized | Total tokens / Task |
| Human intervention | <10% | Escalations / Total tasks |


path: references/tools-guide.md
content: # Class Seven - Tool Integration Guide

## Native Tools (sessions_spawn)

### When to Use Native
- Deterministic tasks with clear success criteria
- File operations, shell commands
- Tasks not requiring deep reasoning
- Quick, low-cost operations

### Spawning Agents
```python
# Basic spawn
result = sessions_spawn(
    task="Implement user authentication",
    label="developer-auth"
)

# With specific model
result = sessions_spawn(
    task="Design database schema",
    model="anthropic/claude-sonnet-4-5",
    label="architect-db"
)

# With timeout
result = sessions_spawn(
    task="Debug memory leak",
    runTimeoutSeconds=600,
    label="debugger-memory"
)
```

## Claude Code Integration

### When to Use Claude Code
- Complex architecture decisions
- Multi-file refactoring
- Deep debugging requiring context analysis
- Tasks requiring high reasoning depth

### Calling Claude Code
```powershell
# Analysis mode
claude -p "Analyze this codebase for security vulnerabilities"

# Interactive mode (for complex tasks)
claude
# Then use natural language within Claude Code
```

### Claude Code Agent Role
```
Role: Senior Engineer / Architect
Strengths: Context management, complex reasoning, large codebases
Use for: Architecture, complex debugging, refactoring
Cost: Higher (but worth it for complex tasks)
```

## Kimi Integration

### When to Use Kimi
- Rapid prototyping
- Chinese language context
- Pattern matching tasks
- Code review and best practices
- Lower latency requirements

### Calling Kimi
```powershell
# Direct CLI
kimi "Generate a Python FastAPI CRUD scaffold"

# With file context
kimi "Review this code" --file ./src/main.py

# Interactive
kimi
```

### Kimi Agent Role
```
Role: Full-stack Developer
Strengths: Fast iteration, bilingual, good for MVPs
Use for: Quick implementation, prototyping, documentation
Cost: Efficient for most tasks
```

## Tool Selection Decision Tree

```
Is task well-defined and deterministic?
├── YES → Use Native
└── NO → Requires reasoning
    ├── Complex architecture/design?
    │   ├── YES → Use Claude Code
    │   └── NO → Continue
    ├── Multi-file analysis needed?
    │   ├── YES → Use Claude Code
    │   └── NO → Continue
    ├── Chinese context preferred?
    │   ├── YES → Use Kimi
    │   └── NO → Continue
    ├── Quick prototype/MVP?
    │   ├── YES → Use Kimi
    │   └── NO → Continue
    └── Default → Use Kimi (cost-effective)
```

## Cost-Effectiveness Matrix

| Task Complexity | Recommended Tool | Est. Token Cost | Time |
|-----------------|------------------|-----------------|------|
| Simple script | Native | Low | Fast |
| CRUD API | Kimi | Medium | Fast |
| Microservice | Kimi/Claude | Medium-High | Medium |
| System design | Claude Code | High | Medium |
| Complex debugging | Claude Code | High | Slow |
| Refactoring | Claude Code | High | Medium |
| Documentation | Kimi | Low-Medium | Fast |
| Test generation | Native/Kimi | Low-Medium | Fast |

## Hybrid Workflows

### Example: Full Feature Development

```
Phase 1: Requirements (Kimi - fast, bilingual)
  ↓
Phase 2: Architecture (Claude Code - deep reasoning)
  ↓
Phase 3: Implementation (Kimi - fast iteration)
  ↓
Phase 4: Testing (Native - deterministic)
  ↓
Phase 5: Debugging (Claude Code if complex, else Kimi)
```

### Example: Bug Fix

```
Phase 1: Triage (Kimi - quick assessment)
  ↓
  ├── Simple bug → Kimi fixes directly
  └── Complex bug → Claude Code deep analysis
                        ↓
                   Kimi implements fix
                        ↓
                   Native runs tests
```

## Environment Setup

### Required Tools
```powershell
# Claude Code
irm https://claude.ai/install.ps1 | iex

# Kimi CLI
irm https://code.kimi.com/install.ps1 | iex
```

### Configuration
Both tools should be configured for Windows/PowerShell:

```json
// ~/.claude/settings.json
{
  "systemPrompt": "Use Windows PowerShell commands. Never use: &&, grep, curl, cat, rm -rf, mkdir -p"
}

// ~/.kimi/config.toml
system_prompt = "Use Windows PowerShell commands. Avoid: &&, grep, curl, cat, rm -rf, mkdir -p"
```

## Monitoring & Logging

Track tool usage for optimization:
```json
{
  "session_id": "<id>",
  "agents": [
    {"role": "PM", "tool": "Kimi", "tokens": 1500, "duration": 30},
    {"role": "Developer", "tool": "Claude", "tokens": 8000, "duration": 120}
  ],
  "total_cost": "$0.45",
  "success": true
}
```


path: references/workflows.md
content: # Class Seven - Workflow Patterns

## Pattern 1: Sequential Pipeline

```
[Task] → PM → Architect → Developer → Tester → [Deliverable]
```

Use when: Clear linear progression, each phase depends on previous

### Implementation
```python
# Main Session as Manager
pm_result = spawn_agent("PM", task_description)
arch_result = spawn_agent("Architect", pm_result.output)
dev_result = spawn_agent("Developer", arch_result.output)
test_result = spawn_agent("Tester", dev_result.output)
return integrate(test_result)
```

## Pattern 2: Parallel Sprint

```
         ┌→ Developer A (Module 1)
[Task] ──┼→ Developer B (Module 2)
         └→ Developer C (Module 3)
              ↓
         Integration → Tester
```

Use when: Modules are independent, can parallelize development

### Implementation
```python
modules = break_down(task)
results = parallel_spawn([
    ("Developer", m) for m in modules
])
integrated = integrate_results(results)
return spawn_agent("Tester", integrated)
```

## Pattern 3: Iterative Refinement

```
[Requirement] → Developer → Tester → [Bugs?]
                    ↑_____________|
```

Use when: Requirements evolve, need rapid iteration

### Implementation
```python
code = spawn_agent("Developer", requirements)
for i in range(max_iterations):
    test_result = spawn_agent("Tester", code)
    if test_result.passed:
        break
    code = spawn_agent("Developer", {
        "code": code,
        "bugs": test_result.bugs
    })
```

## Pattern 4: Debug Triage

```
[Bug Report] → Debugger → [RCA]
                    ↓
            ┌───┴───┐
        [Code Fix] [Config Fix] [Env Fix]
```

Use when: Production issues, need systematic debugging

### Implementation
```python
rca = spawn_agent("Debugger", bug_report)
if rca.type == "code":
    fix = spawn_agent("Developer", rca.analysis)
elif rca.type == "config":
    fix = apply_config_fix(rca.recommendation)
elif rca.type == "environment":
    fix = spawn_agent("DevOps", rca.analysis)
```

## Pattern 5: Review Board

```
[Code/Design] → PM Review
              → Architect Review
              → Tester Review
              ↓
         Consolidated Feedback
```

Use when: Quality gates, significant changes

### Implementation
```python
reviews = parallel_spawn([
    ("PM", code),
    ("Architect", code),
    ("Tester", code)
])
feedback = consolidate_reviews(reviews)
if feedback.blocking_issues:
    return spawn_agent("Developer", {
        "code": code,
        "feedback": feedback
    })
```

## Communication Protocol

### Agent Output Format

Each agent should return:
```json
{
  "agent": "<role>",
  "status": "success|partial|failed",
  "output": "<main deliverable>",
  "artifacts": ["<file paths>"],
  "notes": "<important considerations>",
  "blockers": ["<issues requiring escalation>"]
}
```

### Context Passing Rules

1. **Minimal but sufficient** - Include only what's needed
2. **Structured format** - Use JSON/YAML for complex data
3. **Version tracking** - Include iteration number
4. **Decision log** - Record key decisions made

### Escalation Triggers

Escalate to human when:
- Agent returns status="failed" twice
- Conflicting requirements from different agents
- Scope creep beyond original task
- Technical blockers requiring architectural changes


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)