Adding Supersigil to an Existing Project
The Quickstart walks through a greenfield setup. This guide covers the more common case: you have working code, existing tests, and want to start connecting them to verifiable specs without disrupting what already works.
Strategy
Section titled “Strategy”Start small. Pick one module you understand well, write a single requirements spec for it, and wire up the evidence you already have. Once that loop feels natural, expand to more modules.
-
Initialize Supersigil
From your repository root:
Terminal window supersigil initThis creates
supersigil.tomland installs agent skills. See the Quickstart for install options and the CLI reference for allinitflags. -
Pick one module and write a requirements spec
Choose a module that already has tests. Scaffold a requirements doc:
Terminal window supersigil new requirements authEdit the generated file to describe the behavior that already exists. Start with
status: draftso verification stays relaxed while you iterate:specs/auth/auth.req.md ---supersigil:id: auth/reqtype: requirementsstatus: drafttitle: "Authentication"---```supersigil-xml<AcceptanceCriteria><Criterion id="valid-creds">WHEN a user submits valid credentialsTHE SYSTEM SHALL issue a session token.</Criterion><Criterion id="invalid-creds">WHEN a user submits invalid credentialsTHE SYSTEM SHALL return a 401 response.</Criterion></AcceptanceCriteria><TrackedFiles paths="src/auth/**/*.rs, tests/auth/**/*.rs" />```Write criteria for behavior that is already implemented and tested. You are documenting reality, not specifying new work.
-
Annotate your existing tests
Add annotations to the tests that prove each criterion.
Use the
verifiesattribute macro from thesupersigil_rustcrate. Native support is enabled by default.Terminal window cargo add supersigil-rusttests/auth/login_test.rs use supersigil_rust::verifies;#[verifies("auth/req#valid-creds")]#[test]fn login_returns_session_token() {// your existing test}Enable the JavaScript/TypeScript ecosystem plugin in
supersigil.toml. Then use theverifieshelper from the@supersigil/vitestpackage.Terminal window pnpm install --save-dev @supersigil/vitestsupersigil.toml paths = ["specs/**/*.md"]tests = ["tests/**/*.test.ts"][ecosystem]plugins = ["rust", "js"]tests/auth/login.test.ts import { verifies } from '@supersigil/vitest'import { test, expect } from 'vitest'test('login with valid credentials', verifies('auth/req#valid-creds'), () => {// your existing test})The annotations are no-ops at runtime. They just mark the test as evidence.
-
Run verify and confirm it passes
Terminal window supersigil verifySince the spec is in
draft, configurable findings (like uncovered criteria) are downgraded. But broken refs and structural errors still surface. Fix any that appear. -
Promote to approved when ready
Once you are confident in the evidence mapping, change the status:
status: approvedRun
verifyagain. Now Supersigil enforces coverage — any criterion without evidence becomes a warning or error (depending on your config).
Expanding gradually
Section titled “Expanding gradually”Once the first module works:
- Add more modules one at a time. Each spec is independent. There is no requirement to cover the whole codebase at once.
- Use
TrackedFilesearly. Even before criteria have full evidence, tracked files give you drift detection. You will know when code changes and a spec might need review. - Use
supersigil statusto see coverage across all specs at a glance. - Keep new specs in
draftuntil evidence is wired up. This prevents verify from blocking CI on work-in-progress specs. - Let AI agents handle the next module. The agent skills installed by
supersigil initinclude anss-retroactive-specificationskill designed for exactly this case — an agent reads existing code and tests, writes the spec, and wires up evidence. Point it at a module and let it follow the same loop you just did manually.
CI integration
Section titled “CI integration”Once you have a few specs with solid evidence, add verification to CI. A simple approach:
- name: Verify specs run: supersigil verifyUse supersigil verify --since main in pull request checks to scope verification to changed specs. See the CI Verification guide for the full setup.