agentleFS
QBall-IncQBall-Inc/the-bulwark/skills/pipeline-templates/SKILL.md

pipeline-templates

Skill8 starsChanged 5 months agoMITView on GitHub

Pre-defined F# pipe workflows for multi-agent orchestration. Provides code review, fix validation, test audit, new feature, research & planning, and test execution pipelines. Triggered via PostToolUse hook after significant code changes.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Override rule: If a custom agent specifies model: in frontmatter, use that model instead.

    line 74
  2. Distinctive:

    Blocks: Never (suggestion only, not blocking)

    line 103
  3. Very specific:

    When triggered by the Stop hook after Write/Edit/MultiEdit, select pipeline based on file modified.

    line 107
  4. Very specific:

    If a project relies heavily on inline tests, a future version may add content-based detection.

    line 160
  5. Distinctive:

    All pipelines follow this execution pattern:

    line 179
  6. Very specific:

    All output logged to logs/

    line 203

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

PipelineUse CaseModel PatternReference
Code ReviewPR review, code auditSonnet (role-based, 4 sections)references/code-review.md
Fix ValidationBug fixes, issue resolutionSonnet (analyze) → Opus (fix) → Sonnet (validate) → Sonnet (review)references/fix-validation.md
Test AuditTest quality assessmentHaiku (classify) → Sonnet (detect) → Sonnet (audit)references/test-audit.md
New FeatureFeature implementationHaiku (research) → Opus (write) → Sonnet (review)references/new-feature.md
Research & PlanningPre-implementation researchHaiku (lookup) → Sonnet (review) → loop(min=3)references/research-planning.md
Test Execution & FixRun tests, fix failuresHaiku (execute) → Sonnet (analyze) → Opus (fix)references/test-execution-fix.md
Code Change WorkflowFull automation after code editComposite: chains multiple pipelinesreferences/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 TypeModelExamples
Lookups & ExecuteHaikuWeb fetch, run tests, file search, lint
Review & AnalyzeSonnetCode review, failure analysis, audits
Write & FixOpusWrite 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:

  1. Uses a defined pipeline template from this skill
  2. Specifies model for each stage (or uses default from task-type rubric)
  3. Includes 4-part prompt for each Task (GOAL/CONSTRAINTS/CONTEXT/OUTPUT)
  4. Reads previous stage output before invoking next stage

Invalid Invocation (Warning/Block)

The following patterns trigger validation warnings:

PatternIssueResolution
Ad-hoc multi-agent with no pipelineUnpredictable orchestrationChoose appropriate pipeline
Missing model specificationMay use wrong modelSpecify model or use rubric
Skipping stages without justificationIncomplete workflowDocument skip reason
Using Opus for simple tasksWastefulUse 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 patternStackExamples
tests/, */tests/Bulwark, generictests/hooks/test-foo.sh
test/, */test/Ruby Minitest, Elixir, generictest/foo_test.rb, test/foo_test.exs
__tests__/Jest convention__tests__/Component.test.tsx
spec/, specs/Ruby RSpec, genericspec/models/user_spec.rb
src/test/JVM (Maven/Gradle)src/test/java/FooTest.java

Test detection (filename-based)

Filename patternStackExamples
test_*, test-*Python (pytest), Bulwark hookstest_models.py, test-foo.sh
*_test.*, *-test.*Go, Ruby Minitest, genericmodels_test.go, foo-test.sh
*_spec.*, *-spec.*Ruby RSpec, genericuser_spec.rb
*.test.*, *.spec.*Jest, Vitest, JasmineComponent.test.tsx, service.spec.js

Test detection (PascalCase, JVM/.NET)

Case-sensitive match on basename suffix:

Filename patternStackExamples
*Test.{java,kt,scala}JUnit, Kotest, ScalaTestUserServiceTest.java
*Tests.{cs,vb}xUnit, NUnit (C#/.NET)UserServiceTests.cs
*Spec.{kt,scala}Kotest, Specs2UserServiceSpec.kt
*Specs.csNSpecUserSpecs.cs
*IT.javaJUnit integration testsUserServiceIT.java

Code, script, config detection

File PatternExtensionRecommended Pipeline
Production code.ts, .tsx, .js, .jsx, .mjs, .cjs, .py, .go, .rs, .java, .kt, .scala, .cs, .fs, .vb, .rb, .exs, .ex, .cpp, .c, .php, .swiftCode Review
Scripts.sh, .bash, .zsh, .fish, .ps1Code Review (security focus)
Config.json, .yaml, .yml, .toml, .ini, .envCode Review (security focus)
Documentation.md, .txt, .rstLight review or skip
Data files.xlsx, .csv, .pdfManual 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 TypeThresholdRationale
Code< 5 linesMinor fixes don't need full review
Tests< 10 linesSingle test additions are low risk
Config< 3 linesSingle value changes are quick to verify
Documentation<= 10 linesTypo fixes and small updates
Scripts< 3 linesSecurity-sensitive, low threshold
DataAny changeAlways 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:

EventHookLog Entry
Stage startSubagentStart[timestamp] SubagentStart: agent_id (type)
Stage endSubagentStop[timestamp] SubagentStop: agent_id

Logs written to: logs/pipeline-tracking.log

Related Skills

SkillRelationship
subagent-prompting4-part template, model selection rubric
subagent-output-templatingOutput 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)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.