add-tests
The add-tests command automatically generates comprehensive test suites for specified source files or recently modified code lacking coverage. Use this when onboarding new code to a project, after refactoring existing functions, or to improve test coverage on files that changed in recent commits. The command detects the project's test framework, analyzes code behavior and edge cases, and creates tests following existing project conventions.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/CloudAI-X/claude-workflow-v2/HEAD/commands/add-tests.md -o ~/.claude/commands/add-tests.mdadd-tests.md
## Context - Recently modified files: !`git diff --name-only HEAD~3 2>/dev/null | grep -E '\.(ts|tsx|js|jsx|py|go|rs)$' | head -10 || echo "No recent changes"` - Test framework detection: !`cat package.json 2>/dev/null | grep -E '"(jest|vitest|mocha)"' | head -1 || ls pytest.ini pyproject.toml 2>/dev/null | head -1 || echo "Unknown test framework"` - Existing test files: !`find . -name "*test*" -o -name "*spec*" 2>/dev/null | grep -E '\.(ts|tsx|js|jsx|py|go)$' | head -10 || echo "No test files found"` - Test directory structure: !`ls -la tests/ test/ __tests__/ spec/ 2>/dev/null | head -20 || echo "No standard test directory"` ## Task Add tests for the specified target: 1. Identify the file/function to test 2. Find the corresponding test file (or create one following project conventions) 3. Analyze the code to understand: - Input/output behavior - Edge cases - Error conditions 4. Write comprehensive tests covering: - Happy path - Edge cases - Error handling 5. Run the tests to verify they pass Target: $ARGUMENTS If no target specified, focus on recently modified files that lack test coverage.
Analyzes codebases to understand structure, tech stack, patterns, and conventions. Use when onboarding to a new project, exploring unfamiliar code, or when asked "how does this work?" or "what's the architecture?
System design and architecture planning mode. Focuses on high-level design, trade-offs, and technical decisions before implementation.
Explore the repository with 10 parallel subagents to create comprehensive documentation. Creates CODEBASE.md with full architecture analysis.
Expert code review specialist. Use PROACTIVELY after writing or modifying code, before commits, when asked to review changes, PR review, code quality check, lint, or standards audit. Focuses on quality, security, performance, and maintainability.
Simplifies code after implementation. Reviews recent changes and suggests/applies simplifications while preserving behavior.
Create a conventional commit with auto-generated message
Commit staged changes, push to remote, and create a pull request
Convex backend development guidelines. Use when writing Convex functions, schemas, queries, mutations, actions, or any backend code in a Convex project. Triggers on tasks involving Convex database operations, real-time subscriptions, file storage, or serverless functions.