agentleFS
fmindfmind/dot/skills/python-testing/SKILL.md

python-testing

Skill10 starsChanged 55 days agoMITView on GitHub

Write Python tests with pytest, fixtures, property tests, and TDD.

33 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use swift-protocol-di-testing, springboot-tdd and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • InfopibeSkill

    swift-protocol-di-testing

    Protocol-based dependency injection for testable Swift code — mock file system, network, and external APIs using focused protocols and Swift Testing.

    Also in 6 projects that use this

  • FaisalAlqarniSkill

    springboot-tdd

    Test-driven development for Spring Boot using JUnit 5, Mockito, MockMvc, Testcontainers, and JaCoCo. Use when adding features, fixing bugs, or refactoring.

    Also in 9 projects that use this

  • FaisalAlqarniSkill

    django-verification

    Verification loop for Django projects: migrations, linting, tests with coverage, security scans, and deployment readiness checks before release or PR.

    Also in 9 projects that use this

  • InfopibeSkill

    swift-actor-persistence

    Thread-safe data persistence in Swift using actors — in-memory cache with file-backed storage, eliminating data races by design.

    Also in 6 projects that use this

  • johnrtiptonSkill

    django-security

    This skill should be used when conducting security reviews, auditing Django applications, hardening security settings, implementing OWASP Top 10 protections, managing secrets, or ensuring multi-tenant security isolation. Provides automated security auditor that scans settings, code, dependencies, and multi-tenant configurations with auto-fix capabilities.

    Also in 9 projects that use this

  • joneqianSkill

    postgres-patterns

    PostgreSQL database patterns for query optimization, schema design, indexing, and security. Based on Supabase best practices.

    Also in 12 projects that use this

  • +1 more from FaisalAlqarni
  • +3 more from Infopibe

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 28 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test-only maintenance follows pytest mechanics directly without inventing a production change.

    line 17
  2. Distinctive:

    Discover the harness: Read repository instructions, existing tests, task definitions, and nearby patterns.

    line 21
  3. Distinctive:

    RED: Write one minimal test for one observable behavior.

    line 23
  4. Distinctive:

    Protect the neighborhood: Run the package or subsystem tests.

    line 25
  5. Distinctive:

    Never weaken an existing test: do not loosen a type, add a skip, or mock away the defect to manufacture green.

    line 34
  6. Distinctive:

    Preserve code written before tests: Never delete or overwrite user work because it preceded the test.

    line 35
  7. Distinctive:

    Prefer real collaborators over mocks: Prefer real parsers, databases, filesystems, and HTTP handlers at lightweight boundaries over mocks …

    line 38
  8. Distinctive:

    Make failures self-explanatory: Keep fixtures readable and assertions on outcomes.

    line 39

“Common” is measured: kept by at least 6 in 10 of the 28 edited versions of this file we could read. “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

Python Testing

Prove a change with an honest red-green-refactor cycle: a failing test that detects the missing or broken behavior, then the smallest trustworthy change; quality-assurance owns the broader campaign and systematic-debugging owns failures not yet understood.

Test-only maintenance follows pytest mechanics directly without inventing a production change; use the red-green-refactor workflow below when implementing a behavior change.

Workflow

  1. Discover the harness: Read repository instructions, existing tests, task definitions, and nearby patterns; find the smallest command that exercises the target behavior.
  2. State the contract: Name the production change that would make the test pass and a plausible regression that would make it fail.
  3. RED: Write one minimal test for one observable behavior; run it and confirm it fails for the missing behavior, not for a syntax, fixture, environment, or setup error.
  4. GREEN: Implement only enough production code to satisfy that test; run the focused test and read the full output.
  5. Protect the neighborhood: Run the package or subsystem tests; fix production code when the new behavior breaks a valid existing contract and revisit the spec when contracts conflict.
  6. REFACTOR: Improve names, structure, duplication, and types only while everything stays green; add no behavior.
  7. Repeat: Take the next smallest behavior, edge case, or failure path through a new red cycle.
  8. Prove the regression test: Reuse the observed red result. If implementation preceded the test or its ability to detect the defect remains uncertain, safely exercise the test against the unfixed code in isolation, then confirm green with the fix.
  9. Qualify proportionately: reuse passing focused and subsystem results while relevant inputs remain unchanged; add affected static checks. Run the full gate only when repository policy or cross-cutting risk requires it. Apply the dirty-tree rule when unrelated work is present.
  10. Report evidence: summarize the observed red and green outcomes, checks actually run, and remaining limits; name every failure observed, including pre-existing ones. Do not run additional suites merely to fill the report.

Gotchas

  • Never weaken an existing test: do not loosen a type, add a skip, or mock away the defect to manufacture green.
  • Preserve code written before tests: Never delete or overwrite user work because it preceded the test; preserve it, add a red-capable test, and disclose the sequence.
  • Disclose when test-first does not fit: For a spike, generated code, or configuration-only change, say why and define another failing validation signal; do not call tests written afterward TDD.
  • Start with fast, narrow tests: Fast unit or contract tests first; integration, property, concurrency, or browser tests only where the boundary demands them; characterize legacy behavior before changing it.
  • Prefer real collaborators over mocks: Prefer real parsers, databases, filesystems, and HTTP handlers at lightweight boundaries over mocks of the unit under test; fake only paid, destructive, slow, or unreliable systems behind a narrow owned interface.
  • Make failures self-explanatory: Keep fixtures readable and assertions on outcomes; a little duplicated setup beats hidden intent, and a failure should explain the broken contract without a debugger.

References

  • pytest mechanics: read for fixture, collection, assertion, async-mode, xdist, plugin, or coverage maintenance.
  • Property tests: read when parsers, codecs, migrations, or state transitions need generated input coverage; use uv for project test dependencies.

Documentation

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.