Skip to content

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.

Pattern IDDomainTypical use
invoice-approvalFinance / accounts payableMulti-level invoice review and ERP payment trigger
employee-onboardingHRAccount provisioning, orientation scheduling, system access
supplier-contract-reviewProcurement / legalContract classification, risk scan, CLM storage, e-signature
incident-responseIT / opsSeverity classification, on-call paging, post-mortem creation
loan-originationFinancial servicesIdentity verification, credit check, risk scoring, disbursement
content-moderationTrust & safetyAI scan, action enforcement, CSAM reporting, user notification
order-fulfillmentE-commerce / supply chainInventory validation, payment, warehouse order, shipment tracking

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:

RequestMatched 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)

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.

You can access the pattern library directly in TypeScript:

import { ALL_PATTERNS, findPattern } from "@bpmnkit/patterns"
// List all patterns
console.log(ALL_PATTERNS.map((p) => p.id))
// Find by keyword match
const pattern = findPattern("employee onboarding workflow")
console.log(pattern?.id) // "employee-onboarding"
// Find by exact ID
const invoice = findPattern("invoice-approval")
console.log(invoice?.workers.map((w) => w.jobType))
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"]
}

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.