Skip to content
Back to skills

Init

ASecurity

Set up flow in an existing repository - checks the prerequisites (git, gh, GitHub remote), detects the stack and its lint/typecheck/test commands, makes sure CLAUDE.md lists them and names the PR base, scaffolds the brain and the QA playbook, checks the code index and the labels the issue commands use. Idempotent - rerun it to see what is still missing. Writes to the working tree; never commits.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 1, 2026
developmentpythongobashdockergitapidatabase

Works with

  • cli
  • api

Security analysis

A100/100

Scanned December 1, 2026

npx -y skills add eusilvio/claude-workflow --skill init --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Init?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Init
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/eusilvio-init/badge)](https://www.skillsdirectory.com/skills/eusilvio-init)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: init
description: "Set up flow in an existing repository - checks the prerequisites (git, gh, GitHub remote), detects the stack and its lint/typecheck/test commands, makes sure CLAUDE.md lists them and names the PR base, scaffolds the brain and the QA playbook, checks the code index and the labels the issue commands use. Idempotent - rerun it to see what is still missing. Writes to the working tree; never commits."
argument-hint: "[--local] [--check]"
allowed-tools: Bash(gh:*), Bash(git:*), Bash(ls:*), Bash(python3:*), Bash(${CLAUDE_PLUGIN_ROOT}/scripts/brain.py:*), Bash(${CLAUDE_PLUGIN_ROOT}/scripts/codemap.py:*), Bash(${CLAUDE_PLUGIN_ROOT}/scripts/flowctl.py:*), Read, Write, Edit, Grep, Glob, AskUserQuestion
model: sonnet
---

Arguments: $ARGUMENTS

`/flow:init` prepares a repo that already has code so every other `/flow:*`
command works on the first try. It changes only what is missing, asks before
writing anything the user did not see, and never commits: the user reviews
the diff and commits it.

- `--local`: no GitHub needed. Specs go to `.flow/specs/` and the brain to
  `.flow/brain/`, both kept out of git (`flowctl.py spec init`,
  `brain.py init --local`).
- `--check`: report only. Run steps 1 to 6 without writing and print the
  checklist of step 8.

## 1. Preflight

Run in one parallel batch and stop at the first hard failure:

- `git rev-parse --show-toplevel` - not a git repo: stop with
  `INIT:FAILED not-a-git-repo`.
- `git worktree list --porcelain` - the first entry is the main checkout. If
  the session is inside a worktree, work on the main checkout path.
- `gh auth status` and `gh repo view --json nameWithOwner,defaultBranchRef,hasIssuesEnabled`
  (skip both with `--local`). Not logged in, no GitHub remote or issues
  disabled: tell the user and offer `--local` instead of stopping silently.
- `python3 --version` - the scripts need Python 3.9+.
- `git status --porcelain` - a dirty tree is fine, but say that the init diff
  will mix with their changes.

## 2. Detect the stack and the check commands

Follow the `repo-conventions` skill (`${CLAUDE_PLUGIN_ROOT}/skills/repo-conventions/SKILL.md`).
Read, in one batch, whichever exist: `CLAUDE.md`, `AGENTS.md`, `package.json`
(root and workspaces), `pnpm-workspace.yaml`, `turbo.json`, `Makefile`,
`pyproject.toml`, `Cargo.toml`, `go.mod`, `biome.json`, `.github/workflows/*.yml`.

Build a table with one row per check: **lint**, **typecheck**, **test**,
**single test** (how to run one file), **build**, **dev server** (API and web,
with ports). For each row record the exact command and where it came from
(`package.json#scripts.lint`, `Makefile:12`, CI step). The CI workflow is the
best tiebreaker: what CI runs is what the repo considers "green".

Never invent a command. A check the repo does not have stays empty and goes
to the report as missing.

## 3. CLAUDE.md

The stages run exactly the commands CLAUDE.md lists, so this file matters most.

- **No CLAUDE.md**: draft one with a one-paragraph "what this is", the
  command table from step 2 and the PR base. Show the draft, write it only
  after the user accepts.
- **CLAUDE.md without some commands**: propose only the missing lines, in the
  file's existing language and section style.
- **PR base**: if the repo uses an integration branch (`development`,
  `develop`, `staging` - check `git ls-remote --heads origin` and the base of
  the last merged PRs with `gh pr list --state merged --limit 10 --json baseRefName`)
  and CLAUDE.md does not name it, ask which branch PRs target and add the rule
  `PRs vão para \`<branch>\`` (in the file's language).

Batch every CLAUDE.md change into one `AskUserQuestion` (or show the diff and
ask once). Never rewrite lines the user wrote; only add.

## 4. Brain

`${CLAUDE_PLUGIN_ROOT}/scripts/brain.py dir`. No brain yet: run
`brain.py init` (`--local` with `--local`) and add the line it prints near
the top of CLAUDE.md. Existing brain: run `brain.py check` and report the
count of problems; fixing them is `/flow:learn --check`, not this command.

## 5. QA playbook

Look for `<brain>/qa-playbook.md`, legacy `docs/memory/qa-playbook.md` or a
path CLAUDE.md names. None: create `<brain>/qa-playbook.md` from
`${CLAUDE_PLUGIN_ROOT}/skills/verify/playbook-template.md`, filling the
**Setup** section only with facts from step 2 (dev commands, ports, the test
database from `docker-compose*.yml`, the seed/migration commands). Delete a
Setup line you could not fill instead of leaving a placeholder. Leave
**Test traps** empty: `flow:qa` and `/flow:learn --playbook` own it.

QA recipe (`.flow/qa-env.sh`, used by `/flow:run` to boot the app once for
every QA agent): only mention it. Offer to write one when the repo has a clear
dev command and the user wants parallel QA; the recipe receives `up`,
`rebuild` or `down`, runs in the PR worktree with `FLOW_PORT_API`,
`FLOW_PORT_WEB` and `FLOW_TMP`, starts servers in the background, writes
`KEY=value` lines (URLs) to `$FLOW_QAENV_DIR/env` and exits 0 only when the
app answers.

## 6. Code index, labels and local files

- `${CLAUDE_PLUGIN_ROOT}/scripts/codemap.py stats`: confirm the symbol
  index works for this stack (it needs no setup). Manual map docs are
  optional: never recommend writing one, Claude reads the repo itself. If the
  repo already has them, `codemap.py check` reports only rows pointing at
  missing files (`ORPHAN`), as one informational line.
- Labels (skip with `--local`): `gh label list --json name`. `/flow:issue`
  tags with `bug` or `enhancement` and `/flow:feature` with `feature`, and
  `gh issue create` fails on a label that does not exist. Missing ones: ask
  once, then `gh label create <name>` for each accepted.
- Branch protection (skip with `--local`): `gh api repos/{owner}/{repo}/branches/<default>/protection`.
  404 or no `required_pull_request_reviews`: report `MISSING branch
  protection` and explain in one line that the flow hooks are defense in
  depth, not a boundary - the real guarantee that nothing reaches the default
  branch without the user is "require a pull request before merging" on
  GitHub (Settings -> Branches). Do not change it yourself; it is the user's
  repository setting. A 403 means the token cannot read it: say so and move on.
- `.flow/papercuts.jsonl` is written by agents at the repo root: add the line
  `/.flow/papercuts.jsonl` to `.git/info/exclude` if absent (local, nothing to
  commit).
- `--local`: `${CLAUDE_PLUGIN_ROOT}/scripts/flowctl.py spec init`.

## 7. Error recovery

- A script exits non-zero: show its last lines, skip that step and mark it
  `FAIL` in the checklist, then move on to the next step.
- The user declines a change: mark it `SKIPPED` and continue.
- Detection is ambiguous (two test runners, two lockfiles): ask once with the
  options found; never pick silently.

## 8. Report

Print a checklist, one line per item, each `OK`, `ADDED`, `MISSING`,
`SKIPPED` or `FAIL`, plus the file it touched:

```
OK      git + gh (owner/repo, default main)
ADDED   CLAUDE.md: lint, typecheck, test, single test
OK      PR base: development
ADDED   docs/brain/ (INDEX.md + domain/ decisions/ lessons/)
ADDED   docs/brain/qa-playbook.md (Setup: api, web, test db)
MISSING branch protection on main (require PR before merging)
OK      codemap: 1.204 symbols indexed
ADDED   labels: enhancement, feature
OK      .git/info/exclude: /.flow/papercuts.jsonl
```

Then the next step in one line: review the diff, commit it, and try
`/flow:issue "<a small real bug>"`.

End with exactly one line, alone:

- `INIT:READY` - CLAUDE.md has lint, typecheck and test, and GitHub (or local
  mode) works.
- `INIT:PARTIAL <missing items>` - flow runs, but something on the list is
  missing.
- `INIT:FAILED <reason>` - preflight failed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.