clare-assertive

A testing rule for writing checks around facts that must always remain true, rather than around one particular implementation.

In plain words
What is it for?
Use it to add property-based tests, which try many generated inputs, plus checks for public interfaces and project structure.
Why use it?
It helps tests keep working when the code is rewritten and catches broader errors than checks for a few expected examples.

Cursor rule for Cursor

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 rules/jketreno/clare/clare-assertive
Clone the repo
git clone --depth 1 https://github.com/jketreno/clare

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 620 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.00000 $0.00620
Opus 5 $0.00000 $0.00310
Sonnet 5 $0.00000 $0.00124
Haiku 4.5 $0.00000 $0.00062

Measured 3d ago against content hash 315f9f227e8e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

clare-assertive 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 3d ago.

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.

.cursor/rules/clare-assertive.mdc · 76 lines

How it starts

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

[A] Assertive — Tests Define Invariants, Not Implementations

Every test you write must enforce something that must always be true, not something the implementation currently happens to do.

The Invariant Test Pattern

Before writing a test, ask: "What must be true even if someone rewrites the implementation from scratch?"

That answer is your test.

// ❌ Confirms implementation — useless after regeneration
it('addTax returns 110 when given 100 and 0.1', () => {
  expect(addTax(100, 0.1)).toBe(110);
});

// ✅ Enforces invariant — survives any correct implementation
it('tax is always added to the original amount, never subtracted', () => {
  fc.assert(
    fc.property(
      fc.float({ min: 0, max: 1_000_000 }),
      fc.float({ min: 0, max: 1 }),
      (amount, rate) => {
        fc.pre(amount > 0 && rate >= 0);
        expect(addTax(amount, rate)).toBeGreaterThanOrEqual(amount);
      }
    )
  );
});

Required Test Types per Module

  1. Unit invariant tests — at least one property-based test per critical function
  2. Schema-lock test — for any public API or event contract
  3. Architecture test — in tests/architecture/ for structural rules

Test Naming Convention

Use the pattern: [subject] [never/always/must/cannot] [condition]

  • 'users can never have duplicate emails'
  • 'API responses always include a request ID'
  • 'payment amounts must always be positive'
  • 'auth tokens cannot be longer than 30 days'

Property-Based Test Starters

import fc from 'fast-check'; // TypeScript/JavaScript

// Roundtrip (encode/decode, serialize/deserialize)
fc.assert(fc.property(fc.string(), s => decode(encode(s)) === s));

// Monotonicity (more input → more/equal output)
fc.assert(fc.property(fc.integer({ min: 0 }), n => process(n + 1) >= process(n)));

// Idempotency (doing it twice = doing it once)
fc.assert(fc.property(fc.anything(), x => normalize(normalize(x)) === normalize(x)));

The Test-the-Test Exercise

After writing tests:

  1. Delete the implementation
  2. Ask AI to regenerate it
  3. Run the tests

Read the full file on GitHub · 76 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. 3d ago First seen · 76 lines · 0 tokens per session scan A 315f9f227e8e

Subscribe to this mod's changes

clare-assertive is a cursor rule published in the GitHub repository jketreno/clare (5 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 620 tokens. 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.