Unit test writer
Skill AtulPurohit/Antigravity-Awesome-Skills/plugins/dx-qa-automation/skills/unit-test-writer
Installable GitHub library of 300+ professional agentic skills for Claude Code, Antigravity IDE, Gemini CLI, Cursor, and Copilot. Features a custom NPX installer, 9 stack-specific bundles, validation schemas, security auditing, and an interactive catalog explorer app.
npx -y skills add AtulPurohit/Antigravity-Awesome-Skills --skill unit-test-writerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
3 things to look at
- 26 days oldThe repository was created 26 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Write comprehensive unit tests that verify behavior, catch regressions, and document intent. Covers test organization, assertions, mocking, and coverage.
SKILL.md
3.9 KB, as published. Nobody here has run it
Unit Test Writer
Purpose
Write unit tests that catch bugs early, document intended behavior, and give confidence to refactor.
Test Philosophy
- Test behavior, not implementation
- Each test should be: Fast, Independent, Repeatable, Self-validating
- Test the public interface, not internals
- One concept per test
Test Examples
JavaScript/TypeScript with Jest
describe('UserService', () => {
let service: UserService;
let mockRepo: jest.Mocked<UserRepository>;
let mockEmail: jest.Mocked<EmailService>;
beforeEach(() => {
mockRepo = {
findByEmail: jest.fn(),
create: jest.fn(),
} as any;
mockEmail = { sendWelcome: jest.fn() } as any;
service = new UserService(mockRepo, mockEmail);
});
describe('register', () => {
it('creates a user with hashed password', async () => {
mockRepo.findByEmail.mockResolvedValue(null);
mockRepo.create.mockResolvedValue({ id: '1', email: '[email protected]' });
await service.register({ email: '[email protected]', password: 'Secret123!' });
expect(mockRepo.create).toHaveBeenCalledWith(
expect.objectContaining({
email: '[email protected]',
password: expect.not.stringContaining('Secret123!'), // Password hashed
})
);
});
it('sends welcome email after registration', async () => {
mockRepo.findByEmail.mockResolvedValue(null);
mockRepo.create.mockResolvedValue({ id: '1', email: '[email protected]' });
await service.register({ email: '[email protected]', password: 'Secret123!' });
expect(mockEmail.sendWelcome).toHaveBeenCalledWith('[email protected]');
});
it('throws ConflictError if email already exists', async () => {
mockRepo.findByEmail.mockResolvedValue({ id: '1', email: '[email protected]' });
await expect(
service.register({ email: '[email protected]', password: 'Secret123!' })
).rejects.toThrow(ConflictError);
expect(mockRepo.create).not.toHaveBeenCalled();
});
});
});
Python with pytest
import pytest
from unittest.mock import Mock, patch
@pytest.fixture
def user_service():
mock_repo = Mock()
mock_email = Mock()
return UserService(mock_repo, mock_email), mock_repo, mock_email
class TestUserService:
def test_register_creates_user(self, user_service):
service, mock_repo, _ = user_service
mock_repo.find_by_email.return_value = None
mock_repo.create.return_value = User(id="1", email="[email protected]")
service.register(email="[email protected]", password="Secret123!")
mock_repo.create.assert_called_once()
created_user = mock_repo.create.call_args[0][0]
assert created_user.password != "Secret123!" # Hashed
def test_register_raises_if_email_taken(self, user_service):
service, mock_repo, _ = user_service
mock_repo.find_by_email.return_value = User(id="1", email="[email protected]")
with pytest.raises(ConflictError):
service.register(email="[email protected]", password="Secret123!")
Test Organization
tests/
├── unit/
│ ├── services/
│ ├── models/
│ └── utils/
├── integration/
│ └── api/
└── e2e/
Outputs
- Test suite for specified modules
- Test helpers and factories
- Mock configuration
- Coverage configuration
- CI integration for test runs