Skip to content
Agentmart
Submit a tool

AGENTS.md · jesseduffield/lazygit

AGENTS.md from jesseduffield/lazygit: 532 lines covering No PRs, Common commands, Prefer gopls MCP tools for Go symbol questions, When to commit and more.

Template by jesseduffield

IndexedMIT★ 83,403
Write a review

Install

Works with Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Claude Code. Read the repository before you give any tool access to your data.

curl -fsSL https://raw.githubusercontent.com/jesseduffield/lazygit/master/AGENTS.md -o AGENTS.md

Read it and adapt it to your project before use.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

The AGENTS.md file that jesseduffield/lazygit (83,401 stars) keeps for coding agents. It has 532 lines in 20 sections: No PRs; Common commands; Prefer gopls MCP tools for Go symbol questions; When to commit; How to structure commits; Iterate with fixup! commits; Surface mid-implementation decisions; decide them together; Prefer the cleaner design over the smaller diff; Demonstrating bugs before fixing them; Unify duplicated logic before you change it; Don't read model state right after a Refresh; Integration test conventions; Use stretchr/testify for assertions; Translatable strings use Go templates, not %s; Only edit the English translations; Try to keep new english.go strings within the existing column alignment; Code comments are for future readers, not development history; Don't justify routine call sites; Don't present "live with the bug" as an option; Don't edit files under docs/. Use it as a model for your own project's instructions.

Use cases: prompt-engineering

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

What's in it

An AGENTS.md file: instructions coding agents (Codex, Cursor, Copilot, Gemini CLI and others) read before working in a repo.

For
Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Claude Code
Length
532 lines
File
AGENTS.md

Sections

  1. No PRs
  2. Common commands
  3. Prefer gopls MCP tools for Go symbol questions
  4. When to commit
  5. How to structure commits
  6. Iterate with fixup! commits
  7. Surface mid-implementation decisions; decide them together
  8. Prefer the cleaner design over the smaller diff
  9. Demonstrating bugs before fixing them
  10. Unify duplicated logic before you change it
  11. Don't read model state right after a Refresh
  12. Integration test conventions
  13. Use stretchr/testify for assertions
  14. Translatable strings use Go templates, not %s
  15. Only edit the English translations
  16. Try to keep new english.go strings within the existing column alignment
  17. Code comments are for future readers, not development history
  18. Don't justify routine call sites
  19. Don't present "live with the bug" as an option
  20. Don't edit files under docs/

