workflows.fit
Back to exploration
MediumContributed by Community

Parallel Test Refactoring and Visualizer

Fans out subagents to migrate legacy Jest tests to Vitest in parallel, verifying syntax correctness and running tests at each phase.

RefactoringTestingVitest
128 stars890 pulls

Orchestration Logic

Workflow Graph Visualizer
Generating visual workflow graph...

How to Use Today

1.Install vitest in your project if the migration needs it: pnpm add -D vitest
2.Ask Claude Code to create and run a workflow for this scoped refactor, then review the raw script before approving it.
3.After a successful run, open /workflows, select the run, save it into .claude/workflows/, and reuse it later as /parallel-test-refactoring.

Workflow Script Code

.claude/workflows/parallel-test-refactoring.js
// .claude/workflows/parallel-test-refactoring.js
import { orchestrator, agent } from 'claude';

export async function run(context) {
  // Step 1: Scan codebase for test files
  const files = await context.glob('**/*.test.js');
  console.log(`Found ${files.length} test files to convert.`);
  
  // Step 2: Fan out agents to convert in parallel
  const phases = files.map(file => async () => {
    const subagent = await agent.create({
      instructions: `Convert ${file} from Jest to Vitest. Maintain all logic.`
    });
    await subagent.run();
  });
  
  // Run in parallel with a max concurrency of 5
  await orchestrator.parallel(phases, 5);
  
  // Step 3: Adversarial verify
  const testVerifier = await agent.create({
    instructions: 'Run `pnpm test` and verify that all converted tests pass successfully.'
  });
  await testVerifier.run();
}

Saved Slash Command

Claude Code currently runs workflows from the interactive session. After a run is saved from /workflows, invoke it as a slash command.

$/parallel-test-refactoring
There is no current `claude workflow run` CLI command.

Specifications

Concurrency MaxRuntime bounded
Verification LoopsAdversarial Checks
Platform SupportClaude Code surfaces

Review Before Running

Treat community workflows as patterns. Review the raw script, planned phases, and allowed tools before approving a run in your own project.