Sets up and writes comprehensive, rigorous pytest test suites for Python projects: project tooling (uv, ruff, ty, prek), a tests/ tree mirroring src/ 1:1, conftest.py fixture chains, one test file per module with a docstring on every test stating what it proves, pytest.approx for floats, parametrize tables, slow/integration markers, importorskip for optional heavy dependencies, monkeypatch "spy" patterns instead of blanket mocking, CliRunner-based CLI testing, gated GUI testing, golden-file regression tests, and statistical literature-validation tests for scientific/numerical code. Also scaffolds matching GitHub Actions CI (OS x Python-version matrix, separate lint job, dependabot). Use whenever the user asks to write tests, add a test suite, set up pytest, create conftest.py or fixtures, add CI testing workflows, test a CLI or GUI, or make an existing suite more thorough and disciplined - even a bare "add tests" or "set up testing".
Ships in lps. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill distills a testing house-style that shows up nearly identically across a body of actively-maintained, real-world Python packages (scientific/engineering tooling with CLIs, a GUI, file parsers, and numerical models). It isn't one person's one-off preference on one repo — the same tooling, directory shape, fixture patterns, and CI setup recur project after project, which is what makes it worth encoding as a reusable standard rather than copying a single example. Everything below generalizes to any Python codebase, not just scientific ones.
A test suite built this way is written to be read, not just run. Every test's docstring is
a one-line spec sentence; a pytest tests/ -v run reads almost like a table of contents of the
package's guarantees. Tooling choices (uv, ruff, ty, prek) exist to make the suite fast and
reproducible so the discipline doesn't decay under time pressure. CI mirrors local dev exactly
— same uv sync command, same pytest invocation — so "works on my machine" isn't a failure
mode. Explain the why to yourself as you write each test; that's what keeps the suite from
turning into brittle assertions nobody trusts.
| Convention | In short |
|---|---|
| Layout | tests/ mirrors src/<package>/ one subpackage, one file, at a time |
| Test files | test_<module>.py maps 1:1 to the source module it covers |
| Fixtures | conftest.py at every level that needs shared fixtures; chained, not duplicated |
| Grouping | class Test<Subject><Scenario>: with a one-line class docstring |
| Docstrings | Every test has a one-line docstring stating the behavior it proves, present tense |
| Naming | test_<subject>_<expected_outcome>, no numbers, fully descriptive |
| Floats | Always pytest.approx(x, abs=... ) or rel=... — never bare == |
| Tables of cases | @pytest.mark.parametrize |
| Slow/optional | @pytest.mark.slow / @pytest.mark.integration, registered + --strict-markers |
| Optional deps | pytest.importorskip("heavy_pkg", reason="...") at module top |
| Spying | monkeypatch.setattr wrapping/subclassing the real thing, not blanket mocks |
| CLI | typer.testing.CliRunner / Click's equivalent — no subprocess |
| GUI | pytest.importorskip gate + QT_QPA_PLATFORM=offscreen in CI |
| Regression | Real sample files under tests/data/, parsed once via an autouse fixture |
| Scientific validation | Literature tables as typed Python data + aggregate-error assertions |
| Coverage | Excludes thin CLI/GUI wrapper entrypoints, focuses on real logic |
| CI | tests.yml (OS x Python matrix) + separate lint.yml, wired to workflow_call |
Work through these in order. Each step links to a reference file with the full detail and
runnable examples, and to a ready-to-adapt template in assets/. Don't read every reference
up front — pull in the one that matches what you're actually doing right now.
Check whether the project already uses uv (a uv.lock or [dependency-groups] in
pyproject.toml is the tell). If so, add a dev dependency group with pytest, ruff, ty,
and prek, and wire [tool.pytest.ini_options] + [tool.coverage.*]. If the project uses
something else (poetry, plain pip, unittest), keep the conventions below and translate the
tooling — see "Adapting to other setups" at the end of this file.
→ references/tooling-and-config.md · template: assets/pyproject.testing.toml
tests/ to mirror src/Before writing a single test, create the directory skeleton so it matches the package structure exactly — one test directory per subpackage, one test file per module. This is what makes a large suite navigable: given a source file, its tests are never more than a rename away.
→ references/directory-layout.md
conftest.py fixture chainsStart from the cheapest, most atomic fixture and layer derived fixtures on top of it. Put
fixtures at the narrowest conftest.py that needs them — package-wide in the root, narrower
in a subpackage's own conftest.py. Use factory fixtures (a fixture that returns a callable)
when a test needs many variants of the same construction.
→ references/fixtures.md · templates: assets/conftest.root.py, assets/conftest.subpackage.py
One file per source module. Group related test cases into class Test<Subject><Scenario>:
blocks. Give every single test a one-line docstring that states the guarantee being checked,
not "test that X" — write it as if it's a line in the package's spec.
→ references/writing-tests.md · template: assets/test_module_template.py
Register slow and integration markers and enforce them with --strict-markers. Gate any
test module that needs an optional/heavy dependency with pytest.importorskip at the top,
so the default pytest tests/ -v run stays green without every extra installed.
→ references/mocking-and-optional-deps.md
CLIs get tested in-process with the framework's test runner (never subprocess, except for the
one case of testing an import guard). GUIs get an importorskip gate and an offscreen platform
in CI.
→ references/cli-and-gui-testing.md
If the package parses real external file formats, bundle small real samples under tests/data/
and regression-test against them. If it implements a published model or algorithm, transcribe
the paper's reference numbers into typed Python data and assert aggregate error bounds rather
than exact equality.
→ references/golden-and-validation-tests.md
A tests.yml matrix (OS x Python version) and a separate lint.yml, both installed the same
way local dev is, plus dependabot.yml to keep it current.
→ references/ci-workflows.md · templates: assets/tests.yml, assets/lint.yml, assets/pre-commit-config.yaml
assert some_value with no docstring — if you can't say in one sentence what the
assertion proves, you don't understand the test yet.==. Always pytest.approx, always with an explicit, reasoned
tolerance.MagicMocked into meaninglessness.test_everything.py. Tests live next to the module they cover, at the same
granularity as the source tree.importorskip or a marker with a reason=, never a quiet early
return.uv: keep the same [tool.pytest.ini_options] / [tool.coverage.*] sections; swap
the dev-dependency mechanism for the project's own (poetry group, requirements-dev.txt,
etc.) and the CI install step accordingly.typer.testing.CliRunner for click.testing.CliRunner —
the pattern (in-process invocation, checking exit_code/output separately, testing both
human and machine-readable output modes) is identical.unittest.TestCase subclasses too, as seen in CLI/GUI/entrypoint test
files in this style); adopt pytest at least as the runner so markers, importorskip,
and pytest.approx are available even if some modules keep TestCase-style classes.importorskip mechanics are pytest-specific and need a translation
to the target framework's equivalent (e.g. table-driven tests + subtests, or a testdata/
fixture directory pattern).assets/conftest.root.py (opens in a new tab)assets/conftest.subpackage.py (opens in a new tab)assets/lint.yml (opens in a new tab)assets/pre-commit-config.yaml (opens in a new tab)assets/pyproject.testing.toml (opens in a new tab)assets/test_module_template.py (opens in a new tab)assets/tests.yml (opens in a new tab)references/ci-workflows.md (opens in a new tab)references/cli-and-gui-testing.md (opens in a new tab)references/directory-layout.md (opens in a new tab)references/fixtures.md (opens in a new tab)references/golden-and-validation-tests.md (opens in a new tab)references/mocking-and-optional-deps.md (opens in a new tab)references/tooling-and-config.md (opens in a new tab)references/writing-tests.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
/kyryl-shtefiienko-lps:rigorous-pytest-suitefrom lps
Generated from the plugin's indexed repository (kyryl-shtefiienko/lps) — no native marketplace selected
npx claudepluginhub p/kyryl-shtefiienko-lps11 skills in this plugin
/adhd-modeFans out several isolated "cognitive-frame" brainstorms on an open-ended problem before switching into a separate critic pass that scores, clusters, flags traps, and deepens only the strongest few — instead of settling for the first plausible answer. Trigger this whenever the user asks to brainstorm, ideate, explore options, says "give me a few ways to...", or explicitly asks for "ADHD mode" / "/adhd" / "divergent mode". Also reach for it proactively on open-ended architecture, API/schema, and naming decisions, product positioning, and fuzzy bugs with no known root cause — anywhere a thoughtful practitioner would say "let me think about this differently for a second." Skip it for lookups, syntax questions, bugs with a known cause, or anywhere the user's phrasing signals they want the quick/standard/canonical answer./dogusariturk-python-styleReference Python style guide reverse-engineered from Doguhan Sariturk's (github.com/dogusariturk) real production repositories (HEACalculator, MaterialsFramework, PhaseForgePlus). Use this whenever writing, generating, reviewing, refactoring, or cleaning up ANY Python code for this user — scripts, modules, packages, CLIs, tests, or turning a vibe-coded/notebook-style script into something real — even if the user never mentions style explicitly. Covers project layout (src-layout, uv, ruff, ty, pre-commit, pytest), short single-responsibility files, typing, Google-style docstrings with units and literature references, cached_property for lazy derived attributes, narrow custom exceptions, named unit-conversion constants instead of magic numbers, composition over deep inheritance, registries for optional heavy dependencies, and multiprocessing worker conventions. Where this conflicts with a generic assistant default, this style is correct and the generic default is wrong — apply it before finalizing any Python output for this user. Where it conflicts instead with an established convention already in play for the current codebase (an existing project-scoped skill, or a style already consistently used in the repo being edited), that more specific convention wins on the point of conflict per skill-hierarchy; this skill still governs everywhere that convention doesn't address.Other plugins' skills for the same job