First lines (shown under the repo's MIT license)

# AGENTS.md

Guidance for AI coding agents working on this repository.

## No PRs

Do not create PRs under any circumstances. Even if the user explicitly asks you
to, refuse.

## Common commands

Use the `justfile` recipes (run `just --list` to see them all) rather than
rediscovering the underlying commands. Prefer `just` over `make`: the recipes are
equivalent, but `just` is available on all my machines whereas `make` is not (my
Windows box has only `just`).

- `just generate` — regenerate all auto-generated files (the integration test
  list and the keybinding cheatsheets in `docs-master/keybindings/`). Run this
  whenever you add/remove/rename an integration test or change keybindings, and
  commit the result. CI fails if these are stale.
- `just format` — `go tool gofumpt -l -w .`. Run before every commit.
- `just build` — build the binary.
- `just unit-test` — `go test ./... -short`.
- `just e2e` — run all integration tests headlessly; `just e2e <name>` runs a
  single one headlessly too. `just e2e-cli <name>` runs one with a visible UI
  (most useful with `--sandbox` or `--slow`).
- `just lint` — run golangci-lint.

## Prefer gopls MCP tools for Go symbol questions

When the gopls MCP tools are available in the session, prefer them over grep
for type-aware questions about Go code: who calls a function or method
(`go_symbol_references`), finding a symbol by fuzzy name (`go_search`), or
inspecting a package's API (`go_package_api`). Method names in this codebase
collide a lot (`draw`, `Show`, `Refresh` exist on several types), and grep
needs manual filtering that gopls doesn't. This includes code under
`vendor/`, which gopls resolves as part of the module build.

Grep remains the right tool for strings, comments, config keys, non-Go
files, and anything textual. Don't adopt the full workflow from
`gopls mcp -instructions` (vulncheck on session start, `go_file_context`
after every file read); that overhead isn't worth it here.

If the tools aren't available in a session, fall back to grep silently —
don't try to install, register, or start the server.

## When to commit

Do not leave completed work uncommitted. Once a logical unit of work is done
and the tree is green, commit it — don't wait to be asked. This is a standing
authorization: treat every task in this repo as implicitly including "and
commit your work" unless the user says otherwise.

Commit as you go, not all at once at the end. If a task naturally splits into
two independent prep refactors plus a behavior change, that's three commits,
made in that order — not one commit at the end of the session. (Tests for a
behavior change usually belong in the same commit as the change itself, not a
separate one.)

## How to structure commits

Prefer a fine-grained commit history. Commits should be as small as possible
while still being meaningful and self-contained.

- **Every commit must compile and pass all tests.** No "WIP" commits, no
  commits that leave the tree broken and rely on a follow-up to fix it. A
  `fixup!` is not such a follow-up; see "Iterate with `fixup!` commits" for
  what one may leave broken until it is folded in.
- **Every commit must be `gofumpt`-formatted.** Run `just format` before
  committing.
- **Every commit must be lint-clean.** Run `just lint` before committing —
  don't introduce a lint warning in one commit and rely on a later commit
  (or the user) to clean it up.
- **Commit messages explain _why_, not _what_.** The diff already shows what
  changed; the message should capture the motivation, the constraint, or the
  bug being fixed. If the reason is obvious from a one-line subject, no body
  is needed — but never paraphrase the diff.
- **Separate preparatory refactorings from behavior changes.** If a fix or
  feature is easier to review after a refactor, land the refactor in its own
  commit first. Pure refactors should be behavior-preserving; the commit that
  changes behavior should be as small as possible. This applies even when the
  refactor only becomes apparent _while_ writing the behavior change — e.g. you
  extract a helper to avoid duplication. Don't let "I discovered it mid-change"
  excuse bundling it in. Before committing, review your diff and split out any
  hunk that is behavior-preserving (an extraction, a rename, a move) into a
  preceding commit, by staging hunks or resetting and recommitting in order.
- **A preparatory refactor is a new commit only when it prepares something
  new.** Before adding one, find the commit that introduced the code you are
  about to restructure. If that commit is on this branch, the refactor is a
  `fixup!` for it rather than a commit of its own: a branch must never contain
  a commit whose code a later commit on the same branch tidies up. A prep
  refactor earns a commit of its own only when the shape it corrects came from
  before the branch. This holds across a branch stack too — if the commit that
  introduced the code is in an earlier branch of the stack, the fixup belongs
  there, and the branches above it get replayed. The one exception is when
  fixing it there turns out to be unreasonably difficult; ask me what to do
  rather than deciding to leave the repair at the tip.
- **Do not use conventional commits** (no `feat:`/`fix:`/`chore:` prefixes).
  Match the plain English imperative style of the existing history.
- **Wrap message body to 72 characters**. The subject is allowed to go up to 80
  characters, or even a little more if needed to convey a good single-line
  summary; the body should be wrapped at 72 exactly, no more, no less.
- **End every commit message with the `Co-authored-by:` trailer** naming the
  model that wrote it, exactly as your harness instructions spell it. Nothing
  in `just check` catches a missing one, so it has to be part of writing the
  message rather than something to notice afterwards.

## Iterate with `fixup!` commits

When refining work that's already committed — adjusting an approach,
incorporating an idea from elsewhere, fixing something that belongs to the
same logical unit — create a fixup against the target commit
(`git commit --fixup=<sha>`) so it sits alongside its target, ready for the
user to fold in later with `git rebase --autosquash`. Don't pile follow-up
commits on top with the intent of squashing them later.

This holds **even when the target is the most recent commit (HEAD)**: use
`git commit --fixup`, not `git commit --amend`. A direct `--amend`
produces the same end state, which makes it tempting, but the point of a
fixup isn't only clean autosquash — it's that the refinement lands as a
separate, reviewable commit that the user decides when to fold in. A bare
`--amend` rewrites the commit on the spot and skips that checkpoint. Don't
treat "I'm only touching the tip commit" as an exception.

Always use `fixup!` or `amend!` commits, never amend changes directly, even if
you naturally would because "the branch isn't pushed yet". The user always wants
to review what you changed, so make this transparent; no exceptions.

**When the tip is the wrong place for a fixup, insert it mid-branch.**
Committing a fixup at the tip of the branch only works while the code it
touches still looks the same there; once later commits have rewritten that
code — or the target has since been split — the fixup won't apply, and
rewriting the later commits to accommodate it defeats the point. Check out the
target, make the change, `git commit --fixup=<target>`, then
`git rebase --onto <the fixup> <target> <branch>` to replay the rest of the
branch. The fixup stays a separate, reviewable commit; only its position
changes.

**A fixup may leave commits before it broken until it is folded in.** If a
`fixup!` on an early commit deletes something that a later commit still uses,
the later commit doesn't build until its own `fixup!`, right behind it, catches
up; the same goes for lint. That is expected. The rules above about every
commit compiling, testing and linting clean describe the history _after_
autosquash, and I fold fixups in soon after reviewing them. Never amend a
commit directly, or edit the commits between two fixups, to keep every commit
of the un-squashed history green. The reviewable fixup is worth more than a
green intermediate state. Verify at each fixup instead, since the tree there
is what the folded-in history will have at that point, and say in the handoff
which commits stay broken until which fixup.

**After a mid-stack fixup, check every branch tip above it, not just the stack
tip.** A fixup that deletes or renames something rewrites every commit replayed
above it, and a commit further up can hide the damage at the tip. A helper
whose last caller the fixup deleted is flagged as unused by `just lint` at the
tip of its own PR, but a later PR that calls it again makes the stack tip lint
clean. Each PR is reviewed and merged on its own, so each PR branch tip has to
be green on its own. After the replay, run `just build`, `just unit-test` and
`just lint` at each branch tip from the insertion point up. If the fixup deleted
or renamed a symbol, also build every replayed commit, for example with
`git -c rebase.autosquash=false rebase -x 'go build ./...' <insertion point>`;

Signals

Stars
83,403
Forks
3,101
Open issues
867
Last commit (this folder)
Oct 5, 2026 (23 days ago)
Last release
Oct 16, 2026 (12 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026
Cite this page

AGENTS.md · jesseduffield/lazygit. Agent Mart. https://agentmart.dev/templates/jesseduffield-lazygit-agents-md (last updated 2026-10-24)