specgate/docs v1.8.0

From scratch · 1 — Install and set up#

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: a new project with Specgate set up, knowing how to run your tests, and a gate that passes — before there is a single requirement.

Before you start: Node.js 22 or later, and Git.

The example is the one the landing page records: court bookings for a tennis club, in plain Node. Your stack will differ; the commands will not.

WhoDoes what in this phase
YouCreate the project the way your stack does, run four commands
Your agentNothing yet
The gateRuns once, on an empty specification, to prove the wiring

1. Create the project with your own tools#

Specgate writes specifications, not application code. Start the project the way your stack starts one — npm init, Spring Initializr, cargo new, django-admin startproject, a monorepo generator — and put it under git:

bash
mkdir court-bookings && cd court-bookings
git init
npm init -y
npm pkg set scripts.test="node --test"   # npm init writes a "no test specified" stub

2. Set Specgate up — specgate init#

Install Specgate as a development dependency, then set it up:

bash
npm install --save-dev @rsaglobaltech/specgate
npx specgate init

These pages write commands as specgate status. Where you installed it this way, type npx specgate status. On a stack without a package.json, run it without installing: prefix each command with npx @rsaglobaltech/specgate@latest.

init sees the package.json, so it sets Specgate up in place, in this folder, and touches no code. It writes the specification (spec.md), the agent contract (AGENTS.md) that every coding agent reads, the traceability matrix — the table that links each requirement to its scenario, code and test — and a baseline scenario:

Terminal
$ specgate init
  ◆ specgate · init
 
  ℹ  Existing code found (package.json) — adopting this repository in place. Nothing in your code is touched.
  ℹ  To scaffold a separate new project instead: specgate init --new
 
  Stack detection: package.json ──────────────────────────
    · Project: court-bookings
    · Stack: Node.js
    · Test command: npm test
    + spec.md
    + features/adoption/baseline.feature
    + docs/specs/traceability.md
    + docs/specs/adr/README.md
    + docs/specs/glossary.md
    + AGENTS.md
    + README.md   was missing
  ℹ  🚦 Policy: .specgate/gate.yaml — the standard preset; edit a rule to change what fails
  ℹ  🚦 CI: .github/workflows/spec-gate.yml — the spec gate; `specgate ci status` says what it checks
    · Traceability: generated from spec.md, tags and tests (`specgate matrix`)
 
  Summary ────────────────────────────────────────────────
    · Files written: 7
    · Files skipped (already present): 0
  ▲  This does not certify your code yet — it certifies the skeleton.
     A green `validate` right now means the structure is in place, not that any
     behaviour is covered. It starts meaning something when the requirements below
     are real and their scenarios are linked to tests.
 
… 19 more lines

The lines the block cuts off set the agent: with Claude Code installed, init writes agent: claude … --permission-mode acceptEdits … to harness.config.yaml. At a terminal it asks first; with no terminal — run by an agent or a script — it sets it without asking. specgate config set agent "<command>" changes it.

Two words in that output are written for existing code, because to init a folder with a package.json is existing code: "adopting", and REQ-001 — Existing behaviour is preserved. On a brand-new project that requirement holds trivially. Leave it as it is; once the app exists, a test that it starts — naming REQ-001 — closes it like any other.

Note

Did it create a sub-folder instead? At a terminal, in a folder with no build file at all, init scaffolds a separate project (<slug>/ with spec.md, docs/, CI and container files) from a short wizard; with no terminal it sets the folder up in place instead. Create your project first, as above, and run init inside it — or use init --new on purpose when you want the full scaffold.

3. Tell it how to run your tests — once#

bash
specgate config set test_cmd "node --test"
Terminal
$ specgate config set test_cmd "node --test"
  ✔  test_cmd = node --test
     harness.config.yaml
     `check` and `apply` now run it.

From now on check and apply run your suite as part of the gate. Use your stack's own command: npm test, ./mvnw -B verify, pytest, go test ./....

4. Run the gate#

bash
specgate check
Terminal
$ specgate check
  ◆ specgate · check   court-bookings
 
  ·  Policy         .specgate/gate.yaml (standard): coverage warning, use_cases warning, scope warning, controls warning
  ·  Ids            not compared with a base — no base branch (pass --base <branch>)
  ✔  Specification   validate --strict
  ✔  Tests           node --test
  ·  Architecture    not checked — specgate config set arch_cmd "<command>"
 
  ✔  Gate passed — the specification and `node --test`

Green. As init warned, this certifies the skeleton, not behaviour: there is nothing to certify yet. That changes in the next phase, when the brief becomes requirements.

You're done when…#

  • specgate check ends with ✔ Gate passed — the specification and your test command.
  • spec.md, AGENTS.md, features/ and docs/specs/traceability.md exist and are committed.
bash
git add -A && git commit -m "Specgate set up"

If something goes wrong#

You seeIt meansDo
Gate passed — the specification and "nothing here runs your tests"No test command is configuredspecgate config set test_cmd "<your command>"
A new <slug>/ folder appearedThere was no build file, so init scaffoldedCreate the project first, then init inside it
command not found: specgateIt is installed in the project, not on your PATHType npx specgate before the command, as in npx specgate check

Want more than tests in the gate? specgate quality init writes the quality checks for your stack — coverage and mutation of what each change adds, SAST, secrets, dependencies — each run in Docker.

Using an agent? specgate agents init --tool claude (or cursor, copilot, gemini, …) installs the /specgate:* commands for it. See Agents.

Next#

Have a plan or a client's brief? Write the brief first, then go on to phase 2 — from the brief to a checked spec →