kodit
CLAUDE.md126 starsChanged 9 months agoApache-2.0View on GitHub
Current year: 2026 — include "2026" in web searches for documentation and browser APIs. Install required development tools before doing anything else: Always use make commands — never run go test, go vet, or golangci-lint directly. The Makefile sets required build tags, CGO flags, and environment variables that raw go commands miss. Before committing: Commits and PRs use Conventional Commits: When pushing additional commits to an existing PR, update the PR title and description to reflect the full set of…
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
25 rules. About 0 are common, 17 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈17
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Always use make commands — never run go test, go vet, or golangci-lint directly.
- Very specific: line 30
Run make check and confirm it passes (or at minimum make test for affected packages).
- Distinctive: line 39
When pushing additional commits to an existing PR, update the PR title and description to reflect the full set of changes in the branch.
- Very specific: line 45
Use structs, not map[string]interface{}
- Distinctive: line 47
Use gomock, not testify/mock
- Distinctive: line 48
No fallbacks — one approach, no fallback code paths
- Distinctive: line 49
No type aliases — update all references when moving or renaming types
- Distinctive: line 50
No panics — return errors.
- Very specific: line 55
Every store embeds database.Repository[D, E] (internal/database/repository.go) and implements repository.Store[T] …
- Very specific: line 57
Prefer the generic methods from Repository and Store — do not add custom query methods to stores.
- Very specific: line 71
Use options to express queries — not one-off methods.
- Very specific: line 98
Do not add Get/GetBy/FindBy/DeleteByX methods, store separate db/mapper fields, write raw WHERE clauses for equality filters, or rewrite …
- Distinctive: line 102
When the user says "tdd", follow red-green strictly:
- Distinctive: line 104
Red: Write a failing test. Run it, confirm it fails.
- Distinctive: line 106
Run the full test suite for regressions.
- Very specific: line 108
Use internal/testdb for test databases:
- Distinctive: line 128
Every handler function registered in a chi router must have a complete swag annotation block before merging.
- Distinctive: line 147
Methods: Prefer fewer than five public methods per class.
- Distinctive: line 148
Encapsulation: Prefer four or fewer encapsulated objects per class.
- Distinctive: line 149
Interfaces: Prefer interfaces. Keep them small.
- Distinctive: line 150
Immutability: Default to immutable classes.
- Distinctive: line 151
No globals: Prefer classes over public constants or enums.
- Distinctive: line 152
Testing: Prefer fakes over mocks.
- Distinctive: line 154
Boolean parameters: Don't use a boolean to switch between fundamentally different behaviours (split the method or use polymorphism).
- Distinctive: line 155
Dependency injection: Use constructor injection.
≈ “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
Helix Development Rules
Current year: 2026 — include "2026" in web searches for documentation and browser APIs.
Setup
Install required development tools before doing anything else:
make tools # Install golangci-lint, goimports, swag, oapi-codegen, openapi-spec-converterBuild, Test, and Check
Always use make commands — never run go test, go vet, or golangci-lint directly. The Makefile sets required build tags, CGO flags, and environment variables that raw go commands miss.
make build # Build the binary
make test # Run all tests
make test PKG=./internal/foo/... # Test a specific package
make check # Format, vet, lint, and test
make check PKG=./internal/foo/... # Check a specific package
make test-smoke # Run smoke tests (needs running Docker env)Shipping Code
Before committing:
- Run
make checkand confirm it passes (or at minimummake testfor affected packages). Do not commit code that has not been validated. - Fix any failures before committing — do not skip or work around them.
Commits and PRs use Conventional Commits:
- Prefix:
feat:,fix:,docs:,refactor:,chore:,test:, etc. - Example commit:
feat: add webhook retry logic - PR titles follow the same format:
feat: add webhook retry logic
When pushing additional commits to an existing PR, update the PR title and description to reflect the full set of changes in the branch.
Go
- Fail fast:
return fmt.Errorf("failed: %w", err)— never log and continue - Error on missing configuration — fail with an error, don't log a warning and continue
- Use structs, not
map[string]interface{} - GORM AutoMigrate only — no SQL migration files
- Use gomock, not testify/mock
- No fallbacks — one approach, no fallback code paths
- No type aliases — update all references when moving or renaming types
- No panics — return errors; rewrite methods to support error returns if needed
- Log errors once at the top level — domain code returns errors, only handlers/workers log them
Repositories and Database Stores
Every store embeds database.Repository[D, E] (internal/database/repository.go) and implements repository.Store[T] (domain/repository/store.go).
Prefer the generic methods from Repository and Store — do not add custom query methods to stores. The base types already provide:
| Method | Source | Purpose |
Find(ctx, ...Option) | Repository | List entities matching options |
FindOne(ctx, ...Option) | Repository | Single entity or ErrNotFound |
Count(ctx, ...Option) | Repository | Count matching entities |
Exists(ctx, ...Option) | Repository | Check existence |
DeleteBy(ctx, ...Option) | Repository | Remove matching entities |
Save(ctx, entity) | Store impl | Create or update one entity |
Delete(ctx, entity) | Store impl | Remove one entity |
DB(ctx) | Repository | Raw GORM session (last resort) |
Mapper() | Repository | Access the entity mapper |
Use options to express queries — not one-off methods. Define options in domain/<domain>/options.go using repository.WithCondition:
func WithSHA(sha string) Option { return WithCondition("commit_sha", sha) }
commits, err := store.Find(ctx, repository.WithRepoID(id), repository.WithSHA(sha))
one, err := store.FindOne(ctx, repository.WithID(id))
count, err := store.Count(ctx, repository.WithRepoID(id))
exists, err := store.Exists(ctx, repository.WithSHA(sha))
err := store.DeleteBy(ctx, repository.WithRepoID(id))
saved, err := store.Save(ctx, commit)type CommitStore struct {
database.Repository[repository.Commit, CommitModel]
}
func NewCommitStore(db database.Database) CommitStore {
return CommitStore{
Repository: database.NewRepository[repository.Commit, CommitModel](db, CommitMapper{}, "commit"),
}
}For JOINs, use repository.WithParam and override Find in the store. See EnrichmentStore.
Do not add Get/GetBy/FindBy/DeleteByX methods, store separate db/mapper fields, write raw WHERE clauses for equality filters, or rewrite Find/FindOne/Count/Save/Delete/Exists/DeleteBy unless JOINs are needed. If a query can be expressed with options, use the generic methods.
Testing
When the user says "tdd", follow red-green strictly:
- Red: Write a failing test. Run it, confirm it fails.
- Green: Minimal fix. Run test, confirm it passes.
- Run the full test suite for regressions.
Use internal/testdb for test databases:
db := testdb.New(t) // Migrated in-memory database
db := testdb.NewPlain(t) // Plain in-memory (no migrations)
db := testdb.WithSchema(t, "...") // Plain with custom schemaThe internal/database package tests cannot use testdb (import cycle) and must create their own connections.
Database Access
PostgreSQL runs in the kodit-vectorchord container (database: kodit, user: postgres):
docker exec kodit-vectorchord psql -U postgres -d kodit -c "SELECT * FROM repositories LIMIT 5;"API Handlers
Every handler function registered in a chi router must have a complete swag annotation block before merging. Required fields:
@Summary— short one-line description@Description— longer description (include deprecation notice and replacement endpoint if applicable)@Tags— logical grouping (e.g.repositories,search,enrichments)@Accept/@Produce— content types (json,text/markdown, etc.)@Param— one entry per path, query, and body parameter@Success— at minimum the happy-path status + response type@Failure— at minimum 404 and 500; include 400 when the handler validates input@Security APIKeyAuth— required on all non-deprecated endpoints@Deprecated— required on deprecated endpoints (paired with a@Descriptionnote pointing to the replacement)@Router— path relative to the API version prefix + HTTP method
Software Engineering
Object-oriented design principles:
- Naming: Classes by what they are, not what they do (avoid -er suffixes). Methods are builders (noun) or manipulators (verb), rarely both. Variables should be explainable as single/plural nouns; prefer simple names over compound ones.
- Constructors: One primary constructor, secondaries delegate to it. Keep constructors light. Prefer
newonly in secondary constructors. - Methods: Prefer fewer than five public methods per class. Avoid static methods. Avoid null arguments and return values. Prefer richer encapsulation over getters/setters.
- Encapsulation: Prefer four or fewer encapsulated objects per class. Favour composition over inheritance.
- Interfaces: Prefer interfaces. Keep them small.
- Immutability: Default to immutable classes. Avoid type introspection and reflection unless the language idiom demands it.
- No globals: Prefer classes over public constants or enums.
- Testing: Prefer fakes over mocks.
- Design: Think in objects, not algorithms. Tell objects what you want; don't ask for data.
- Boolean parameters: Don't use a boolean to switch between fundamentally different behaviours (split the method or use polymorphism). Booleans are fine for orthogonal modifiers like filters or formatting options.
- Dependency injection: Use constructor injection. When a constructor accumulates many parameters, group related ones into a parameter/options object.
- Language idioms: Where these principles conflict with strong language conventions (e.g. Go exported struct fields, Python dataclasses), follow the language idiom and note the deviation.
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.

