Style Guide
Audience: anyone writing code or docs in the Pulse repository.
This page summarises the conventions enforced by review and by CI. The
authoritative source is the “Code Conventions” section of
CLAUDE.md;
copy that file’s rules when in doubt.
Go style
- Standard
gofmt/go vetcleanliness —make lintis the gate. - Module path is
github.com/frankbardon/pulse. The standard-libraryiocollision is handled by aliasing the project’s package aspio "github.com/frankbardon/pulse/io". - Library-first: business logic lives in library packages, never in
cmd/pulse/. The CLI parses flags, calls the library, formats output. - All file I/O routes through the injected
afero.Fs— neveros.Open/os.ReadFiledirectly in library code, because that defeatsfs.NewMemMap()for tests and the extension hook for custom storage backends.
Naming
- Component types use
SCREAMING_SNAKE_CASE:AGG_COUNT,ATTR_ZSCORE,FILTER_INCLUDE,GROUP_CATEGORY,WIN_LAG,FEAT_LOG,TEST_T. - Error codes use
DOMAIN_CATEGORYformat, organised by the six domains listed in CLAUDE.md (ENCODING,PROCESSING,SERVICE,DATA,CLI,PULSE). - Field types use lowercase snake (
u8,packed_bool,categorical_u16,decimal128,set_u256).
Structural bans
These are enforced by non-skippable CI gates:
| Ban | Enforced by |
|---|---|
internal/descriptor/ MUST NOT import internal/service/ or internal/processing/ | TestPredictNoExecutionImports |
descriptor/ + internal/descriptor/ MUST NOT use fmt.Sprintf for JSON construction | TestDescriptorNoFmtSprintf |
Golden files in descriptor/testdata/ MUST NOT be hand-edited | TestGoldensNotHandEdited |
| No predecessor-project string prefixes in error codes or type constants | TestNoOrbitPrefixes (errors), TestNoOrbitPrefix (types) |
CLAUDE.md names the current format_version and stays under its size ceiling | TestClaudeMdMentionsFormatVersion, TestClaudeMdSizeBudget |
Every PULSE_* env var has a row in Options → Environment variables | TestEnvVarsDocumented |
See the Pull Request Process for how these surface during review.
Comments and prose
- Public Go symbols carry a godoc-shaped comment opening with the symbol name.
- Skill files use YAML frontmatter (
name,description,type,applies_to) and are LLM-facing — keep them in MCP voice (tool calls, JSON payloads). The human-facing equivalent is this site; cross-link from each side. - mdBook chapters open with a one-sentence summary and an Audience line. See any of the already-authored chapters in this site for the tone.
The Update Demand
The single most important convention: a code change ships with its companions (skills, capability declarations, book pages, goldens) in the same PR, and most are gate-enforced. CLAUDE.md is not a companion. The Update Demand chapter explains how to find them. Read it before opening a PR that touches a registered surface (new aggregator, new error code, new CLI flag, new field type, …).