specgate/docs v1.8.0

From scratch · 5 — Every day#

The short version of a new project, in six commands: Start. This page is the same step in detail, with recorded output.

In this phase

When you finish: the gate on every pull request, and a daily loop short enough to remember — four verbs: propose, apply, status and archive.

Before you start: phases 1 to 4 are done, and the project is on a Git host with CI (GitHub, GitLab, Azure DevOps or Jenkins).

WhoDoes what in this phase
YouCommit the CI file init wrote; then start each day with status
Your agentFollows the same loop — AGENTS.md tells it how
CIRuns specgate check on every pull request

1. The gate is already in CI#

specgate init wrote it: .github/workflows/spec-gate.yml — or the file for GitLab, Azure DevOps or Jenkins when the folder shows one. It runs specgate check on Ubuntu, macOS and Windows, compares the requirement ids with the base branch, runs the quality checks once you configure them, checks the packs and keeps the plan. A step whose tool is not configured yet says so and passes. See what it checks:

bash
specgate ci status
Terminal
$ specgate ci status
  ◆ specgate · ci status   .github/workflows/spec-gate.yml
 
  ✔  the specification (validate --strict)
  ✔  the project's tests (check runs test_cmd)
  ✔  the architecture check (check runs arch_cmd)
  ✔  Ubuntu, macOS and Windows
  ✔  the requirement ids against the base branch (check --base)
  ✔  the quality checks (quality run)
  ✔  the pack drift (validate --against-lock)
  ✔  the pending-work plan (plan --format json)
 
  ✔  Everything specgate can check runs in CI.

It checks more than less on purpose: every step says in the YAML what it checks and what to delete to remove it. One Ubuntu job running only specgate check, with no base branch, no pack drift and no plan (GitHub only): specgate ci init --provider github --minimal --force. Another provider: specgate ci init --provider gitlab. Commit the file, and make the job a required check in your main branch's protection rules: from then on, a pull request with a red test cannot merge.

2. Where work comes from#

Work arrives in one of three ways. Each opens a change — a folder with the requirements and scenarios being added — and from there the loop is the same.

The work arrives as…Open the change withGuide
One behaviour, or a feature with a few rulesspecgate propose <change-id>This page, below
A Jira story with acceptance criteriaspecgate propose --from-ticket <KEY>From a Jira ticket
A new module of the product, from the briefspecgate propose --from-brief <module>Phase 2

A Jira ticket is read, never written to. specgate propose --from-ticket KAN-13 --check runs its Definition of Ready (rules T1–T9: acceptance criteria present, measurable, small enough), and the same command without --check opens the change and pushes its branch, feature/KAN-13-<slug>.

3. The daily loop#

  1. Propose — open the change and write its delta: the requirements and scenarios it adds.
  2. Approve — you read the delta and run specgate change approve <change-id> in your terminal; an agent cannot, and apply refuses a requirement of an unapproved change (change_not_approved).
  3. Build — for each requirement, a test that names it, then the code.
  4. Apply — specgate apply REQ-NNN; commit.
  5. Archive — specgate archive <change-id> once every requirement is applied, on your branch.
  6. Pull request — the specification and the code reach review together. For a ticket's change, the alm pr command opens it — see From a Jira ticket.
text
specgate propose  →  change approve  →  test and code  →  specgate apply  →  specgate archive  →  pull request

Tip

Lost? Type specgate on its own. Inside a project it shows status: where everything stands, and the one command to run next. Every command ends the same way — a Next block with the command alone on its line, so you can copy it.

A new requirement that came up in a conversation, not in the brief:

bash
specgate propose free-courts
Terminal
$ specgate propose free-courts
  ◆ specgate · propose   free-courts
 
  ✔  Change free-courts created · lite · REQ ids REQ-012…REQ-014 reserved
 
    + docs/specs/changes/free-courts/change.yaml
    + docs/specs/changes/free-courts/discover.md
    + docs/specs/changes/free-courts/design.md
    + docs/specs/changes/free-courts/tasks.md
    + docs/specs/changes/free-courts/specs/free-courts/spec.md
 
  Next ───────────────────────────────────────────────────
  ➜  specgate apply
     after you write the delta, a test that names each requirement, and the code

