build-loop-init
Skill0 starsChanged 6 months agoMITView on GitHub
Scaffolds build-loop infrastructure in a project — runs convergence gates for new, legacy, or existing repos
- Reads credentials
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- build-loop-iterateSkill
- build-loopSkill
- frontend-designSkill
- handle-pr-reviewSkill
- orchestrateSkill
- phase-goal-reviewSkill
- phase-retroSkill
- regression-detectSkill
- review-prSkill
- spec-authorSkill
- test-gateSkill
- verify-gateSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
30 rules. About 0 are common, 6 are distinctive, and 24 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
24
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Pre-check —
AGENTS.md: Verify AGENTS.md exists at PROJECT_ROOT. - Distinctive: line 20
Create AGENTS.md using the minimal template below, inserting the operator's answer.
- Very specific: line 41
If .git exists, scan and classify before touching anything:
- Very specific: line 49
If no .git -> skip assessment, proceed to Gate 1.
- Very specific: line 65
If no .git directory, run git init.
- Very specific: line 69
If no origin remote: prompt operator for GitHub account (personal/work), repo name, visibility.
- Very specific: line 71
If origin exists but is not a GitHub URL: abort — the build system requires GitHub for PRs and Actions.
- Very specific: line 72
If origin points to GitHub: proceed.
- Very specific: line 76
Run gh auth status. If it fails, abort with instructions to run gh auth login.
- Distinctive: line 77
Check admin access to the repo.
- Very specific: line 82
Check repo-level user.name and user.email.
- Very specific: line 83
If either is missing, prompt operator to choose which GitHub account to use.
- Distinctive: line 87
If default branch is main, proceed.
- Distinctive: line 88
If different (e.g. master), prompt operator: rename to main, or keep?
- Very specific: line 92
Check repo visibility: run gh repo view --json visibility -q .visibility.
- Very specific: line 98
Verify .gitignore exists. If not, create a minimal one.
- Very specific: line 102
If tsconfig.json also exists -> prepend npx tsc --noEmit && (TypeScript projects must prove compilation.
- Very specific: line 103
If Makefile exists -> make lint test
- Very specific: line 105
If pyproject.toml or setup.py exists:
- Very specific: line 107
If mypy.ini, .mypy.ini, setup.cfg with [mypy], or pyproject.toml with [tool.mypy] exists -> prepend mypy .
- Very specific: line 111
Write docs/plan/progress.yaml using the template from the state-machine reference …
- Very specific: line 112
Write docs/plan/phase-goal.md with placeholder content: No phase started.
- Very specific: line 113
Create .github/workflows/ directory if it doesn't exist.
- Very specific: line 114
Write .github/workflows/phase-retro-check.yml using the workflow template below (replace if outdated).
- Very specific: line 115
Create .github/ directory if it doesn't exist.
- Very specific: line 135
If README.md does not exist at PROJECT_ROOT, create it with a heading derived from the directory name and the build-loop section (see …
- Very specific: line 136
If README.md exists but does not contain the marker <!-- build-loop -->, append the build-loop section to the end of the file.
- Distinctive: line 137
If the marker already exists, do nothing (idempotent).
- Very specific: line 138
Read the version from <!-- version: N --> in the router skill SKILL.md to populate the version number.
- Distinctive: line 152
Failure mode: If any gate fails, stop cleanly.
≈ “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.
Files
<!-- version: 12 --><!-- Sub-skill of build-loop. Read the router skill first for shared sections: parameters, scope restriction, concurrency guard, resolve project root, phase spec format. --><!-- Router: ${CLAUDE_PLUGIN_ROOT}/skills/build-loop/SKILL.md -->Action: init
Scaffolds build-loop infrastructure in a project. Runs gates to converge the project to the current standard — whether brand new, legacy, or an existing repo without build-loop.
IMPORTANT: init is the entry point for NEW projects. If the project directory does not exist, init creates it after confirming the path with the operator (see "Resolve project root" step 4 in the router skill). The operator can confirm the default path or provide an alternative. If AGENTS.md does not exist, init scaffolds it (see pre-check below).
Pre-check — AGENTS.md: Verify AGENTS.md exists at PROJECT_ROOT. If not:
- Prompt the operator: "No AGENTS.md found. What is this project's purpose? (1-2 sentences)"
- Create
AGENTS.mdusing the minimal template below, inserting the operator's answer. - Report: "Created AGENTS.md with starter quality checks. You can refine it later."
Minimal AGENTS.md template for new projects:
# <Project Name (inferred from directory)>
## Purpose
<Operator's answer>
## Quality checks
- no-silent-pass
- no-bare-except
- error-path-coverage
- agents-consistencyState assessment (existing repos)
If .git exists, scan and classify before touching anything:
| Scenario | Detection signals | Action |
| A — Current | docs/plan/progress.yaml exists with current schema | Idempotent — verify gates, no changes needed. |
| B — Legacy | progress.md instead of progress.yaml, missing log/ or archive/ subdirs, old workflow template | List divergences. Prompt operator: "Migrate to current standard?" If declined, abort cleanly. |
| C — Existing repo, no build-loop | .git exists with history, but no docs/plan/ | Report what will be added. Prompt operator to confirm before proceeding. |
If no .git -> skip assessment, proceed to Gate 1.
Edge case: .git exists but no commits (unborn HEAD) -> treat as fresh repo, make an initial commit first.
Legacy migration (Scenario B):
| Legacy pattern | Migration action |
progress.md instead of progress.yaml | Convert content to YAML format, rename file, commit |
Flat docs/plan/ without log/ or archive/ | Create missing directories, move existing log files into log/ |
Missing or outdated phase-retro-check.yml | Replace with current template |
No ## Quality checks in AGENTS.md | Prompt operator to add the starter set |
| Retro files in old locations | Move to docs/plan/archive/ with current naming |
Gate 1 — Git repository
If no .git directory, run git init. Otherwise proceed.
Gate 2 — GitHub remote
- If no
originremote: prompt operator for GitHub account (personal/work), repo name, visibility. Create viagh repo createand push default branch.- Public repo data safety check: Before creating a public repo, scan
AGENTS.mdfor keywords indicating personal or sensitive data (personal,people,PII,sensitive,private,names,confidential,person notes,daily logs). If found, warn: "This repo will be PUBLIC. AGENTS.md mentions personal/sensitive data. Confirm you want public visibility, or switch to private (note: phase retro enforcement will be advisory only on private repos without GitHub Pro)." Wait for operator confirmation before proceeding.
- Public repo data safety check: Before creating a public repo, scan
- If
originexists but is not a GitHub URL: abort — the build system requires GitHub for PRs and Actions. - If
originpoints to GitHub: proceed.
Gate 3 — gh authentication and permissions
- Run
gh auth status. If it fails, abort with instructions to rungh auth login. - Check admin access to the repo. If missing, abort — admin access is required for branch protection setup.
- Validate token scopes: run
gh auth statusand inspect the reported scopes. Required scopes:repo(full repo access for PRs, branch protection),workflow(GitHub Actions management),actions:read(workflow run status visibility). If any required scope is missing, report which scopes are missing and abort with: "Re-authenticate with:gh auth login --scopes repo,workflow,actions:read".
Gate 4 — Git identity
- Check repo-level
user.nameanduser.email. If both set, display for confirmation. - If either is missing, prompt operator to choose which GitHub account to use. Set per-repo (never
--global).
Gate 5 — Default branch
- If default branch is
main, proceed. - If different (e.g.
master), prompt operator: rename tomain, or keep? If kept, adapt workflow template and branch protection target accordingly.
Gate 6 — Branch protection
- Check repo visibility: run
gh repo view --json visibility -q .visibility. - If private: Required status checks need GitHub Pro (or Team/Enterprise). Check if branch protection creation succeeds. If the API returns a 403 or "upgrade your plan" error, warn: "Branch protection status checks require GitHub Pro for private repos. Phase retro enforcement will be advisory — run phase-retro manually before merging." Skip branch protection setup and proceed. Do not abort.
- If public (or paid plan): Check if
retro-gateis a required status check on the default branch. If not, create the branch protection rule viagh apiusing contextretro-gate(the jobidfrom the workflow YAML — this is the actual check name the GitHub Checks API reports; the UI decorates it as<workflow-name> / <job-id> (<event>)but the API context is just the job id). If already present, proceed.
Gate 7 — Build scaffolding (idempotent)
- Verify
.gitignoreexists. If not, create a minimal one. If it exists, check it includes common secret patterns (.env,.env.*,*.key,*.pem,credentials.json,.build-loop.lock). Add any missing patterns. - Detect the verify command by checking in order:
- If
package.jsonexists:- Base:
npm run lint && npm run test - If
tsconfig.jsonalso exists -> prependnpx tsc --noEmit &&(TypeScript projects must prove compilation; linters and test runners do not enforce type safety)
- Base:
- If
Makefileexists ->make lint test - If
Cargo.tomlexists ->cargo clippy && cargo test - If
pyproject.tomlorsetup.pyexists:- Base:
python -m pytest - If
mypy.ini,.mypy.ini,setup.cfgwith[mypy], orpyproject.tomlwith[tool.mypy]exists -> prependmypy . &&(typed Python projects must prove type correctness)
- Base:
- Otherwise ->
echo "no verify command configured"
- If
- Extract golden principles from
AGENTS.md. Look for sections titled "Golden principles", "Invariants", "Non-negotiable invariants", or similar. - Create directories:
docs/plan/,docs/plan/log/,docs/plan/archive/,docs/product/phases/,docs/concepts/,docs/briefs/. Theconcepts/andbriefs/directories are part of the idea pipeline (see${CLAUDE_PLUGIN_ROOT}/docs/MANUAL.md"Idea pipeline"): concepts hold rough future-phase ideas, briefs hold fully shaped ideas ready for spec-author. Thedocs/product/phases/directory holds per-phase spec files — each phase gets its own file instead of being inlined in the PRD. - Write
docs/plan/progress.yamlusing the template from the state-machine reference (${CLAUDE_PLUGIN_ROOT}/skills/build-loop-iterate/state-machine.md) (skip if it already exists — never overwrite progress state). - Write
docs/plan/phase-goal.mdwith placeholder content:No phase started. Run /sabs:build-loop project=<project> action=start phase=<phase> to begin.(skip if it already exists). - Create
.github/workflows/directory if it doesn't exist. - Write
.github/workflows/phase-retro-check.ymlusing the workflow template below (replace if outdated). - Create
.github/directory if it doesn't exist. Write.github/pull_request_template.mdusing the PR template below (skip if it already exists). This provides a manual retro checklist that works on all repos regardless of GitHub plan.
Gate 8 — Skill version compatibility
Read the version frontmatter (<!-- version: N -->) from each companion skill. Compare against the minimum required versions listed below. If any skill is below its minimum, warn with the specific skill name, current version, required version, and upgrade instructions. Do not abort — version mismatches are warnings, not blockers.
| Skill/Command | Minimum version |
| build-loop (router) | 12 |
| verify-gate | 3 |
| phase-retro | 3 |
| review-pr | 3 |
| handle-pr-review | 3 |
| spec-author | 4 |
Gate 9 — Command shadow check
Check whether any plugin skill has a shadowing personal skill at ~/.claude/skills/ or legacy command at ~/.claude/commands/. For each match, warn loudly: "SHADOWED: ~/.claude/skills/<name>/SKILL.md (or ~/.claude/commands/<name>.md) exists and may override the plugin version. Delete the personal copy to ensure the plugin version is used." List all shadowed files. Do not abort — this is a warning, not a blocker.
README build-loop insert (idempotent):
- If
README.mddoes not exist atPROJECT_ROOT, create it with a heading derived from the directory name and the build-loop section (see template below). - If
README.mdexists but does not contain the marker<!-- build-loop -->, append the build-loop section to the end of the file. - If the marker already exists, do nothing (idempotent).
- Read the version from
<!-- version: N -->in the router skill SKILL.md to populate the version number.
Build-loop README section template:
<!-- build-loop --> --- *Built with [build-loop](docs/plan/) — init v<VERSION>*- If
- Commit:
chore: scaffold build loop files - Report initialised and next step. The next step is ALWAYS
spec-author, notbuild-loop start. Output: "Build loop initialised. Next: run spec-author to define your phases and specs. Spec-author will give you the exact/sabs:build-loop startcommand when specs are ready." Include any version warnings from Gate 8 and any shadow warnings from Gate 9.
Failure mode: If any gate fails, stop cleanly. Earlier gates must pass before later ones run. Nothing half-scaffolded.
Phase retro check workflow template
name: Phase retro check
on:
pull_request:
branches: [main]
jobs:
retro-gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check phase retro requirement
run: |
PROGRESS="docs/plan/progress.yaml"
if [ ! -f "$PROGRESS" ]; then
echo "No progress.yaml — skipping retro check"
exit 0
fi
if grep -q 'phase_complete: true' "$PROGRESS"; then
if grep -q 'retro_complete: true' "$PROGRESS"; then
echo "Phase retro complete — check passed"
exit 0
else
echo "::error::Phase is complete but no retrospective found."
echo "Run /sabs:phase-retro and push to this branch."
exit 1
fi
else
echo "No completed phase — retro not required"
exit 0
fiPR template
## Summary
<!-- Brief description of what this phase delivers -->
## Stories shipped
<!-- List completed user stories -->
## Pre-merge checklist
- [ ] Phase retro completed (`/sabs:phase-retro`)
- [ ] Quality checks pass
- [ ] Done-when evidence reviewedDoes 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
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.

