Skip to content

Add AGENTS.md (contributor guide) and CLAUDE.md import#34

Open
dolph wants to merge 2 commits into
mainfrom
claude/add-agents-md
Open

Add AGENTS.md (contributor guide) and CLAUDE.md import#34
dolph wants to merge 2 commits into
mainfrom
claude/add-agents-md

Conversation

@dolph
Copy link
Copy Markdown
Owner

@dolph dolph commented May 16, 2026

Summary

Adds an AGENTS.md contributor guide for humans and AI agents working in
the repo, plus a one-line CLAUDE.md that imports it so Claude Code and
other agent harnesses share a single source of truth.

AGENTS.md documents:

  • Project summary: what find-replace is and its minimal CLI surface
    (find-replace FIND REPLACE, no flags yet — see Build-time version metadata is injected via -ldflags but never referenced; no --version flag #26).
  • Development loop: the exact gofmt -l ., go vet ./...,
    go build ./..., go test -race ./... commands plus ./build.sh. The
    -race flag is called out as non-negotiable.
  • TDD discipline: failing test first → confirm it fails for the right
    reason → minimal fix → refactor green. Go-specific warnings on
    hermeticity (t.TempDir), t.Helper(), t.Fatal vs log.Fatal
    (cross-refs Test helpers use log.Fatal (kills test binary), assertion helpers lack t.Helper(), and TestNewFile is empty #33), table-driven tests, and the checklist theater
    anti-pattern.
  • Code style: fmt.Errorf with %w, modern stdlib (os.ReadFile,
    strings.ReplaceAll, errors.Is), HTTP body close, context.Context
    plumbing rule, log/slog for new structured logging, no math/rand
    in filesystem paths (Predictable temp-file names enable a symlink/race attack on file rewrites #3), no log.Fatal from goroutines (log.Fatal from worker goroutines leaves the tree in a partially-modified state #6).
  • Repo conventions: branch naming, imperative ≤72-char commit
    subjects, Fixes #N in PR descriptions.
  • Release labels: mandatory release:skip|patch|minor|major on every
    PR (release workflow defaults to patch if unlabeled), with
    precedence skip > major > minor > patch.
  • Priority labels: the priority: critical|high|medium|low rubric
    mirroring how the existing 22+ issues are already labeled.
  • Known traps: the highest-impact open landmines, each
    cross-referenced to its issue — concurrent walker, os.Stat follows
    symlinks, os.Rename silently overwrites, O_CREATE vs O_EXCL,
    log.Fatal from goroutines, naïve binary detection, dead -ldflags.
  • Scope discipline: single-purpose PRs; file an adjacent defect as a
    new issue rather than expanding the current PR.

CLAUDE.md contains literally @AGENTS.md (Claude Code's import syntax)
so the two share one source of truth and won't drift.

Test plan

  • go vet ./... passes (no behavior changes)
  • go build ./... passes
  • go test -race ./... passes (no behavior changes)
  • Documentation-only change; no code is modified
  • Verified CLAUDE.md import syntax (@AGENTS.md is the Claude Code
    file-import directive)

Labeled release:skip — documentation only, no user-visible behavior
change. Subsequent work depends on this landing first so contributors
(human and AI) follow the documented conventions from day one.


Generated by Claude Code

AGENTS.md is a contributor guide for humans and AI agents working in the
repo. It documents:

- The project's purpose and minimal CLI surface
- The exact dev loop: gofmt, vet, build, test -race, build.sh
- TDD discipline with Go-specific guardrails (hermetic tests, t.Helper,
  log.Fatal vs t.Fatal, checklist theater)
- Code style — fmt.Errorf %w, modern stdlib, defer Close, no math/rand
  in filesystem paths, no log.Fatal from goroutines
- Repo conventions for branch names, commit subjects, PR refs
- Mandatory release:* and priority:* label rubrics
- Known traps cross-referenced to open issues
- Scope discipline — single-purpose PRs

CLAUDE.md imports AGENTS.md via Claude Code's @-syntax so both files share
one source of truth.
@dolph dolph added the release:skip label May 16, 2026 — with Claude
Comment thread AGENTS.md Outdated

## What this project is

`find-replace` is a small Go CLI (~400 LoC, single binary) that recursively
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LoC assertion will not age well - remove

Per review feedback on #34: the '~400 LoC' figure won't age well as the
codebase grows. Keep the 'single binary' descriptor which stays true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants