AGENTS.md — example-package-go
Summary: This playbook governs agents working in the Go example package. It inherits all global rules from the root
AGENTS.mdand sets the mode to autonomous. Agents must run gofmt, golangci-lint, andgo test ./...before completing any task. No global rules are overridden.
Inherits
/AGENTS.md — the root operational playbook.
Overrides
(none) — all root rules apply without modification.
Mode
autonomous
Scope
MAY
- Read and write any file within
example-package-go/. - Run
gofmt,goimports,golangci-lint run ./...,go build ./...,go test ./..., andgovulncheck ./...as part of any task. - Modify
go.modandgo.sumas part of an approved dependency task. - Update
example-package-go/index.mdafter any structural change.
MUST NOT
- Modify any file outside
example-package-go/without explicit human approval. - Use
panicin any non-main, non-test code path without an escalation flag. - Ignore an error with
_ = ...without an inline justification comment. - Introduce a goroutine without a clear termination condition documented in a comment.
Navigation Order
- /index.md — understand the global repo structure.
- /AGENTS.md — load global behavioral rules.
- /codebase_rules.md — load global coding standards.
- example-package-go/index.md — understand this package's structure.
- example-package-go/AGENTS.md — load package-specific rules (this file).
- example-package-go/codebase_rules.md — load Go coding standards.
- Relevant source files identified from
index.md.
Task Patterns
Adding a new exported function
- Read navigation order files.
- Write the failing test first using a table-driven test structure.
- Write the implementation with a Go doc comment starting with the function name.
- Run
gofmt -s -w ./...andgoimports -w ./...to format. - Run
golangci-lint run ./...and fix all issues. - Run
go test ./...and confirm all tests pass. - Run
go test -coverprofile=coverage.out ./...and verify coverage ≥80%. - Update
index.mdif the function is a new public entry point. - Produce the output contract.
Fixing a bug
- Read navigation order files.
- Reproduce the bug in a failing test. Use
t.Run()for the new case. - Fix the implementation. Run golangci-lint and
go test ./.... - Confirm no regressions.
- Produce the output contract.
Adding a module dependency
- Read navigation order files.
- Run
govulncheckon the proposed module before adding it. - Run
go get <module>@<version>. Commitgo.modandgo.sum. - Run
go build ./...andgo test ./.... Fix any breakage. - Produce the output contract.
Output Contract
Follows the root AGENTS.md output contract exactly.
Additional requirement: note in ## Changes whether each Go file passed gofmt -l (no output
means clean) and golangci-lint.
Escalation Triggers
Inherits all global triggers from /AGENTS.md. Additional local triggers:
- Any function that spawns a goroutine without a cancellable
context.Contextparameter requires human review before the task is considered complete.