plugins/v1tamins/skills/v1-write-tests/SKILL.md
Use when writing unit tests for code changes or new functionality. Triggers on "write tests", "add tests", "test this code".
npx skillsauth add v1-io/v1tamins v1-write-testsInstall 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.
Create comprehensive unit tests with proper imports and setup according to project testing conventions.
Typical invocations:
/v1-write-tests [target]v1-write-tests from the skills menu or use $v1-write-tests [target]Target (optional):
Examples:
/v1-write-tests # Test all changes vs main
/v1-write-tests src/core/query.py # Test specific file
In Codex, the slash examples below map directly to $v1-write-tests ....
Backend (pytest):
tests/unit/ or tests/integration/ (follow project conventions)conftest.pyFrontend (Jest/Vitest):
__tests__/ mirroring src/ structure__mocks__/testUtils.tsStyle:
1. NEVER test mock behavior
2. NEVER add test-only methods to production classes
3. NEVER mock without understanding dependencies
Bad:
// Testing that mock exists, not real behavior
test('renders sidebar', () => {
render(<Page />);
expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument();
});
Fix: Test real component or don't mock it. If you must mock, don't assert on mock elements.
Bad: Adding destroy() to a class only because tests need cleanup.
// BAD: destroy() only used in tests
class Session {
async destroy() { /* cleanup */ }
}
// In tests
afterEach(() => session.destroy());
Fix: Put cleanup utilities in test-utils/, not production code.
// GOOD: Test utility
// test-utils/cleanup.ts
export async function cleanupSession(session: Session) {
const workspace = session.getWorkspaceInfo();
if (workspace) await workspaceManager.destroyWorkspace(workspace.id);
}
// In tests
afterEach(() => cleanupSession(session));
Bad: Mocking "to be safe" without understanding what the test depends on.
// Mock breaks test logic - method had side effects test needed!
vi.mock('ToolCatalog', () => ({
discoverAndCacheTools: vi.fn().mockResolvedValue(undefined)
}));
await addServer(config);
await addServer(config); // Should throw - but won't!
Fix: Run test with real implementation first, then add minimal mocking.
Bad: Mocking only fields you think you need.
const mockResponse = {
status: 'success',
data: { userId: '123' }
// Missing: metadata that downstream code uses
};
Fix: Mirror the complete real API response structure.
*-mock test IDsBefore each mock, ask: "Do I understand what this test actually needs?"
| Question | If No... | |----------|----------| | What side effects does the real method have? | Don't mock yet | | Does this test depend on any of those side effects? | Mock at lower level | | Do I fully understand what this test needs? | Run with real impl first |
pytest for backend, npm test for frontendtools
Use when planning or synthesizing user tests for prototypes, mockups, clickable demos, product concepts, design flows, landing pages, or early product specs. Triggers on "test this prototype", "prototype testing", "user test plan", "validate this product idea", "test with users".
development
Use when creating a polished self-contained HTML page would help the user understand, compare, review, present, tune, or interact with information better than Markdown. Triggers on "make an HTML page", "HTML artifact", "nice HTML", "visual report", "interactive explainer", "one-page dashboard", "shareable page".
data-ai
Use when turning a textbook, PDF, blog post, article, paper, course, notes, transcript, or other source material into suggested agent skills or skill improvements. Triggers on "what skills could come from this", "extract skills from", "turn this into skills", "skill ideas from this source".
development
Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for large prs, new features/architectures, a deep code quality audit, or especially harsh maintainability review.