agentleFS
helixmlhelixml/kodit/CLAUDE.md

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
  1. Very specific:

    Always use make commands — never run go test, go vet, or golangci-lint directly.

    line 15
  2. Very specific:

    Run make check and confirm it passes (or at minimum make test for affected packages).

    line 30
  3. Distinctive:

    When pushing additional commits to an existing PR, update the PR title and description to reflect the full set of changes in the branch.

    line 39
  4. Very specific:

    Use structs, not map[string]interface{}

    line 45
  5. Distinctive:

    Use gomock, not testify/mock

    line 47
  6. Distinctive:

    No fallbacks — one approach, no fallback code paths

    line 48
  7. Distinctive:

    No type aliases — update all references when moving or renaming types

    line 49
  8. Distinctive:

    No panics — return errors.

    line 50
  9. Very specific:

    Every store embeds database.Repository[D, E] (internal/database/repository.go) and implements repository.Store[T] …

    line 55
  10. Very specific:

    Prefer the generic methods from Repository and Store — do not add custom query methods to stores.

    line 57
  11. Very specific:

    Use options to express queries — not one-off methods.

    line 71
  12. Very specific:

    Do not add Get/GetBy/FindBy/DeleteByX methods, store separate db/mapper fields, write raw WHERE clauses for equality filters, or rewrite …

    line 98
  13. Distinctive:

    When the user says "tdd", follow red-green strictly:

    line 102
  14. Distinctive:

    Red: Write a failing test. Run it, confirm it fails.

    line 104
  15. Distinctive:

    Run the full test suite for regressions.

    line 106
  16. Very specific:

    Use internal/testdb for test databases:

    line 108
  17. Distinctive:

    Every handler function registered in a chi router must have a complete swag annotation block before merging.

    line 128
  18. Distinctive:

    Methods: Prefer fewer than five public methods per class.

    line 147
  19. Distinctive:

    Encapsulation: Prefer four or fewer encapsulated objects per class.

    line 148
  20. Distinctive:

    Interfaces: Prefer interfaces. Keep them small.

    line 149
  21. Distinctive:

    Immutability: Default to immutable classes.

    line 150
  22. Distinctive:

    No globals: Prefer classes over public constants or enums.

    line 151
  23. Distinctive:

    Testing: Prefer fakes over mocks.

    line 152
  24. Distinctive:

    Boolean parameters: Don't use a boolean to switch between fundamentally different behaviours (split the method or use polymorphism).

    line 154
  25. Distinctive:

    Dependency injection: Use constructor injection.

    line 155

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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-converter

Build, 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:

  1. Run make check and confirm it passes (or at minimum make test for affected packages). Do not commit code that has not been validated.
  2. 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:

MethodSourcePurpose
Find(ctx, ...Option)RepositoryList entities matching options
FindOne(ctx, ...Option)RepositorySingle entity or ErrNotFound
Count(ctx, ...Option)RepositoryCount matching entities
Exists(ctx, ...Option)RepositoryCheck existence
DeleteBy(ctx, ...Option)RepositoryRemove matching entities
Save(ctx, entity)Store implCreate or update one entity
Delete(ctx, entity)Store implRemove one entity
DB(ctx)RepositoryRaw GORM session (last resort)
Mapper()RepositoryAccess 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:

  1. Red: Write a failing test. Run it, confirm it fails.
  2. Green: Minimal fix. Run test, confirm it passes.
  3. 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 schema

The 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 @Description note 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 new only 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.