go-backend
Skill2 starsChanged 35 days agoApache-2.0View on GitHub
Mazarbul Go backend rules. USE WHEN editing any *.go file, working with internal/, cmd/, migrations/, .mise.toml, or SQL. Covers Google Go style, Google AIP naming applied to JSON and Go, event-log append-only discipline, kernel helper catalog, Zap structured logging, and the no-proto / JSONL convention. NOT FOR TUI-specific work (use tui-design) or CLI argument parsing (use cli-developer agent).
3 other projects use a version of this.
Adopted by
Most recently taken up by
- alessiogarifo92/claude-skillstheir own version, first seen Oct 25, 2026
- muxammadmamajonov/dot-claudetheir own version, first seen Jul 6, 2026
- shristi2211/Claude_Skillstheir own version, first seen May 21, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- shristi2211/Claude_Skills★ 1same name
- alessiogarifo92/claude-skills★ 0same name
- muxammadmamajonov/dot-claude★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository41 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- 12-principles-of-animationSkill
- aip-namingSkill
- architectSkill
- babysit-abortSkill
- babysit-prSkill
- babysit-tickSkill
- baseline-uiSkill
- commit-pushSkill
- complex-refactorSkill
- critiqueSkill
- deadSkill
- devstackSkill
- goSkill
- go-strictSkill
- greptileSkill
- impl-checkSkill
- inspect-dbSkill
- inspect-deploySkill
- inspect-runtimeSkill
- interaction-designSkill
- issue-planSkill
- lessonsSkill
- mergeSkill
- new-resourceSkill
- plan-featureSkill
- preflightSkill
- pr-reviewSkill
- review-fixSkill
- reviewSkill
- shipSkill
- simplifySkill
- task-execution-protocolSkill
- teamSkill
- tui-component-browserSkill
- tui-design-labSkill
- tui-designSkill
- verifySkill
- wrap-upSkill
- write-docsSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Event log is append-only: Never UPDATE or DELETE event rows.
- Distinctive: line 16
Provenance on every fact: Every event carries source, confidence, timestamp.
- Distinctive: line 19
If unsure about a kernel invariant, ASK USER.
- Very specific: line 25
Run go vet ./... plus mise run lint.
- Very specific: line 46
No stuttering: entity.ByID() not entity.GetEntityByID().
- Very specific: line 47
No generic packages: util, common, helpers, FORBIDDEN.
- Distinctive: line 48
No global state: dependency injection only.
- Distinctive: line 49
No panic in library code: return errors.
- Distinctive: line 66
Before adding new helpers, check:
- Distinctive: line 143
Update README.md when changing: command surface, project structure, dev workflow, or prerequisites.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Go Backend Rules
Core invariants (NON-NEGOTIABLE)
- Event log is append-only. Never UPDATE or DELETE event rows. Supersede via newer events.
- Provenance on every fact. Every event carries source, confidence, timestamp.
- Timestamps: UTC
time.Time, JSON RFC 3339. Never*_at. - No proto. Wire format is JSONL. Schema layer is JSON Schema. Types are Go structs with
json:tags. - If unsure about a kernel invariant, ASK USER.
Schema and types
- Define or update the JSON Schema in
internal/kernel/schemas/. - Define or update the Go struct with
json:tags. Doc-comment on every exported field. - Run
go vet ./...plusmise run lint. - Tests cover happy path plus at least one documented error code.
See /aip-naming for the full naming rules.
Naming Standards
- Packages: lowercase, single word, no underscores (
kernel,mcp,plugin,cli,tui). - Variables: camelCase, descriptive (
entityIDnoteid,eventCountnotcnt). - Exported functions: PascalCase, verb-noun (
AppendEvent,ValidateSchema). - Interfaces:
-ersuffix when single method (Reader,Writer,Validator). - Acronyms in Go (Mazarbul convention): single words in PascalCase (
JwknotJWK,McpnotMCP,UrlnotURL,HttpnotHTTP). Brand names preserved (OAuth,JSONRPC). - Enum values in Go: PascalCase typed constants (
EventKindUnspecified,EventKindCreated). - Boolean fields (AIP-140): adjectives,
activenotisActive. Exception: reserved words. - Time fields (AIP-142):
*Timesuffix,createTime,updateTime,deleteTime.
Code Standards (Google Go Style)
- Context first parameter:
func Foo(ctx context.Context, ...) - Return errors, don't log-and-return (let caller decide).
- Error wrapping:
fmt.Errorf("operation: %w", err). - No stuttering:
entity.ByID()notentity.GetEntityByID(). - No generic packages:
util,common,helpers, FORBIDDEN. - No global state: dependency injection only.
- No panic in library code: return errors.
- Receiver names: short, consistent (
sforServer, notserverorself). - Line length: prefer <100 characters, hard limit 120.
Log Message Conventions
Per Google Go Style:
| Type | Casing | Example |
| Log messages | Capitalized | logger.Info(ctx, "Starting server") |
| Error strings | lowercase | fmt.Errorf("failed to start: %w", err) |
Proper nouns and acronyms (OpenTelemetry, MCP, HTTP, JSON-RPC) keep standard casing in log messages.
Code Reuse, ALWAYS check helpers first
Before adding new helpers, check:
internal/kernel/for event-log writers, query composers, supersede helpers.internal/mcp/for JSON-RPC error mapping, tool registry helpers.internal/tui/style/for theme accessors.
Full catalog with usage examples lives in the references/ subfolder.
When to Use What, Observability
| Need | Tool | When |
| Structured log | Zap | Every method (already configured) |
| Event-log write | kernel.Append(ctx, event) | Every state-changing user or system action |
| Custom span | OTEL tracer.Start | External APIs, complex multi-step logic |
| Custom metric | OTEL meter.Int64Counter | Quotas, rate-limited APIs |
Full patterns live in the references/ subfolder.
AIP Compliance, TL;DR
| AIP | What |
| 122/123 | Resource references + definitions |
| 131-135 | Get/List/Create/Update/Delete |
| 140 | Boolean field naming (adjectives) |
| 142 | Time fields (*Time suffix) |
| 155 | Idempotency (requestId UUID4) |
| 158 | Pagination (cursor-based) |
| 160 | Filtering (CEL syntax) |
| 192 | Documentation (comments everywhere) |
| 193 | Error model (JSON-RPC or RFC 7807) |
| 203 | Field behavior (required/readOnly/writeOnly) |
Full mapping with worked examples: agent-docs/synthesis.md section 3 and the aip-naming skill.
Pull Request Standards
- Target: 50 to 100 LoC for incremental changes.
- Initial development exception: larger PRs OK for new packages.
- Hard limit: 300 LoC (excluding generated code, migrations).
- Review SLA: <1 hour for small PRs, max 1 business day.
Forbidden Actions
- Emojis in code or comments.
- Logging passwords, tokens, API keys, encryption keys.
- Hardcoded credentials or connection strings.
- Skipping error handling with
_assignment. - Guessing kernel invariants (ask user instead).
- Modifying event-log entries (append-only).
- Creating types that bypass JSON Schema (define the schema first).
- Non-idiomatic Go patterns.
- Creating
docs/directories or documentation without being asked. - Em-dashes in code, comments, docs, or commits.
When Uncertain, ASK USER
- Kernel invariant interpretations.
- Domain model definitions (entities, relationships).
- Business logic behavior.
- Provenance requirements for a new event type.
- Schema design decisions.
Key Commands
| Command | What |
go vet ./... | Compile-time checks. |
mise run test | All tests with race detector. |
mise run lint | golangci-lint. |
mise run ci | Format + lint + test (before every commit). |
mise run fmt | gofumpt + goimports with local prefix. |
lefthook install | Install git hooks. |
README.md Maintenance
Update README.md when changing: command surface, project structure, dev workflow, or prerequisites. Keep it concise (~100 lines).
Gotchas
Concrete pitfalls encountered when implementing Go backend code in Mazarbul. Add new ones as you hit them, this is the compounding-engineering log (see agent-docs/lessons-learned.md for the broader pattern).
- Never embed unbounded inside a tool's
Invoke. Any synchronous embedding call on the request path must either (a) bound itself with theinternal/ontology/deduppattern, a hard ceiling (defaultSemanticTimeout, 20s, indedup.go) plus a singleEmbedBatchround-trip instead of N per-text calls, or (b) defer the embed to a background worker the wayrememberandrecalldo (enqueue, return immediately, drain off the request path). A deadline-less embed makes the tool look hung when Ollama is cold or busy: this was the real cause of thedefineEntityKind"multi-second hang" (fixed in PR #286). When you add a new tool that needs a vector, copy the dedup ceiling-plus-batch shape; do not call the embedder in a bare loop.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

