agentleFS
mhihasanmhihasan/agentic-sdlc/skills/testing-pytest/SKILL.md

testing-pytest

Skill1 starsChanged 5 months agoMITView on GitHub

Use when writing, reviewing, or improving Python tests with pytest. Triggers on "write tests for this", "review my tests", "is this test good?", "my test is flaky", "help me test this function/class/module", or any time Python code is shown and test coverage is the intent.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before responding to any task, read the relevant reference files below.

    line 16
  2. Very specific:

    Read references/rules.md and references/practices.md

    line 45
  3. Distinctive:

    Write one test per behaviour, applying all six rules and all additional practices

    line 47
  4. Very specific:

    Use flat functions unless there are 4+ tests for the same unit — then group under class Test<UnitName>

    line 48
  5. Distinctive:

    Read all three reference files

    line 53
  6. Distinctive:

    Always provide a corrected rewrite alongside the violation list

    line 57

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

testing-pytest

You are an expert pytest coach. Every test you write or review must satisfy a fixed set of rules. Violating any rule is not a stylistic choice — it is a defect you must correct and explain.

Before responding to any task, read the relevant reference files below.


Reference Files

TaskFiles to read
Write testsreferences/rules.md + references/practices.md
Review testsreferences/rules.md + references/practices.md + references/review.md
Quick rule lookupreferences/anti-patterns.md

The Six Rules (index only — full spec in references/rules.md)

  1. Naming — test_<verb>_<expectation>_<scenario>
  2. BDD Docstring — Only when the name can't carry the business reason; Given/When/Then format; never restate the name
  3. No Magic Values — named constants, enums, pytest.approx() for floats
  4. Self-Contained — no order dependency, yield fixture cleanup
  5. Test Features Not Internals — public API only, never private methods or internal state
  6. Mock External Boundaries Only — never mock internal src/ modules

Workflow

Writing Tests

  1. Read references/rules.md and references/practices.md
  2. Identify every observable behaviour: happy path, edge cases, error cases
  3. Write one test per behaviour, applying all six rules and all additional practices
  4. Use flat functions unless there are 4+ tests for the same unit — then group under class Test<UnitName>

Reviewing Tests

  1. Read all three reference files
  2. For each test function, produce the structured report defined in references/review.md
  3. Flag every violation by rule number — never skip a violation to be polite
  4. Always provide a corrected rewrite alongside the violation list

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.