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

> Set up your development environment for no-mistakes with Go 1.22 Git and Make. Compile the CLI using make build and validate changes with make test for a smooth workflow.

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

---

**You need Go 1.22+, Git, and Make to build the `no-mistakes` CLI from source, then use `make build` to compile the binary and `make test` to validate your changes.**

`no-mistakes` is a Go-based CLI tool that intermediates between your local Git repository and remote push targets by running an AI-driven validation pipeline in disposable worktrees. Setting up a development environment for `no-mistakes` requires installing the Go toolchain, cloning the repository, and leveraging the project's `Makefile` for build automation. This guide walks you through the complete setup process using the actual source structure from `kunchenguid/no-mistakes`.

## Prerequisites and repository setup

Before compiling the project, ensure your system meets the baseline requirements. The codebase uses Go modules and requires a minimum Go version of 1.22 for optimal compatibility.

Install the following dependencies:

- **Go 1.22 or later** – required for building the binary and running tests
- **Git** – used for repository operations and worktree management
- **Make** – drives the build system via the `Makefile`

Clone the repository and prepare the module dependencies:

```bash
git clone https://github.com/kunchenguid/no-mistakes.git
cd no-mistakes
go mod tidy

```

The `go mod tidy` command ensures your local `go.mod` and `go.sum` files match the exact dependency tree required by the source code.

## Understanding the codebase structure

The `no-mistakes` source is organized under an `internal/` package hierarchy that separates concerns between CLI parsing, daemon lifecycle, and pipeline execution. Familiarizing yourself with these packages helps when navigating the code:

- **`internal/cli`** – Parses user commands, launches the TUI, and writes CLI logs. Entry point at [`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, manages worktrees, and coordinates pipeline runs. 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 by [`internal/pipeline/executor.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/executor.go).
- **`internal/git`** – Thin wrapper around Git commands ensuring correct handling of bare repositories and worktrees. Implementation in [`internal/git/git.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/git/git.go).
- **`internal/shellenv`** – Helper for spawning 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 including trusted repo settings. Defined in [`internal/config/config.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/config/config.go).
- **`internal/telemetry`** – Sends anonymised usage metrics while respecting privacy guarantees. Located in [`internal/telemetry/track.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/telemetry/track.go).

## Building the project

The build system is driven by the `Makefile` in the repository root. The most common target for developers is `make build`, which compiles the binary with version information baked in.

Run the build command:

```bash
make build

```

This produces the executable at `bin/no-mistakes`. For development iterations, you may also want to run `make fmt` to ensure consistent formatting across the codebase:

```bash
make fmt

```

The `fmt` target runs `gofmt -w .` to automatically format all Go source files according to standard conventions.

## Testing your changes

The project provides multiple test targets to verify code correctness at different levels of integration.

For rapid feedback during development, run the unit test suite with race detection:

```bash
make test

```

This executes `go test -race ./...` to catch concurrency issues and logic regressions.

To validate the complete push → pipeline → PR flow—including agent interactions and network operations—run the end-to-end suite:

```bash
make e2e

```

Note that the `e2e` target requires network access for agent CLIs and runs behind the `e2e` build tag.

Before committing changes, verify that generated skill files remain synchronized and that `go vet` passes:

```bash
make lint

```

The `lint` target ensures the generated skill is up-to-date and performs static analysis on the codebase.

## Development workflow

A typical development workflow for contributing to `no-mistakes` follows these steps:

1. **Edit code** – Make changes under `internal/…` or `cmd/…` directories.
2. **Run `make fmt`** – Keep formatting consistent with Go standards.
3. **Run `make lint`** – Ensure the generated skill is still current.
4. **Run `make test`** – Catch regressions early with unit tests.
5. **Run `make e2e`** – Verify the complete validation pipeline still functions correctly.

After initial build, you can initialize a local gate to test the CLI behavior:

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

```

This creates the `~/.no-mistakes` directory and initializes the gate configuration required for local testing.

## Working with the skill generator

The project ships a skill generator located at [`cmd/genskill/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/genskill/main.go) that produces the `/no-mistakes` skill used by AI agents. This tool generates Markdown skill files from source constants.

If you modify the skill body or any source constants affecting agent behavior, regenerate the skill file:

```bash
make skill

```

This keeps the generated documentation in sync with the implementation, ensuring AI agents receive accurate instructions when processing your code changes.

## Summary

Setting up a development environment for `no-mistakes` requires Go 1.22+, Git, and Make, with builds managed through the repository's `Makefile`.

- Clone the repository from `kunchenguid/no-mistakes` and run `go mod tidy` to fetch dependencies.
- Use `make build` to compile the binary to `bin/no-mistakes` and `make fmt` to standardize formatting.
- Validate changes with `make test` for unit tests and `make e2e` for full integration testing.
- Remember to run `make skill` after editing AI agent skill definitions in the source code.

## Frequently Asked Questions

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

Go version 1.22 or later is recommended. While earlier versions may compile the code, the project targets Go 1.22 features and has been tested primarily against this release. Run `go version` to verify your installation meets this requirement.

### How do I run only the unit tests without the end-to-end suite?

Run `make test` to execute only the unit tests with race detection enabled. This command runs `go test -race ./...` and excludes the slower e2e tests that require network access and external agent CLIs.

### What is the skill generator used for?

The skill generator at [`cmd/genskill/main.go`](https://github.com/kunchenguid/no-mistakes/blob/main/cmd/genskill/main.go) creates the AI agent skill documentation used by the `/no-mistakes` command. When you modify the skill constants in the source, running `make skill` regenerates the Markdown files so that AI agents have current instructions for code review and validation tasks.

### How do I debug the no-mistakes daemon during development?

The daemon lifecycle and singleton lock logic reside in [`internal/daemon/daemon.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/daemon/daemon.go). For debugging, build the binary with `make build` and run `./bin/no-mistakes` with appropriate flags to trigger daemon initialization. The daemon manages worktree creation and pipeline coordination through [`internal/pipeline/executor.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/pipeline/executor.go), where you can add logging or attach a debugger to trace execution flow.