CLAUDE.md
Guides Claude Code on the SalmonWatch monorepo structure, commands, schema, and implementation plan for an MVP.
What this file does
Guides Claude Code on the SalmonWatch monorepo structure, commands, schema, and implementation plan for an MVP.
When to use it
- Starting a new task in the 12-task Phase 1 plan
- Setting up the development environment for the first time
- Reviewing the database schema or API endpoints before coding
- Running tests or migrations for the backend or frontend
Assumes this stack
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project
SalmonWatch BC — open-source Pacific salmon intelligence platform for British Columbia. Monorepo with a Python FastAPI backend serving NuSEDS data from PostGIS and a Next.js 16 frontend rendering an interactive Deck.gl map.
Status: Early-stage MVP. Design docs and implementation plan exist; code is being built following the 12-task Phase 1 plan.
Architecture
NuSEDS CSV/XLSX → Python ingest → PostGIS → FastAPI JSON → Next.js → Deck.gl/uPlot
api/— Python 3.14 FastAPI backend. Source code inapi/src/salmonwatch/. SQLAlchemy 2.0 ORM with PostGIS spatial extensions. Alembic for migrations.web/— Next.js 16 (App Router), React 19, TypeScript, Tailwind CSS v4. Deck.gl + react-map-gl for mapping, uPlot for time series charts.data/— Raw data downloads (gitignored). NuSEDS Excel files go here.scripts/— Data processing and ingestion scripts.docs/plans/— Design doc and implementation plan.
Key Commands
Backend (api/)
cd api
pip install -e ".[dev]" # Install with dev dependencies
pytest tests/ -v # Run all tests
pytest tests/test_foo.py -v # Run single test file
pytest tests/test_foo.py::test_bar -v # Run single test
uvicorn salmonwatch.main:app --reload --host 0.0.0.0 --port 8000 # Dev server
alembic upgrade head # Run migrations
alembic revision --autogenerate -m "description" # Create migration
Frontend (web/)
cd web
npm install # Install dependencies
npm run dev # Dev server (localhost:3000)
npm run build # Production build
npm run lint # ESLint
Key References
- Design doc:
docs/plans/2026-02-28-salmonwatch-design.md— full product spec, UX flows, database schema, API endpoints, phased roadmap - Implementation plan:
docs/plans/2026-02-28-phase1-implementation.md— 12-task Phase 1 MVP plan with code snippets and file paths - NuSEDS data dictionary fields: AREA, WATERBODY, GAZETTED_NAME, SPECIES, ANALYSIS_YR, NATURAL_ADULT_SPAWNERS, NATURAL_JACK_SPAWNERS, NATURAL_SPAWNERS_TOTAL, ADULT_BROODSTOCK_REMOVALS, TOTAL_RETURN_TO_RIVER, ACCURACY, POPULATION, RUN_TYPE, WATERSHED_CDE
Tech Stack
| Layer | Technology |
|---|---|
| Frontend | Next.js 16, React 19, TypeScript, Tailwind CSS v4 |
| Mapping | Deck.gl + react-map-gl (Mapbox GL JS) |
| Charts | uPlot |
| Backend | Python 3.14, FastAPI, Uvicorn |
| ORM | SQLAlchemy 2.0 (async), GeoAlchemy2 |
| Database | PostgreSQL 16 + PostGIS |
| Migrations | Alembic |
| Data processing | pandas, geopandas, openpyxl |
| Deployment | Vercel (frontend) + Railway (API + PostgreSQL) |
Database Schema (Core)
- spawning_sites — 9,800+ salmon populations with PostGIS Point geometry (WGS84/SRID 4326). Columns: species, region, stream_name, conservation_unit, cu_status, lat/lon, geom. GiST index on geom.
- escapement_observations — One row per site per year. Columns: natural_adult_spawners, natural_jack_spawners, total_spawners, accuracy, run_type. Composite indexes on (site_id, year) and (species, year).
API Endpoints (Phase 1)
GET /v1/populations — GeoJSON FeatureCollection, filterable by species/region/year/cu_status
GET /v1/populations/{id} — Single population detail
GET /v1/populations/{id}/timeseries — Annual escapement array
GET /v1/stats — Aggregate statistics
GET /v1/status — Health check
Implementation Notes
- Implementation plan directs: use
superpowers:executing-plansskill to implement task-by-task - Species enum: chinook, sockeye, coho, chum, pink, steelhead
- Spatial data uses GeoJSON FeatureCollections for API responses
- Fraser Valley data is the starting scope; expand to all BC in Phase 2
- NuSEDS Fraser extract filename:
Fraser and BC Interior NuSEDS_20251014.xlsx
What's inside
6 sections: project overview, architecture, key commands, tech stack, database schema, API endpoints
Change this for your project
- Replace
SalmonWatch BCwith your project name - Replace
Fraser and BC Interior NuSEDS_20251014.xlsxwith your data file - Replace
docs/plans/2026-02-28-salmonwatch-design.mdwith your design doc path
Where it goes
Save as CLAUDE.md in your repository root. Claude Code reads it automatically at the start of every session.
Worth borrowing
- Monorepo layout with separate api/, web/, data/, scripts/, and docs/ directories
- Single-file orientation that lists all key commands and references for an AI coding assistant
- Explicit species enum and spatial data conventions for a geospatial app
Related Documents
Code indexing for AI agents: summarization strategies and evaluation systems
Synthesises 2024-2025 research on code indexing for AI agents, covering summarisation strategies, hybrid retrieval architectures, and evaluation benchmarks.
write-script
Guides an AI through writing a YouTube video script with strict structural, language, and quiz rules for a survival channel.
Claude AI Git Workflow Integration
Recommends using the git-ai-commit CLI tool for AI-generated commit messages instead of manual ones.
Missing Business Agents Research — FLUXION 2026
Identifies 12 missing business operations agents for an indie software company and ranks them by impact and effort with €0 implementation plans.