harness-moaiadk-best-practices

Featured

moai-adk-go best-practices reference for the 4 harness specialists (cli-template-specialist, quality-specialist, workflow-specialist, hook-ci-specialist). Covers TRUST 5 gates, Go test isolation (t.TempDir, no OTEL env in parallel tests), hardcoding-prevention rules (env constants in envkeys.go, thresholds in defaults.go), the AskUserQuestion orchestrator-only boundary, the deferred-tool preload rule, the archived-agent rejection contract, and verification-claim integrity. Loaded by the specialists when authoring or reviewing moai-adk-go code.

AI & Automation 1,120 stars 207 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# moai-adk-go Best Practices ## TRUST 5 Quality Gates Every change must pass all five dimensions before completion: | Pillar | Gate | Failure action | |--------|------|----------------| | **Tested** | `go test ./...` with coverage | Block merge; generate missing tests | | **Readable** | `golangci-lint run` | Warn; suggest refactoring | | **Unified** | `go fmt` + `goimports` | Auto-format or warn | | **Secured** | OWASP-aligned review (per-spawn opus agent) | Block; require review | | **Trackable** | Conventional Commits regex | Suggest format | Coverage targets: 85% package minimum; 90%+ for critical packages (`internal/cli`, `internal/template`, `internal/hook`). ## Test Isolation - **Always** `t.TempDir()` for temp dirs — auto-cleanup, under `os.TempDir()`. - **macOS path pitfall**: `t.TempDir()` returns `/var/folders/...`. Go's `filepath.Join(cwd, absPath)` does NOT strip the leading `/`: `filepath.Join("/a/b", "/var/folders/x")` → `"/a/b/var/folders/x"` (WRONG). Use `filepath.Abs()` when resolving user-supplied paths in CLI commands. - **No OTEL env in parallel tests** (CLAUDE.local.md §WARN): never `t.Setenv("OTEL_EXPORTER_*", ...)` in parallel tests — the OTEL SDK initializes global state from env vars on first use, causing data races. Use a fake/no-op exporter instead; or make the parent test non-parallel. - **No `t.Setenv("HOME", tmpDir)`** in GLM integration tests — parallel-test pollution. Use `t.TempDir()` + explicit path construction. - **After...

Details

Author
modu-ai
Repository
modu-ai/moai-adk
Created
9 months ago
Last Updated
today
Language
Go
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category