code-generate-tests
Generate tests for untested functions and edge cases, then verify they pass.
Process
-
Identify context:
- If code changes are involved: run
jj diff -sfirst to see changed files; then usejj diff -- pathto restrict to specific files/directories - If the user specified specific files or paths, focus on those
- Understand which functions/modules need test coverage
- If code changes are involved: run
-
Detect test framework:
- Invoke
code-analyze-projectskill to detect test framework and testing patterns - Check for existing test files and naming conventions
- Identify test helper functions and fixtures in use
- Invoke
-
Identify untested code paths:
- Use Grep to find functions without corresponding tests
- Check for edge cases, error paths, boundary conditions
- Identify critical paths that lack coverage
-
Research and analyze:
- Research testing best practices for the language/framework (use WebSearch/WebFetch)
- Identify critical paths, edge cases, and error handling scenarios
-
Generate test code:
- Match existing test conventions (naming, structure, fixtures)
- Cover happy path, edge cases, and error scenarios
- Include proper assertions and test organization
-
Run the generated tests:
- Invoke
testskill to run the new tests - Analyze any failures
- Invoke
-
Fix test failures:
- Identify root cause of failures
- Fix test code or generated code as appropriate
- Re-run tests to verify
Stop Condition
- If test generation or fixing fails twice, stop and ask for guidance.
Output
- Test Framework Detected
- Untested Functions/Paths Identified
- Generated Tests (with file locations and coverage summary)
- Test Results (from running tests)
- Failures Fixed (if any, with explanations)
- Verification - All new tests pass
More from sirn/dotfiles
code-explain
Explain code, triage changes, or map project structure. Use when user asks to explain, understand, triage, or explore project structure.
19code-plan
Generate comprehensive implementation plan based on analysis. Use when user asks to plan this, create a plan, how should I implement, or wants implementation guidance.
19code-commit
Commit current changes using jj. Analyzes changes, suggests commit messages following repository conventions, proposes splits if needed, and creates commits. Use ONLY when user explicitly asks to commit changes or create commits.
18gemini-reference
Reference for calling the Gemini CLI agent from other agents. ALWAYS read BEFORE invoking Gemini to ensure correct JSON protocol, session management, and subtask delegation patterns.
18code-quality
Run comprehensive quality checks by orchestrating review, verification, testing, and linting. Use when user asks to check code quality, run full checks, or verify code health.
18context7
Retrieve up-to-date documentation context for libraries using the Context7 API. Use when needing current library documentation (React, Python stdlib, Rust, etc.) BEFORE implementing or writing code.
17