Standards

Overview & archetypes

On this page
  1. Operating context (read this first)
  2. Pick the archetype
  3. The standards
    1. Implementation standards (services & clients)
  4. Shared tooling

These standards describe how this fleet of repos is built. They are descriptive of patterns already in use across the reference repos, not aspirational.

Operating context (read this first)#

Every standard here assumes the same context. It is deliberately narrow:

  • Single developer, single user. Optimise for one person moving fast, not for teams. Commit directly to main; no PR review gates, no release trains. See workflow.md.
  • Self-hosted everything. CI runs on self-hosted agents (managed by agentutil), deploys land on the homelab via Komodo, client apps ship through the self-hosted apps.dev.thmsn.dev registry. There is no reliance on external SaaS for the core loop.
  • Reverse-domain identity. Everything namespaced under dev.thmsn.*.
  • Versions are cheap and disposable. Because there's one user and continuous deploy to main, versions exist for debugging ("which commit is this?"), not for release marketing. Hence the derived MAJOR.MINOR.<commit count> scheme.

Pick the archetype#

A repo is exactly one of these. The archetype tells you which standards are mandatory vs optional. Full rules in archetypes/.

ArchetypeWhat it isReference reposStandards that apply hardest
Full-stack productRust/Poem server emitting an OpenAPI contract, native clients per platform, deployed to the homelabsomeproductall of them
LibraryA shared lib* crate consumed by other repos over gitlibsomeproduct + the lib* familyversioning (light), identifiers, testing
OrchestrationDeployment/infra-as-code for the homelab itselfhomelabdeployment, identifiers, secrets split
CLI / service toolStandalone binary published to the registry with an install manifestsomeproduct (CLI), workerversioning, registry publishing, build info
Vendored appA third-party app we don't own, pinned as upstream/ and built/released into our infra à-la-carte (no rebrand)relay (wraps subpop/Relay)ci/cd, registry publishing, self-hosted agents

When a repo blends types (e.g. a product that also ships a CLI), apply each archetype to the relevant subtree.

The standards#

TopicDocOne-line rule
Versioningversioning.mdDerived MAJOR.MINOR.<commit count>; tag is the only manual knob.
Identifiersidentifiers.mdReverse-domain dev.thmsn.*; inject via libproduct.
Build infobuild-info.mdEmbed git/build metadata via libbuildinfo when feasible.
Brandingbranding.mdOne in-repo, code-as-truth generator produces all assets.
CI/CDci-cd.mdWoodpecker pipelines in .woodpecker/; build → GHCR/registry on main.
Self-hosted agentsself-hosted-agents.mdWoodpecker agents by label; dev Mac for Apple builds.
Deploymentdeployment.mdKomodo GitOps + Watchtower + Caddy; secrets out of git.
Registry publishingregistry-publishing.mdClient apps ship via apps.dev.thmsn.dev.
Testingtesting.md>80% on services; don't unit-test UIs; no change-detector tests.
Platform UXplatform-ux.mdNative per OS, designed for the target OS.
Workflowworkflow.mdCommit to main; versions for debugging, not releases.
Skills & MCPskills-and-mcp.mdShared skills/MCP live here; repos link them in.
Shortcutsshortcuts.mdRepeated operational questions get a one-command answer in the repo's SHORTCUTS.md.
READMEsreadmes.mdRoot README.md everywhere: pitch, mechanism, layout, quickstart, what CI runs, what's missing.

Implementation standards (services & clients)#

Deeper technical conventions, mostly for the full-stack-product archetype (some apply to libraries/CLIs too):

TopicDocOne-line rule
Service architectureservice-architecture.mdWorkspace layered core→db→engine→api; poem-openapi; 10s graceful drain.
Data & persistencedata-persistence.mdsqlx + SQLite, .sql migrations, typed Id<T> (UUIDv7).
Backupsbackups.mdstash-backup sidecar per stateful stack → Secure/Application Backups/<product> on the NAS; stash audits and drills them; keys never under /data.
Public short idspublic-ids.mdStored 11-char Crockford-Base32 alias; URLs use it, UUID stays internal.
API contractscontracts.mdServer emits OpenAPI/AsyncAPI; clients generated + drift-checked.
Error handlingerror-handling.mdDomain Error→HTTP; liberror+thiserror+valuable trinity.
Auth integrationauth-integration.mdCentral auth via SDK; explicit mode (fail-closed); TLS transport; me() is live authority; grant-gated.
Refresh tokensrefresh-tokens.mdClient stores in Keychain/DPAPI/httpOnly-cookie/0600; rotate single-flight; refresh is non-idempotent.
Configurationconfiguration.mdlibconfig Loader: defaults→TOML→shared→prefixed env.
Observabilityobservability.mdliblog/OTLP; /api/metrics; log ids/timings, never bodies.
Tracingtracing.mdAlways-on export, collector tail-samples; spans finish inside 60 s; traceparent + x-<product>-* from clients, trace id echoed as Ref:.
Client analyticsclient-analytics.mdClients batch usage events to their own server, which re-emits them as OTLP logs routed to ClickHouse; no third-party analytics SDKs, no user content in props.
Alertingalerting.mdGrafana-provisioned rules as code; alert on repetition and severity, never a retry's substring; liveness at minimum.
Grafana dashboardsgrafana-dashboards.mdCommitted <name>.dashboard.json; queries key off fleet identifiers.
Securitysecurity.mdArgon2, ChaCha20-Poly1305, CSP, SSRF/decompression caps.
Web & client archweb-architecture.mdTanStack Query (server) + Zustand (UI); generated client; @thmsn/ui on Tailwind v4; shared Kit.
Rust conventionsrust-conventions.mdEdition 2024, clippy pedantic + allowlist, git deps.
lib* ecosystemlib-ecosystem.mdSolve cross-cutting concerns once in a shared lib*.

Unfamiliar term? glossary.md defines the conventions, concepts, infrastructure, and lib* toolchain referenced throughout.

Shared tooling#

Beyond docs, every repo gets the same tooling from the standards server at https://standards.thmsn.dev:

  • The standards MCP: search, get_doc, get_checklist, get_template, get_skill, registered once per machine at user scope.
  • thmsn-* skills: stubs in ~/.claude/skills/ whose bodies are fetched from the server.
  • The standards cli: doctor wires the machine and checks a repo; init / new scaffold one.

A repo keeps only .standards.conf and the Standards: line in its AGENTS.md. See skills-and-mcp.md, and migration.md to move a repo off the old standards/ submodule.

Status: complete first draft. All standards, all five archetypes, skills-and-mcp, and the copyable templates are written and cross-linked. Open for iteration.