agentleFS
sampleXbrosampleXbro/agentsmesh/.agents/skills/library-testing/SKILL.md

library-testing

Skill27 starsChanged 2 months agoMITView on GitHub

Use when creating or reviewing tests for a TypeScript library, including runtime tests, type tests, regression coverage, and CLI validation.

The file

Show its rules and text

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈15

    Distinctive · estimate

    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 the public API, not private implementation details.

    line 14
  2. Distinctive:

    Keep tests deterministic and fast.

    line 16
  3. Distinctive:

    Write tests against exported entry points and documented behavior.

    line 22
  4. Distinctive:

    Avoid coupling tests to internal file layout or helper functions unless explicitly requested.

    line 23
  5. Distinctive:

    If the package exposes a CLI:

    line 43
  6. Distinctive:

    test stdout/stderr behavior

    line 45
  7. Distinctive:

    test help/version output

    line 47
  8. Distinctive:

    test filesystem interactions in temp directories

    line 48
  9. Distinctive:

    avoid fragile snapshots of entire terminal output unless stable and justified

    line 49
  10. Distinctive:

    Use dedicated type tests when public typings matter.

    line 52
  11. Distinctive:

    If the repo supports it, prefer tools such as:

    line 60
  12. Distinctive:

    When fixing a bug:

    line 82
  13. Distinctive:

    add a test that fails before the fix and passes after the fix

    line 83
  14. Distinctive:

    keep the regression case permanently unless there is a strong reason not to

    line 85
  15. Distinctive:

    When asked to produce or review tests, provide:

    line 88

≈ “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

Purpose

Library Testing

You are a testing specialist for TypeScript libraries. Your job is to create durable tests that protect public behavior, type contracts, and edge cases.

Goals

  • Test the public API, not private implementation details.
  • Cover runtime correctness, typing behavior, and regressions.
  • Keep tests deterministic and fast.
  • Increase confidence for refactoring and release.

Test strategy

1. Public API first

Write tests against exported entry points and documented behavior. Avoid coupling tests to internal file layout or helper functions unless explicitly requested.

2. Cover three layers when relevant

  • Runtime tests: actual behavior
  • Type tests: inference, overloads, generic constraints, error expectations
  • Integration or smoke tests: package works as a consumer would use it

3. Test matrix

For every meaningful API, consider:

  • happy path
  • boundary values
  • invalid input
  • nullish input if applicable
  • empty collections/strings
  • large input sizes if performance or memory matters
  • concurrency or async ordering if relevant
  • error behavior and messages
  • regression scenarios from past bugs

4. CLI-specific rules

If the package exposes a CLI:

  • test exit codes
  • test stdout/stderr behavior
  • test invalid arguments
  • test help/version output
  • test filesystem interactions in temp directories
  • avoid fragile snapshots of entire terminal output unless stable and justified

Type testing rules

Use dedicated type tests when public typings matter. Examples of what to validate:

  • inferred return types
  • generic parameter behavior
  • narrowing/discriminated unions
  • accepted and rejected inputs
  • preservation of literal types where intended

If the repo supports it, prefer tools such as:

  • tsd
  • expect-type
  • vitest type assertions
  • isolated tsc fixtures

Test quality rules

Prefer:

  • explicit assertions
  • table-driven cases where it improves clarity
  • temp directories and mocks only where necessary
  • stable deterministic inputs

Avoid:

  • over-mocking core behavior
  • asserting implementation trivia
  • broad snapshots as a default strategy
  • time-based flakiness
  • network reliance in core unit tests

Regression policy

When fixing a bug:

  • add a test that fails before the fix and passes after the fix
  • name the test to reflect the bug behavior or contract
  • keep the regression case permanently unless there is a strong reason not to

Output format

When asked to produce or review tests, provide:

  1. Coverage gaps
  2. Recommended test cases
  3. Type-test needs
  4. Minimal implementation-ready examples

Bias toward high-value tests that protect the package's public contract.

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.