From parallel-workflows
Use this skill when writing or reviewing workflow scripts that need to handle agent failures, design defensive schemas, or correctly place .filter(Boolean) after parallel and pipeline calls. Reference whenever a workflow will run at scale where individual agent failures are expected.
How this skill is triggered — by the user, by Claude, or both
Slash command
/parallel-workflows:error-handlingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
An `agent()` call returns `null` when the agent:
An agent() call returns null when the agent:
Failures are expected at scale. A 200-agent workflow must tolerate individual failures without aborting the whole run.
.filter(Boolean) after parallel()After every parallel() call, filter before iterating:
const results = await parallel(items.map(item => () =>
agent(`Analyse ${item}`, {schema: RESULT_SCHEMA})
))
const valid = results.filter(Boolean)
log(`${valid.length}/${items.length} agents completed`)
Without .filter(Boolean), a single null crashes any subsequent .map(), .flatMap(), or property access.
pipeline() stagesA pipeline stage that throws drops that item to null and skips its remaining stages. Use try/catch to handle gracefully and log what was dropped:
const results = await pipeline(
items,
async item => {
try {
return await agent(`Process ${item}`, {schema: RESULT_SCHEMA})
} catch (err) {
log(`Dropped ${item}: ${err.message}`)
return null
}
},
result => result
? agent(`Verify ${result.finding}`, {schema: VERDICT_SCHEMA})
: null
)
const valid = results.filter(Boolean)
Loose schemas cause agents to return partial data that breaks downstream aggregation. Four rules:
required fields — don't rely on the model to include optional onesenum for bounded strings — { type: 'string', enum: ['critical','high','medium','low'] } prevents free-text valuesauthorName, authorEmail) not { author: { name, email } }const FINDING_SCHEMA = {
type: 'object',
properties: {
file: { type: 'string' },
line: { type: 'number' },
severity: { type: 'string', enum: ['critical', 'high', 'medium', 'low'] },
description: { type: 'string' },
fix: { type: 'string' }
},
required: ['file', 'line', 'severity', 'description']
}
When a schema: is provided, the model retries automatically on mismatch. The retry loop is built into the runtime. Adding a manual retry wrapper creates double-retry amplification: the agent retries internally, then your wrapper retries the whole agent call, multiplying token spend.
If an agent consistently fails schema validation, fix the schema or the prompt — not with a retry loop.
Never silently continue past a null result. A log line makes dropped items visible in the /workflows progress view:
const valid = results.filter(Boolean)
if (valid.length < results.length) {
log(`[warn] ${results.length - valid.length} agents returned null — coverage incomplete`)
}
This ensures the final report's consumer knows the result set may be incomplete.
npx claudepluginhub donalmoloney/claudeworkflows --plugin parallel-workflowsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.