

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# BirdNET-Go Development Guidelines23## Project Overview45BirdNET-Go: Go implementation of BirdNET for real-time bird sound identification aimed for non serious birders and home users. Open source project for fun.67## Quick Navigation89- **Frontend**: See `frontend/CLAUDE.md` for Svelte 5, TypeScript, UI10- **Backend**: See `internal/CLAUDE.md` for Go standards, testing11- **API v2**: See `internal/api/v2/CLAUDE.md` for endpoints12- **Testing**: See `TESTING.md` for test patterns, testify usage, shared helpers1314**IMPORTANT**: Always read the relevant CLAUDE.md file before working on code:1516- Working on Go code? Read `internal/CLAUDE.md` first17- Working on frontend? Read `frontend/CLAUDE.md` first18- Working on API v2? Read `internal/api/v2/CLAUDE.md` first19- Writing tests? Read `TESTING.md` first - all tests MUST use testify20- Working with Sentry issues or support dumps? Load the `sentry` skill first2122## Universal Rules2324### Critical Constraints2526- **NEVER expand API v1** - All new endpoints in `internal/api/v2/`27- **Always lint before commit**: `golangci-lint run -v` (Go), `npm run check:all` (Frontend)28- **Branch from updated main**: `git pull origin main && git checkout -b feature-name`29- **No magic numbers/strings** - Use named constants with descriptive names30- **Settings must support hot-reload** - All settings changed via the UI must take effect immediately without requiring a server restart. Use per-request checks (e.g., dynamic middleware) instead of startup-time branching.3132### Project Structure3334| Path | Purpose |35| ------------ | ------------------ |36| `/cmd/` | Viper CLI commands |37| `/internal/` | Private packages |38| `/pkg/` | Public packages |39| `/frontend/` | Svelte 5 UI |4041## Code Search & Refactoring4243**Use ast-grep instead of grep/sed for code operations** - it's more reliable and syntax-aware.4445### Search Operations4647```bash48# ❌ Avoid grep for code patterns49grep -r "function.*async" src/5051# ✅ Use ast-grep - understands syntax52ast-grep --pattern "async function $NAME($$$) { $$$ }" src/5354# ❌ Complex grep with regex55grep -r "console\.\(log\|warn\|error\)" src/5657# ✅ Structural pattern matching58ast-grep --pattern "console.$METHOD($$$)" src/59```6061### Refactoring Operations6263```bash64# ❌ Avoid sed for code changes65sed 's/let \([a-zA-Z]*\) =/const \1 =/g' file.js6667# ✅ Use ast-grep rewrite - syntax-safe68ast-grep --pattern "let $VAR = $VALUE" --rewrite "const $VAR = $VALUE" src/6970# ✅ Complex refactoring example71ast-grep --pattern "export let $PROP" --rewrite "let { $PROP } = \$props()" --lang svelte src/72```7374### Why ast-grep?7576- **Syntax-aware**: Won't break code structure77- **Language-specific**: Supports TypeScript, Svelte, Go, etc.78- **Reliable**: Matches semantic patterns, not just text79- **Safe refactoring**: Preserves code meaning8081**Frontend**: See `frontend/doc/AST-GREP-SETUP.md` for complete ast-grep integration guide.8283## Build Commands8485| Command | Purpose |86| --------------------- | ----------------------------------- |87| `task` | Default build (auto-detects target) |88| `task dev_server` | Development with hot reload |89| `task frontend-build` | Frontend only |90| `task clean` | Clean artifacts |91| `task linux_amd64` | Cross-platform builds |9293## Pre-Commit Checklist94950. Run preflight quality gate: `/preflight` (or follow `.agents/skills/preflight/SKILL.md`)961. Run linters: `golangci-lint run -v` / `npm run check:all`972. Run tests: `go test -race -v` / `npm test`983. Check open PRs to avoid conflicts994. Format markdown with prettier1005. Document all exports101102## QA Testing Framework103104The BirdNET-Go QA system lives in `~/src/birdnet-go-qa/`. Always use it instead of ad-hoc test scripts.105106### Key Paths107108| Path | Purpose |109|------|---------|110| `~/src/birdnet-go-qa/e2e/tests/` | Playwright E2E test specs |111| `~/src/birdnet-go-qa/configs/` | Test runtime configs (mounted into containers) |112| `~/src/birdnet-go-qa/Taskfile.yml` | Task runner for build/deploy/test workflows |113| `~/src/birdnet-go-qa/Dockerfile.test` | Test container image definition |114115### Running E2E Tests116117```bash118# Build test image with latest binary119cp ~/src/birdnet-go/bin/birdnet-go ~/src/birdnet-go-qa/birdnet-go120cd ~/src/birdnet-go-qa && podman build -t birdnet-go:test -f Dockerfile.test .121122# Deploy test container (dashboard config, port 8085, auth enabled)123podman run -d --name birdnet-go-test --network host \124 -v ~/src/birdnet-go-qa/configs/test-runtime-dashboard:/config \125 birdnet-go:test126127# Run specific test suites128cd ~/src/birdnet-go-qa/e2e129npm run test:settings # Settings CRUD round-trip (15 tests)130npm run test:fuzz # Settings fuzzer131npm run test:integrity # Config integrity132npm run test:alerts # Alert rules133npm run test:eq-gain # Audio EQ134```135136### Config Management Tests137138For config hot-reload QA, these are the relevant test files:139- `settings-roundtrip.spec.js` - PATCH/PUT persistence, CSRF, validation140- `settings-fuzzer.spec.js` - Fuzzing settings with random/boundary values141- `config-integrity.spec.js` - Config structure validation142- `hot-reload-comprehensive.sh` - Shell-based hot-reload tests143- `hot-reload-deep.sh` - Deep hot-reload edge cases144- `audio-eq-save.spec.js` - Audio equalizer save round-trip145146### Forgejo QA Wiki147148Full documentation in the birdnet-go-qa Forgejo wiki: `http://localhost:3000/tphakala/birdnet-go-qa/wiki/`149150## PR Review Workflow151152Automated code review (CodeRabbit, plus the repo's configured review checks) runs on new PRs automatically and checks for bugs, security issues, and best practices. After pushing fixes, you can request a fresh CodeRabbit pass:153154```bash155# Re-request a CodeRabbit review156gh pr comment <PR_NUMBER> --body "@coderabbitai review"157158# Or from current branch159gh pr comment $(gh pr view --json number -q .number) --body "@coderabbitai review"160```161162### Handling PR Review Comments163164When fetching and addressing code review comments from a PR, use the receiving-code-review skill:165166```text167/superpowers:receiving-code-review168```169170This skill ensures:171172- Technical verification before implementing suggestions173- Appropriate pushback on incorrect feedback174- No performative agreement - just fix and move on175- Clarification of unclear items before partial implementation176
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| tphakala/birdnet-go.cursor/rules/database.mdc · 1.6k | Cursor rules | databasedo-not | 45/100 | today | |
| tphakala/birdnet-go.cursor/rules/frontend.mdc · 1.6k | Cursor rules | dependenciesuido-not | 61/100 | today | |
| tphakala/birdnet-go.cursor/rules/go.mdc · 1.6k | Cursor rules | buildteststylearch+5 | 69/100 | today | |
| tphakala/birdnet-go.cursor/rules/go_test.mdc · 1.6k | Cursor rules | setupteststyletesting-strategy+1 | 56/100 | today | |
| tphakala/birdnet-goAGENTS.md · 1.6k | AGENTS.md | teststylegitdo-not+1 | 78/100 | today | |
| tphakala/birdnet-gofrontend/CLAUDE.md · 1.6k | CLAUDE.md | setuptestlint-formatstyle+7 | 84/100 | today | |
| tphakala/birdnet-gofrontend/src/lib/desktop/components/CLAUDE.md · 1.6k | CLAUDE.md | teststylearchui | 70/100 | today | |
| tphakala/birdnet-gofrontend/src/lib/desktop/components/ui/CLAUDE.md · 1.6k | CLAUDE.md | styleuidocs | 54/100 | today | |
| tphakala/birdnet-gofrontend/src/lib/desktop/features/settings/CLAUDE.md · 1.6k | CLAUDE.md | buildstylearchtypes+2 | 66/100 | today | |
| tphakala/birdnet-gofrontend/static/messages/CLAUDE.md · 1.6k | CLAUDE.md | archuido-notagent-behaviour | 67/100 | today | |
| tphakala/birdnet-gofrontend/tools/CLAUDE.md · 1.6k | CLAUDE.md | no sections | 65/100 | today | |
| tphakala/birdnet-gointernal/CLAUDE.md · 1.6k | CLAUDE.md | buildteststylearch+5 | 88/100 | today | |
| tphakala/birdnet-gointernal/api/v2/CLAUDE.md · 1.6k | CLAUDE.md | teststylesecurityapi+1 | 84/100 | today | |
| tphakala/birdnet-gointernal/errors/CLAUDE.md · 1.6k | CLAUDE.md | styleuiperformancedo-not+1 | 61/100 | today |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 7 days ago | |
| stacklok/toolhiveCLAUDE.md · 2.0k | CLAUDE.md | buildteststylearch+4 | 100/100 | 14 days ago | |
| Adit-Jain-srm/NightmareNetCLAUDE.md · 46 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 14 days ago | |
| microsoft/playwrightCLAUDE.md · 95k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 7 days ago | |
| dotCMS/corecore-web/CLAUDE.md · 949 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 14 days ago | |
| tyrchen/geektime-bootcamp-aiw7/genslides/backend/CLAUDE.md · 230 | CLAUDE.md | testlint-formatstylearch+6 | 100/100 | 9 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.5k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 14 days ago | |
| dotCMS/coreCLAUDE.md · 949 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | today |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/tphakala-birdnet-go-claude)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.