test-gate

A test-first workflow that writes failing tests to define what a feature must do before implementation begins. TDD, or test-driven development, is the practice of writing these behavior checks before the code.

In plain words
What is it for?
Use it for a feature or component when you want tests to describe the required behavior and then guide the implementation.
Why use it?
It turns vague requirements into an observable contract and exposes missing or misunderstood behavior before implementation is complete.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/rajconnects/founder-stack/test-gate
Clone the repo
git clone --depth 1 https://github.com/rajconnects/founder-stack
Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 811 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00023 $0.00811
Opus 5 $0.00012 $0.00405
Sonnet 5 $0.00005 $0.00162
Haiku 4.5 $0.00002 $0.00081

Measured yesterday against content hash ff351fc366ed, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-gate scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

workflow/commands/test-gate.md · 43 lines

How it starts

The opening of the file, as written. The whole thing — 43 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are running the test gate. This gate runs BEFORE implementation — tests establish the contract.

Arguments: $ARGUMENTS

Steps

  1. If $ARGUMENTS is empty, fail fast: "test-gate requires a scope (feature/component name or spec section). Example: /test-gate ThemeToggle." Do not guess.

  2. Classify the scope. Read the cited brief/spec section. Pick one:

    • Bounded — acceptance criteria explicitly enumerate ≤5 test cases AND the contract fits in one paragraph. → main agent writes tests inline (step 3).
    • Open — criteria are prose, list >5 cases, or the contract is ambiguous. → delegate to subagent (step 4).
  3. (Bounded path.) Read the cited spec section. Write 3–5 behavior/structure tests in the adjacent *.test.tsx / tests/ location. Skip styling assertions — those are /design-gate's job. Run test_commands.* from test_commands.*_cwd. Confirm failures are contract failures. If the test runner itself is broken (JSX runtime, polyfill gap, stale deps), fix it inline — config rot is a tax of doing business, not a workflow step. Report tests + paths. Skip to step 5.

  4. (Open path.) Launch the test-author subagent with a self-contained prompt:

    • The scope argument.
    • Instruct it to read .claude/project.json for test_commands, test_roots, design_system.*_spec.
    • Ask it to write failing tests, run them to confirm the failure mode is a contract failure, and return the standard output. Print the subagent output verbatim.
  5. If verdict is CONTRACT_ESTABLISHED (bounded or open), remind: "Tests red by design. Implement against the test file(s). When green, run /design-gate <scope>."

  6. If verdict is ERROR (spec has no acceptance criteria), surface it — the user's next step is to tighten the spec, not to write code.

  7. Real-corpus gate (if real_corpora is configured in project.json). Synthetic fixtures don't catch the gap between "code accepts the shape we wrote" and "code accepts the shape on disk." For each entry in real_corpora:

    • Resolve validator (file path + named export). Load the validator at test time, not at this gate's runtime.
    • List every artifact under path. For each, run it through the validator.
    • On any failure: surface the file path + the specific validator error. Do NOT auto-fix; the spec or the validator (depending on which is correct) needs to change. This is a contract conversation, not a code task.
    • On pass: log [real-corpus] <name>: <count> validated so the result is visible in handoff output. This step is the difference between "tests passed against my fixtures" and "the system handles real data." If the project doesn't ship a corpus on disk, omit real_corpora and skip this step.

Read the full file on GitHub · 43 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 43 lines · 23 tokens per session scan A ff351fc366ed

Subscribe to this mod's changes

test-gate is a command published in the GitHub repository rajconnects/founder-stack (2 stars, last pushed 1mo ago), licensed MIT. It adds 23 tokens to every session and 811 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.