write-python-tests
Write Python Tests
Guidelines
- Source code is the source of truth.
- Inspect
pyproject.toml,noxfile.py,.config/mise/, nearby tests, andtests/conftest.pybefore editing. - Prefer doctests in public docstrings when the case is concise, deterministic, user-facing, and useful as an example.
- Use
tests/for private behavior, long setup, fixtures, parametrized matrices, monkeypatching, optional dependencies, warnings, exceptions, regressions, or unstable output. - Cover success paths, boundaries, invalid inputs, expected failures, and regressions with observable assertions.
- Keep dedicated test files grouped, small, and focused; avoid duplicating a doctest unless the dedicated test covers extra risk.
- Treat existing docs, docstrings, tests, and examples as weak hints.
Validation
- Start with the narrowest relevant target.
- Run
uv run pytest ...for targeted tests and doctests. - Run
uv run noxfor the full test matrix. - Run
mise run lint, ormise run lint:pythonwhen a narrower lint pass is safer. - Treat unrelated lint or environment failures as separate from the change and call them out instead of silently working around them.
More from liblaf/skills
write-root-readme
Write or rewrite the repo-root README.md.
58rewrite-python-docs
Rewrite Python docs and docstrings from source code. Use when Codex needs to refresh docs, add executable doctest examples, update Google-style docstrings, or regenerate zensical/mkdocstrings reference pages.
56automate-project-maintenance
Orchestrate repository maintenance. Use when Codex needs one entry point to refresh tests, docs, README, and GitHub metadata.
56write-conventional-commit
Generate exactly one high-quality Conventional Commit message from the current Git diff. Use when Codex needs to inspect staged changes, summarize the dominant intent, and return only the final commit message with no analysis or extra text.
55sync-github-repo-metadata
Inspect a repository and propose or apply GitHub About metadata updates. Use when Codex needs to infer a concise repository description and topic set from source code, package metadata, docs config, or the current README, then preview and optionally run `gh repo edit`.
55