Skip to content
Back to skills

Cli Mock Stdin

ASecurity

Create mock stdin utilities for interactive CLI testing.

  • 1,760 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 2, 2026
ai-agentstypescriptbashtestingbackend

Works with

  • cli
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 2, 2026

npx -y skills add a5c-ai/babysitter --skill cli-mock-stdin --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cli Mock Stdin?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cli Mock Stdin
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/a5c-ai-cli-mock-stdin-babysitter/badge)](https://www.skillsdirectory.com/skills/a5c-ai-cli-mock-stdin-babysitter)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cli-mock-stdin
description: Create mock stdin utilities for interactive CLI testing.
allowed-tools: Read, Write, Edit, Bash, Glob, Grep
graph:
  domains: [domain:software-engineering]
  specializations: [specialization:cli-mcp-development]
  skillAreas: [skill-area:cli-design, skill-area:e2e-testing]
  roles: [role:backend-engineer, role:platform-engineer]
  workflows: [workflow:feature-development]
  topics: [topic:developer-experience]

---

# CLI Mock Stdin

Create mock stdin utilities for testing.

## Generated Patterns

```typescript
import { Readable } from 'stream';

export function mockStdin(inputs: string[]): Readable {
  let index = 0;
  return new Readable({
    read() {
      if (index < inputs.length) {
        setTimeout(() => {
          this.push(inputs[index++] + '\n');
        }, 10);
      } else {
        this.push(null);
      }
    },
  });
}

export async function runWithStdin(
  cmd: () => Promise<void>,
  inputs: string[]
): Promise<void> {
  const originalStdin = process.stdin;
  Object.defineProperty(process, 'stdin', { value: mockStdin(inputs) });
  try {
    await cmd();
  } finally {
    Object.defineProperty(process, 'stdin', { value: originalStdin });
  }
}
```

## Target Processes

- cli-unit-integration-testing
- interactive-prompt-system

Files in this skill

  • README.md155 B
  • SKILL.md1.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…