coco-research/generate-tests
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.
npx skills add https://github.com/coco-research/coco --skill generate-tests
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.
Follow every step below. Do NOT generate tests without first analyzing the project's testing setup and the target code.
Before writing any tests, discover the project's testing conventions:
package.json (dependencies/scripts), or config files:jest.config.* / jest key in package.json → Jestvitest.config.* → Vitestcypress.config.* → Cypressplaywright.config.* → Playwrightpytest.ini / pyproject.toml [tool.pytest] → pytestgo.mod → Go testingCargo.toml → Rust (#[cfg(test)])*.test.*, *.spec.*, test_*.py, *_test.go to understand naming conventions and patterns already in use.test/utils.ts, __mocks__/, conftest.py).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.
Read the file or component the user wants tested. Identify:
Before writing code, outline what you'll test:
Follow these principles:
describe("[ModuleName]", () => {
describe("[functionName]", () => {
it("should [expected behavior] when [condition]", () => {
// Arrange
// Act
// Assert
});
});
});
expect() calls are fine if they assert one logical thingdescribe — One block per function/method/component behaviorbeforeEach/afterEach for test isolation. Clean up subscriptions, timers, mocks.jest.mock(), vi.mock(), unittest.mock)jest.useFakeTimers() / vi.useFakeTimers()) for time-dependent codeafterEach to prevent test pollutionawait async functions or return the promisewaitFor / findBy for async UI updates (React Testing Library)| Framework | Component Testing | Key Patterns |
|-----------|------------------|--------------|
| React | React Testing Library | render(), screen.getByRole(), userEvent, waitFor |
| Vue | Vue Test Utils | mount(), shallowMount(), wrapper.find(), trigger() |
| Angular | TestBed | TestBed.configureTestingModule(), fixture.detectChanges() |
| Node.js | Supertest | request(app).get("/api/...").expect(200) |
| Python | pytest | @pytest.fixture, monkeypatch, parametrize |
| Go | testing | t.Run(), table-driven tests, t.Parallel() |
After generating the tests:
| Priority | Coverage Target |
|----------|----------------|
| Critical business logic | 90%+ |
| Utility functions | 85%+ |
| UI components | 80%+ |
| Configuration/glue code | 60%+ |
Focus on branch coverage over line coverage — untested else and catch paths are where bugs hide.
Before finishing, verify:
Take coco-research/generate-tests from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.