agentleFS
patonkikhpatonkikh/APES/skills/ai/ai-workflow-builder/skill.md

ai-workflow-builder

Skill3 starsChanged 4 months agoMITView on GitHub

Build an executable AI workflow pipeline: stage definitions, data flow, branching logic, retries, and integration points for production deployment. Use when working on prompt engineering, AI workflows, agents, context design, or LLM optimization.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Document retry policy: max attempts, backoff, jitter.

    line 54
  2. Distinctive:

    Keep stages small and testable in isolation.

    line 116
  3. Distinctive:

    Use circuit breakers on external tool and model calls.

    line 118

≈ “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

AI Workflow Builder

Purpose

Build an executable AI workflow pipeline: stage definitions, data flow, branching logic, retries, and integration points for production deployment.

Input: Orchestration plan or use case, AI architecture, tool/MCP inventory (optional), NFRs (latency, throughput)
Output: AI Workflow Specification with stage graph, I/O contracts, and deployment configuration outline Examples: See examples.md for worked input/output.


Workflow

Step 1: Map workflow stages

Define pipeline stages:

Trigger → Preprocess → [Branch] → Model call(s) → Postprocess → Output / Webhook
StageTypeInputOutputTimeout

Stage types: transform, LLM call, tool call, human gate, parallel fan-out, aggregate.

Step 2: Define I/O contracts

For each stage boundary document:

  • Input schema (fields, types, validation)
  • Output schema (fields, types, required vs optional)
  • Error payload format
  • Idempotency key strategy (if applicable)

Step 3: Design branching and control flow

ConditionBranchDefault
Classification resultRoute to specialist pipelineFallback general path
Confidence below thresholdEscalate to human or stronger modelContinue with flag
Tool call failureRetry N times then degradeSurface error to caller

Document retry policy: max attempts, backoff, jitter.

Step 4: Plan state and observability

  • Workflow run ID and correlation ID propagation
  • Per-stage metrics (duration, token count, success rate)
  • Structured logging fields
  • Checkpoint/resume points for long workflows

Step 5: Specify deployment model

OptionFit
Synchronous APILow latency, short pipelines
Async queue + workerLong-running, batch workloads
Event-driven (webhook)External triggers, fan-out
Scheduled cronPeriodic batch processing

Step 6: Validate

Run Validation checklist.


Decision Rules

ConditionAction
No orchestration plan for multi-agent caseRecommend multi-agent-planner first
Stage exceeds latency budget aloneSplit stage or add caching layer
Non-idempotent side effects without guardAdd idempotency key and dedup store
>10 sequential LLM callsFlag cost/latency risk; recommend consolidation
Missing error handling on any stageBlock delivery; every stage needs failure path
PII flows through multiple stagesAdd redaction stage and audit log policy

Validation

  • All stages documented with I/O contracts
  • Branching logic covers success, failure, and edge cases
  • Retry policy defined per external dependency
  • Observability: metrics and correlation IDs specified
  • Deployment model aligned with NFRs
  • Cost estimate per workflow run (order of magnitude)
  • Human-in-the-loop gates placed where risk requires
  • No stage without explicit timeout

Anti-patterns

  • Monolithic stage — one giant LLM call doing preprocess + reason + format.
  • Silent failures — swallowing errors without branch to recovery path.
  • Unbounded retries — retrying without cap on transient and permanent errors.
  • Missing correlation — logs that cannot trace a single user request end-to-end.
  • Hardcoded prompts in workflow — inline prompts instead of versioned prompt assets.

Best Practices

  • Keep stages small and testable in isolation.
  • Version workflow definitions; support rollback.
  • Use circuit breakers on external tool and model calls.
  • Cache deterministic preprocessing results.
  • Pair with ai-evaluation-builder for stage-level quality gates.

Output Structure

# AI Workflow Specification: [Workflow Name]
**Version:** 1.0

## Stage Graph
[Diagram and stage table]

## I/O Contracts
### Stage: [Name]
**Input schema:** ...
**Output schema:** ...

## Control Flow
| Trigger | Condition | Action |
|---------|-----------|--------|

## Retry & Circuit Breaker
| Dependency | Max retries | Backoff | Circuit threshold |
|------------|-------------|---------|-------------------|

## Observability
| Metric | Stage | Alert threshold |
|--------|-------|-----------------|

## Deployment
[Model, scaling, trigger mechanism]

## Cost Estimate
[Per-run and monthly at projected volume]

Next Skills

OutcomeRecommended Skill
Build eval harness for workflowai/ai-evaluation-builder
Reduce workflow costai/ai-cost-optimizer
Reduce pipeline latencyai/ai-latency-optimizer
Design prompts for stagesai/prompt-engineer
Add MCP tools to stagesmcp/mcp-tool-generator

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.