Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .claude/rules/base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Base Rules

BEFORE DOING ANYTHING, RESEARCH THE BEST APPROACH. ONCE YOU HAVE DONE SO, COME UP WITH A PLAN, PAUSE AND PROMPT FOR CONFIRMATION.

DO NOT ASSUME I AM RIGHT, VERIFY WHAT I ASSERT

- When working on a list of tasks in a README.md bullet list `- [ ] ...`, pick the next incomplete one and implement that, mark it as complete, then stop.
- If you are in read-only "Ask" mode, and are asked to modify something, immediately abort saying you can't modify anything.
- Do exactly what I ask, no more. Don't add extra scripts, documentation, etc.
- Always run tests to verify correctness.
- Always write tests for updated/new code.
- Be succinct.
- Don't write comments if the related code itself is simple.
- If you're not sure of next steps, ask for clarification.
- Prefer to create helper functions rather than writing single giant functions.
- Search for existing functions and reuse them where possible, refactoring them if the old functionality and new desired functionality is similar.
- Be succinct when writing documentation and comments.
- Always use ripgrep rather than grep.
- Extend or create abstractions where appropriate, rather than inlining large amounts of bespoke code.
- For changes that are fairly mechanical across 10 or more locations, prefer to create a temporary script that makes the change in one shot.
- If asked to research or plan something, do NOT include detailed configuration or code, just human readable descriptions.
44 changes: 44 additions & 0 deletions .claude/rules/go.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## Go (Golang) Code

- We are targeting Go 1.24 or newer.
- Use Go 1.22+'s new "for range" syntax everywhere possible.
- Combine multiple if clauses whose bodies do the same thing, into single expressions.
- Always use `any` rather than `interface{}`
- Use `github.com/alecthomas/errors` for errors if the project already uses it. It has `Errorf`, `New`, `Wrap`, etc.
- Always wrap errors, but try to be succinct if possible.
- Never use underscore in names.
- Use `github.com/alecthomas/assert/v2` for test assertions. In particular note that `assert.Equal()` performs a deep comparison.
- Prefer to compare whole objects rather than individual fields, using `assert.Equal(t, expected, actual, assert.Exclude[T]())` to exclude dynamic values like time.
- ALWAYS use table-driven tests if the tests can be parameterised on data. If not, just create distinct test functions.
- When writing "sub tests", their names MUST be UpperCamelCase.
- Test functions must always be UpperCamelCase, never with underscores.
- When writing code, avoid using `strings.Contains()` and string comparisons to compare types. Instead, use existing helper functions or methods, or write new ones.
- Where it makes sense, update existing test rather than creating new ones.
- ALWAYS run tests with `-timeout 30s` to ensure that wedged tests don't last forever.
- Don't run tests with `-v` in general, as it produces a large amount of output.
- Once the change is complete and working, run `golangci-lint run` and fix any linter errors introduced before adding the files to git. Do NOT EVER run `golangci-lint` on individual files.
- For "unparam" linter warnings about "XXX is unused", remove the parameter unless the type is part of an interface implementation or callback system.
- ALWAYS respect encapsulation of struct fields, even between types in the same package.
- ALWAYS apply the Go proverb "align the happy path to the left", to avoid deep nesting.

eg. instead of:
```go
if a, ok := doA(); ok {
if b, ok := doB(); ok {
// Code
}
}
```

Do this:

```go
a, ok := doA()
if !ok {
continue // Or return
}
b, ok := doB()
if !ok {
continue // Or return
}
```
4 changes: 0 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,6 @@ linters:
forbid-mutex: true

errcheck:
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
# Such cases aren't reported by default.
# Default: false
check-type-assertions: true
check-blank: true

exhaustive:
Expand Down
230 changes: 0 additions & 230 deletions docs/git-strategy-research.md

This file was deleted.

Loading