skills/init/SKILL.md
Initialize C4Flow dependencies in the current project — auto-sets up git (init repo if missing), installs Dolt and Beads. Use when setting up a new project, when bd/dolt is missing, or when the user needs to configure DoltHub sync or team collaboration.
npx skillsauth add tunneleven/C4Flow c4flow:initInstall 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.
Agent type: Main agent (interactive) Status: Implemented
Detects, installs, and configures all C4Flow dependencies in the current project:
Git — auto-installs if missing; auto-inits a repo if not inside one
Dolt — version-controlled SQL database (Beads backend)
Beads (bd) — issue tracking and task management CLI
Runs bd init + starts Dolt server
Installs git hooks for data consistency (bd hooks install)
Optionally configures DoltHub sync for cloud backup
Sets up bd prime for Claude context injection
Optionally creates or manages a GitHub repository through Terraform
Optionally creates .coderabbit.yaml and helps attach CodeRabbit
The init script is bundled with this skill. Find and run it:
# Search common locations (latest version first for plugin cache)
INIT_SCRIPT=""
for dir in \
"$(pwd)" \
$(ls -d "$HOME/.claude/plugins/cache/c4flow-marketplace/c4flow/"*/ 2>/dev/null | sort -V -r) \
"$HOME/.codex/c4flow"; do
if [ -f "$dir/skills/init/init.sh" ]; then
INIT_SCRIPT="$dir/skills/init/init.sh"
break
fi
done
if [ -n "$INIT_SCRIPT" ]; then
echo "Found: $INIT_SCRIPT"
bash "$INIT_SCRIPT" "$@"
else
echo "Init script not found"
fi
The script will:
doltbd (Beads)bd init with a 30s timeout--remote provided)Do you want to create/manage a GitHub repository for this project?Do you want to set up CodeRabbit for this repository?.coderabbit.yaml and attach CodeRabbit when installation metadata is availablebd listAll steps have timeouts. Total time should be under 30 seconds.
If the user provides a DoltHub URL, pass it with --remote:
bash "$dir/skills/init/init.sh" --remote https://www.dolthub.com/repositories/org/repo
The script accepts these URL formats:
https://www.dolthub.com/repositories/org/repo (web URL — auto-converted)https://doltremoteapi.dolthub.com/org/repo (API URL — used as-is)org/repo (short form — auto-expanded)The script will:
bd dolt remote add origin <api-url>bd dolt pushIf push fails (auth), it tells the user to run dolt login first.
After the init script completes, run these additional setup steps:
Beads uses git hooks for data consistency. If an external hook manager (lefthook, husky, pre-commit) is detected, beads chains its hooks:
bd hooks install 2>/dev/null
This installs:
pre-commit — data consistency checkspost-merge — ensures Dolt DB stays current after pull/mergebd prime injects ~1-2k tokens of workflow context into Claude sessions. This is far more efficient than MCP tool schemas (10-50x less overhead):
bd setup claude --project 2>/dev/null
This installs SessionStart and PreCompact hooks that run bd prime to keep Claude aware of the current beads state.
For team workflows, configure the actor identity and auto-push:
# Set actor for audit trail (defaults to git user.name)
bd config set actor "$(git config user.name)" 2>/dev/null
# Enable JSONL backup (safety net behind Dolt snapshots)
bd config set backup.enabled true 2>/dev/null
bd info --json 2>/dev/null
bd list --json 2>/dev/null
If a DoltHub remote was configured, save the API URL to docs/c4flow/.state.json:
{
"doltRemote": "https://doltremoteapi.dolthub.com/org/repo"
}
Read the existing .state.json first (create it if missing), then merge the doltRemote field.
If the user approves GitHub bootstrap, the script requires:
terraform installed locallyGITHUB_OWNER or --github-ownerGITHUB_TOKENGITHUB_APP_ID, GITHUB_APP_INSTALLATION_ID, and GITHUB_APP_PEM_FILEThe GitHub bootstrap uses Terraform with the GitHub provider and manages a github_repository resource for the selected owner and repository name.
If the user approves GitHub bootstrap but these variables are missing, stop and ask the user to set them before continuing.
If the user approves CodeRabbit setup, the script will:
.coderabbit.yaml from the bundled template--coderabbit-installation-id is providedManual fallback text should tell the user to complete the GitHub App install from the CodeRabbit dashboard for the selected repository.
The script outputs a verification summary. Just relay it to the user.
If the script is not found, run these commands manually:
# Git (if missing / no repo)
git init && git commit --allow-empty -m "chore: initial commit"
# Install Dolt (if missing)
curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | sudo bash
# Install Beads (if missing)
curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
# Init in project
bd init
The script also supports these non-interactive flags:
--github / --no-github--github-owner--github-repo--github-visibility--coderabbit / --no-coderabbit--coderabbit-installation-idbd doctor or bd doctor --fix — hangs indefinitely. The init script verifies with bd list instead.bd dolt start to start the server — never run dolt sql-server manually. Beads manages its own server lifecycle.bd list triggers it.--github was passed.--coderabbit was passed.If Dolt connection fails after init, tell the user:
"Run
bd dolt startto start the Dolt server, orbd dolt statusto check."
| Error | Solution |
|-------|----------|
| sudo required for Dolt | Ask user to run with sudo, or use brew install dolt |
| bd init times out | Script continues, uses bd dolt start |
| Port conflict | Beads picks port automatically (default 3307) |
| bd init fails | Try bd init --stealth for minimal mode (no hooks, no AGENTS.md) |
| Dolt won't connect | bd dolt start, then bd dolt status to check |
| Hook manager conflict | bd hooks install auto-chains with lefthook/husky/pre-commit |
| Git worktree | All worktrees share the same .beads/ — database discovery is automatic |
| Missing GitHub auth vars | Ask user to set GITHUB_TOKEN or GitHub App env vars |
| Missing terraform | Ask user to install Terraform before GitHub bootstrap |
| Existing git origin differs | Ask This repo already has an origin remote. Do you want to replace it? |
| Missing CodeRabbit installation metadata | Create .coderabbit.yaml, then print manual CodeRabbit install instructions |
development
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.