.claude/skills/agent-ready-go/SKILL.md
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.
npx skillsauth add dirien/yet-another-agent-harness agent-ready-goInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Make Go applications work effectively with AI coding agents by ensuring all tooling produces machine-readable output, errors are structured, and commands run non-interactively by default.
Making a Go app agent-ready involves these steps:
.golangci.yml with thorough configgo test -race -count=1 -timeout=5m with coverage thresholds--yes/-y flags, env vars over promptsbuild, test, lint, cover targetsFor greenfield projects, apply all steps. For existing projects, run the audit first and address only what's missing.
Run this checklist against the project. Address each ❌:
LOG_FORMAT=json--json or --output json flag.golangci.yml exists with a thorough linter setgo test -race passesgo vet ./... passes cleanfmt.Errorf("...: %w", err))context.Context threaded through all I/O-bound functions--yes/-y bypass flagMakefile with build, test, lint, cover, ci targets/healthz, /readyz) for HTTP servicesgovulncheck ./... passes cleanNO_COLOR respected; no ANSI codes in non-TTY outputSee references/logging.md for setup patterns for slog, Zap, ZeroLog, and Logrus.
Key requirements:
!isatty(os.Stdout.Fd()) or LOG_FORMAT=jsonlevel, ts, msg, plus context fieldsfmt.Println for operational log outputAgents parse stdout to validate results. Every non-trivial command must support JSON output.
var outputJSON bool
cmd.Flags().BoolVar(&outputJSON, "json", false, "output results as JSON")
if outputJSON {
enc := json.NewEncoder(os.Stdout)
enc.SetIndent("", " ")
_ = enc.Encode(result)
} else {
fmt.Printf("Created: %s\n", result.Name)
}
Rule: structured data → stdout; progress/human messages → stderr.
fmt.Fprintln(os.Stderr, "Processing...") // progress to stderr
json.NewEncoder(os.Stdout).Encode(result) // data to stdout
Copy assets/.golangci.yml to the project root, then:
golangci-lint run ./...
Requires golangci-lint v1.59+ (v1.x series).
See references/testing.md for linter explanations and tuning guidance.
See references/testing.md for full testing setup.
go test -race -count=1 -timeout=5m -coverprofile=coverage.out ./...
go tool cover -func=coverage.out | tail -1
Enforce minimum coverage in CI:
COVERAGE=$(go tool cover -func=coverage.out | tail -1 | awk '{print $3}' | tr -d '%')
[ $(echo "$COVERAGE >= 80" | bc -l) -eq 1 ] || { echo "Coverage ${COVERAGE}% < 80%"; exit 1; }
See references/error-handling.md for structured error patterns and exit code conventions.
Quick rules:
fmt.Errorf("loading config: %w", err)main() catches all errors and exits with appropriate codeos.Exit deep in business logic — return errors uppanic outside of init() / package-level setupSee references/non-interactive.md for patterns.
Any prompt that blocks agent execution must have a --yes/-y bypass:
if !yes {
confirmed, _ := promptConfirm("Delete all records?")
if !confirmed {
return nil
}
}
// proceed
Copy assets/Makefile to the project root. Adjust
BINARY_NAME and MAIN_PKG for the project.
Standard targets: make build, make test, make lint, make cover,
make ci (runs full pipeline).
| File | Contents |
| ---- | -------- |
| references/logging.md | slog, Zap, ZeroLog, Logrus JSON setup |
| references/testing.md | Race detector, coverage, golangci-lint tuning |
| references/error-handling.md | Structured errors, exit codes, context |
| references/non-interactive.md | --yes flags, env vars, stdin detection |
| references/services.md | HTTP graceful shutdown, health checks, OTel, request ID |
| references/config.md | Configuration management, env var parsing, validation |
| assets/.golangci.yml | Production-ready linter config |
| assets/Makefile | Standard build/test/lint/cover targets |
tools
Implements advanced TypeScript type systems, creates custom type guards, utility types, and branded types, and configures tRPC for end-to-end type safety. Use when building TypeScript applications requiring advanced generics, conditional or mapped types, discriminated unions, monorepo setup, or full-stack type safety with tRPC.
development
Use when challenging ideas, plans, decisions, or proposals using structured critical reasoning. Invoke to play devil's advocate, run a pre-mortem, red team, or audit evidence and assumptions.
development
Systematic technical debt analysis across architecture, testing, documentation, and infrastructure. Investigates the codebase, scores findings by impact and effort, and generates a prioritized TECH_DEBT.md remediation plan. Delegates to specialized skills for code quality (scout) and linting (lint-fix). Use when assessing overall project health, planning cleanup sprints, or onboarding to an unfamiliar codebase.
testing
Install and configure Tailscale across platforms. Detects OS, distro, and environment (including WSL2 and containers). Verifies existing installations, performs platform-appropriate install, and guides initial connection. Use when setting up Tailscale on a new machine, onboarding a server to a tailnet, or verifying an existing install.