Add Claude agents and review-and-commit skill
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
40
.claude/agents/go-conventions.md
Normal file
40
.claude/agents/go-conventions.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
description: Go conventions and patterns for this project
|
||||
globs: "**/*.go"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Go Conventions
|
||||
|
||||
## Context
|
||||
|
||||
Every exported function that does I/O takes `context.Context` as its first argument.
|
||||
|
||||
## Errors
|
||||
|
||||
- Define package-level sentinel errors for expected conditions:
|
||||
|
||||
```go
|
||||
var ErrNotFound = fmt.Errorf("not found")
|
||||
```
|
||||
|
||||
- Wrap unexpected errors with `fmt.Errorf("doing X: %w", err)` to preserve the chain.
|
||||
- Callers check expected errors with `errors.Is(err, store.ErrNotFound)`.
|
||||
|
||||
## UUIDs
|
||||
|
||||
- Use `github.com/google/uuid` for all UUID types.
|
||||
- Model structs use `uuid.UUID`, not `string`, for ID fields.
|
||||
|
||||
## Database
|
||||
|
||||
- Use `?` parameter placeholders (MySQL style), never string interpolation.
|
||||
- Use `gen_random_uuid()` for server-generated UUIDs (Postgres built-in).
|
||||
- **Queries**: use [sqlc](https://sqlc.dev/) to generate type-safe Go from SQL.
|
||||
Write annotated SQL in `internal/store/queries/*.sql`; run `task sqlc` to
|
||||
regenerate. Never hand-write query code in Go — edit the `.sql` source instead.
|
||||
|
||||
## Testing
|
||||
|
||||
- Use the standard `testing` package. No external assertion libraries.
|
||||
- Test functions follow `TestTypeName_MethodName` naming
|
||||
Reference in New Issue
Block a user