skills/c4flow/SKILL.md
Orchestrate the complete c4flow agentic development workflow — from research through deployment. Use when the user mentions "c4flow", wants to start a new feature workflow, or asks about the development pipeline. Triggers on feature planning, implementation orchestration, and workflow management.
npx skillsauth add tunneleven/C4Flow c4flowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are the c4flow orchestrator. You drive a multi-phase workflow that takes a feature idea from research through deployment. You manage state, check gate conditions, dispatch sub-agents for autonomous work, and handle user interaction for decisions that need human input.
| State | Phase | Status |
|-------|-------|--------|
| IDLE | — | Start here |
| RESEARCH | 1: Research & Spec | ✅ Implemented |
| SPEC | 1: Research & Spec | ✅ Implemented |
| DESIGN | 2: Design | ✅ Implemented |
| BEADS | 2: Task Breakdown | ✅ Implemented |
| CODE_LOOP | 3: Implementation | ✅ Implemented |
| INFRA | 6: Release | ✅ Implemented |
| DEPLOY | 6: Release | ✅ Implemented |
| DONE | — | Terminal state |
Note: TEST, REVIEW, VERIFY, PR, and MERGE are no longer top-level states. They execute per-task inside CODE_LOOP.
Ensure docs/c4flow/ directory exists (create it if needed)
Read docs/c4flow/.state.json
{
"version": 1,
"currentState": "IDLE",
"feature": null,
"mode": "research",
"startedAt": null,
"completedStates": [],
"failedAttempts": 0,
"beadsEpic": null,
"doltRemote": null,
"worktree": null,
"prNumber": null,
"lastError": null
}
feature schema (when set, MUST be an object with exactly these fields):
{
"name": "AI Log Analyzer",
"slug": "ai-log-analyzer",
"description": "One-sentence feature description from user input"
}
name: display name (original casing from user)slug: kebab-cased version used for directory paths (e.g., docs/specs/<slug>/)description: the full feature description provided by the user.state.json is gitignored and never committed to git. Each team member maintains their own copy tracking personal workflow progress and current task. Shared feature state lives in beads (synced via DoltHub) and spec artifacts under docs/specs/. When a new team member joins, they run /c4flow:run to create their own .state.json.Display the current state using the format from /c4flow:status
Branch based on currentState:
/c4flow:run my feature idea), use them as the feature name/description instead of asking--fast flag in arguments. If present, set mode: "fast" in .state.json. Default: mode: "research"currentState to RESEARCHcurrentState to SPEC, add RESEARCH to completedStates.state.json:
feature to { "name": "<display name>", "slug": "<kebab-case>", "description": "<user description>" }mode, startedAt to today's datecurrentState based on user's research choice above.state.json to IDLE state, ask for new feature infodocs/specs/{feature.slug}/research.md existsproposal.md, tech-stack.md, spec.md, design.md exist in docs/specs/{feature.slug}/references/phase-transitions.md in this skill's directory)completedStates, advance currentState, write .state.jsonbeadsEpic in state) or does docs/specs/{feature.slug}/tasks.md exist?tasks.md existscompletedStates, advance currentState to CODE_LOOP, write .state.jsondocs/c4flow/designs/<feature.slug>/ exist?
MASTER.md exists but no screen frames in .pen → resume from Step 1.3 (components)references/phase-transitions.md)DESIGN to completedStates, advance currentState to BEADS, write .state.jsoncurrentState is "CODE", update to "CODE_LOOP" and set taskLoop: null before proceedingtaskLoop from .state.json
taskLoop.currentTaskId is set: tell user "Task <id> was in progress at sub-state <subState>. Resume?"c4flow:codebd ready --assignee <actor> returns empty and all epic tasks are closed, the code skill advances currentState to "INFRA" directly — no orchestrator action neededinfraState in .state.json
infraState.appliedAt is present: tell user "Infrastructure already provisioned (applied: {infraState.appliedAt}). Re-provision or continue to DEPLOY?"
completedStates, advance currentState to DEPLOY, write .state.json, proceed to DEPLOYinfraState.githubSecretsConfigured == true in .state.jsoncompletedStates, advance currentState to DEPLOY, write .state.jsongh run view shows success)completedStates, advance currentState to DONE, write .state.jsonDispatch a sub-agent. Provide the sub-agent with:
skills/research/prompt.md (execution steps)skills/research/references/research-template.mdFeature: {feature.name}
Description: {feature.description}
Mode: {mode from .state.json — "fast" or "research"}
Output: docs/specs/{feature.slug}/research.md
prompt.md step by step (7 steps: parse → Layer 1 market → Layer 2 technical → quality gate → executive summary → write → report status)After sub-agent returns:
This runs in the main agent (you). Load the c4flow:spec skill and follow its instructions.
This runs in the main agent (you). Load the c4flow:design skill and follow its instructions.
This runs in the main agent (you). Load the c4flow:beads skill and follow its instructions.
After the skill completes, update beadsEpic in .state.json with the epic ID (or null if using tasks.md fallback).
This runs in the main agent (you). Load the c4flow:infra skill and follow its instructions.
This runs in the main agent (you). Load the c4flow:deploy skill and follow its instructions.
This runs in the main agent (you). Load the c4flow:code skill and follow its instructions.
The code skill runs a serial task loop — one task at a time:
--assignee arg → BD_ACTOR → git config user.name)bd ready --assignee <actor> --json → pick one unblocked taskbd update <task-id> --claim (atomic) → bd dolt pushgit checkout -b feat/<bead-id>-<task-slug> (always from latest main)bd preflight --checkc4flow:review → route CRITICAL/HIGH back to TDD sub-agentc4flow:pr → merge to mainbd close <id> --reason "..." → bd dolt pushWhen bd ready returns empty and all epic tasks are closed, the code skill writes currentState: "INFRA" to .state.json and exits.
Pass the actor to the skill:
Invoke c4flow:code with any assignee override from user instructions.
Example: "pickup task from Alice" → pass --assignee "Alice"
After each state transition:
completedStatescurrentState to the next statefailedAttempts to 0lastError.state.jsonbd dolt push 2>/dev/nullfailedAttempts, set lastError, retry up to 3 timescurrentState to the desired state, remove all subsequent states from completedStates, write .state.jsonWhen the user wants to return to a previous state:
currentState to that statecompletedStates that come after the target state in the workflow orderfailedAttempts to 0, clear lastError.state.jsondevelopment
Quality gate aggregation — runs bd preflight, combines with Codex review results, declares Ready for PR status. Use when the user wants to check if code is ready for PR, verify quality gates, or run preflight checks. Also triggers when mentioning "verify", "preflight", "quality gate", or "ready for PR".
development
Run unit and integration tests with coverage checking. Auto-detect framework, classify failures, enforce coverage threshold before advancing to review. Use when the user wants to run tests, check coverage, or validate implementation quality. Triggers on "run tests", "check coverage", "test suite", or when the code phase completes.
development
Test-driven development — RED-GREEN-REFACTOR cycles for all C4Flow implementation work. Merged into c4flow:code as a sub-agent phase with a mandatory RED gate pause. Use c4flow:code to run the full task loop.
testing
Sync local project with remote sources — pulls DoltHub beads and GitHub repo to local. Handles the "no common ancestor" Dolt error that occurs when bd init creates a fresh local DB that conflicts with an existing DoltHub history. Use when local beads are out of sync, after a fresh init on a project that already has DoltHub data, or to pull the latest GitHub changes.