adr-writer
Generates Architecture Decision Records capturing context, rationale, alternatives, and consequences in numbered status-tracked format. Triggers on: "write an…
Generates pytest test suites with happy path, edge cases, error conditions, fixture scaffolding, mocks, async patterns. Triggers on: "generate tests", "write tests for", "test this function", "create test suite", "pytest for", "unit tests for", "mock strategy for".
$ npx -y skills add Mathews-Tom/armory --skill test-harness --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/test-harnessContext preview
The summary Claude sees to decide when to auto-load this skill.
Generates pytest test suites with happy path, edge cases, error conditions, fixture scaffolding, mocks, async patterns. Triggers on: "generate tests", "write tests for", "test this function", "create test suite", "pytest for", "unit tests for", "mock strategy for".
name: test-harness description: 'Generates pytest test suites with happy path, edge cases, error conditions, fixture scaffolding, mocks, async patterns. Triggers on: "generate tests", "write tests for", "test this function", "create test suite", "pytest for", "unit tests for", "mock strategy for".' metadata: version: 1.1.1 category: development tags: [testing, pytest, test-generation, python] difficulty: intermediate phase: build
Systematic test suite generation that transforms source code into comprehensive, runnable pytest files. Analyzes function signatures, dependency graphs, and complexity hotspots to produce tests covering happy paths, boundary conditions, error states, and async flows — with properly scoped fixtures and focused mocks.
| File | Contents | Load When | | -------------------------------- | ---------------------------------------------------------------------- | -------------------------------- | | `references/pytest-patterns.md` | Fixture scopes, parametrize, marks, conftest layout, built-in fixtures | Always | | `references/mock-strategies.md` | Mock decision tree, patch boundaries, assertions, anti-patterns | Target has external dependencies | | `references/async-testing.md` | pytest-asyncio modes, event loop fixtures, async mocking | Target contains async code | | `references/fixture-design.md` | Factory fixtures, yield teardown, scope selection, composition | Test requires non-trivial setup | | `references/coverage-targets.md` | Threshold table, branch vs line, pytest-cov config, exclusion patterns | Coverage assessment requested |
Before writing a single test, build a model of the target code:
1. **Identify scope** — What functions, classes, or modules need tests? If unspecified, check for recent modifications: `git diff --name-only HEAD~5` 2. **Read function signatures** — Parameters, types, return types, defaults. Every parameter is a test dimension. 3. **Map dependencies** — Which calls go to external systems (DB, API, filesystem, clock)? These are mock candidates. 4. **Detect complexity hotspots** — Functions with high branch counts, deep nesting, or multiple return paths need more test cases. 5. **Check existing tests** — If tests already exist, understand what they cover. Do not duplicate; extend. 6. **Read project conventions** — Check CLAUDE.md, conftest.py, pytest.ini/pyproject.toml for fixtures, markers, and test organization patterns already in use.
For each function under test, enumerate cases across four categories:
| Category | What to Test | Example | | ---------- | ---------------------------------------------- | ------------------------------------------- | | Happy path | Expected inputs produce expected outputs | `add(2, 3)` returns `5` | | Boundary | Edge values at limits of valid input | Empty string, zero, max int, single element | | Error | Invalid inputs trigger proper exceptions | `None` where `str` expected, negative index | | State | State transitions produce correct side effects | Object moves from `pending` to `active` |
For each case, note:
Parametrize cases that share the same test logic but differ only in input/output values.
1. **Identify shared setup** — If 3+ tests need the same object, extract a fixture. 2. **Select scope** — Use the narrowest scope that avoids redundant setup:
| Scope | Use When | Example | | ---------- | ------------------------------------------ | ---------------------------- | | `function` | Default. Each test gets fresh state | Most unit tests | | `class` | Tests within a class share expensive setup | DB connection per test class | | `module` | All tests in a file share setup | Loaded config file | | `session` | Entire test run shares setup | Docker container startup |
3. **Design teardown** — Use `yield` fixtures when cleanup is needed. Never leave side effects (temp files, DB rows, monkey-patches) after a test. 4. **Identify conftest candidates** — Fixtures used across multiple test files belong in `conftest.py`. Fixtures used in one file stay in that file.
1. **Decide what to mock** — Mock external dependencies only:
2. **Decide what NOT to mock** — Never mock:
3. **Choose mock level** — Patch at the import boundary of the module under test, not at the definition site. `@patch('mymodule.requests.get')`, not `@patch('requests.get')`.
4. **Add mock assertions** — Every mock should assert it was called with expected arguments and the expected number of times. Mocks without assertions are coverage holes.
Generate the test file following this structure:
1. Imports (pytest, mocks, target module) 2. Constants
Curated, production-grade skills, agents, hooks, rules, commands, utilities, and presets for AI coding agents. No magic, no demos — battle-tested workflows built for developers who use AI seriously.
Repo: Mathews-Tom/armory
Generates Architecture Decision Records capturing context, rationale, alternatives, and consequences in numbered status-tracked format. Triggers on: "write an…
Build AI agents and automate Claude Code programmatically via the Claude Agent SDK and headless CLI mode. Covers Python SDK, claude -p, SDK MCP servers, hooks,…
Audits and enhances FastAPI and REST API documentation: missing descriptions, response codes, examples, docstrings, Pydantic models, OpenAPI spec. Triggers on:…
Generate architecture diagrams as fully editable SVG with native AWS, Azure, and GCP icons for cloud diagrams, or hand-drawn generic icons for everything else.…
Architecture reviews across 7 dimensions (structural, scalability, enterprise readiness, performance, security, ops, data) with scored reports. Triggers on:…
Optimize and prepare figures for arXiv submission: format conversion (EPS/PDF/PNG/JPG), size reduction, metadata stripping, processor compatibility (DVI vs…