CLI Snapshot Tester

SkillDev tools

Set up snapshot testing for CLI output with update workflows and diff reporting.

Instructions available. Your AI can read the instructions. Execution depends on the setup they require.

Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.

Then ask your AI: use the CLI Snapshot Tester skill

What this skill tells your AI

The instructions your AI receives, as published by a5c-ai/babysitter in library/specializations/cli-mcp-development/skills/cli-snapshot-tester/SKILL.md and read by ahel’s review.

Set up snapshot testing for CLI output.

Generated Patterns

import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';

export function runCliSnapshot(cmd: string, name: string): void {
  const output = execSync(cmd, { encoding: 'utf-8' });
  const snapshotPath = path.join('__snapshots__', `${name}.txt`);

  if (process.env.UPDATE_SNAPSHOTS) {
    fs.mkdirSync(path.dirname(snapshotPath), { recursive: true });
    fs.writeFileSync(snapshotPath, output);
    return;
  }

  const expected = fs.readFileSync(snapshotPath, 'utf-8');
  expect(output).toBe(expected);
}

Target Processes

  • cli-unit-integration-testing
  • cli-documentation-generation

Signals

GitHub stars
2k
Forks
112
Last commit
Sep 2026
Advanced
Item type
skill
Key
cli-snapshot-tester
Source
github.com/a5c-ai/babysitter