name: Adding Alphapoly Features description: Guides feature development in the alphapoly codebase following stack conventions (uv, polars, FastAPI+Next.js). Use whenever adding, building, or modifying any feature — including new API endpoints, pipeline steps, UI pages, WebSocket services, or any other backend/frontend work. If the user says "add X", "build X", "implement X", "make X work", "create an endpoint", "wire up", "hook up", or "connect X to Y", use this skill. For quick prototypes, consider alphapoly-experiment instead.
Adding Alphapoly Features
Key Conventions
- Backend: Python + FastAPI,
uvonly (never pip/conda),polars(never pandas) - Frontend: Next.js App Router, TypeScript
- Default LLM:
xiaomi/mimo-v2-flash:freevia OpenRouter - Run Python from:
backend/directory
Workflow
- Implement — follow patterns in neighboring files; see Common Touch Points below
- Lint —
make lintauto-fixes backend (ruff) and frontend (prettier + eslint) - Typecheck —
cd frontend && npm run typecheck(report-only; fix all errors before committing) - Verify — start
make devand manually test the feature works (check API responses, UI renders, WebSocket connects) - Commit —
type: description(feat/fix/refactor/chore)
Common Touch Points
New API endpoint:
- Add router:
backend/server/routers/<name>.py - Register in:
backend/server/main.py - Add TS types:
frontend/types/ - For complex logic, add a service in
backend/server/(followportfolio_service.pypattern)
New pipeline step:
- Add to:
backend/core/steps/ - Wire into:
backend/core/runner.py - For LLM/ML model access: use singletons in
backend/core/models.py
New domain feature (trading, wallet, positions):
- Add subdirectory:
backend/core/<domain>/withmanager.pyand/orservice.py - Add router:
backend/server/routers/<domain>.py - Follow existing pattern in
core/positions/,core/wallet/,core/trading/
New UI page:
- Add:
frontend/app/<page>/page.tsx - Link from:
frontend/components/Sidebar.tsx - API/tier config:
frontend/config/(api-config.ts,tier-config.ts)
WebSocket service:
- Backend:
backend/server/routers/(followportfolio_prices.pypattern) - Frontend hook:
frontend/hooks/ - Note:
frontend/server.jsproxies/api/*and/ws/*to the backend