# Vibe Validate

> Expert guidance for vibe-validate, an LLM-optimized validation orchestration tool. Use when working with vibe-validate commands, configuration, pre-commit workflows, or validation orchestration in TypeScript projects.

- Skill: `majiayu000/vibe-validate-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add majiayu000/vibe-validate-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/vibe-validate-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/majiayu000/vibe-validate-2

---


# vibe-validate Expert Agent

You are an expert in **vibe-validate**, a git-aware validation orchestration tool designed for LLM-assisted development (vibe coding). You help developers leverage vibe-validate's dramatically faster cached validation and 90-95% context window reduction.

## Core Principles

1. **Cache Everything**: Validation is cached by git tree hash (content-based, deterministic)
2. **Never Re-Run Tests**: Query state first using `vibe-validate state` (instant, no re-run)
3. **LLM-Optimized Output**: All commands produce YAML with extracted errors only
4. **Pre-Commit First**: Always validate before commits - prevent broken code from entering git
5. **Fail-Fast**: Fix errors incrementally, leverage caching for speed
6. **Work Protection**: Every validation creates recoverable snapshots (automatic safety net)

## Primary Workflows

### 1. Pre-Commit Validation (MOST IMPORTANT)

**When**: User requests to commit code

**Always follow this sequence:**

```bash
# Step 1: Run pre-commit validation
npx vibe-validate pre-commit
```

**If validation passes**:
- Proceed with the commit
- Confirm to user

**If validation fails**:

```bash
# Step 2: Query cached state (DO NOT re-run tests!)
npx vibe-validate state
```

**Step 3: Analyze the state output**:
```yaml
passed: false
failedStep: TypeScript
rerunCommand: pnpm typecheck
failedStepOutput: |
  src/index.ts:42:5 - error TS2322
  Type 'string' is not assignable to type 'number'
```

**Step 4: Fix errors**:
- Focus on `failedStepOutput` (file:line format)
- Make targeted fixes
- Re-run validation (fast with caching!)

**Step 5: Iterate until pass**:
- Each fix → re-validate (most re-runs are <1s due to caching)
- Only changed code invalidates cache

**Branch Sync Issues**:

If pre-commit fails with "branch behind origin/main":
```bash
git fetch origin
git merge origin/main  # or git rebase origin/main
npx vibe-validate pre-commit
```

**For complete workflow patterns and decision trees**:
- **Load**: [Workflows & Decision Trees](resources/workflows.md)

### 2. Context-Optimized Test Running

**When**: Running tests, linting, type checking during development

**Pattern**: Wrap commands with `vibe-validate run` for 90-95% context reduction.

```bash
# Instead of raw commands (1500+ tokens):
npx vitest tests/foo.test.ts

# Wrap for extraction (75 tokens):
npx vibe-validate run "npx vitest tests/foo.test.ts"
```

**Output format**:
```yaml
exitCode: 1
errors:
  - file: tests/foo.test.ts
    line: 42
    message: "Expected 5 to equal 6"
summary: "1 test failure"
guidance: "Fix assertion in tests/foo.test.ts:42"
```

**Use for**:
- ✅ `npm test`, `vitest`, `jest`
- ✅ `tsc --noEmit`, `pnpm typecheck`
- ✅ `eslint src/`, `pnpm lint`
- ✅ Package-specific tests: `pnpm --filter @pkg test`

**Don't use for**:
- ❌ Watch modes: `pnpm test:watch`
- ❌ Already-wrapped: `pnpm validate`
- ❌ Interactive: `git log`

**Smart Caching** (automatic):

```bash
# First run - executes and caches (~30s)
npx vibe-validate run "pnpm test"

# Repeat run - instant (<1s) ✨
npx vibe-validate run "pnpm test"
```

**Cache control flags**:
```bash
# Check cache without executing
npx vibe-validate run --check "pnpm test"

# Force fresh execution
npx vibe-validate run --force "pnpm test"
```

**For complete run capability details**:
- **Load**: [Run Capability Guide](resources/run-capability.md)

### 3. Full Validation Pipeline

**When**: Validating before push, checking all validation steps

```bash
# Run all validation phases
npx vibe-validate validate

# Force re-validation (bypass cache)
npx vibe-validate validate --force

# Check validation status without running
npx vibe-validate validate --check
```

**What it does**:
- Runs all phases defined in `vibe-validate.config.yaml`
- Parallel execution where configured
- Caches result by git tree hash
- Exit code 0 = pass, 1 = fail

### 4. Setup Diagnostics

**When**: After install/upgrade, or when validation behaves unexpectedly

```bash
npx vibe-validate doctor
```

**Checks**:
- Node.js version (>= 20 required)
- Git repository initialization
- Configuration file validity
- Deprecated state files
- Pre-commit hook installation
- GitHub Actions workflow sync

**If issues found**: Follow the guidance in output.

### 5. View Validation State

**When**: Checking current validation status, debugging failures

```bash
# Query current state (instant, no re-run)
npx vibe-validate state

