# How to Use the /no-mistakes Skill with Claude Code for Agent-Driven Pipelines

> Learn to use the /no-mistakes skill with Claude Code to build agent-driven pipelines. Drive lint, test, and push workflows with structured outputs from real-time events.

- Repository: [Kun Chen/no-mistakes](https://github.com/kunchenguid/no-mistakes)
- Tags: how-to-guide
- Published: 2026-07-03

---

**The /no-mistakes skill integrates Claude Code into end-to-end pipelines by running the Anthropic Claude CLI in stream-JSON mode, parsing real-time events, and returning structured outputs that drive automated lint, test, and push workflows.**

The `kunchenguid/no-mistakes` repository provides a Go-based CLI that orchestrates complete software development pipelines through LLM agents. When you invoke the **/no-mistakes** skill with the **Claude Code** agent, you delegate complex refactoring, testing, and validation tasks to Anthropic's Claude CLI while maintaining strict JSON-schema contracts for machine-readable outputs.

## Architecture of the Claude Code Integration

### Skill Definition and CLI Driver

The pipeline starts with a static skill definition in [`skills/no-mistakes/SKILL.md`](https://github.com/kunchenguid/no-mistakes/blob/main/skills/no-mistakes/SKILL.md), which describes the command surface that agents see. This file is generated from [`internal/skill/skill.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/skill/skill.go). The **axi** interactive shell serves as the CLI driver, parsing user input and resolving skills through [`internal/cli/axi_drive.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/cli/axi_drive.go).

### The Agent Interface

All agents implement the `agent.Agent` interface defined in [`internal/agent/agent.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/agent/agent.go), which requires `Name`, `Run`, and `Close` methods. The driver calls `Run(ctx, opts)` and streams chunk callbacks to the UI. The Claude-specific implementation lives in [`internal/agent/claude.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/agent/claude.go).

### Stream-JSON Event Parsing

The `claudeAgent` launches the Claude binary with flags `-p` and `--output-format stream-json`. The `parseClaudeEvents` function reads JSONL events from stderr, aggregates token usage, and captures the final `result` event containing structured output.

## How the Pipeline Flow Works

1. **User invokes the skill** via `no-mistakes axi drive --agent=claude` with a prompt and optional JSON schema.

2. **CLI builds `RunOpts`** containing the prompt, schema, working directory, and UI callback.

3. **`claudeAgent.runOnce`** creates an `exec.CommandContext` with `gitSafeEnv` and `shellenv.ConfigureShellCommand` for proper process cleanup.

4. **`parseClaudeEvents`** streams JSONL, forwards text chunks via `onChunk` callbacks, and aggregates `TokenUsage`.

5. **Result validation** occurs when the driver receives a `Result` struct with `Output`, `Text`, and `Usage` fields. If a schema was provided but `structured_output` is missing, the driver returns `errNoStructuredOutput`.

6. **Pipeline continues** to the next step (e.g., `git apply`, test run, or human review gate).

## Claude Code vs. Generic Chat Agents

Claude Code differs from standard chat agents because it emits a **stream-JSON** payload that the pipeline parses incrementally. This enables real-time assistant text display, accurate token usage telemetry, and enforcement of JSON-schema contracts for automated fix loops.

## Configuration and Customization

Repository-level settings live in [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml), which controls allowed agents, per-repo overrides, and default arguments via `agent_args_override`. The CLI merges global and repo-specific settings, passing extra arguments to the Claude binary.

## Practical Usage Examples

Run a simple fix with schema validation:

```bash
no-mistakes axi drive \
  --agent=claude \
  --prompt="Replace the deprecated `os.IsAbs` call with `filepath.IsAbs`" \
  --json-schema='{"type":"object","properties":{"patch":{"type":"string"}},"required":["patch"]}'

```

Use a repository-specific model override:

```bash
no-mistakes axi drive \
  --agent=claude \
  --prompt="Add unit tests for the `ParseConfig` function" \
  --extra-args="--model=claude-2.1"

```

Integrate into a CI pipeline programmatically:

```bash
go run ./cmd/no-mistakes axi drive \
  --agent=claude \
  --prompt="$(cat ./fix_prompt.txt)" \
  --json-schema="$(cat ./fix_schema.json)"

```

## Summary

- The `/no-mistakes` skill wraps Claude Code in a structured pipeline that automates lint, test, rebase, and push operations.
- Claude Code runs in **stream-JSON mode** (`--output-format stream-json`), enabling real-time event parsing and token usage tracking in [`internal/agent/claude.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/agent/claude.go).
- The `claudeAgent` implementation handles process lifecycle through `runOnce`, JSONL parsing via `parseClaudeEvents`, and structured output validation.
- Configuration via [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) allows per-repository agent selection and argument overrides through `agent_args_override`.
- JSON schemas enforce machine-readable contracts, critical for auto-fix loops that apply patches automatically without human intervention.

## Frequently Asked Questions

### What makes Claude Code different from other agents in no-mistakes?

Claude Code uses a **stream-JSON** output format that emits parseable JSONL events, allowing the pipeline to display real-time text chunks and accurately track token usage. Other agents may return plain text or lack the structured event streaming required for intermediate UI updates.

### How does the stream-JSON output format work?

The Claude CLI emits newline-delimited JSON events to stderr, including `assistant` chunks for streaming text and a final `result` event containing `structured_output`. The `parseClaudeEvents` function in [`internal/agent/claude.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/agent/claude.go) buffers this stream, aggregates token usage statistics, and extracts the final result for pipeline consumption.

### Where is the agent configuration stored?

Agent settings reside in [`.no-mistakes.yaml`](https://github.com/kunchenguid/no-mistakes/blob/main/.no-mistakes.yaml) at the repository root. This file defines allowed agents, default arguments, and overrides via the `agent_args_override` field. The CLI merges these settings with global configuration before launching the Claude binary.

### Can I use custom JSON schemas with the Claude Code agent?

Yes. Pass a JSON schema via the `--json-schema` flag when running `no-mistakes axi drive`. If provided, the Claude Code agent expects the `result` event to contain a `structured_output` field matching the schema. Missing structured output triggers `errNoStructuredOutput`, causing the pipeline step to fail.