agentleFS
justincordovajustincordova/agents/skills/testing/SKILL.md

testing

Skill1 starsChanged 4 months agoMITView on GitHub

Use when writing tests, deciding what to test, or choosing testing approaches. Practical guidance for test design and strategy.

194 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use bundle-dependency-prs, update-library-template 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.
  • MicrosoftSkill

    bundle-dependency-prs

    Fix broken dependency update PRs and aggregate the ones that work into one PR.

    Also in 8 projects that use this

  • MicrosoftSkill

    update-library-template

    Merges the latest Library.Template into this repo (at position of HEAD) and resolves conflicts.

    Also in 8 projects that use this

  • NVIDIA-NeMoSkill

    build-and-dependency

    Dev environment setup for Megatron Bridge — container-based development, uv package management, lockfile regeneration, adding dependencies, Slurm container usage, and common build pitfalls.

    Also in 3 projects that use this

  • timmo001Skill

    changeset-scope

    Keep all scoped code work contained to the user-defined changeset. Use for implementation, fixes, diagnosis, refactoring, cleanup, and review when explicit instructions, named files, diffs, branches, pull requests, or injected work scopes define the boundary.

    Also in 3 projects that use this

  • JetBrainsSkill

    module-dependencies

    Add or modify IntelliJ module dependencies in `.iml` files.

    Also in 3 projects that use this

  • CES-LtdSkill

    oss-pr

    Use when creating a pull request, after committing changes, or when user invokes /oss-pr. Covers branch management, quality checks, commit, push, and PR creation.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 175 edited versions we read keep these.

  • 6

    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:

    Follow the project's existing convention.

    line 74
  2. Distinctive:

    Use real dependencies when they're fast and deterministic (in-process code, a local test database).

    line 99
  3. Distinctive:

    Prefer fakes (in-memory implementations) over mocks when possible.

    line 101
  4. Distinctive:

    If you're mocking more than 2-3 things in one test, test at a different level.

    line 102
  5. Distinctive:

    Every public API has at least one test

    line 109
  6. Distinctive:

    Follow the project's existing pattern.

    line 141

“Common” is measured: kept by at least 6 in 10 of the 175 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

Testing

Overview

Practical testing guidance: what to test, how to test it, and when tests matter. Not dogmatic TDD — just enough testing to give you confidence.

Core principle: Tests should give you confidence to ship and refactor without fear.

What to Test

Always Test

  • Public APIs and interfaces
  • Bug fixes (reproduce the bug first)
  • Critical paths: auth, payments, data integrity, security
  • Business logic and state transitions
  • Edge cases: empty input, null, zero, max values, unicode

Usually Test

  • Shared utilities and libraries
  • Data transformations and parsers
  • Error handling paths

Skip Testing

  • Prototypes and spikes (throwaway code)
  • One-off scripts
  • Pure UI layout tweaks with no logic
  • Third-party library behavior (that's their tests)
  • Config changes

Test Design

Test Behavior, Not Implementation

# BAD: Tests implementation details
def test_user_service_calls_repository():
    mock_repo.get.assert_called_once_with(user_id=1)

# GOOD: Tests observable behavior
def test_get_user_returns_user_when_exists():
    result = user_service.get_user(user_id=1)
    assert result.name == "Justin"

One Concept Per Test

# BAD: One giant test
def test_checkout():
    # tests empty cart
    # tests invalid item
    # tests successful checkout
    # tests total calculation
    pass

# GOOD: Separate tests
def test_checkout_empty_cart_returns_error():
    ...

def test_checkout_invalid_item_returns_error():
    ...

def test_checkout_successful_returns_order():
    ...

Test Naming

Follow the project's existing convention. If no precedent:

test_[unit]_[scenario]_[expected]

Examples:

  • test_login_invalidPassword_returns401
  • test_checkout_emptyCart_returnsError
  • test_parse_validJson_returnsObject

Test Types — When to Use What

TypeWhenSpeed
UnitPure logic, utilities, edge casesFast
IntegrationAPI endpoints, database operations, service interactionsMedium
E2ECritical user flows, cross-service behaviorSlow

Default to integration tests for application code. Unit tests for pure logic.

Most bugs happen at integration boundaries, not inside pure functions.

Mocking Guidelines

  • Use real dependencies when they're fast and deterministic (in-process code, a local test database).
  • For external services (APIs, queues), wrap them behind your own interface and fake that interface in tests. Don't mock third-party library internals — the mock encodes your guess about code you don't own.
  • Prefer fakes (in-memory implementations) over mocks when possible.
  • If you're mocking more than 2-3 things in one test, test at a different level.

Coverage Philosophy

Aim for confidence, not a number.

You have enough coverage when:

  • Every public API has at least one test
  • Error paths are tested
  • Edge cases are covered
  • You can refactor without fear

You don't have enough when:

  • You're afraid to change code because tests might break
  • You can't answer "what happens if this fails?"
  • Bug fixes keep appearing in the same area

Test Organization

Mirror the source structure:

src/
  auth/
    login.ts
    logout.ts
tests/
  auth/
    login.test.ts
    logout.test.ts

Co-locate when the project prefers it:

src/
  auth/
    login.ts
    login.test.ts

Follow the project's existing pattern.

Common Mistakes

Don'tDo Instead
Test implementation detailsTest observable behavior
Write tests after "just to have them"Write tests that verify something specific
Mock everythingUse real deps when practical
Chase 100% coverageCover what matters
Write brittle tests (tight coupling)Test the contract, not the internals
Skip testing error pathsTest what happens when things fail

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.