confab-web / backend
CLAUDE.md15 starsChanged 3 months agoMITView on GitHub
Backend conventions Claude would get wrong by default — commands, sync rules, backend-only invariants. For architecture see README.md; for the package index see internal/README.md; for per-package conventions read the package README. Add to this file only when the rule is (a) backend-wide, (b) non-obvious from reading the code, and (c) Claude would get it wrong without the instruction. Full tests (final verification — requires Docker/Orbstack): Unit-only iteration: Sharded (parallel package-at-a-time, what CI runs): Integration tests use testutil.SetupTestEnvironment(t) for a containerized…
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- frontend/CLAUDE.mdCLAUDE.md
- add-session-cardSkill
- backend-maintenanceSkill
- bugfixSkill
- cut-releaseSkill
- frontend-maintenanceSkill
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
If the Go LSP is available, use it when it helps — go-to-definition, find-references, and hover types beat grep for cross-file symbol and …
- Very specific: line 42
Update the shared column list (db.SessionDetailColumns / sessionSelectCols) AND the shared Scan-target helper (db.SessionDetailScanTargets …
- Very specific: line 44
Add a wire-level assertion in the relevant *_http_integration_test.go: read the new field off the JSON response and check its value.
- Very specific: line 45
If the new field has provider/legacy/canonical normalization (like Provider), include each variant in the test table.
- Very specific: line 70
Run it locally before pushing: govulncheck ./cmd/server from backend/.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md 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
Backend Development Notes
What belongs in this file
Backend conventions Claude would get wrong by default — commands, sync rules, backend-only invariants. For architecture see README.md; for the package index see internal/README.md; for per-package conventions read the package README. Add to this file only when the rule is (a) backend-wide, (b) non-obvious from reading the code, and (c) Claude would get it wrong without the instruction.
Running tests
Full tests (final verification — requires Docker/Orbstack):
go test ./...Unit-only iteration:
go test -short ./...Sharded (parallel package-at-a-time, what CI runs):
./scripts/list-test-packages.sh
# then one `go test <pkg>` per line, parallelizedIntegration tests use testutil.SetupTestEnvironment(t) for a containerized Postgres + MinIO.
Formatting
CI runs make fmt-check (gofmt + go fix -diff) in the backend-unit job. Run make fmt before pushing. When bumping the Go version (go.mod + ci.yml together), also run make fmt: new toolchains add modernizers that the gate will flag.
Code intelligence (Go LSP)
If the Go LSP is available, use it when it helps — go-to-definition, find-references, and hover types beat grep for cross-file symbol and type work. Skip it when a plain read or grep is quicker.
When adding a field to a shared DB struct
Adding a column to db.SessionDetail, db.SessionListItem, or any struct loaded from SQL in more than one place:
- Update the shared column list (
db.SessionDetailColumns/sessionSelectCols) AND the shared Scan-target helper (db.SessionDetailScanTargets/scanSessionListItems) — both in one edit, since their order must match. - Grep for every other Scan into the struct (
grep -rn 'db.SessionDetail{' .). Confirm each goes through the shared helpers, not a hand-rolled column list. - Add a wire-level assertion in the relevant
*_http_integration_test.go: read the new field off the JSON response and check its value. Subset-of-columns drift is invisible to type checks; the wire test is the cheapest reliable guard. - If the new field has provider/legacy/canonical normalization (like
Provider), include each variant in the test table.
This rule exists because Go's database/sql silently allows Scan over a subset of columns. A parallel column list is one ghost-field bug waiting to happen.
Updating model pricing
Prices live in one place: internal/pricingsource/pricing.json (provider-nested, embedded via go:embed). To add or reprice a model, edit that file and bump its updated_at. There is no second table to keep in sync — the backend cost compute and the frontend both read from it.
The backend serves the effective table at GET /api/v1/pricing and refreshes it from confabulous.dev at runtime, so self-hosters pick up new prices without a redeploy (see internal/pricingsource/README.md). Read internal/analytics/README.md before adding an OpenAI entry — its billing conventions (cached_input as subset, reasoning_output as subset) differ from Anthropic's. Cache writes are not free across the board: the 5.6 and 6 families bill them at 1.25x short-context input, while older families publish no price and stay at 0. They cost nothing today only because the Codex wire carries no cache-write token count (md0z).
Anthropic prices: https://www.anthropic.com/pricing OpenAI prices: https://developers.openai.com/api/docs/pricing
Finding dead code
staticcheck ./...— unused unexported code (functions, types, vars, constants).deadcode -test ./...— whole-program reachability frommain()and tests.
Neither catches unused exported identifiers.
Vulnerability scanning
CI runs govulncheck ./cmd/server as a required check (the govulncheck job in
.github/workflows/ci.yml). It scans only the production binary's import graph,
so test-only advisories (e.g. testcontainers' Moby chain) don't block the gate.
Run it locally before pushing: govulncheck ./cmd/server from backend/. Most
stdlib findings are cleared by a Go patch bump — update the go directive in
go.mod and the go-version fields in ci.yml together.
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.

