ai-workflow-engineering
Guide for creating reliable AI workflows and SOPs. Use when: (1) User wants to create a structured workflow for AI tasks, (2) User needs to build an SOP for complex processes, (3) User wants to ensure their workflow follows best practices for managing LLM uncertainty, (4) User mentions creating workflows for domains like code review, response analysis, documentation, or any structured process
Best use case
ai-workflow-engineering is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Guide for creating reliable AI workflows and SOPs. Use when: (1) User wants to create a structured workflow for AI tasks, (2) User needs to build an SOP for complex processes, (3) User wants to ensure their workflow follows best practices for managing LLM uncertainty, (4) User mentions creating workflows for domains like code review, response analysis, documentation, or any structured process
Teams using ai-workflow-engineering should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/ai--workflow-engineering/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How ai-workflow-engineering Compares
| Feature / Agent | ai-workflow-engineering | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Guide for creating reliable AI workflows and SOPs. Use when: (1) User wants to create a structured workflow for AI tasks, (2) User needs to build an SOP for complex processes, (3) User wants to ensure their workflow follows best practices for managing LLM uncertainty, (4) User mentions creating workflows for domains like code review, response analysis, documentation, or any structured process
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Top AI Agents for Productivity
See the top AI agent skills for productivity, workflow automation, operational systems, documentation, and everyday task execution.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
SKILL.md Source
# AI Workflow Engineering Pattern
## When to Use This Skill
Creating reliable AI workflows that manage LLM uncertainty through structured phases, explicit constraints, and human checkpoints. This is the universal pattern that emerged across PDD, HumanLayer, and Agent SOPs.
## The 5-Phase Universal Structure
All reliable AI workflows follow this pattern:
1. **Intake/Investigation** - Validate inputs before processing
2. **Decomposition/Planning** - Break work into components
3. **Iterative Execution** - Do work with checkpoints
4. **Validation/Review** - Test quality with metrics
5. **Decision Point** - Human chooses next action
## Creating a New Workflow
### Parameters to Gather
Ask user for:
- `workflow_domain` - What problem space (e.g., "code review", "meeting facilitation")
- `primary_goal` - Main outcome to achieve
- `target_users` - Who will use this (optional)
- `output_location` - Where to save artifacts (default: "./workflows")
**Key constraint:** Get all parameters upfront in single prompt
### Phase 1: Domain Analysis
Create `{output}/domain-analysis.md` documenting:
```markdown
## Problem Statement
[What makes this hard without structure]
## Failure Modes
- [What goes wrong without workflow]
- [Where LLM uncertainty is highest]
## Critical Decision Points
- [Where human judgment matters]
## Success Criteria
- [Observable outcomes]
```
**Checkpoint:** "Does this analysis capture the domain correctly?"
### Phase 2: Input/Output Specification
Define in `{output}/io-specification.md`:
**Required parameters:**
- Name, type, description
- Required vs optional
- Validation rules
- Default values
**Output artifacts:**
- What files/data produced
- Format specifications
- Success criteria
**Input methods:**
- Direct text, file upload, URL, API, etc.
**Checkpoint:** "Are I/O specs clear and testable?"
### Phase 3: Phase Decomposition
Create `{output}/phases.md` with structure:
```markdown
## Phase N: [Name]
**Objective:** [What this accomplishes]
**Entry criteria:** [What must be true to enter]
**Activities:**
- [Key actions in this phase]
**Outputs:** [Artifacts created]
**Exit criteria:** [What must be true to exit]
**Checkpoint:** [User decision at end]
**Can iterate back to:** [Which phases]
```
Include mermaid diagram showing phase transitions.
**Required phases:**
1. Intake (validate inputs)
2. Decomposition (structure work)
3. Execution (do work - can have sub-phases)
4. Validation (check quality)
5. Decision (user chooses next)
**Checkpoint:** "Do phases cover complete workflow?"
### Phase 4: Constraint Definition
Create `{output}/constraints.md` using RFC 2119 language:
**Format:**
```markdown
## Phase: [Name]
### Action Constraints
- You MUST [action] before [other action]
- You MUST NOT [anti-pattern] because [reason]
- You SHOULD [best practice] when [condition]
- You MAY [optional action] if [condition]
### Interaction Constraints
- You MUST ask ONE question at a time
- You MUST wait for user confirmation before [action]
- You MUST present [summary] at checkpoints
### Validation Constraints
- You MUST verify [condition] is met
- You MUST calculate [metric] and compare to [threshold]
```
**Critical:** Include rationale with "because" for key constraints.
**Anti-patterns:** Document common failures to prevent:
```markdown
- You MUST NOT list all questions at once because this overwhelms users
- You MUST NOT pre-populate answers because this assumes preferences
```
**Checkpoint:** "Any additional constraints or anti-patterns to add?"
### Phase 5: Checkpoint Design
Create `{output}/checkpoints.md`:
```markdown
## Checkpoint: [Name]
**Trigger:** [When this occurs]
**Present to user:**
- Current state: [Progress summary]
- Key findings: [Important discoveries]
- Quality metrics: [Scores/coverage]
**Options:**
[A] [Proceed option]
[B] [Iterate/revise option]
[C] [Change approach option]
[D] [Request info option]
**Question:** [Explicit question to user]
**Constraints:**
- You MUST wait for user response
- You MUST NOT auto-select option
```
**Key principle:** Checkpoints at natural decision points only (not purely informational).
**Checkpoint:** "Are these the right decision points?"
### Phase 6: Validation Framework
Create `{output}/validation-framework.md`:
```markdown
## Test: [Name]
**Purpose:** [What this validates]
**Method:** [How to perform test]
**Pass criteria:** [Observable conditions]
**Fail criteria:** [Observable conditions]
**Partial criteria:** [If applicable]
**Score calculation:** [If numeric]
```
**Required core tests:**
1. Completeness (all required elements present?)
2. Coverage (output addresses all input components?)
3. Specificity (output actionable and concrete?)
4. Context (output fits given constraints?)
**Success metrics:**
- Minimum passing score
- Excellent vs acceptable vs needs-revision thresholds
**Checkpoint:** "Are these the right quality criteria?"
### Phase 7: Artifact Specification
Create `{output}/artifacts.md`:
```markdown
## Artifact: [Name]
**Path:** {output}/[filename]
**Format:** [markdown/JSON/code/etc]
**Created:** [Which phase]
**Purpose:** [Checkpoint/intermediate/final]
**Required sections:**
- [Section 1]
- [Section 2]
**Lifecycle:** [Create → Update → Archive]
```
**Artifact types:**
- **Checkpoint artifacts** - Preserve state for resumption
- **Intermediate artifacts** - Support the process
- **Final artifacts** - Main deliverables
**Checkpoint:** "Will these artifacts support workflow needs?"
### Phase 8: Example Scenarios
Create `{output}/examples.md` with:
1. **Success scenario** - Everything goes smoothly
2. **Iteration scenario** - Multiple refinement cycles
Show for each:
- Initial inputs
- Interaction at checkpoints
- User responses
- Artifacts created
- Quality scores
- Final outputs
**Format:** Dialogue showing agent-user interaction
**Checkpoint:** "Do examples represent real usage?"
### Phase 9: Troubleshooting
Create `{output}/troubleshooting.md`:
```markdown
## Issue: [Name]
**Symptoms:** [How to recognize]
**Causes:** [Why it happens]
**Resolution:** [What to do]
**Prevention:** [How to avoid]
```
**Common issues to address:**
- Incomplete/ambiguous inputs
- User stuck at checkpoint
- Quality not improving with iteration
- Workflow too complex
- Context limits reached
**Checkpoint:** "What other issues to document?"
### Phase 10: Generate Final SOP
Create `{output}/workflow.sop.md`:
```markdown
# [Workflow Name]
## Overview
[What this does, when to use it]
## Parameters
[Required and optional inputs with constraints]
## Steps
### 1. [Phase Name]
[Description with constraints]
...
## Examples
[Usage scenarios]
## Troubleshooting
[Common issues]
```
Also create:
- `{output}/README.md` - Quick start guide
- Mermaid workflow diagram
- Quick reference card (optional)
**Checkpoint:** "Generate other formats? (SKILL.md, MCP prompt)"
### Phase 11: Validation
Run meta-validation checklist:
**Core Structure:**
- [ ] 5 core phases present
- [ ] Entry/exit criteria defined
- [ ] Clear checkpoints
**Constraints:**
- [ ] Uses MUST/SHOULD/MAY
- [ ] Includes rationales
- [ ] Testable/observable
**Checkpoints:**
- [ ] Prevents auto-progression
- [ ] Clear options presented
- [ ] Supports iteration
**Validation:**
- [ ] Success criteria defined
- [ ] Quality metrics present
- [ ] Pass/fail tests included
Create `{output}/validation-report.md` with scores:
- Completeness
- Clarity
- Actionability
- Robustness
**Checkpoint:** "What needs refinement before ready?"
### Phase 12: Iteration Checkpoint
Present summary:
```
Workflow Engineering Summary
============================
Domain: [workflow_domain]
Phases: [count] defined
Constraints: [count] explicit
Checkpoints: [count] decision points
Tests: [count] validation tests
Validation Score: X/10
Ready for use: [Yes/Needs revision]
Options:
[A] Ready - generate deliverables
[B] Revise sections (which?)
[C] Add examples/troubleshooting
[D] Simplify - too complex
[E] Test with real scenario first
```
### Phase 13: Delivery
Package all artifacts in `{output}/` directory.
Generate requested formats:
- Standard .sop.md (always)
- SKILL.md (if for Claude.ai)
- MCP prompt format (if for Claude Code)
Present:
```
Files created:
- workflow.sop.md (main SOP)
- README.md (quick start)
- [all other artifacts]
Next steps:
1. Review workflow.sop.md
2. Test with real scenario
3. Iterate based on results
4. Share with users
[A] Walk through with test case
[B] Generate additional formats
[C] Create training materials
[D] Done
```
## The 7 Universal Principles
Every workflow MUST follow:
1. **Explicit Over Implicit** - All constraints use MUST/SHOULD/MAY
2. **Validate Early/Often** - Check inputs, outputs, assumptions
3. **Human at Critical Points** - Checkpoints for decisions, not auto-pilot
4. **Observable/Measurable** - Every step produces artifacts, metrics
5. **Robust to Interruption** - Resume from checkpoints via artifacts
6. **Iterative by Design** - Non-linear, easy to revise, clear paths back
7. **Constrained but Flexible** - Rigid structure, flexible content
## Quick Reference: Constraint Language
**MUST** - Absolute requirement (testable pass/fail)
**MUST NOT** - Absolute prohibition (include "because")
**SHOULD** - Strong recommendation (can violate with reason)
**SHOULD NOT** - Strong discouragement
**MAY** - Optional (user's choice)
**Template:**
```
You MUST [action] before [other action]
You MUST NOT [anti-pattern] because [reason]
You SHOULD [best practice] when [condition]
You MAY [optional] if [condition]
```
## Common Workflow Domains
This pattern works for:
**Development:** Code review, design docs, API documentation, test strategy
**Communication:** Response quality, meeting facilitation, technical writing
**Analysis:** Problem decomposition, decision making, requirements gathering
**Planning:** Project/sprint planning, roadmap creation, resource allocation
## Meta-Validation Checklist
Quick check if workflow follows pattern:
- [ ] Has all 5 core phases
- [ ] Uses MUST/SHOULD/MAY language
- [ ] Has checkpoints with clear options
- [ ] Prevents auto-progression at decisions
- [ ] Has testable success criteria
- [ ] Calculates quality metrics
- [ ] Includes concrete examples
- [ ] Documents troubleshooting
## Why This Pattern Works
**Manages LLM uncertainty:**
- Constraints bound solution space
- Validation catches drift
- Checkpoints ensure alignment
**Decomposes complexity:**
- Explicit phases with clear outputs
- Iterative refinement over one-shot
- Context management via artifacts
**Coordinates human-AI:**
- Humans decide at critical points
- AI needs explicit permission
- Shared understanding of state
## Usage Notes
**For simple workflows:** May collapse some phases or reduce checkpoint frequency
**For complex workflows:** May expand execution phase into sub-phases, add more checkpoints
**Key principle:** Start simple, add structure only when needed
Always ask: "Does this constraint/checkpoint/test add value, or just complexity?"
## Version
v1.0 - Meta-pattern codified from PDD, HumanLayer, Agent SOPs convergenceRelated Skills
writing-eval-sloptastic
Quantitative framework for detecting AI-generated "slop" in prose through systematic analysis of structural, lexical, rhetorical, and logical patterns. Use when analyzing text authenticity, evaluating writing quality, detecting AI-generated content, or assessing whether prose has characteristic AI patterns like excessive parallelism, abstraction laddering, chiasmus abuse, platitudes, tautologies, or rhetorical overengineering.
validated-knowledge-synthesis
Transform raw, unorganized information into actionable knowledge through systematic validation. Use when users want to synthesize information from multiple sources (documents, URLs, transcripts, notes) into structured knowledge documents. Supports three document types - curated context (default, optimized for recall), guidance (implementation-focused narrative), and reference (quick lookup). Combines convergent synthesis with tension preservation to maintain productive contradictions. Triggers on requests like "synthesize this information", "create knowledge document from these sources", "transform these notes into actionable guidance", or "help me organize this research".
transcribing-youtube
Download and transcribe YouTube videos into clean, deduplicated Markdown documents with chapter headings. Wraps yt-dlp to fetch subtitles (manual or auto-generated), removes the rolling-text triplication artifacts from auto-subs, inserts chapter markers from video metadata, and produces both a timestamped transcript and a prose-only version. Use when the user wants to: (1) transcribe a YouTube video, (2) get a transcript or subtitles from YouTube, (3) create an InfoNugget from a video, (4) extract text from a YouTube URL or video ID, or (5) mentions yt-dlp, YouTube transcript, or video subtitles.
synthesize-knowledge-graph
Transform source materials into K-DAGs (Knowledge DAGs) — modular, curated domain knowledge structured as directed acyclic graphs with typed edges, mermaid visualization, and prose context. Use when users want to build knowledge graphs from documents, synthesize multiple sources into structured ontologies, intersect existing K-DAGs to discover emergent relationships, or create machine-readable knowledge structures that resist context rot. Triggers on: 'build a knowledge graph', 'create a K-DAG', 'intersect these knowledge sources', 'map the relationships between these documents', 'synthesize an ontology from these sources'.
skill-resiliency
This skill should be used when the user asks to "add resiliency to a skill", "make this skill more robust", "improve error handling", "add validation mechanisms", "create self-correcting behavior", or discusses determinism, robustness, error correction, or homeostatic patterns in Agent Skills. Applies biological resiliency principles from Michael Levin's work to Agent Skill design.
prompt-driven-development
Transform rough ideas into detailed design documents with implementation plans. Use when a user wants to develop an idea into a complete specification, create a design document from a concept, plan a feature implementation, or mentions "PDD", "prompt-driven development", "idea to design", "design doc from idea", or wants to systematically refine requirements before building. Guides through requirements clarification, research, detailed design, and implementation planning.
codebase-summary
Analyze a codebase and generate comprehensive documentation including architecture, components, interfaces, workflows, and dependencies. Creates an AI-optimized knowledge base (index.md) and can consolidate into AGENTS.md, README.md, or CONTRIBUTING.md. Use when the user wants to document a codebase, create AGENTS.md, understand system architecture, generate developer documentation, or asks to "summarize the codebase".
Skill Development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.
Plugin Structure
This skill should be used when the user asks to "create a plugin", "scaffold a plugin", "understand plugin structure", "organize plugin components", "set up plugin.json", "use ${CLAUDE_PLUGIN_ROOT}", "add commands/agents/skills/hooks", "configure auto-discovery", or needs guidance on plugin directory layout, manifest configuration, component organization, file naming conventions, or Claude Code plugin architecture best practices.
Plugin Settings
This skill should be used when the user asks about "plugin settings", "store plugin configuration", "user-configurable plugin", ".local.md files", "plugin state files", "read YAML frontmatter", "per-project plugin settings", or wants to make plugin behavior configurable. Documents the .claude/plugin-name.local.md pattern for storing plugin-specific configuration with YAML frontmatter and markdown content.
MCP Integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context Protocol", "connect external service", mentions "${CLAUDE_PLUGIN_ROOT} with MCP", or discusses MCP server types (SSE, stdio, HTTP, WebSocket). Provides comprehensive guidance for integrating Model Context Protocol servers into Claude Code plugins for external tool and service integration.
Hook Development
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.