Generate Tests logo

Generate Tests

Community
coco-research
generate-tests

Use when asked to generate tests for a file, module or component, to raise coverage, or to bootstrap a suite for untested code. Detects the project's test framework and conventions first, then writes unit, integration and edge-case tests.

Overview

Publishercoco-research
Repositorycoco
Skill namegenerate-tests
Stars
550
Forks
12
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by coco-research on GitHub. Read the source before you install it.

Installation

Install the Generate Tests AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/coco-research/coco/tree/main/skills/generate-tests
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/coco-research/coco.git /tmp/coco
mkdir -p .claude/skills
cp -r /tmp/coco/skills/generate-tests .claude/skills/generate-tests
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Generate Tests in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Generate Tests on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Generate Tests is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Generate Tests — Comprehensive Test Suite Generator

Generate complete test coverage for any file, component, or module. Covers unit tests, integration tests, edge cases, error handling, and mocking — adapted to whatever testing framework the project uses.

Use when: you want tests generated for a file or component, need to improve test coverage, want edge case coverage, need mocks for external dependencies, or want to bootstrap a test suite for untested code.


When This Skill Is Activated

Follow every step below. Do NOT generate tests without first analyzing the project's testing setup and the target code.


Step 1: Detect the Testing Setup

Before writing any tests, discover the project's testing conventions:

  1. Find the test framework — Check package.json (dependencies/scripts), or config files:

    • jest.config.* / jest key in package.json → Jest
    • vitest.config.* → Vitest
    • cypress.config.* → Cypress
    • playwright.config.* → Playwright
    • pytest.ini / pyproject.toml [tool.pytest] → pytest
    • go.mod → Go testing
    • Cargo.toml → Rust (#[cfg(test)])
  2. Find existing test files — Search for *.test.*, *.spec.*, test_*.py, *_test.go to understand naming conventions and patterns already in use.

  3. Check for test utilities — Look for shared helpers, factories, custom matchers, or mock setups the project already provides (e.g., test/utils.ts, __mocks__/, conftest.py).

  4. Check the test script — Read the test script in package.json (or equivalent) to understand how tests are run, what flags are used, and what coverage tool is configured.

Match the project's existing conventions exactly. File naming, import style, assertion style, describe/it vs test, etc.


Step 2: Analyze the Target Code

Read the file or component the user wants tested. Identify:

  • All exported functions, classes, methods, and components
  • Input types and return types (or infer them)
  • External dependencies (API calls, database, file system, third-party libs)
  • Side effects (mutations, network calls, timers, DOM manipulation)
  • Error paths (throw statements, catch blocks, error returns)
  • Edge cases (null/undefined inputs, empty arrays, boundary values, large inputs)
  • Async behavior (promises, callbacks, streams)

Step 3: Plan the Test Suite

Before writing code, outline what you'll test:

Unit Tests

  • Every exported function with representative inputs
  • Return values for happy path
  • Error handling for invalid inputs
  • Boundary values (0, -1, empty string, null, max int, etc.)
  • Type coercion edge cases if applicable

Integration Tests (if the code interacts with other modules)

  • Component interactions and data flow
  • API calls with mocked responses (success + failure)
  • Service layer with mocked dependencies
  • State management side effects

Edge Cases and Error Handling

  • Null, undefined, empty inputs
  • Malformed data
  • Network failures / timeouts
  • Concurrent access / race conditions
  • Extremely large inputs

Step 4: Write the Tests

Follow these principles:

Structure

describe("[ModuleName]", () => {
  describe("[functionName]", () => {
    it("should [expected behavior] when [condition]", () => {
      // Arrange
      // Act
      // Assert
    });
  });
});
  • Descriptive test names — Read like documentation: "should return empty array when input is null"
  • AAA pattern — Arrange (setup), Act (execute), Assert (verify). Separate each visually.
  • One assertion per concept — Multiple expect() calls are fine if they assert one logical thing
  • Group with describe — One block per function/method/component behavior
  • Setup/teardown — Use beforeEach/afterEach for test isolation. Clean up subscriptions, timers, mocks.

Mocking Strategy

  • Mock external dependencies only — Don't mock the code under test
  • Use the project's existing mock patterns (e.g., jest.mock(), vi.mock(), unittest.mock)
  • Create test data factories for complex objects instead of inline literals
  • Mock timers (jest.useFakeTimers() / vi.useFakeTimers()) for time-dependent code
  • Mock dates for deterministic snapshots
  • Always restore mocks in afterEach to prevent test pollution

Async Testing

  • Always await async functions or return the promise
  • Test both resolve and reject paths
  • Use waitFor / findBy for async UI updates (React Testing Library)
  • Test loading, success, and error states

Framework-Specific Guidance

FrameworkComponent TestingKey Patterns
ReactReact Testing Libraryrender(), screen.getByRole(), userEvent, waitFor
VueVue Test Utilsmount(), shallowMount(), wrapper.find(), trigger()
AngularTestBedTestBed.configureTestingModule(), fixture.detectChanges()
Node.jsSupertestrequest(app).get("/api/...").expect(200)
Pythonpytest@pytest.fixture, monkeypatch, parametrize
Gotestingt.Run(), table-driven tests, t.Parallel()

Step 5: Verify and Improve

After generating the tests:

  1. Run the tests — Execute the test suite to make sure they pass
  2. Check coverage — Identify untested lines or branches
  3. Add missing cases — Fill gaps in coverage, especially error paths
  4. Review test quality — Tests should fail when the code breaks, not just when the tests break

Coverage Goals

PriorityCoverage Target
Critical business logic90%+
Utility functions85%+
UI components80%+
Configuration/glue code60%+

Focus on branch coverage over line coverage — untested else and catch paths are where bugs hide.


Output Checklist

Before finishing, verify:

  • Tests follow the project's existing naming convention and file location
  • All exported functions/components have at least one test
  • Happy path tested for every function
  • Error/failure path tested for every function that can fail
  • Edge cases covered (null, empty, boundary values)
  • External dependencies are mocked (no real API calls, no real DB)
  • Async code is properly awaited
  • Mocks are cleaned up in afterEach
  • Tests are independent — can run in any order
  • Test names read like documentation

Frequently asked questions

What does the Generate Tests AI skill do?

Use when asked to generate tests for a file, module or component, to raise coverage, or to bootstrap a suite for untested code. Detects the project's test framework and conventions first, then writes unit, integration and edge-case tests.

Why use Generate Tests on TypingMind?

Because you install it once and use it with any model. Generate Tests is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Generate Tests in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/coco-research/coco/tree/main/skills/generate-tests. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Generate Tests?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Generate Tests?

As many as you like. As long as a model supports skills, you can use Generate Tests with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Generate Tests AI skill free?

It is published on GitHub by coco-research. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