Development guidance for Galipo, a legal case management system with MCP server + React dashboard. Handles backend (Python/FastAPI), frontend (React/Vite), database (PostgreSQL), and multi-repo workflows.
Development guidance for working with the Galipo codebase - a legal case management system for personal injury law firms.
Provides comprehensive context for developing Galipo, which operates as:
```
main.py # FastAPI + MCP server entry point
├── db/ # Database layer (connection, domain queries)
├── tools/ # MCP tools (AI interface)
├── routes/ # REST API endpoints (web UI interface)
└── frontend/src/
├── pages/ # Route pages
├── components/ # UI components by domain
├── api/ # API client functions
└── types/ # TypeScript interfaces
```
```bash
uvicorn main:app --reload --port 8000
python main.py
python migrations/run_migration.py
python migrations/run_migration.py <migration_file.sql>
```
```bash
cd frontend
npm run dev # Dev server at http://localhost:5173
npm run build # Production build
npm run lint # ESLint
npm run type-check # TypeScript type checking
```
```bash
psql $DATABASE_URL
./scripts/backup.sh
./scripts/restore.sh <backup_file>
RESET_DB=true python main.py
python scripts/generate_schema_diagram.py
```
**Note**: Schema diagram at `docs/schema.md` auto-updates via pre-commit hook when migrations or `db/connection.py` change.
**Always use `/dev` to start/restart all development servers**. This ensures:
Use `/dev`:
Logs are at: `/tmp/backend_$BACKEND_PORT.log` and `/tmp/frontend_$VITE_PORT.log`
For working on multiple branches simultaneously with isolated databases:
**Port allocation:**
| Copy | Backend | Frontend | Database |
|------|---------|----------|----------|
| mcp-galipo | 8000 | 5173 | galipo |
| mcp-galipo_2 | 8001 | 5174 | galipo_2 |
| mcp-galipo_3 | 8002 | 5175 | galipo_3 |
**Setup steps:**
1. Create databases:
```bash
/Applications/Postgres.app/Contents/Versions/latest/bin/psql postgres -c "CREATE DATABASE galipo_2;"
/Applications/Postgres.app/Contents/Versions/latest/bin/psql postgres -c "CREATE DATABASE galipo_3;"
```
2. Copy repo:
```bash
cd ~/Code
cp -r mcp-galipo mcp-galipo_2
cp -r mcp-galipo mcp-galipo_3
```
3. Update `.env` in each copy (change only these values):
```bash
DATABASE_URL=postgresql://YOUR_USER@localhost:5432/galipo_2
PORT=8001
BACKEND_PORT=8001
VITE_PORT=5174
DATABASE_URL=postgresql://YOUR_USER@localhost:5432/galipo_3
PORT=8002
BACKEND_PORT=8002
VITE_PORT=5175
```
4. Reinstall frontend dependencies:
```bash
cd mcp-galipo_2/frontend && rm -rf node_modules && npm install
cd mcp-galipo_3/frontend && rm -rf node_modules && npm install
```
5. Start each with `/dev` in separate Claude Code sessions
6. Optionally seed test data:
```bash
cd mcp-galipo_2
set -a && source .env && set +a
.venv/bin/python seed_dev_data.py
```
**When adding new Python directories/modules**, update the `Dockerfile` to include them:
```dockerfile
COPY main.py database.py tools.py routes.py auth.py ./
COPY db/ ./db/
COPY tools/ ./tools/
COPY routes/ ./routes/
COPY services/ ./services/
```
Missing COPY lines cause production `ModuleNotFoundError`. Ensure new packages have `__init__.py`.
**Run `/verify` before pushing changes that affect:**
The `/verify` skill checks:
**Critical**: Live production database receives schema changes automatically on app restart. No manual migration step exists - `migrate_db()` runs on startup.
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `DATABASE_URL` | Yes | (none) | PostgreSQL connection string |
| `AUTH_USERNAME` | Yes | (none) | Web dashboard login username |
| `AUTH_PASSWORD` | Yes | (none) | Web dashboard login password |
| `PORT` | No | 8000 | Backend server port (uvicorn) |
| `BACKEND_PORT` | No | 8000 | Backend port (Vite proxy config) |
| `VITE_PORT` | No | 5173 | Frontend dev server port |
| `ANTHROPIC_API_KEY` | No | (none) | For in-app chat feature |
| `CHAT_MODEL` | No | (none) | Model for in-app chat |
| `WEBHOOK_SECRET_COURTLISTENER` | No | (none) | CourtListener webhook secret |
| `RESET_DB` | No | false | Drop all tables on startup (dev only) |
**Never push automatically.** The user handles `git push` manually. Only commit when asked.
Development uses [lazygit](https://github.com/jesseduffield/lazygit) in a separate terminal to monitor git activity and handle pushes.
Project MCP servers in `.mcp.json`:
**Note**: Only use `sequential-thinking` MCP when explicitly requested by the user.
The database uses a person-centric model where:
1. **Use `/dev` liberally** to ensure services are running correctly
2. **Run `/verify` before pushing** database or type-related changes
3. **Update Dockerfile** when adding new Python packages
4. **Follow modular structure** - keep domain logic separated in `db/`, `tools/`, `routes/`
5. **Use context managers** for all database operations
6. **Invalidate queries** after mutations in frontend
7. **Never auto-push** - user handles git push manually
The codebase includes notes about planned person schema simplifications where role would drive UI instead of separate type fields, with person-level attributes for inherent/stable data and case-level attributes for engagement-specific overrides.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/galipo-legal-case-management-development/raw