Skip to content
Development
Command

/testgen

Generate tests for a file or module using coverage analysis and TDD patterns

From plugin
ruvnet-claude-flow
72k196 skills160 agents196 commands1 MCP
Install
> /plugin marketplace add ruvnet/claude-flow

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/testgen

Context preview

What this command does when you run it.

Generate tests for a file or module using coverage analysis and TDD patterns

Command definition

testgen.md
name: testgen
description: Generate tests for a file or module using coverage analysis and TDD patterns

$ARGUMENTS

Generate tests by analyzing coverage gaps and applying TDD London School patterns.

1. **Analyze gaps**: `npx @claude-flow/cli@latest hooks coverage-gaps --format table` 2. **Route for coverage**: `npx @claude-flow/cli@latest hooks coverage-route --task "$ARGUMENTS"` 3. **Suggest tests**: `npx @claude-flow/cli@latest hooks coverage-suggest --path "$ARGUMENTS"`

Parse $ARGUMENTS as a file path or module name. Generate tests following these conventions:

  • Place tests adjacent to source: `src/foo.ts` -> `src/foo.test.ts`
  • Use `describe`/`it` blocks with descriptive names
  • Mock external dependencies
  • Cover happy path, edge cases, and error paths

If no arguments, run coverage-gaps to show what needs tests.

Ships withruvnet-claude-flow

An agent meta-harness for Claude Code and Codex. 📖 RuFlo Explained — Build an AI Team That Plans, Remembers, Tests, and Improves A 14-chapter guide: from the basic idea to a first useful task, then memory, agent teams, plugins, cost and verification.

Get the whole plugin

Other commands on ruvnet-claude-flow.