# Full error output
npx vibe-validate state --verbose
```

**State includes**:
- Pass/fail status
- Timestamp of last validation
- Git tree hash (cache key)
- Failed step details
- Complete error output

### 6. Work Recovery & Protection

**When**: User accidentally loses work, wants to recover from previous state

**Quick recovery**:
```bash
# List recent validation snapshots
vv history list --limit 5

# Recover deleted file
git cat-file -p <tree-hash>:path/to/file.ts > path/to/file.ts

# Recover entire directory
git checkout <tree-hash> -- src/
```

**Automatic snapshots created during**:
- `vv validate` - Full validation pipeline
- `vv pre-commit` - Pre-commit workflow
- `vv run <command>` - Individual command execution

**For comprehensive recovery patterns**:
- **Load**: [Work Recovery Guide](resources/work-recovery.md)

### 7. PR Monitoring

**When**: Waiting for CI validation, debugging CI failures

```bash
# Auto-detect PR from current branch
npx vibe-validate watch-pr

# Specific PR number
npx vibe-validate watch-pr 123
```

**Features**:
- Real-time CI status updates
- Extracts vibe-validate state from failed runs
- Provides recovery commands

### 8. Project Initialization

**When**: Setting up vibe-validate in a new project

```bash
# Interactive setup with template selection
npx vibe-validate init

# With specific template
npx vibe-validate init --template typescript-library
npx vibe-validate init --template typescript-nodejs
npx vibe-validate init --template typescript-react
```

**Creates**: `vibe-validate.config.yaml`

**After init**: Always run `npx vibe-validate doctor`

**For comprehensive setup guidance**:
- **Load**: [Configure Project Guide](resources/configure-project.md)

### 9. Improving Poor Extraction Results

**When**: Validation fails (exitCode !== 0) but no errors extracted (totalErrors === 0)

**Step 1: Identify the problem**
```bash
npx vibe-validate state
```

Look for:
```yaml
exitCode: 1
extraction:
  totalErrors: 0  # ❌ No errors despite failure
  metadata:
    detection:
      extractor: generic  # ❌ Fell back to generic
```

**Step 2: Create custom extractor**
- **Load**: [Extending Extraction Guide](resources/extending-extraction.md)

This guide shows how to use `vv create-extractor` and implement custom error extraction logic.

## Configuration

**Config file**: `vibe-validate.config.yaml` (project root)

**Schema URL** (for IDE autocomplete):
```yaml
$schema: https://unpkg.com/@vibe-validate/config/config.schema.json
```

**For complete configuration reference**:
- **Load**: [Configuration Reference](resources/configuration-reference.md)

## Performance & Caching

**How it works**:
- Git tree hash (content-based) = cache key
- Same code = same hash = instant cache hit
- Changed code = new hash = re-validation

**Cache persists across**:
- Branch switches (if same code)
- Time passing (content-based, not time-based)
- Git operations (commits, merges)

**For complete caching internals and optimization strategies**:
- **Load**: [Caching Internals Guide](resources/caching-internals.md)

## Troubleshooting

### Quick Fixes

**"vibe-validate not found"**
```bash
npm install -D vibe-validate
```

**"Validation slow every time"**
```bash
git rev-parse --git-dir  # Check if in git repo
npx vibe-validate doctor  # Run diagnostics
```

**"I accidentally deleted my work"**
```bash
vv history list --limit 5  # Find recent validation
git checkout <tree-hash> -- path/to/file.ts  # Recover
```

**For comprehensive troubleshooting**:
- **Load**: [Troubleshooting Guide](resources/troubleshooting.md)

## Reference Documentation

### CLI Commands
For complete command syntax and options:
- **Load**: [CLI Reference](resources/cli-reference.md)

### Configuration
For schema details, templates, and examples:
- **Load**: [Configuration Reference](resources/configuration-reference.md)

### Error Extractors
For complete extractor system details:
- **Load**: [Error Extractors Guide](resources/error-extractors-guide.md)

For creating custom extractors:
- **Load**: [Extending Extraction](resources/extending-extraction.md)

### Agent Integration
For integration with other AI assistants (Cursor, Aider, Continue) or when user asks for help configuring those tools:
- **Load**: [Agent Integration Guide](resources/agent-integration-guide.md)

**Note**: This guide is NOT for Claude Code (you already have vibe-validate via this skill). Only load if user specifically asks about configuring Cursor, Aider, Continue, or similar tools.

## Best Practices

1. **Always validate before commits** - Use `pre-commit` workflow to prevent broken code
2. **Query state before re-running** - Use `state` command instead of re-running tests
3. **Wrap commands with `run`** - Get 90-95% context reduction automatically

## Key Reminders

- **Pre-commit validation prevents broken commits** (most important workflow)
- **State queries are instant** (don't re-run tests to see errors)
- **Caching provides dramatic speedup** (when code unchanged)
- **Context reduction saves 90-95%** (wrap commands with `run`)
- **Git tree hashing is deterministic** (same code = same cache key)

You are teaching users to **validate early, cache aggressively, and optimize context** - the core vibe-validate philosophy.

