test-writer

test-writer is an agent for Claude Code from Smart-AI-Memory/attune-ai. It costs 10 tokens per session (392 once invoked), scanned A, original, Apache-2.0.

A helper agent that reads source code and writes pytest behavioral tests for its public functions and methods.

In plain words
What is it for?
Use it to generate test files in the tests directory using Given/When/Then scenarios for Python code.
Why use it?
It helps create tests based on how the code actually behaves, including expected results and error cases.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: mentions subagents.

Good fit Use it to generate test files in the tests directory using Given/When/Then scenarios for Python code.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/smart-ai-memory/attune-ai/test-writer
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.

Clone the repo
git clone --depth 1 https://github.com/Smart-AI-Memory/attune-ai

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/smart-ai-memory/attune-ai/test-writer.svg)](https://agentmods.dev/agents/smart-ai-memory/attune-ai/test-writer)
Your own site
<a href="https://agentmods.dev/agents/smart-ai-memory/attune-ai/test-writer"><img src="https://agentmods.dev/badge/agents/smart-ai-memory/attune-ai/test-writer.svg" alt="Measured on agentmods" height="20"></a>
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 392 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00010 $0.00392
Opus 5 $0.00005 $0.00196
Sonnet 5 $0.00002 $0.00078
Haiku 4.5 $0.00001 $0.00039

Measured 4d ago against content hash 2e7617786615, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

test-writer 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 4d 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.

src/attune/commands/agents/test-writer.md · 57 lines

What it actually says

Test Writer

Role: Generate pytest behavioral tests by reading source code and extracting the actual API surface.

Model Tier: Sonnet (capable)

Instructions

  1. Read the target module source code to extract public API:
    • Public functions and methods (not prefixed with _)
    • Their signatures, parameter types, and return types
    • Docstrings describing expected behavior
  2. For each public function, generate tests using Given/When/Then structure
  3. Write test files to the tests/ directory following project naming conventions

Tool Restrictions

Allowed: Read, Grep, Glob, Write (restricted to tests/ directory), Bash (only uv run pytest)

Prohibited: Write to any path outside tests/, Edit of source files

Test Naming Convention

def test_{function_name}_{scenario}_{expected_outcome}():
    """Test description using Given/When/Then."""
    # Given
    ...
    # When
    ...
    # Then
    assert ...

Quality Requirements

  • Each test must import the module under test, not mock it away
  • Use pytest.raises for exception testing with match= parameter
  • Use tmp_path fixture for any file operations
  • Minimum 3 test cases per public function (happy path, edge case, error case)
  • Follow project coding standards: type hints, docstrings, specific exceptions

Output

Test files written to tests/ with the pattern test_{module_name}_behavioral.py.

After writing, run uv run pytest <test_file> -v to verify all tests pass.

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. 4d ago First seen · 57 lines · 10 tokens per session scan A 2e7617786615

Subscribe to this mod's changes

test-writer is an agent published in the GitHub repository Smart-AI-Memory/attune-ai (10 stars, last pushed today), licensed Apache-2.0. It adds 10 tokens to every session and 392 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-09-03.

Related

Other agents, from other repositories

pr-test-analyzer

Review pull request test coverage quality and completeness, with emphasis on behavioral coverage and real bug prevention.

affaan-m/ECC · 24 tokens

test-engineer

Specialized in Python testing with pytest. Expert in running tests, fixing failures, and ensuring test coverage. Use when running tests, fixing failing tests, or validating test coverage. Does NOT write new tests - focuses on running and fixing.

closedloop-ai/claude-plugins · 51 tokens

test-architect

Generates and hardens the test suite — unit AND end-to-end — for a change, runs it, and validates the behavior actually works (not just that assertions pass). Use as the SAFETY GATE before any autonomous fix is approved or merged: no adequate tests, no green light. The thing that makes the autonomous loops safe.

dshakes/compass · 72 tokens

tester

Testing specialist for unit tests, integration tests, test coverage analysis, and TDD workflows. Use when the task requires writing test suites, improving coverage, setting up test infrastructure, or validating behavior. For example: writing unit tests for a service class, setting up integration test fixtures, or…

josstei/maestro-orchestrate · 66 tokens

skill-eval-reporter

Compares repeated paired execution results using blind A/B methodology and generates a skill effectiveness report. Use when valid skill-evaluation result pairs are available.

shinpr/rashomon · 35 tokens

test-generator

Scan codebase for test gaps and generate unit/integration/E2E tests that actually pass — no hollow tests, no false coverage.

pillip/claude-dev-kit · 30 tokens