write-tests

A guided workflow for writing software tests that check whether code still behaves correctly after changes.

In plain words
What is it for?
Writing unit or integration tests, adding missing coverage, creating reproduction tests, and working with test-driven development (TDD), where tests are written before the code.
Why use it?
It helps avoid tests that merely increase line coverage without catching real regressions. For bug fixes, it records the failure before the fix and checks nearby edge cases.

Skill for Claude CodeCodex

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 skills/hellotern/sextant/write-tests
Any agent
npx skills add hellotern/Sextant --skill write-tests
Clone the repo
git clone --depth 1 https://github.com/hellotern/Sextant

Made for: Claude Code, Codex.

Per session 100 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,834 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.00100 $0.02834
Opus 5 $0.00050 $0.01417
Sonnet 5 $0.00020 $0.00567
Haiku 4.5 $0.00010 $0.00283

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

Security

Grade A, and why

write-tests 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 2d 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.

skills/write-tests/SKILL.md · 298 lines

How it starts

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

!../principles/SKILL_BODY.md

!../tool-gitnexus/SKILL_BODY.md


Test Writing Workflow

Core Principle

The value of tests is not "line coverage," but accurately reporting regressions when code changes. Good tests are a safety net for future refactoring — they go red only when behavior is truly broken, not when unrelated changes are made.


Entering from a Bug Fix

If this test session was triggered by a bug fix, apply the following adjustments before entering the standard workflow:

1. Write the reproduction test first — before anything else.

The root cause and trigger conditions are already known from the bug fix. Use that analysis directly:

def test_<bug_description>():
    # This test MUST FAIL before the fix is applied.
    # It documents the exact condition that triggered the bug.
    result = <call using the trigger conditions from the bug fix>
    assert <the correct behavior that was previously broken>

2. Skip Step 1 (code analysis) for the fixed function. Jump directly to Step 2, using the impact assessment from the bug fix as input for "what callers depend on."

3. Prioritize boundary tests adjacent to the bug. Focus on the boundary conditions the bug exposed — null, zero, extreme values, race conditions.

4. Name the reproduction test clearly:

def test_calculate_discount_zero_rate_does_not_divide_by_zero():
    # fix: rate=0 caused ZeroDivisionError (see bug fix root cause)
    assert calculate_discount(price=100, rate=0) == 100

Once the reproduction test is in place and passing, skip to Step 2 for any additional coverage.

If the reproduction test still fails after the fix was applied: stop the test-writing workflow. Report to the user: "The reproduction test is still failing — the fix may be incomplete. Please re-trigger with sextant:fix-bug to re-evaluate the root cause, or describe the remaining failure and I'll investigate with baseline rules." Do not proceed to Step 2.


Read the full file on GitHub · 298 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. 2d ago First seen · 298 lines · 100 tokens per session scan A fdffda96af69

Subscribe to this mod's changes

write-tests is a skill published in the GitHub repository hellotern/Sextant (15 stars, last pushed 4mo ago), licensed MIT. It adds 100 tokens to every session and 2,834 once invoked, about $0.0005 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-30.