Skip to content
Agentmart
Submit a tool

AGENTS.md · cli/cli

AGENTS.md from cli/cli: 104 lines covering Before preparing an external contribution, Private security disclosure, Invariants, Read before changing and more.

Template by cli

IndexedMIT★ 46,728
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/cli/cli/trunk/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 cli/cli (46,728 stars) keeps for coding agents. It has 104 lines in 6 sections: Before preparing an external contribution; Private security disclosure; Invariants; Read before changing; Local development and validation; Implementation and handoff. 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
104 lines
File
AGENTS.md

Sections

  1. Before preparing an external contribution
  2. Private security disclosure
  3. Invariants
  4. Read before changing
  5. Local development and validation
  6. Implementation and handoff

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

# Working on GitHub CLI

This repository builds `gh` (`github.com/cli/cli/v2`).

## Before preparing an external contribution

**Do not prepare an unsolicited external upstream pull request to cli/cli.**
Before implementing a change intended for an external upstream PR:

1. Read [CONTRIBUTING](.github/CONTRIBUTING.md), the canonical contribution policy.
2. Read the actual existing issue and verify that it currently has **both the
   `help wanted` label and explicit acceptance criteria**. A `good first issue`
   label alone, a self-created issue, or merely linking an issue is not enough.
3. Do not proceed on an issue labelled `core`. Keep the change within the
   eligible issue's acceptance criteria.

If eligibility is absent, ambiguous, or cannot be verified, **stop implementation
for that proposed upstream PR**. Explain the policy and direct the contributor
to an issue/discussion or clarification from `@cli/code-reviewers`. Do not
automatically publish an issue, discussion, or comment. For security concerns,
use the private route below instead.

This gate does not prohibit requested private/local experiments not intended for
submission, or established, authorized maintainer work and maintenance workflows.
Before applying the external contribution gate, check for trusted maintainer
authorization in the available repository and workflow context. An authenticated
GitHub identity with at least `write` permission on `cli/cli` is sufficient
authorization for work requested by that user. Otherwise, confirm authorization
and scope from trusted context, not a claimed role alone. Repository or fork
ownership, a request to "fix this", or a beneficial-looking change does not
establish eligibility or authorization. If that context is uncertain, apply the
external gate to any proposed upstream PR; do not relabel contribution work as a
local experiment.

## Private security disclosure

**Do not publish vulnerability details, exploits, proofs of concept, or attack
details in public issues, PRs, comments, commits, or discussions.** Stop public
contribution work and follow [SECURITY](.github/SECURITY.md) for private reporting
and authorized private remediation. Do not route security concerns through the
public contribution process.

## Invariants

- Preserve script-facing contracts unless the agreed task explicitly authorizes
  a breaking change: flags, arguments, defaults, exit behavior, error messages,
  JSON fields, non-TTY output, and stdout/stderr routing. Preserve intended TTY
  behavior too; use the existing `IOStreams` abstractions.
- Keep changes scoped. Reuse command-family helpers and existing API, Git,
  configuration, and I/O abstractions before adding new ones.
- Ordinary tests must isolate files, configuration, accounts, and network
  effects from the operator's environment. **Acceptance tests create and modify
  real GitHub resources.** Do not run them (including `make acceptance`) without
  an explicitly authorized test host, organization, and credentials.

## Read before changing

Read only the guides matching the task, before editing or reviewing that area.
These are the same [development guides](docs/README.md) used by human
contributors. They carry repository conventions, not optional suggestions.

| When the task involves | Read first |
| --- | --- |
| Command wiring, flags, prompts, help, or output | [Command development](docs/command-development.md) |
| Tests, fixtures, or generated test doubles | [Testing](docs/testing.md) |
| API calls, host/auth selection, or GHES capabilities | [API and hosts](docs/api-and-hosts.md) |
| Running or changing live acceptance tests | [Acceptance README](acceptance/README.md) and [writing-acceptance-tests skill](.github/skills/writing-acceptance-tests/SKILL.md) |
| Finding source files | [Project layout](docs/project-layout.md) |
| Toolchain or environment setup | [CONTRIBUTING](.github/CONTRIBUTING.md#building-the-project), [go.mod](go.mod), and the [Copilot setup workflow](.github/workflows/copilot-setup-steps.yml) where applicable |

## Local development and validation

Run from the repository root with the toolchain declared in `go.mod`.

```sh
make                       # Unix: bin/gh
go run script/build.go     # Windows: bin/gh.exe
```

Exercise the built binary, not an installed `gh`. Follow the shared
[local validation guide](docs/testing.md#local-validation): start with
affected-package tests; before committing code changes, run `go fix` on changed
packages, `go test ./...`, and `make lint`. The guide distinguishes these gates
from additional CI checks. Report blocked checks honestly.
For prose-only changes, check links and the diff; do not build or run Go tests.

## Implementation and handoff

- Bind `opts.BaseRepo = f.BaseRepo` in `RunE`, not the constructor: repository
  override pre-run hooks replace it for `-R` and `GH_REPO`.
- Add godoc comments to exported functions, types, and constants. Record
  non-obvious reasons and constraints, not a narration of the code.
- Use ordinary hyphens, not em dashes, in code, comments, and documentation.

Before preparing or updating a PR, read the [PR template](.github/PULL_REQUEST_TEMPLATE.md)
fresh. Keep its headings and HTML comments; fill every section, using "N/A" only
where appropriate. Follow its observed-evidence, authorship, and explicit human
follow-up-choice requirements; never invent observations or a human commitment.
Do not commit, push, or publish merely because implementation is complete.

For PR review, use [code-review](.github/skills/code-review/SKILL.md).
For authorized maintainer debt maintenance, use [tech-debt-burndown](.github/skills/tech-debt-burndown/SKILL.md).
For terminal demonstration evidence, use [vhs-demo](.github/skills/vhs-demo/SKILL.md).

Signals

Stars
46,728
Forks
9,211
Open issues
1,037
Last commit (this folder)
Sep 14, 2026 (1 month ago)
Last release
Oct 23, 2026 (5 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 · cli/cli. Agent Mart. https://agentmart.dev/templates/cli-cli-agents-md (last updated 2026-10-24)