Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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 speciali
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 32% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 79% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 13% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 60% | 0% |
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).
t.TempDir() for temp dirs — auto-cleanup, under os.TempDir().t.TempDir() returns /var/folders/.... Go'sfilepath.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.
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.
t.Setenv("HOME", tmpDir) in GLM integration tests — parallel-testpollution. Use t.TempDir() + explicit path construction.
go test ./...) to catchcascading failures. Use -count=1 to disable caching when debugging flaky tests; use -race for concurrency-safety checks.
const.internal/config/envkeys.go asconstants; reference the constant everywhere. Never inline a raw env string.
internal/config/defaults.go. Neverduplicate a threshold across packages.
$HOME, HOMEBREW_PREFIX, etc. In.sh.tmpl fallback paths use $HOME (not .HomeDir), because .HomeDir freezes at moai init time and breaks for users with non-standard layouts.
CLAUDE.local.md, settings.local.json,and _test.go files inside t.TempDir().
AskUserQuestion is the ONLY user-facing question channel, and it isreserved for the MoAI orchestrator (main session).
AskUserQuestion. If user input is required, return a structured blocker report to the orchestrator (see .claude/rules/moai/core/askuser-protocol.md § Blocker Report Format).
AskUserQuestion, TaskCreate, TaskUpdate,TaskList, TaskGet are deferred tools — schema not loaded at session start. The orchestrator MUST call ToolSearch(query: "select:AskUserQuestion,TaskCreate,...") before first use. Subagents inherit this constraint.
through AskUserQuestion (orchestrator) or a blocker report (subagent).
12 agents are ARCHIVED and MUST NOT be referenced anywhere in generated harness files — no delegates-to, no prose, no examples. The full list of archived names lives in the canonical SSOT at .claude/rules/moai/workflow/archived-agent-rejection.md §B; this skill does not repeat the literal names (repeating them in every generated file would re-seed the exact tokens the rejection contract is meant to suppress).
The 8 RETAINED agents are the only valid delegation targets:
manager-spec, manager-develop, manager-docs, manager-git,
plan-auditor, sync-auditor, builder-harness, Explore (Anthropic built-in)For domain expertise formerly provided by the archived domain-expert agents, use the per-spawn pattern: Agent(subagent_type: "general-purpose", model: "opus", tools: "<whitelist>", prompt: "...<domain> specialist: <conventions>...") at delegation time. See .claude/rules/moai/workflow/archived-agent-rejection.md §C for the full migration table (rows #1-#12), which maps each archived agent to its canonical retained-agent or per-spawn replacement.
Per .claude/rules/moai/core/verification-claim-integrity.md:
assertion is valid ONLY when the actor ran the command and observed the output. An unran command is a gap, never a pass.
frontmatter text or grep matches alone — without the domain's dedicated tool (moai spec audit, go test -cover, golangci-lint) — is a hypothesis, not a verified defect. The 2026-06-17 incident (29 SPECs wrongly flagged as "Mx-close debt"; moai spec audit showed all 29 were grandfather-protected) is the canonical worked example.
the verbatim output observed, measured against this tree in this run. A number from a different SPEC/package/time is a carry-over, not a baseline.
/ Residual-risk. The Gaps section is the defense — force yourself to enumerate what was NOT observed.
.claude/rules/moai/core/verification-claim-integrity.md v1.1.0.claude/rules/moai/core/askuser-protocol.md.claude/rules/moai/workflow/archived-agent-rejection.md.claude/rules/moai/development/coding-standards.mdOther measured skills in the registry, with their headline benchmark lift.