Skip to content

dirien/yet-another-agent-harness / .claude/skills/agent-ready-go

agent-ready-go

Verified

Prepares Go applications to work effectively with AI coding agents. Use when setting up a new Go project or retrofitting an existing one to ensure: structured JSON logging (slog/Zap/ZeroLog/Logrus), machine-readable command output, thorough golangci-lint configuration, non-interactive CLI design with --yes flags, structured error handling with meaningful exit codes, proper context.Context propagation, graceful shutdown, health check endpoints, and a standardized Makefile. Triggers when a user asks to make their Go app "agent-ready," "AI-friendly," wants to improve agent tooling/observability in a Go project, or needs to audit an existing Go project against agent-readiness best practices.

FileKindSize
SKILL.mdskill md6.3 KB
assets/Makefileother2.5 KB
references/config.mdmarkdown4.0 KB
references/error-handling.mdmarkdown5.6 KB
references/logging.mdmarkdown7.1 KB
references/non-interactive.mdmarkdown4.8 KB
references/services.mdmarkdown5.8 KB
references/testing.mdmarkdown6.5 KB

assets/Makefile

View on GitHub
# Makefile for Agent-Ready Go projects
# Copy to project root and adjust BINARY_NAME and MAIN_PKG.

BINARY_NAME        ?= app
MAIN_PKG           ?= ./cmd/$(BINARY_NAME)
BUILD_DIR          ?= ./bin
COVERAGE_THRESHOLD ?= 80
GOFLAGS            ?= -trimpath
VERSION            ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
BUILD_TIME         ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS            ?= -s -w -X main.version=$(VERSION) -X main.buildTime=$(BUILD_TIME)

.PHONY: all build build-static test cover lint vet fmt generate vuln tidy ci-check-tidy bench ci clean help

all: build test

build: ## compile the binary
	@mkdir -p $(BUILD_DIR)
	go build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_PKG)

build-static: ## compile static binary for containers (CGO_ENABLED=0)
	@mkdir -p $(BUILD_DIR)
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
		go build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-static $(MAIN_PKG)

test: ## run tests with race detector
	go test -race -count=1 -timeout=5m ./...

cover: ## run tests with coverage report (enforces COVERAGE_THRESHOLD)
	go test -race -count=1 -timeout=5m -coverprofile=coverage.out ./...
	go tool cover -func=coverage.out
	@COVERAGE=$$(go tool cover -func=coverage.out | tail -1 | awk '{print $$3}' | tr -d '%'); \
	echo "Total coverage: $${COVERAGE}%"; \
	awk -v c="$${COVERAGE}" -v t="$(COVERAGE_THRESHOLD)" \
	    'BEGIN { if (c+0 < t+0) { print "Coverage " c "% is below threshold " t "%"; exit 1 } }'

lint: ## run golangci-lint
	golangci-lint run ./...

vet: ## run go vet
	go vet ./...

fmt: ## format source files with gofmt and goimports
	gofmt -w ./...
	goimports -w ./...

generate: ## run go generate
	go generate ./...

vuln: ## check for known vulnerabilities with govulncheck
	govulncheck ./...

tidy: ## tidy and verify module dependencies
	go mod tidy
	go mod verify

ci-check-tidy: ## verify go.mod/go.sum are tidy (for CI — fails if tidy would make changes)
	go mod tidy
	git diff --exit-code go.mod go.sum || (echo "go.mod/go.sum not tidy; run 'make tidy' and commit"; exit 1)

bench: ## run benchmarks
	go test -bench=. -benchmem -run='^$$' ./...

ci: ci-check-tidy vet lint cover vuln ## full pipeline: tidy-check, vet, lint, cover, vuln

clean: ## remove build artifacts and coverage files
	rm -rf $(BUILD_DIR) coverage.out coverage.html

help: ## show available targets
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
		awk 'BEGIN {FS = ":.*?## "}; {printf "  \033[36m%-20s\033[0m %s\n", $$1, $$2}'
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall