Pattern Library
The pattern library (@bpmnkit/patterns) provides domain knowledge for common business
processes. When you run /implement, Claude checks the library for a matching pattern and
loads it as context before generating the BPMN.
Patterns are hints, not templates. Claude adapts them to the specific request and ignores them entirely when nothing relevant matches.
Available patterns
Section titled “Available patterns”| Pattern ID | Domain | Typical use |
|---|---|---|
invoice-approval | Finance / accounts payable | Multi-level invoice review and ERP payment trigger |
employee-onboarding | HR | Account provisioning, orientation scheduling, system access |
supplier-contract-review | Procurement / legal | Contract classification, risk scan, CLM storage, e-signature |
incident-response | IT / ops | Severity classification, on-call paging, post-mortem creation |
loan-origination | Financial services | Identity verification, credit check, risk scoring, disbursement |
content-moderation | Trust & safety | AI scan, action enforcement, CSAM reporting, user notification |
order-fulfillment | E-commerce / supply chain | Inventory validation, payment, warehouse order, shipment tracking |
How matching works
Section titled “How matching works”When /implement runs, Claude calls pattern_list and scores each pattern by counting how
many of its keywords appear in the request. The highest-scoring pattern is selected.
Exact pattern ID matches take priority over keyword scoring.
Examples:
| Request | Matched pattern |
|---|---|
| ”invoice approval workflow” | invoice-approval |
| ”employee onboarding with Okta and Jira” | employee-onboarding |
| ”on-call incident escalation” | incident-response |
| ”custom blockchain process” | (no match — Claude works from scratch) |
What a pattern contains
Section titled “What a pattern contains”Each pattern has four components:
README — domain context, common variations, relevant regulations, and conventions. Claude reads this before generating the BPMN.
Template — a compact BPMN template in the BPMNKit intermediate format (not raw XML). Used as a starting-point structure, not a fixed output.
Worker specs — typical service tasks with job type, inputs, outputs, and real integration options (e.g. “SAP, NetSuite, or QuickBooks” for a payment trigger).
Variations — common process variants (e.g. “3-way match”, “auto-approve below threshold”) so Claude can adapt the flow to the user’s specific context.
Using patterns from code
Section titled “Using patterns from code”You can access the pattern library directly in TypeScript:
import { ALL_PATTERNS, findPattern } from "@bpmnkit/patterns"
// List all patternsconsole.log(ALL_PATTERNS.map((p) => p.id))
// Find by keyword matchconst pattern = findPattern("employee onboarding workflow")console.log(pattern?.id) // "employee-onboarding"
// Find by exact IDconst invoice = findPattern("invoice-approval")console.log(invoice?.workers.map((w) => w.jobType))Pattern schema
Section titled “Pattern schema”interface Pattern { id: string name: string description: string keywords: string[] readme: string // domain context for the LLM workers: WorkerSpec[] variations: string[] template: PatternTemplate // compact BPMN structure}
interface WorkerSpec { name: string jobType: string description: string inputs: Record<string, string> outputs: Record<string, string> integrationOptions?: string[] // e.g. ["Stripe", "Adyen", "Braintree"]}Adding custom patterns
Section titled “Adding custom patterns”Create a new pattern file in packages/patterns/src/patterns/ and export it from index.ts.
Follow the existing patterns as a reference — each is a single TypeScript file that exports
a Pattern object.
For private or organisation-specific patterns, add them to your project and contribute the
pattern object to ALL_PATTERNS via the findPattern API. Contributions to the seed library
are welcome via pull request.
See also
Section titled “See also”- AI-Driven Implementation — how Claude uses patterns during
/implement @bpmnkit/patternssource