Generate comprehensive test cases for functions, components, or modules. Creates unit tests following testing best practices.
Commands are custom slash commands that extend Claude Code's functionality. They're markdown files in .claude/commands/ that define reusable prompts or workflows. Invoke them with /command-name in Claude Code. Commands can accept arguments and automate complex multi-step tasks.
Save as `.claude/commands/test.md` and use `/test <file>`
Generate comprehensive tests for the specified code:
## Test Structure
### Unit Tests
```typescript
describe("FunctionName", () => {
describe("happy path", () => {
it("should return expected result for valid input", () => {
// Arrange
const input = validInput;
// Act
const result = functionName(input);
// Assert
expect(result).toBe(expectedOutput);
});
});
describe("edge cases", () => {
it("should handle empty input", () => { ... });
it("should handle null/undefined", () => { ... });
it("should handle boundary values", () => { ... });
});
describe("error handling", () => {
it("should throw on invalid input", () => {
expect(() => functionName(invalidInput)).toThrow();
});
});
});
```
### Component Tests
- Test rendering
- Test user interactions
- Test prop changes
- Test accessibility
### Integration Tests
- Test with real dependencies
- Test API calls
- Test state changes
## Coverage Goals
- Statements: 80%+
- Branches: 80%+
- Functions: 90%+Generate comprehensive documentation for code, APIs, or components. Creates markdown docs following best practices.
Generate conventional commit messages following the project style. Analyzes staged changes and creates properly formatted commits.
Create and execute a phases-based plan for complex tasks. Divides work into structured phases with individual step tracking.