# /iblai-vibe-spec-kit

> Mirrored from [`iblai/base`](https://github.com/iblai/base) · [`skills/start/iblai-vibe-spec-kit/SKILL.md`](https://github.com/iblai/base/blob/main/skills/start/iblai-vibe-spec-kit/SKILL.md). This page is generated — edit it in the repository, not here.

[GitHub Spec Kit](https://github.com/github/spec-kit) has the agent write down what
to build before building it: a **constitution** (the rules every plan is checked
against), then for each feature a **spec** (what and why), a **plan** (how), a
**task list**, and only then the code. This skill sets it up with ibl.ai's rules in
the constitution, so every plan maps each requirement to the ibl.ai skill that
builds it instead of hand-rolling what the platform already has.

**Every new app is built with it, from a description.** Right after
`/iblai-vibe-ops-init` sets the project up, the user says what the app does and
who it's for, and Spec Kit takes it from there; a new app has no opt-out. For a
headless project (after `/iblai-api-login`) or an existing codebase getting
ibl.ai, it is recommended and offered once.

## Step 0: Skip, or resume

When another skill sent you here, check in order:

1. A headless project or an existing codebase whose `iblai.env` sets
   `USE_SPEC_KIT` to a falsy value (`false`, `0`, `no`, `off`) → the user already
   said no; go back to what you were doing without a word. A new app ignores the
   flag.
2. The host exports `IBLAI_PLATFORM_KEY` (the ibl.ai desktop app does; its Code
   mode has its own flow) → go back.
3. `iblai.env` lacks `ARCHITECTURE=` → run `/iblai-vibe-start` first.
4. A new app (`PROJECT=new`, `ARCHITECTURE` `single-org` or `multi-org`) with no
   `package.json` → run `/iblai-vibe-ops-init` first. The starter comes before the
   first spec, so plans read real code; ops-init sends you back here. If the user
   declined the starter there, go on without it.

When the user asked for Spec Kit by name, skip 1 and 2 (and delete a
`USE_SPEC_KIT` line: the request overrides the earlier no).

Then, if `.specify/` exists, Spec Kit is already set up: a
`.specify/memory/constitution.md` that still starts with `# [PROJECT_NAME]` →
Step 3; otherwise → Step 4.

## Step 1: The description, or the offer

**A new app** gets no yes/no. Say in one line that every app here is built with
Spec Kit from a description, then ask for it unless the user already gave it:
what the app does and who it's for, in their own words (two or three
sentences). It becomes the constitution's purpose (Step 3) and the first
`/speckit-specify` (Step 4). If they refuse Spec Kit, say plainly that new apps
are built only this way, and stop there.

**A headless project or an existing codebase:** skip the question when the user
already asked for Spec Kit in this conversation. Otherwise ask one yes/no
question, in plain words:

> Before we build, shall I write it down first with **Spec Kit**? You describe what
> you want; I turn it into a short spec, a plan and a task list, and you approve
> each before any code is written. ibl.ai's rules go into every plan.
> *(recommended)*

- **Yes** → Step 2.
- **No** → append `USE_SPEC_KIT=false` to `iblai.env` (no skill asks again; delete
  the line to be asked again) and go back to what the user asked for.

## Step 2: Set up Spec Kit

1. **Existing codebase:** Spec Kit writes into the repo, so ask for a clean
   `git status` (commit or stash) before running anything.
2. **uv** runs the Specify CLI. If `uv --version` fails, ask before installing it:
   - macOS / Linux: `curl -LsSf https://astral.sh/uv/install.sh | sh`
   - Windows (PowerShell): `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"`

   If the user declines, say Spec Kit cannot run without it: a new app stops
   there; a headless project or an existing codebase may go on without Spec Kit
   (`USE_SPEC_KIT=false`, as in Step 1).
3. **Initialize** in the project root, pinned (the only place this skill names a
   Spec Kit version):

   ```bash
   uvx --from git+https://github.com/github/spec-kit.git@v1.4.5 \
     specify init --here --force --non-interactive --ignore-agent-tools --integration claude
   ```

   `--integration` names the agent you are running in. Never omit it: without a
   terminal the CLI silently picks Copilot.

   | Agent | `--integration` | Installs | Commands |
   |---|---|---|---|
   | Claude Code | `claude` | `.claude/skills/speckit-*` | `/speckit-specify` … |
   | OpenAI Codex | `codex` | `.agents/skills/speckit-*` | `$speckit-specify` … |
   | Cursor | `cursor-agent` | `.cursor/skills/speckit-*` | `/speckit-specify` … |
   | OpenCode | `opencode` | `.opencode/commands/` | `/speckit.specify` … |

   `--force` is needed because the folder is not empty (the installed skills are
   in it); `--ignore-agent-tools` skips a check for the agent's CLI on `PATH`. A
   non-zero exit → show its last lines and stop. Never write `.specify/` by hand.
4. **What it wrote:** `.specify/` (templates, scripts and `memory/constitution.md`;
   commit it) and nine `speckit-*` commands in the agent's folder. It leaves
   `CLAUDE.md`, `AGENTS.md`, `.claude/settings.json` and git alone. vibe-starter
   gitignores `.claude/skills` and `.agents/skills`, so after a fresh clone run
   this step again; it keeps the constitution.
5. **The project's instructions:** add this block to `CLAUDE.md` (Codex, Cursor
   and OpenCode read `AGENTS.md`; in vibe-starter they are one file) unless it
   already names `/speckit-specify`:

   ```markdown
   ## Spec Kit

   Every feature goes through Spec Kit: `/speckit-specify` → `/speckit-clarify` →
   `/speckit-plan` → `/speckit-tasks` → `/speckit-implement` → `/speckit-converge`.
   Plans are checked against `.specify/memory/constitution.md`; amend it only with
   `/speckit-constitution`. After a fresh clone, `/iblai-vibe-spec-kit` reinstalls
   the `speckit-*` commands.
   ```

