fork of https://github.com/sourcegraph/zoekt
1# Zoekt Coding Agent Guidelines
2
3## Build & Test Commands
4- Build: `go build ./cmd/...`
5- Run all tests: `go test ./... -short`
6- Run a single test: `go test -run=TestName ./path/to/package`
7- Run specific test with verbose output: `go test -v -run=TestName ./path/to/package`
8- Benchmark: `go test -bench=BenchmarkName ./path/to/package`
9- Fuzzing: `go test -fuzz=FuzzTestName -fuzztime=30s ./package`
10- Smoke test: Check a specific repo: `go run ./cmd/zoekt-git-index /path/to/repo`
11
12## Code Style Guidelines
13- Import format: standard Go imports (stdlib, external, internal) with alphabetical sorting
14- Error handling: explicit error checking with proper returns (no ignored errors)
15- Naming: Go standard (CamelCase for exported, camelCase for private)
16- Tests: Table-driven tests preferred with descriptive names
17- Documentation: All exported functions should have comments
18- Shell scripts: Use shfmt with `-i 2 -ci -bn` flags
19- Proto files: Run buf lint and format checks
20- Memory optimization: As a code search database, Zoekt is memory-sensitive - be conscious of struct field ordering and memory usage in core structures
21
22## Documentation Resources
23- Design overview: `doc/design.md` - Core architecture and search methodology
24- Indexing details: `doc/indexing.md` - How the indexing process works
25- Query syntax: `doc/query_syntax.md` - Search query language reference
26- FAQ: `doc/faq.md` - Common questions and troubleshooting