Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
29 changes: 29 additions & 0 deletions CRUSH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CRUSH.md - Fantasy AI SDK

## Build/Test/Lint Commands
- **Build**: `go build ./...`
- **Test all**: `task test` or `go test ./... -count=1`
- **Test single**: `go test -run TestName ./package -v`
- **Test with args**: `task test -- -v -run TestName`
- **Lint**: `task lint` or `golangci-lint run`
- **Format**: `task fmt` or `gofmt -s -w .`
- **Modernize**: `task modernize` or `modernize -fix ./...`

## Code Style Guidelines
- **Package naming**: lowercase, single word (ai, openai, anthropic, google)
- **Imports**: standard library first, then third-party, then local packages
- **Error handling**: Use custom error types with structured fields, wrap with context
- **Types**: Use type aliases for function signatures (`type Option = func(*options)`)
- **Naming**: CamelCase for exported, camelCase for unexported
- **Constants**: Use const blocks with descriptive names (ProviderName, DefaultURL)
- **Structs**: Embed anonymous structs for composition (APICallError embeds *AIError)
- **Functions**: Return error as last parameter, use context.Context as first param
- **Testing**: Use testify/assert, table-driven tests, recorder pattern for HTTP mocking
- **Comments**: Godoc format for exported functions, explain complex logic inline
- **JSON**: Use struct tags for marshaling, handle empty values gracefully

## Project Structure
- `/ai` - Core AI abstractions and agent logic
- `/openai`, `/anthropic`, `/google` - Provider implementations
- `/providertests` - Cross-provider integration tests with VCR recordings
- `/examples` - Usage examples for different patterns
Loading
Loading