agentleFS
SrejonKhanSrejonKhan/agent-skills/skills/scaffold_tests/SKILL.md

scaffold_tests

Skill3 starsChanged 2 months agoMITView on GitHub

Generates unit and regression test files for existing code. Creates "Happy Path", "Edge Case", and "Error" test stubs.

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill to automatically generate test suites for your code, ensuring functionality is locked in.

    line 8
  2. Very specific:

    Use view_file to analyze the source code.

    line 17
  3. Very specific:

    Use write_to_file to create the test file.

    line 18
  4. Distinctive:

    Write the test file with three specific sections:

    line 37
  5. Distinctive:

    Test-Driven Development (TDD): Write failing test FIRST, implement minimal code to pass, refactor after green.

    line 50
  6. Distinctive:

    Behavior-Driven Testing: Test behavior, not implementation details.

    line 51
  7. Very specific:

    Factory Pattern: When scaffolding tests, create data factory functions (e.g., getMockUser(overrides)) that provide sensible defaults but …

    line 52
  8. Distinctive:

    Mocking Strategies: Use factory functions to mock entire modules or specific hooks when scaffolding tests to isolate the unit under test.

    line 53

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

Scaffold Tests

Use this skill to automatically generate test suites for your code, ensuring functionality is locked in.

Inputs

  • Target File: The source code specific to test.
  • Test Runner: (Optional) Jest, Pytest, etc.

Tooling Strategy

  • Use view_file to analyze the source code.
  • Use write_to_file to create the test file.

Workflow

1. Context Analysis

  • Target: Analyze the open file or the specified module (e.g., utils.py, auth.js).
  • Framework Detection: Determine the project's test runner (Jest, PyTest, Mocha, Unittest). If none, suggest the most lightweight option suitable for the user's legacy hardware.

2. Test Strategy

Plan the test coverage:

  • Unit Tests: Isolated tests for individual functions/classes.
  • Regression Tests: Tests that ensure specific bugs (fixes) don't reappear.
  • Naming Convention: Standardize names (e.g., [filename].test.js or test_[filename].py).

3. Generation (The "Safety Net")

Write the test file with three specific sections:

  • Happy Path: Standard inputs produce standard outputs (The "It works" check).
  • Edge Cases: Nulls, empty strings, zeros, huge numbers (The "Robustness" check).
  • Error Handling: Invalid inputs trigger the expected error messages (The "Security" check).

4. Output

  • Save the file to a tests/ directory or alongside the source code (based on project convention).
  • Prompt the user to run them using /run_tests.

Advanced Testing Patterns

  • Test-Driven Development (TDD): Write failing test FIRST, implement minimal code to pass, refactor after green. Never write production code without a failing test.
  • Behavior-Driven Testing: Test behavior, not implementation details. Focus on public APIs and business requirements. Use descriptive test names that describe the behavior.
  • Factory Pattern: When scaffolding tests, create data factory functions (e.g., getMockUser(overrides)) that provide sensible defaults but allow tests to override specific properties. This keeps tests DRY and maintainable.
  • Mocking Strategies: Use factory functions to mock entire modules or specific hooks when scaffolding tests to isolate the unit under test.

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.