agentleFS
Dokkabei97Dokkabei97/forged-claude-code/skills/cto/test-generator/SKILL.md

test-generator

Skill2 starsChanged 9 months agoMITView on GitHub

Analyzes existing code and auto-generates unit and integration tests. Covers happy paths, edge cases, and error scenarios for Jest, Vitest, pytest, and Kotest frameworks.

21 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use git-doc-updater, git-precommit 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.
  • u9401066Skill

    git-doc-updater

    Auto-check and update key documentation before Git commits to keep docs in sync with code. Triggers: docs, 文檔, 更新文檔, sync docs, release, 發布.

    Also in 3 projects that use this

  • u9401066Skill

    git-precommit

    Orchestrate pre-commit workflow including Memory Bank sync, README/CHANGELOG/ROADMAP updates. Triggers: GIT, gc, push, commit, 提交, 準備 commit, 要提交了, git commit, pre-commit, 推送.

    Also in 3 projects that use this

  • nilecuiSkill

    code-refactor

    Perform bulk code refactoring operations like renaming variables/functions across files, replacing patterns, and updating API calls. Use when users request renaming identifiers, replacing deprecated code patterns, updating method calls, or making consistent changes across multiple locations.

    Also in 3 projects that use this

  • AutumnsGroveSkill

    api-designer

    Design and document RESTful and GraphQL APIs with OpenAPI/Swagger specifications, authentication patterns, versioning strategies, and best practices. Use for: (1) Creating API specifications, (2) Designing REST endpoints, (3) GraphQL schema design, (4) API authentication and authorization, (5) API versioning strategies, (6) Documentation generation

    Also in 3 projects that use this

  • ArogyaReddySkill

    changelog-generator

    Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.

    Also in 4 projects that use this

  • +7 more from u9401066

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 3

    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 existing test conventions in the project

    line 148
  2. Distinctive:

    Write E2E tests (use e2e-runner agent)

    line 151
  3. Distinctive:

    Test private/internal implementation details

    line 154

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

Test Generator - Automated Test Generation

Overview

Reads existing code and generates comprehensive test suites. Covers the boring-but-critical test writing so developers can focus on business logic.


1. When to Apply

TriggerBehavior
"generate tests for [file]"Analyze file, generate test suite
"add tests"Scan for untested code, generate tests
"test coverage"Identify coverage gaps, generate missing tests

2. Test Generation Workflow

Step 1: Code Analysis

1. Read target file(s)
2. Identify exported functions/classes/methods
3. Analyze parameter types and return types
4. Detect dependencies (imports, injections)
5. Identify side effects (API calls, DB, file system)

Step 2: Test Case Planning

For each function, generate test cases:

CategoryExamples
Happy pathValid inputs → expected output
Boundary values0, 1, MAX, empty string, empty array
Invalid inputsnull, undefined, wrong type, negative
Error handlingNetwork failure, timeout, invalid response
Edge casesConcurrent calls, unicode, special chars

Step 3: Test Generation

TypeScript (Jest/Vitest):

import { describe, it, expect, vi } from 'vitest'
import { calculatePrice } from './pricing'

describe('calculatePrice', () => {
  it('calculates base price correctly', () => {
    expect(calculatePrice({ quantity: 1, unitPrice: 100 })).toBe(100)
  })

  it('applies discount for bulk orders', () => {
    expect(calculatePrice({ quantity: 100, unitPrice: 10 })).toBe(900)
  })

  it('throws for negative quantity', () => {
    expect(() => calculatePrice({ quantity: -1, unitPrice: 10 }))
      .toThrow('Quantity must be positive')
  })

  it('returns 0 for zero quantity', () => {
    expect(calculatePrice({ quantity: 0, unitPrice: 100 })).toBe(0)
  })
})

Python (pytest):

import pytest
from pricing import calculate_price

def test_base_price():
    assert calculate_price(quantity=1, unit_price=100) == 100

def test_bulk_discount():
    assert calculate_price(quantity=100, unit_price=10) == 900

def test_negative_quantity_raises():
    with pytest.raises(ValueError, match="positive"):
        calculate_price(quantity=-1, unit_price=10)

def test_zero_quantity():
    assert calculate_price(quantity=0, unit_price=100) == 0

Step 4: Mock Generation

Auto-generate mocks for external dependencies:

// Auto-detected: function calls supabase
vi.mock('@/lib/supabase', () => ({
  supabase: {
    from: vi.fn(() => ({
      select: vi.fn().mockResolvedValue({ data: mockData, error: null })
    }))
  }
}))

3. Framework Detection

File PatternFramework
vitest.config.*Vitest
jest.config.*Jest
pytest.ini, pyproject.toml with pytestpytest
build.gradle* with kotestKotest

4. Tool Coordination

ToolPurpose
ReadAnalyze source code
WriteGenerate test files
GlobFind test config, existing tests
GrepDetect imports, dependencies
BashRun tests, check coverage

5. Boundaries

Will:

  • Generate test suites for functions/classes/endpoints
  • Cover happy paths, edge cases, and error scenarios
  • Auto-generate mocks for external dependencies
  • Follow existing test conventions in the project

Will Not:

  • Write E2E tests (use e2e-runner agent)
  • Replace TDD workflow (use tdd-guide agent for that)
  • Guarantee 100% coverage (focuses on meaningful tests)
  • Test private/internal implementation details

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.