Pipeline Templates
Overview
This skill provides pre-defined F# pipe workflows for common multi-agent scenarios. Pipelines ensure:
- Deterministic orchestration: Consistent agent sequencing
- Hard validation: Block incorrect pipeline usage
- Progress tracking: Log all pipeline stages
- Model optimization: Right model for each stage
When to use: Multi-agent work requiring more than simple exploration.
When NOT to use: Single-agent tasks (explore, search, lookup) bypass pipeline validation automatically.
Pipeline Selection Guide
Choose the appropriate pipeline based on your task:
Is this a multi-agent task?
├─ No → No pipeline needed (single-agent bypass)
└─ Yes → What type of work?
├─ Reviewing existing code → Code Review Pipeline
├─ Fixing a bug/issue → Fix Validation Pipeline
├─ Auditing test quality → Test Audit Pipeline
├─ Implementing new functionality → New Feature Pipeline
├─ Research before implementation → Research & Planning Pipeline
└─ Running tests and fixing failures → Test Execution & Fix Pipeline
Available Pipelines
| Pipeline |
Use Case |
Model Pattern |
Reference |
| Code Review |
PR review, code audit |
Sonnet (role-based, 4 sections) |
references/code-review.md |
| Fix Validation |
Bug fixes, issue resolution |
Sonnet (analyze) → Opus (fix) → Sonnet (validate) → Sonnet (review) |
references/fix-validation.md |
| Test Audit |
Test quality assessment |
Haiku (classify) → Sonnet (detect) → Sonnet (audit) |
references/test-audit.md |
| New Feature |
Feature implementation |
Haiku (research) → Opus (write) → Sonnet (review) |
references/new-feature.md |
| Research & Planning |
Pre-implementation research |
Haiku (lookup) → Sonnet (review) → loop(min=3) |
references/research-planning.md |
| Test Execution & Fix |
Run tests, fix failures |
Haiku (execute) → Sonnet (analyze) → Opus (fix) |
references/test-execution-fix.md |
| Code Change Workflow |
Full automation after code edit |
Composite: chains multiple pipelines |
references/code-change-workflow.md |
Pipeline Architecture Notes
Role-Based Agents: Code Review pipeline uses general-purpose sub-agents with specific roles. Each agent loads the code-review skill and references a specific section (Security, Type Safety, Linting, Coding Standards).
Custom Sub-Agents: Fix Validation pipeline uses custom sub-agents (bulwark-issue-analyzer, bulwark-fix-validator) that encapsulate stage behavior and load relevant skills via frontmatter.
Code-Writing Agent: Fix Validation and New Feature pipelines use bulwark-implementer (custom sub-agent, Opus) for code-writing stages with built-in quality enforcement.
Model Selection
Reference subagent-prompting skill for the task-type rubric:
| Task Type |
Model |
Examples |
| Lookups & Execute |
Haiku |
Web fetch, run tests, file search, lint |
| Review & Analyze |
Sonnet |
Code review, failure analysis, audits |
| Write & Fix |
Opus |
Write code, write tests, apply fixes |
Override rule: If a custom agent specifies model: in frontmatter, use that model instead.
Validation Rules
Valid Pipeline Invocation
A pipeline invocation is valid when:
- Uses a defined pipeline template from this skill
- Specifies model for each stage (or uses default from task-type rubric)
- Includes 4-part prompt for each Task (GOAL/CONSTRAINTS/CONTEXT/OUTPUT)
- Reads previous stage output before invoking next stage
Invalid Invocation (Warning/Block)
The following patterns trigger validation warnings:
| Pattern |
Issue |
Resolution |
| Ad-hoc multi-agent with no pipeline |
Unpredictable orchestration |
Choose appropriate pipeline |
| Missing model specification |
May use wrong model |
Specify model or use rubric |
| Skipping stages without justification |
Incomplete workflow |
Document skip reason |
| Using Opus for simple tasks |
Wasteful |
Use Haiku for lookups |
Hook Behavior (PostToolUse)
The PostToolUse hook on Write|Edit:
- Skips silently: Small changes below threshold
- Suggests pipeline: Significant changes inject
additionalContext with pipeline recommendation
- Blocks: Never (suggestion only, not blocking)
File Type to Pipeline Mapping
When triggered by the Stop hook after Write/Edit/MultiEdit, select pipeline based on file modified. The hook (suggest-pipeline-stop.sh) emits ALL applicable pipelines for the turn — Code Review and Test Audit can both fire when a turn touches both production code and test files.
Test detection (path-based, takes priority)
Files under any of these directory components are classified as test regardless of filename:
| Directory pattern |
Stack |
Examples |
tests/, */tests/ |
Bulwark, generic |
tests/hooks/test-foo.sh |
test/, */test/ |
Ruby Minitest, Elixir, generic |
test/foo_test.rb, test/foo_test.exs |
__tests__/ |
Jest convention |
__tests__/Component.test.tsx |
spec/, specs/ |
Ruby RSpec, generic |
spec/models/user_spec.rb |
src/test/ |
JVM (Maven/Gradle) |
src/test/java/FooTest.java |
Test detection (filename-based)
| Filename pattern |
Stack |
Examples |
test_*, test-* |
Python (pytest), Bulwark hooks |
test_models.py, test-foo.sh |
*_test.*, *-test.* |
Go, Ruby Minitest, generic |
models_test.go, foo-test.sh |
*_spec.*, *-spec.* |
Ruby RSpec, generic |
user_spec.rb |
*.test.*, *.spec.* |
Jest, Vitest, Jasmine |
Component.test.tsx, service.spec.js |
Test detection (PascalCase, JVM/.NET)
Case-sensitive match on basename suffix:
| Filename pattern |
Stack |
Examples |
*Test.{java,kt,scala} |
JUnit, Kotest, ScalaTest |
UserServiceTest.java |
*Tests.{cs,vb} |
xUnit, NUnit (C#/.NET) |
UserServiceTests.cs |
*Spec.{kt,scala} |
Kotest, Specs2 |
UserServiceSpec.kt |
*Specs.cs |
NSpec |
UserSpecs.cs |
*IT.java |
JUnit integration tests |
UserServiceIT.java |
Code, script, config detection
| File Pattern |
Extension |
Recommended Pipeline |
| Production code |
.ts, .tsx, .js, .jsx, .mjs, .cjs, .py, .go, .rs, .java, .kt, .scala, .cs, .fs, .vb, .rb, .exs, .ex, .cpp, .c, .php, .swift |
Code Review |
| Scripts |
.sh, .bash, .zsh, .fish, .ps1 |
Code Review (security focus) |
| Config |
.json, .yaml, .yml, .toml, .ini, .env |
Code Review (security focus) |
| Documentation |
.md, .txt, .rst |
Light review or skip |
| Data files |
.xlsx, .csv, .pdf |
Manual review suggested |
Out of scope (path-only detection limits)
Path-based classification cannot detect tests embedded in production source files:
- Rust inline
#[test] — annotation-only signal, no path convention. src/foo.rs always classifies as code; if it contains inline tests, they'll be reviewed under Code Review, not Test Audit.
- Python doctests — same rationale;
foo.py with doctests classifies as code.
- Inline test directives in any language — content-only signal, undetectable from path.
If a project relies heavily on inline tests, a future version may add content-based detection. For now, conventional tests/ or test_* placement triggers Test Audit; inline tests don't.
Small Change Bypass
Skip pipeline for small changes (threshold by file type):
| File Type |
Threshold |
Rationale |
| Code |
< 5 lines |
Minor fixes don't need full review |
| Tests |
< 10 lines |
Single test additions are low risk |
| Config |
< 3 lines |
Single value changes are quick to verify |
| Documentation |
<= 10 lines |
Typo fixes and small updates |
| Scripts |
< 3 lines |
Security-sensitive, low threshold |
| Data |
Any change |
Always significant, suggest review |
Changes at or below threshold are skipped silently. Changes above threshold trigger pipeline suggestion.
Pipeline Execution Pattern
All pipelines follow this execution pattern:
// F# pipe syntax for workflow orchestration
// Sequential execution (each stage reads previous stage's output)
Stage1 (task) // First agent runs
|> Stage2 (task) // Reads Stage1 output, runs
|> Stage3 (task) // Reads Stage2 output, runs
|> (if condition // Conditional branching
then StageA
else StageB)
|> LOOP(max=N) // Optional iteration
// Parallel execution (agents run concurrently, results merged)
[Stage1a, Stage1b, Stage1c] // Array notation = parallel
|> Stage2 (reads all Stage1 outputs)
Key principles:
- Sequential (
|>): Each stage reads the previous stage's log output
- Parallel (
[]): Stages in array notation run concurrently via multiple Task calls in a single message
- Conditional branches based on stage results
- Loops have explicit iteration limits
- All output logged to
logs/
Progress Tracking
Pipeline progress is tracked via hooks:
| Event |
Hook |
Log Entry |
| Stage start |
SubagentStart |
[timestamp] SubagentStart: agent_id (type) |
| Stage end |
SubagentStop |
[timestamp] SubagentStop: agent_id |
Logs written to: logs/pipeline-tracking.log
Related Skills
| Skill |
Relationship |
subagent-prompting |
4-part template, model selection rubric |
subagent-output-templating |
Output format for pipeline stages |
Quick Reference
// Code Review (role-based agents, parallel execution)
[SecurityReviewer (section: Security), // Sonnet - role-based
TypeSafetyReviewer (section: Type Safety), // Sonnet - role-based
LintReviewer (section: Linting), // Sonnet - role-based
StandardsReviewer (section: Coding Standards)] // Sonnet - role-based
|> ReviewSynthesizer (consolidates all findings)
|> (if critical_issues then FixWriter else Done)
// Fix Validation (custom sub-agents)
IssueAnalyzer (bulwark-issue-analyzer, produces debug_report)
|> FixWriter (bulwark-implementer, implements fix)
|> (if !tests_cover_scenario // Only if tests don't exist
then TestWriter |> TestAudit (mock-detection only) // Audit generated tests for T1-T4
else TestAudit (if FixWriter wrote tests)) // Audit implementer tests for T1-T4
|> FixValidator (bulwark-fix-validator, validates against debug_report)
|> CodeReviewer (reviews all, approves/rejects)
|> (if !approved then IssueAnalyzer else Done)
|> LOOP(max=3)
// Test Audit (Main Context Orchestration - skill-based)
TestClassifier |> MockDetector |> AuditSynthesizer
|> (if REWRITE_REQUIRED then TestRewriter else Done)
|> LOOP(max=2)
// New Feature
Researcher |> Architect |> Implementer (bulwark-implementer) |> TestWriter |> TestAudit |> CodeReviewer
// Research & Planning (min 3 iterations)
Researcher |> PlanDraft |> PlanReviewer |> LOOP(min=3)
// Test Execution & Fix (orchestrator fixes, PostToolUse hook enforces quality)
TestRunner |> (if failures then FailureAnalyzer |> FixWriter (orchestrator) |> LOOP else Done)
// CODE CHANGE WORKFLOW (Composite - chains pipelines after code edit)
// See references/code-change-workflow.md for full details
CodeReviewPipeline
|> TestAuditPipeline (Main Context Orchestration)
|> TestExecutionPipeline
|> (if code_bugs then FixValidationPipeline else Done)
1---2name: pipeline-templates3description: Pipeline Templates4---56# Pipeline Templates78## Overview910This skill provides pre-defined F# pipe workflows for common multi-agent scenarios. Pipelines ensure:1112- **Deterministic orchestration**: Consistent agent sequencing13- **Hard validation**: Block incorrect pipeline usage14- **Progress tracking**: Log all pipeline stages15- **Model optimization**: Right model for each stage1617**When to use**: Multi-agent work requiring more than simple exploration.1819**When NOT to use**: Single-agent tasks (explore, search, lookup) bypass pipeline validation automatically.2021## Pipeline Selection Guide2223Choose the appropriate pipeline based on your task:2425```26Is this a multi-agent task?27├─ No → No pipeline needed (single-agent bypass)28└─ Yes → What type of work?29 ├─ Reviewing existing code → Code Review Pipeline30 ├─ Fixing a bug/issue → Fix Validation Pipeline31 ├─ Auditing test quality → Test Audit Pipeline32 ├─ Implementing new functionality → New Feature Pipeline33 ├─ Research before implementation → Research & Planning Pipeline34 └─ Running tests and fixing failures → Test Execution & Fix Pipeline35```3637## Available Pipelines3839| Pipeline | Use Case | Model Pattern | Reference |40|----------|----------|---------------|-----------|41| Code Review | PR review, code audit | Sonnet (role-based, 4 sections) | `references/code-review.md` |42| Fix Validation | Bug fixes, issue resolution | Sonnet (analyze) → Opus (fix) → Sonnet (validate) → Sonnet (review) | `references/fix-validation.md` |43| Test Audit | Test quality assessment | Haiku (classify) → Sonnet (detect) → Sonnet (audit) | `references/test-audit.md` |44| New Feature | Feature implementation | Haiku (research) → Opus (write) → Sonnet (review) | `references/new-feature.md` |45| Research & Planning | Pre-implementation research | Haiku (lookup) → Sonnet (review) → loop(min=3) | `references/research-planning.md` |46| Test Execution & Fix | Run tests, fix failures | Haiku (execute) → Sonnet (analyze) → Opus (fix) | `references/test-execution-fix.md` |47| **Code Change Workflow** | **Full automation after code edit** | **Composite: chains multiple pipelines** | `references/code-change-workflow.md` |4849### Pipeline Architecture Notes5051**Role-Based Agents**: Code Review pipeline uses general-purpose sub-agents with specific roles. Each agent loads the `code-review` skill and references a specific section (Security, Type Safety, Linting, Coding Standards).5253**Custom Sub-Agents**: Fix Validation pipeline uses custom sub-agents (`bulwark-issue-analyzer`, `bulwark-fix-validator`) that encapsulate stage behavior and load relevant skills via frontmatter.5455**Code-Writing Agent**: Fix Validation and New Feature pipelines use `bulwark-implementer` (custom sub-agent, Opus) for code-writing stages with built-in quality enforcement.5657## Model Selection5859Reference `subagent-prompting` skill for the task-type rubric:6061| Task Type | Model | Examples |62|-----------|-------|----------|63| **Lookups & Execute** | Haiku | Web fetch, run tests, file search, lint |64| **Review & Analyze** | Sonnet | Code review, failure analysis, audits |65| **Write & Fix** | Opus | Write code, write tests, apply fixes |6667**Override rule**: If a custom agent specifies `model:` in frontmatter, use that model instead.6869## Validation Rules7071### Valid Pipeline Invocation7273A pipeline invocation is valid when:74751. Uses a defined pipeline template from this skill762. Specifies model for each stage (or uses default from task-type rubric)773. Includes 4-part prompt for each Task (GOAL/CONSTRAINTS/CONTEXT/OUTPUT)784. Reads previous stage output before invoking next stage7980### Invalid Invocation (Warning/Block)8182The following patterns trigger validation warnings:8384| Pattern | Issue | Resolution |85|---------|-------|------------|86| Ad-hoc multi-agent with no pipeline | Unpredictable orchestration | Choose appropriate pipeline |87| Missing model specification | May use wrong model | Specify model or use rubric |88| Skipping stages without justification | Incomplete workflow | Document skip reason |89| Using Opus for simple tasks | Wasteful | Use Haiku for lookups |9091### Hook Behavior (PostToolUse)9293The PostToolUse hook on Write|Edit:94- **Skips silently**: Small changes below threshold95- **Suggests pipeline**: Significant changes inject `additionalContext` with pipeline recommendation96- **Blocks**: Never (suggestion only, not blocking)9798## File Type to Pipeline Mapping99100When triggered by the Stop hook after Write/Edit/MultiEdit, select pipeline based on file modified. The hook (`suggest-pipeline-stop.sh`) emits ALL applicable pipelines for the turn — Code Review and Test Audit can both fire when a turn touches both production code and test files.101102### Test detection (path-based, takes priority)103104Files under any of these directory components are classified as **test** regardless of filename:105106| Directory pattern | Stack | Examples |107|-------------------|-------|----------|108| `tests/`, `*/tests/` | Bulwark, generic | `tests/hooks/test-foo.sh` |109| `test/`, `*/test/` | Ruby Minitest, Elixir, generic | `test/foo_test.rb`, `test/foo_test.exs` |110| `__tests__/` | Jest convention | `__tests__/Component.test.tsx` |111| `spec/`, `specs/` | Ruby RSpec, generic | `spec/models/user_spec.rb` |112| `src/test/` | JVM (Maven/Gradle) | `src/test/java/FooTest.java` |113114### Test detection (filename-based)115116| Filename pattern | Stack | Examples |117|------------------|-------|----------|118| `test_*`, `test-*` | Python (pytest), Bulwark hooks | `test_models.py`, `test-foo.sh` |119| `*_test.*`, `*-test.*` | Go, Ruby Minitest, generic | `models_test.go`, `foo-test.sh` |120| `*_spec.*`, `*-spec.*` | Ruby RSpec, generic | `user_spec.rb` |121| `*.test.*`, `*.spec.*` | Jest, Vitest, Jasmine | `Component.test.tsx`, `service.spec.js` |122123### Test detection (PascalCase, JVM/.NET)124125Case-sensitive match on basename suffix:126127| Filename pattern | Stack | Examples |128|------------------|-------|----------|129| `*Test.{java,kt,scala}` | JUnit, Kotest, ScalaTest | `UserServiceTest.java` |130| `*Tests.{cs,vb}` | xUnit, NUnit (C#/.NET) | `UserServiceTests.cs` |131| `*Spec.{kt,scala}` | Kotest, Specs2 | `UserServiceSpec.kt` |132| `*Specs.cs` | NSpec | `UserSpecs.cs` |133| `*IT.java` | JUnit integration tests | `UserServiceIT.java` |134135### Code, script, config detection136137| File Pattern | Extension | Recommended Pipeline |138|--------------|-----------|---------------------|139| Production code | `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`, `.cjs`, `.py`, `.go`, `.rs`, `.java`, `.kt`, `.scala`, `.cs`, `.fs`, `.vb`, `.rb`, `.exs`, `.ex`, `.cpp`, `.c`, `.php`, `.swift` | Code Review |140| Scripts | `.sh`, `.bash`, `.zsh`, `.fish`, `.ps1` | Code Review (security focus) |141| Config | `.json`, `.yaml`, `.yml`, `.toml`, `.ini`, `.env` | Code Review (security focus) |142| Documentation | `.md`, `.txt`, `.rst` | Light review or skip |143| Data files | `.xlsx`, `.csv`, `.pdf` | Manual review suggested |144145### Out of scope (path-only detection limits)146147Path-based classification cannot detect tests embedded in production source files:148149- **Rust inline `#[test]`** — annotation-only signal, no path convention. `src/foo.rs` always classifies as code; if it contains inline tests, they'll be reviewed under Code Review, not Test Audit.150- **Python doctests** — same rationale; `foo.py` with doctests classifies as code.151- **Inline test directives in any language** — content-only signal, undetectable from path.152153If a project relies heavily on inline tests, a future version may add content-based detection. For now, conventional `tests/` or `test_*` placement triggers Test Audit; inline tests don't.154155### Small Change Bypass156157Skip pipeline for small changes (threshold by file type):158159| File Type | Threshold | Rationale |160|-----------|-----------|-----------|161| Code | < 5 lines | Minor fixes don't need full review |162| Tests | < 10 lines | Single test additions are low risk |163| Config | < 3 lines | Single value changes are quick to verify |164| Documentation | <= 10 lines | Typo fixes and small updates |165| Scripts | < 3 lines | Security-sensitive, low threshold |166| Data | Any change | Always significant, suggest review |167168Changes at or below threshold are skipped silently. Changes above threshold trigger pipeline suggestion.169170## Pipeline Execution Pattern171172All pipelines follow this execution pattern:173174```fsharp175// F# pipe syntax for workflow orchestration176177// Sequential execution (each stage reads previous stage's output)178Stage1 (task) // First agent runs179|> Stage2 (task) // Reads Stage1 output, runs180|> Stage3 (task) // Reads Stage2 output, runs181|> (if condition // Conditional branching182 then StageA183 else StageB)184|> LOOP(max=N) // Optional iteration185186// Parallel execution (agents run concurrently, results merged)187[Stage1a, Stage1b, Stage1c] // Array notation = parallel188|> Stage2 (reads all Stage1 outputs)189```190191**Key principles**:192- **Sequential** (`|>`): Each stage reads the previous stage's log output193- **Parallel** (`[]`): Stages in array notation run concurrently via multiple Task calls in a single message194- Conditional branches based on stage results195- Loops have explicit iteration limits196- All output logged to `logs/`197198## Progress Tracking199200Pipeline progress is tracked via hooks:201202| Event | Hook | Log Entry |203|-------|------|-----------|204| Stage start | SubagentStart | `[timestamp] SubagentStart: agent_id (type)` |205| Stage end | SubagentStop | `[timestamp] SubagentStop: agent_id` |206207Logs written to: `logs/pipeline-tracking.log`208209## Related Skills210211| Skill | Relationship |212|-------|--------------|213| `subagent-prompting` | 4-part template, model selection rubric |214| `subagent-output-templating` | Output format for pipeline stages |215216## Quick Reference217218```fsharp219// Code Review (role-based agents, parallel execution)220[SecurityReviewer (section: Security), // Sonnet - role-based221 TypeSafetyReviewer (section: Type Safety), // Sonnet - role-based222 LintReviewer (section: Linting), // Sonnet - role-based223 StandardsReviewer (section: Coding Standards)] // Sonnet - role-based224|> ReviewSynthesizer (consolidates all findings)225|> (if critical_issues then FixWriter else Done)226227// Fix Validation (custom sub-agents)228IssueAnalyzer (bulwark-issue-analyzer, produces debug_report)229|> FixWriter (bulwark-implementer, implements fix)230|> (if !tests_cover_scenario // Only if tests don't exist231 then TestWriter |> TestAudit (mock-detection only) // Audit generated tests for T1-T4232 else TestAudit (if FixWriter wrote tests)) // Audit implementer tests for T1-T4233|> FixValidator (bulwark-fix-validator, validates against debug_report)234|> CodeReviewer (reviews all, approves/rejects)235|> (if !approved then IssueAnalyzer else Done)236|> LOOP(max=3)237238// Test Audit (Main Context Orchestration - skill-based)239TestClassifier |> MockDetector |> AuditSynthesizer240|> (if REWRITE_REQUIRED then TestRewriter else Done)241|> LOOP(max=2)242243// New Feature244Researcher |> Architect |> Implementer (bulwark-implementer) |> TestWriter |> TestAudit |> CodeReviewer245246// Research & Planning (min 3 iterations)247Researcher |> PlanDraft |> PlanReviewer |> LOOP(min=3)248249// Test Execution & Fix (orchestrator fixes, PostToolUse hook enforces quality)250TestRunner |> (if failures then FailureAnalyzer |> FixWriter (orchestrator) |> LOOP else Done)251252// CODE CHANGE WORKFLOW (Composite - chains pipelines after code edit)253// See references/code-change-workflow.md for full details254CodeReviewPipeline255|> TestAuditPipeline (Main Context Orchestration)256|> TestExecutionPipeline257|> (if code_bugs then FixValidationPipeline else Done)258```