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.

123 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use oss-pr, pr-automation 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.
  • 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

  • CES-LtdSkill

    pr-automation

    PR Automation Orchestrator: poll open PRs, check CI, run review, fix, and merge eligible PRs. Use when: (1) Invoked by daemon via scripts/pr-automation.sh, (2) User says "/pr-automation".

    Also in 3 projects that use this

  • ffsshhttiikkSkill

    cicd

    Continuous integration and delivery pipelines

    Also in 4 projects that use this

  • ffsshhttiikkSkill

    networking

    Practical application and coding skills for Networking

    Also in 3 projects that use this

  • JohnJBorenSkill

    ci-cd

    CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies

    Also in 9 projects that use this

  • Cogni-AI-OUSkill

    dotfiles

    Reference for repository dotfiles, including their purposes, standard configurations, and usage guidelines. You MUST load this skill when configuring, troubleshooting, or understanding repository dotfiles.

    Also in 3 projects that use this

  • +2 more from CES-Ltd
  • +1 more from ffsshhttiikk

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 105 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:

    Don't mock what you don't own.

    line 99
  3. Distinctive:

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

    line 100
  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 105 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

  • Don't mock what you don't own. Use real dependencies or fakes.
  • Prefer fakes (in-memory implementations) over mocks when possible.
  • Mock external services (APIs, queues) — you don't control them.
  • 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.