agentleFS
Echo-ScionEcho-Scion/orioncortex/.agents/skills/strict-tdd/SKILL.md

strict-tdd

Skill2 starsChanged 8 days agoMITView on GitHub

Use when writing new features, fixing bugs, or implementing code requiring verified test coverage before writing implementation.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check if target project contains .orion/working/audit/AUDIT_STATE.md or 00-ledger.md.

    line 14
  2. Very specific:

    IF present: Run in Fused Mode.

    line 15
  3. Distinctive:

    IF absent: Run lean standalone mode (no ledger overhead).

    line 16
  4. Distinctive:

    Test the happy path.

    line 22
  5. Distinctive:

    Test edge cases (null, empty, error boundaries, malformed input).

    line 23
  6. Very specific:

    No Change-Detector Tests: Test the behavior that depends on a decision, not raw constants or internal private variables …

    line 37
  7. Very specific:

    The Mock Earns No Assertions: Never assert on a mock's existence (expect(sidebarMock).toBeInTheDocument()).

    line 38
  8. Very specific:

    THE PENALTY (Mechanical Rollback): If implementation code was written BEFORE a verified failing test existed, execute git stash push …

    line 42

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

🔴🟢 Strict TDD (/strict-tdd)

Execute the following steps sequentially when instructed to use TDD.

0. CONTEXT RETRIEVAL (JIT)

  • Verify Binary Oratory compliance in Root Instructions (AGENTS.md).
  • Persistent Audit State Hook (Automatic Bridging):
    • Check if target project contains .orion/working/audit/AUDIT_STATE.md or 00-ledger.md.
    • IF present: Run in Fused Mode. Auto-load AUDIT_STATE.md to pick target [OPEN] finding, apply TDD cycle, and auto-update 00-ledger.md to [FIXED] upon Exit Code 0. No manual separate workflow call required.
    • IF absent: Run lean standalone mode (no ledger overhead).

The Strict TDD Cycle

  • 1. Scaffold Interfaces: Define types/interfaces or class/function skeletons without the actual implementation.
  • 2. Write Failing Test (RED): Write a test that is guaranteed to fail because the code has not been implemented yet.
    • Enforce State-Delta Assertion Mandate (Anti-Tautology Gate): Assertions MUST verify concrete state mutations (delta: before vs. after, specific property values, or invariant transitions). Banned tautologies: toBeDefined(), assert True, assert x is not None, or checking HTTP status without payload verification.
    • Test the happy path.
    • Test edge cases (null, empty, error boundaries, malformed input).
  • 3. Run Test (Verify RED): Verify that the test actually fails (RED) with the expected error (feature missing/bug present, not a typo or compile error). If it passes, the test is faulty.
  • 4. Implement Minimal Code (GREEN): Write as little code as possible just to make the test pass. Apply YAGNI (You Aren't Gonna Need It); do not over-engineer or add features not explicitly tested.
  • 5. Run Test (Verify GREEN): Verify that all tests now pass.
  • 6. Adversarial Mutation Self-Check: Verify test sensitivity against false passes. If the core business logic operator is inverted (e.g., > to <, == to !=, boolean flipped, or assignment omitted), would the test turn RED? If the test would still pass with broken logic, the assertion is vacuous. Rewrite assertions before proceeding.
  • 7. Refactor (Stay GREEN): Improve code quality or optimize production code. Re-run tests to ensure they stay green. Do NOT add new behavior during refactoring.
  • 8. Repeat: Next behavior.

Anti-Tautology & Mutation Defense

  • State-Delta Assertion Mandate: Tests must assert what changed. Tautologies (checking that an object exists, status is 200 with unverified payload, or ungrounded assertions) do NOT prove correctness. Always assert specific property deltas or state transitions.
  • Adversarial Mutation Check: An assertion that cannot fail when code is defective is useless. Ensure every assertion deterministically fails if the underlying business logic operator is inverted or bypassed.

3. Test & Mock Hygiene Rules (Universal)

  1. No Mirror Assertions: Derive expected values by hand or using independent fixtures; never compute expected using the same builder or helper under test (expect(buildQuery(x)).toBe(buildQuery(x)) is an auto-tautology).
  2. No Change-Detector Tests: Test the behavior that depends on a decision, not raw constants or internal private variables (expect(MAX_RETRIES).toBe(5) is forbidden).
  3. The Mock Earns No Assertions: Never assert on a mock's existence (expect(sidebarMock).toBeInTheDocument()); assert the real component's behavior or unmock.
  4. Mirror Real Schemas Completely: Mock complete real structures (all documented fields), never partial objects that pass unit tests but break integration when downstream code reads an omitted field.
  5. Zero Test-Only Production Methods: Methods like destroy() or resetForTest() belong strictly in test utilities, never as methods on production classes.

THE PENALTY (Mechanical Rollback): If implementation code was written BEFORE a verified failing test existed, execute git stash push --include-untracked -m "tdd-premature-impl-backup" -- <file> to revert the implementation code safely. You must capture an Exit Code > 0 on the test run before proceeding.

ABSOLUTE RULE (Log Check): Evidence over claims. If the shell log does not explicitly show the test failing (Exit Code > 0), you do not know what you are testing. Halt and rewrite the test.

💡 Continuous Learnings

<!-- LEARNED_START -->
  • Recurring Mechanical Catch in test_module:fetch_items: Enforce boundary invariant guard on test_module:fetch_items
<!-- LEARNED_END -->

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.