Replace the template in the change's delta, docs/specs/changes/free-courts/specs/free-courts/spec.md, with the requirement and its scenario, under the ## ADDED Requirements heading the template has:

markdown
# Delta — free-courts

## ADDED Requirements

### Requirement: REQ-012 — A member sees which courts are free on a day

<!-- specgate:trace actor=Member kind=functional -->

The system SHALL list, for a day, the courts that are free at each hour.

#### Scenario: SCN-006 — The centre court is taken on Monday evening

- GIVEN the centre court is booked on Monday evening
- WHEN a member sends GET /api/courts/free?day=monday
- THEN Monday evening lists every court except the centre court

Read the delta, then approve it yourself, at your terminal — apply waits for it:

bash
specgate change approve free-courts

Start the day with status — it lists the new requirement with the rest, and names the one command to run next:

bash
specgate status
Terminal
$ specgate status
  ◆ specgate · status   court-bookings
 
  Requirements  █████░░░░░░░░░░░░░░░  1 of 4 done
 
  To do ──────────────────────────────────────────────────
    ○ REQ-003  A court is never booked twice for the same …  a test and code
    ○ REQ-012  A member sees which courts are free on a day  a test and code
 
  ·  REQ-001 Preserve existing behaviour: your test suite holds it on every check.
     To close it, name REQ-001 in a test that starts the product.
 
  Waiting for an answer ──────────────────────────────────
    ○ REQ-004  A member cancels a booking  an answer to Q1
    Questions: Q1 (docs/specs/changes/draft-bookings/questions.md)
 
  Brief         ████████████████████  1 of 1 module(s) drafted   docs/brief.md
 
  Next ───────────────────────────────────────────────────
  ➜  specgate apply REQ-003
     free-courts waits for a person to approve it, at their terminal — apply delivers nothing before

This recording ran status before the approval, so its last line still says free-courts waits for a person. Once you have approved it, REQ-012 is delivered like the others: its test, its code, specgate apply REQ-012.

A requirement that changes goes through a change too, under ## MODIFIED Requirements in its delta, so the review sees the before and after.

4. When the client answers#

The requirement it blocked rejoins the queue in five steps:

  1. In the change's questions.md, write the answer in the question's Answer cell and set its Status to answered. status now lists the requirement under "Answered — update the spec".
  2. Write the value into the requirement's text and its scenario.
  3. Remove status="Needs Clarification" from its specgate:trace.
  4. Approve the change again, yourself, at your terminal: specgate change approve <change>. The text is no longer what was approved, so apply refuses it (approved_requirement_changed) until then; the client's answer in questions.md is the source of the new value.
  5. Write its test, then specgate apply REQ-…. Until step 3 the harness skips it and apply refuses it (done_needs_clarification).

Gato, the cat that keeps the gate#

At the foot of status, on your terminal, sits Gato. You don't feed it by hand: its state is the project's.

GatoComes fromYou look after it with
Grows: egg, kitten, cat, crowned legendthe share of requirements closedspecgate apply
Healthy, or sickhow the last specgate check endeda green gate
Worriedrequirements waiting for an answeranswering questions.md
Asleepno check for a weekrunning check
🔥 streakdays in a row the gate ended greenkeeping it green

Whatever it says ends with the same command status gives you. specgate pet shows the whole cat and its four needs. It never appears in a pipe, a log or CI, and specgate config set pet off puts it away. The streak lives in .specgate/pet.json, which git ignores: the cat is yours, not the team's.

You're done when…#

  • .github/workflows/spec-gate.yml (or your provider's file) is committed, and the job is a required check.
  • Your team starts with specgate status and ends each change with specgate archive and a pull request.

If something goes wrong#

You seeIt meansDo
.github/workflows/spec-gate.yml already exists — refusing to overwrite.You already have that file--stdout to print the job and paste it in, or --force to replace
Unknown provider: circleciNot supportedgithub, gitlab, azure or jenkins; or run specgate check from any CI by hand
status says Next specgate planA requirement has no feature filespecgate plan names it

Next#

← Back to the start