test-generator
Skill9 starsChanged 12 months agoMITView on GitHub
Generates Jest or Pytest tests following Ben's testing standards. Use when creating tests, adding test coverage, writing unit tests, mocking dependencies, or when user mentions testing, test cases, Jest, Pytest, fixtures, assertions, or coverage.
21 other projects use a version of this.
Adopted by
Most recently taken up by
- jablonkai/skillstheir own version, first seen Oct 1, 2026
- u9401066/pubmed-search-mcptheir own version, first seen Oct 1, 2026
- trebaud/skillstheir own version, first seen Aug 18, 2026
- codebygarv/Ai-skillstheir own version, first seen Aug 16, 2026
- liuxiao20051106-prog/claude-skillstheir own version, first seen Aug 10, 2026
- bestdeejay-design/agent-skillstheir own version, first seen Aug 9, 2026
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.
u9401066Skillgit-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
u9401066Skillgit-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
nilecuiSkillcode-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
AutumnsGroveSkillapi-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
ArogyaReddySkillchangelog-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
Other versions21 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 21
- laolaoshiren/claude-code-skills-zh★ 876same name
- alirezarezvani/claude-code-tresor★ 777same name
- rshankras/claude-code-apple-skills★ 777same name
- u9401066/pubmed-search-mcp★ 28same name
- codebygarv/Ai-skills★ 26same name
- bestdeejay-design/agent-skills★ 5same name
- Data-Wise/craft★ 4same name
- u9401066/nsforge-mcp★ 4same name
- agentsdance/agentskills★ 3same name
- suxiao1824308603/Qoder-devtools-skills★ 3same name
11 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-design-patternsSkill
- code-formatterSkill
- devkit-knowledgeSkill
- documentation-templatesSkill
- error-handlerSkill
- frontend-designSkill
- product-discoverySkill
- react-patternsSkill
- tailwind-conventionsSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 9 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 13 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Place tests in __tests__/ or tests/ directories
- Distinctive: line 19
Use clear, descriptive test file names
- Distinctive: line 45
Test edge cases and boundary conditions
- Distinctive: line 49
Follow the Arrange-Act-Assert pattern:
- Distinctive: line 91
Use descriptive names that explain what's being tested
- Distinctive: line 286
Create test structure with descriptive names
- Distinctive: line 287
Write positive tests (happy path)
- Distinctive: line 288
Write negative tests (error cases)
- Distinctive: line 289
Add parameterized tests for multiple inputs
- Distinctive: line 292
Always explain what each test validates and why it's important.
“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.
Files
Test Generator Skill
Generate high-quality tests using Jest (JavaScript/TypeScript) or Pytest (Python) following established best practices.
Test Frameworks
- JavaScript/TypeScript: Jest
- Python: Pytest
Test Directory Structure
- Place tests in
__tests__/ortests/directories - Mirror source structure in test directories
- Use clear, descriptive test file names
JavaScript/TypeScript:
src/
utils/
validator.ts
__tests__/
utils/
validator.test.tsPython:
src/
utils/
validator.py
tests/
utils/
test_validator.pyTest Writing Standards
Coverage Requirements
- Include at least one negative test per feature
- Test edge cases and boundary conditions
- Aim for high coverage but prioritize quality over quantity
Test Structure
Follow the Arrange-Act-Assert pattern:
// Jest example
describe('functionName', () => {
it('should handle valid input correctly', () => {
// Arrange
const input = 'valid';
// Act
const result = functionName(input);
// Assert
expect(result).toBe(expected);
});
it('should throw error for invalid input', () => {
// Negative test case
expect(() => functionName(null)).toThrow();
});
});# Pytest example
class TestFunctionName:
def test_valid_input(self):
# Arrange
input_val = 'valid'
# Act
result = function_name(input_val)
# Assert
assert result == expected
def test_invalid_input_raises_error(self):
# Negative test case
with pytest.raises(ValueError):
function_name(None)Test Naming
- Use descriptive names that explain what's being tested
- Format:
test_<what>_<condition>_<expected_result> - Examples:
test_user_login_with_valid_credentials_returns_tokentest_api_call_with_invalid_auth_raises_401
Test Quality Checklist
- Tests are independent and can run in any order
- Each test has a single, clear purpose
- Mock external dependencies (APIs, databases, file systems)
- Include both positive and negative test cases
- Test error handling and edge cases
- Use meaningful assertion messages
- Tests are fast and deterministic
Common Test Patterns
Mocking (Jest)
jest.mock('../api/client');
it('should handle API errors gracefully', async () => {
apiClient.get.mockRejectedValue(new Error('Network error'));
await expect(fetchData()).rejects.toThrow('Network error');
});Fixtures (Pytest)
@pytest.fixture
def sample_user():
return User(name='Test User', email='test@example.com')
def test_user_creation(sample_user):
assert sample_user.name == 'Test User'Parameterized Tests
@pytest.mark.parametrize("input,expected", [
("hello", "HELLO"),
("world", "WORLD"),
("", ""),
])
def test_uppercase(input, expected):
assert uppercase(input) == expectedAsync Testing Patterns
Jest - Async/Await
describe('async operations', () => {
it('should fetch user data', async () => {
const user = await fetchUser(1);
expect(user.name).toBe('John');
});
it('should handle async errors', async () => {
await expect(fetchUser(-1)).rejects.toThrow('Invalid ID');
});
it('should resolve multiple promises', async () => {
const [users, posts] = await Promise.all([
fetchUsers(),
fetchPosts(),
]);
expect(users).toHaveLength(10);
expect(posts).toHaveLength(5);
});
});Jest - Timers and Timeouts
describe('timer operations', () => {
beforeEach(() => {
jest.useFakeTimers();
});
afterEach(() => {
jest.useRealTimers();
});
it('should debounce function calls', () => {
const callback = jest.fn();
const debounced = debounce(callback, 500);
debounced();
debounced();
debounced();
expect(callback).not.toHaveBeenCalled();
jest.advanceTimersByTime(500);
expect(callback).toHaveBeenCalledTimes(1);
});
it('should timeout long operations', async () => {
const slowOperation = () => new Promise(r => setTimeout(r, 10000));
await expect(
Promise.race([
slowOperation(),
new Promise((_, reject) =>
setTimeout(() => reject(new Error('Timeout')), 1000)
),
])
).rejects.toThrow('Timeout');
});
});React Testing Library - waitFor
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
describe('async component behavior', () => {
it('should show loading then data', async () => {
render(<UserProfile userId={1} />);
// Initially shows loading
expect(screen.getByText('Loading...')).toBeInTheDocument();
// Wait for data to appear
await waitFor(() => {
expect(screen.getByText('John Doe')).toBeInTheDocument();
});
// Loading should be gone
expect(screen.queryByText('Loading...')).not.toBeInTheDocument();
});
it('should handle user interactions', async () => {
const user = userEvent.setup();
render(<SearchForm />);
await user.type(screen.getByRole('textbox'), 'search term');
await user.click(screen.getByRole('button', { name: 'Search' }));
await waitFor(() => {
expect(screen.getByText('Results:')).toBeInTheDocument();
}, { timeout: 3000 }); // Custom timeout
});
});Pytest - Async Tests
import pytest
import asyncio
@pytest.mark.asyncio
async def test_async_fetch():
result = await fetch_data()
assert result is not None
@pytest.mark.asyncio
async def test_concurrent_operations():
results = await asyncio.gather(
fetch_users(),
fetch_posts(),
)
assert len(results) == 2
@pytest.mark.asyncio
async def test_async_timeout():
with pytest.raises(asyncio.TimeoutError):
await asyncio.wait_for(slow_operation(), timeout=1.0)
# Async fixtures
@pytest.fixture
async def async_client():
client = await create_async_client()
yield client
await client.close()Running Tests
Before committing:
# JavaScript/TypeScript
npm run test
# Python
pytest -qGeneration Process
When generating tests:
- Analyze the code to understand functionality
- Identify edge cases and potential failure points
- Create test structure with descriptive names
- Write positive tests (happy path)
- Write negative tests (error cases)
- Add parameterized tests for multiple inputs
- Include setup/teardown if needed
Always explain what each test validates and why it's important.
Version
- v1.1.0 (2025-12-05): Enriched trigger keywords in description
- v1.0.0 (2025-11-15): Initial version
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
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.