If your agent cannot invoke the new commands in this session, read
`<its folder>/speckit-<command>/SKILL.md` from the table and follow it with the
same arguments.

## Step 3: Ratify the constitution

Run `/speckit-constitution` with the principles below, filled in: the app's name,
its description (Step 1) as the purpose, and the decisions in `iblai.env`
(`PROJECT`, `ARCHITECTURE`, `ACCESS`, `DOMAIN_FOCUS`). Keep the one Platform &
Stack bullet that fits this project. Then show the user the five principles in
five lines and ask what else
must always hold; add it with another `/speckit-constitution`.

```markdown
I. The platform first. Every capability the platform has (sign-in, agents and
   chat, users and admins, per-user and per-organization data, memory, analytics,
   notifications, billing) MUST come from it through its ibl.ai skill:
   iblai-vibe-* with a screen, iblai-api-* headless. A need with no skill goes
   through /iblai-vibe-api and the matching iblai-api-* skill. Per-user data lives
   in per-user metadata and per-organization data in organization metadata
   (GET-merge-PUT); never localStorage, never a database of the app's own.
II. One architecture, decided once. The project is <ARCHITECTURE>, access
   <ACCESS>, about <DOMAIN_FOCUS>; changing that is an amendment, not a code
   change. Nothing is built on the shared `main` organization.
III. Secrets stay on the server. The Platform API Token (IBLAI_API_KEY) is read
   only on the server: never NEXT_PUBLIC_, never printed, logged or committed.
   Never ask for a password; never invent an agent UUID, ask for a real one.
IV. It looks like ibl.ai (apps only). SDK components, then shadcn/ui, then
   custom, in that order; SDK components are used as shipped. Diverging from the
   ibl.ai look is a question for the user, never a default.
V. Done means tested. Before "done": a vibe-starter app passes
   /iblai-vibe-ops-test (build, tests, `pnpm e2e:coverage` at or above 95 %, a
   touch test in a real browser); another app passes its own build and tests plus
   that touch test; a headless project runs against the organization and its
   output is checked.

Platform & Stack (keep one):
- vibe-starter app: Next.js 16, @iblai/iblai-js, Tailwind v4, shadcn/ui, pnpm
  (installs with --ignore-scripts), Vitest, Playwright; scaffolded by
  /iblai-vibe-ops-init.
- Any other app (an existing codebase, or a new app without the starter): its own
  stack, plus the rules already true in this repo (its linters, tests and
  conventions) as principles of their own; ibl.ai through /iblai-vibe-auth
  (Next.js) or /iblai-api-login and /iblai-vibe-api (any other framework).
- Headless: the iblai-api-* skills, with IBLAI_ORG and IBLAI_API_KEY from .env,
  never committed.

Development workflow: every feature goes through /speckit-specify,
/speckit-clarify, /speckit-plan, /speckit-tasks, /speckit-implement and
/speckit-converge. Every plan names, for each requirement, the ibl.ai skill that
builds it, or says why none does.

Governance: amendments go through /speckit-constitution with the user's
approval; versions follow semver.
```

## Step 4: Build a feature with Spec Kit

The first feature is what the user came for: in a new app, its description from
Step 1 (the starter is already the baseline); in an existing codebase, adding
ibl.ai (sign-in, and what `DOMAIN_FOCUS` needs); in a headless project, what the
script or job does. Every later feature starts here too.

1. `/speckit-specify <the feature in the user's words>`: what and why, and who
   uses it; no stack.
2. `/speckit-clarify`: put its questions (at most five) to the user.
3. **Gate:** sum up `spec.md` in three lines; the user approves or corrects it.
4. `/speckit-plan <stack note>`, the note by project:
   - vibe-starter app: "Next.js app from vibe-starter in this folder; for each
     requirement, name the iblai-vibe-* skill that builds it (the table in
     /iblai-vibe)." For `multi-org`, add: "Going multi-org through
     /iblai-vibe-auth comes first."
   - Any other app: "This repo's stack; ibl.ai through /iblai-vibe-auth
     (Next.js) or /iblai-api-login and /iblai-vibe-api; name the skill per
     requirement."
   - Headless: "Scripts on the iblai-api-* skills, with IBLAI_ORG and
     IBLAI_API_KEY from .env."

   The plan's Constitution Check holds it to the principles.
5. **Gate:** walk the user through the plan in a few lines; they approve it.
6. `/speckit-tasks`, then `/speckit-analyze` when the plan is large (a read-only
   cross-check of spec, plan and tasks).
7. `/speckit-implement`. A task that names an ibl.ai skill opens that skill.
8. `/speckit-converge`; repeat 7 and 8 until it reports converged.
9. Done means tested (principle V): `/iblai-vibe-ops-test` for apps. Then offer
   to show it and do the one picked: a preview you start yourself (`pnpm dev` in
   the background, then the URL it prints), a public URL with
   `/iblai-vibe-ops-deploy`, or a desktop or phone app with `/iblai-vibe-ops-build`.

## Notes

- `/speckit-checklist` (after the plan) writes a requirements checklist; optional.
- Spec Kit makes no git branches or commits; commit each feature yourself, or add
  its `git` extension (Step 2's `uvx … specify` with `extension add git` in place
  of `init …`), which does both.
- Upgrade: re-run Step 2's command with a newer tag from the
  [Spec Kit releases](https://github.com/github/spec-kit/releases); the
  constitution and `specs/` are kept.
- Amend the constitution only through `/speckit-constitution`, never by hand.
