# How to Set Up a Development Environment for no-mistakes

> Set up your no-mistakes development environment quickly. Clone the repo, install Go, run go mod tidy, and compile with make build for a flawless setup.

- Repository: [Kun Chen/no-mistakes](https://github.com/kunchenguid/no-mistakes)
- Tags: getting-started
- Published: 2026-07-11

---

**To set up a development environment for no-mistakes, clone the repository, ensure Go 1.22+ is installed, run `go mod tidy`, and use `make build` to compile the binary.**

no-mistakes is a Go-based CLI tool that intercepts Git push operations to run an AI-driven validation pipeline. The source code is organized under an `internal/` package hierarchy and uses a conventional `Makefile` for build automation.

## Prerequisites

Before compiling the project, verify your system meets the following requirements:

- **Go 1.22 or higher** – The project uses modern Go features and requires version 1.22 minimum.
- **Git** – Required for worktree manipulation and subcommand execution.
- **Make** – Used to invoke build targets defined in the repository root.

You can check your Go version with:

```bash
go version

```

## Repository Structure

Understanding the package layout helps navigate the codebase effectively. The project follows a standard Go structure with internal packages:

- **`internal/cli`** – Parses user commands and launches the TUI. Entry point is [`cmd/no-mistakes/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/no-mistakes/main.go).
- **`internal/daemon`** – Runs the long-lived daemon that owns the gate lock and manages worktrees. Core logic resides in [`internal/daemon/daemon.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/daemon/daemon.go).
- **`internal/pipeline`** – Implements the step-wise validation pipeline (review, test, docs, lint, push, PR). Orchestrated via [`internal/pipeline/executor.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/executor.go).
- **`internal/git`** – Thin wrapper around Git commands handling bare repositories and worktrees safely. Implementation is in [`internal/git/git.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/git/git.go).
- **`internal/shellenv`** – Spawns subprocesses with proper cancellation and cleanup. See [`internal/shellenv/shell_command.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/shellenv/shell_command.go).
- **`internal/config`** – Loads global and repository-specific configuration. Defined in [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go).
- **`internal/telemetry`** – Sends anonymized usage metrics while respecting privacy guarantees. Located in [`internal/telemetry/track.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/telemetry/track.go).
- **`cmd/genskill`** – Generates the `/no-mistakes` skill file used by AI agents. Source is in [`cmd/genskill/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/genskill/main.go).

## Build System Overview

The project uses a `Makefile` to coordinate compilation, testing, and code generation. Key targets include:

- **`make build`** – Compiles the binary to `bin/no-mistakes` with version information baked in.
- **`make test`** – Runs all unit tests with race detection enabled (`go test -race ./...`).
- **`make e2e`** – Executes the end-to-end suite (agents + pipeline) behind the `e2e` build tag.
- **`make lint`** – Verifies generated skill files are up-to-date and runs `go vet`.
- **`make fmt`** – Formats the entire source tree using `gofmt -w .`.
- **`make skill`** – Regenerates the Markdown skill file from the source constant after any skill body changes.

## Step-by-Step Setup

Follow these commands to build no-mistakes from source:

```bash

# Clone the repository

git clone https://github.com/kunchenguid/no-mistakes.git
cd no-mistakes

# Install dependencies

go mod tidy

# Build the binary

make build

```

This produces `bin/no-mistakes` in your working directory. Initialize the tool to create the gate directory in `~/.no-mistakes`:

```bash
./bin/no-mistakes init

```

## Development Workflow

After modifying code under `internal/`, follow this verification sequence:

1. **Run `make fmt`** – Ensures consistent formatting across all Go files.
2. **Run `make lint`** – Confirms generated skills are synchronized and code passes static analysis.
3. **Run `make test`** – Catches regressions with the unit test suite.
4. **Run `make e2e`** – Validates the complete push → pipeline → PR flow (requires network access for agent CLIs).

If you modify the AI skill definitions, regenerate the skill file:

```bash
make skill

```

## Key Source Files

- **[`README.md`](https://github.com/kunchenguid/no-mistakes/blob/main/README.md)** – High-level overview and quick-start instructions.
- **`Makefile`** – Build orchestration and release commands.
- **[`cmd/no-mistakes/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/no-mistakes/main.go)** – CLI entry point that delegates to `internal/cli`.
- **[`internal/daemon/daemon.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/daemon/daemon.go)** – Daemon lifecycle management and singleton lock implementation.
- **[`internal/pipeline/executor.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/executor.go)** – Pipeline step orchestration and validation gates.
- **[`internal/git/git.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/git/git.go)** – Safe Git operations for bare repositories and worktrees.
- **[`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go)** – Configuration loading and trusted repository handling.

## Summary

- **no-mistakes** requires Go 1.22+ and uses standard `make` targets for building.
- The codebase is organized under `internal/` with clear separation between CLI parsing, daemon lifecycle, and pipeline execution.
- Use `make build` to compile, `make test` for unit tests, and `make e2e` for full integration testing.
- Run `make skill` after editing AI skill constants to regenerate the Markdown skill file.
- The binary initializes its state in `~/.no-mistakes` when you run `./bin/no-mistakes init`.

## Frequently Asked Questions

### What Go version is required to build no-mistakes?

Go 1.22 or higher is recommended. The project uses modern language features and the `go.mod` file specifies a compatible version. Verify your installation with `go version` before running `make build`.

### How do I run the full test suite including AI agent integration?

Use `make e2e` to execute the end-to-end suite. This target requires the `e2e` build tag and network access to download agent CLIs. Unit tests alone can be run with `make test`, which executes `go test -race ./...` to detect race conditions.

### Why is there a `make skill` command and when should I use it?

The `cmd/genskill` tool generates the `/no-mistakes` Markdown skill file from a source constant. You must run `make skill` after editing the skill body in the Go source to keep the generated documentation synchronized. The `make lint` target will fail if the skill file is out of date.

### Where does no-mistakes store its configuration and worktrees?

The daemon creates a gate directory at `~/.no-mistakes` when you run `./bin/no-mistakes init`. This location stores the singleton lock, disposable worktrees, and cached configuration. The [`internal/daemon/daemon.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/daemon/daemon.go) and [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go) files handle these paths according to the XDG Base Directory specification where applicable.