generate-tests
Generate a complete test file for a specified source file or component. Use when the user explicitly asks to write, create, or generate tests for a specific file.
- 0
- Installs
- —
- Rating
- —
- Success rate
- 1
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 820d581462831a08… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
generate-tests.md
Generate Tests
Generate comprehensive test suite for: $ARGUMENTS
Current Testing Setup
- Test framework: !
cat package.json 2>/dev/null | grep -E '"jest"|"vitest"|"mocha"|"jasmine"' | head -3 || cat jest.config.* vitest.config.* 2>/dev/null | head -5 || echo "Framework not detected" - Existing tests: !
find . -name "*.test.*" -o -name "*.spec.*" | head -5 - Test coverage: !
npm run test:coverage 2>/dev/null || echo "No coverage script" - Target: if $ARGUMENTS is a file path, read it with @$ARGUMENTS; if it is a component name, search for it with Grep before writing tests
Test Generation Framework
- Analyze the target file/component structure — identify all exported functions, classes, methods, and their signatures
- Strategy — examine existing test patterns in the project; choose unit vs integration scope; identify critical paths and error scenarios
- Mock Design — map all external dependencies (I/O, APIs, timers, dates); create factories for test data; plan cleanup for async operations
- Unit Tests — write isolated tests per function/method covering happy path, edge cases, and error conditions; follow AAA pattern (Arrange, Act, Assert)
- Integration Tests — test component interactions, API layers with mocked responses, and end-to-end user workflows where applicable
- Quality Check — verify naming describes behavior not implementation; confirm 80%+ coverage on critical business logic; ensure test isolation
Framework-Specific Guidance
- React: Component testing with React Testing Library; test user interactions and rendering
- Vue: Component testing with Vue Test Utils; test props, events, and slots
- Angular: Component and service testing with TestBed; test dependency injection
- Node.js: API endpoint and middleware testing; test request/response cycles
- Python:
pytestwith fixtures,unittest.mockfor patching,pytest-covfor coverage - Go: Table-driven tests in
_test.gofiles,testify/assertfor assertions, subtests viat.Run() - Rust:
#[cfg(test)]modules,#[test]attributes,mockallfor mocking
Best Practices
- Follow AAA pattern (Arrange, Act, Assert)
- 80%+ coverage; prioritize critical business logic and error paths
- Mock external I/O; use factories for test data
- Naming: describe what the function does, not implementation details
Files
1- generate-tests.md
207c1854882.6 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from davila7/claude-code-templates8
Execute GitHub Actions locally using act
Implement secure user authentication system with chosen method and security best practices
Generate and maintain project changelog with Keep a Changelog format
Setup comprehensive mutation testing with framework selection and CI integration
Add and configure new package to workspace with proper structure and dependencies
Setup comprehensive application performance monitoring with metrics, alerting, and observability
Implement property-based testing with framework selection and invariant identification
Add entry to project changelog following Keep a Changelog format
Related frontend skillsscan passed
Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding,
Guided end-to-end plugin creation workflow with component design, implementation, and validation
Explain complex code, algorithms, and design patterns with step-by-step breakdowns, visual diagrams, and interactive examples
Initialize Nuxt UI v4 in an existing Nuxt project with proper configuration