# Librepl

> librepl - Interactive REPL utilities. Repl class creates command-line interfaces with custom commands, state persistence, and terminal formatting. Supports dependency injection for testability. Use for building CLI tools, interactive debugging interfaces, and developer utilities.

- Skill: `aibot88/librepl` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add aibot88/librepl`
- Raw SKILL.md: https://api.skillmd.com/api/skills/aibot88/librepl/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: aibot88 (https://skillmd.com/u/aibot88)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/aibot88/librepl

---


# librepl Skill

## When to Use

- Building interactive CLI tools
- Creating debug and exploration interfaces
- Adding REPL functionality to applications
- Prototyping with persistent state

## Key Concepts

**Repl**: Interactive command-line interface with custom commands, history, and
state management.

## Usage Patterns

### Pattern 1: Create custom REPL

```javascript
import { Repl } from "@copilot-ld/librepl";

const repl = new Repl({
  prompt: "agent> ",
  commands: {
    search: async (query) => {
      const results = await searchIndex(query);
      return JSON.stringify(results, null, 2);
    },
    help: () => "Commands: search <query>, help, exit",
  },
});

await repl.start();
```

### Pattern 2: State persistence

```javascript
const repl = new Repl({
  prompt: "> ",
  storage: storage,
  stateKey: "repl-state",
});
// State persists across sessions
```

## Integration

Used by CLI tools like cli-chat and cli-search. Integrates with libformat for
terminal output.

