assets/bundled_skills/test-helper/SKILL.md
Generate comprehensive test cases following TDD principles
npx skillsauth add 2233admin/cicada test-helperInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate high-quality test cases following Test-Driven Development (TDD) principles and best practices.
Always write tests BEFORE implementation:
Test individual functions/methods in isolation.
describe('retryOperation', () => {
it('should retry failed operations up to 3 times', async () => {
let attempts = 0;
const operation = () => {
attempts++;
if (attempts < 3) throw new Error('fail');
return 'success';
};
const result = await retryOperation(operation);
expect(result).toBe('success');
expect(attempts).toBe(3);
});
it('should throw error after max retries exceeded', async () => {
const operation = () => {
throw new Error('persistent failure');
};
await expect(retryOperation(operation)).rejects.toThrow('persistent failure');
});
it('should return immediately on first success', async () => {
let attempts = 0;
const operation = () => {
attempts++;
return 'success';
};
await retryOperation(operation);
expect(attempts).toBe(1);
});
});
Test interactions between components.
describe('UserService', () => {
let db: Database;
let userService: UserService;
beforeEach(async () => {
db = await createTestDatabase();
userService = new UserService(db);
});
afterEach(async () => {
await db.close();
});
it('should create user and store in database', async () => {
const userData = {
email: '[email protected]',
name: 'Test User'
};
const user = await userService.createUser(userData);
expect(user.id).toBeDefined();
expect(user.email).toBe(userData.email);
const stored = await db.users.findById(user.id);
expect(stored).toEqual(user);
});
});
Test complete user workflows.
describe('User Registration Flow', () => {
it('should allow new user to register and login', async () => {
// Register
const response = await request(app)
.post('/api/register')
.send({
email: '[email protected]',
password: 'SecurePass123!',
name: 'New User'
});
expect(response.status).toBe(201);
expect(response.body.success).toBe(true);
// Login
const loginResponse = await request(app)
.post('/api/login')
.send({
email: '[email protected]',
password: 'SecurePass123!'
});
expect(loginResponse.status).toBe(200);
expect(loginResponse.body.token).toBeDefined();
});
});
it('should do something specific', () => {
// Arrange - Set up test data and conditions
const input = 'test data';
const expected = 'expected result';
// Act - Execute the code under test
const result = functionUnderTest(input);
// Assert - Verify the result
expect(result).toBe(expected);
});
Good Names:
should return user when valid ID providedshould throw error when email already existsshould retry 3 times before failingBad Names:
test1it worksuser test// Good: Mock external API
const mockFetch = jest.fn().mockResolvedValue({
json: () => Promise.resolve({ data: 'test' })
});
// Bad: Over-mocking internal logic
const mockAdd = jest.fn((a, b) => a + b); // Just test the real function!
development
Identify code smells and suggest refactoring improvements
tools
Internationalization and localization assistance for multi-language applications
tools
Generate clear, conventional commit messages and manage Git workflows
development
Generate comprehensive documentation for code, APIs, and projects