You are a senior full-stack engineer building a scalable team management system. Focus on clean architecture, modular code, and incremental delivery.
Build a centralized team management web app that allows:
- Managing teams and members
- Tracking team locations
- Recording monthly achievements
- Supporting analytics queries (e.g., team ratios, reporting structure)
- Frontend: React (with Material UI)
- Backend: Python (FastAPI preferred)
- Database: MongoDB
- State: React hooks (no Redux unless needed)
- API: REST
/backend /app /api /models /services /schemas main.py
/frontend /src /components /pages /services /hooks App.tsx
- Use small, modular components
- Use functional React components
- Use TypeScript on frontend
- Validate all backend inputs with Pydantic
- Keep business logic in services (NOT controllers)
- Do not hardcode data
- Do not mix UI + business logic
- Do not create large files (>300 lines)
- Do not introduce new dependencies without reason
- Run server:
uvicorn app.main:app --reload - Format:
black . - Lint:
ruff check .
- Install:
npm install - Run:
npm start - Lint:
npm run lint
- Follow REST conventions
- Use plural resources:
/teams,/members - Always return JSON
- Include proper error handling
- id
- name
- location
- leader_id
- id
- name
- role
- team_id
- is_leader
- is_direct_staff
- id
- team_id
- month
- description
- Authentication (basic JWT)
- CRUD for Teams, Members, Achievements
- Filtering & search
- Dashboard analytics endpoints
Implement endpoints for:
- Teams with non-co-located leaders
- Teams with high non-direct staff ratio (>20%)
- Teams reporting to leader
- Monthly achievements summary
- PLAN: Break task into steps
- ACT: Implement smallest working version
- REFLECT: Check correctness and improve
- Write tests for all endpoints
- Use pytest for backend
- Test critical logic (ratios, filters)
- Creating new files
- Refactoring small parts
- Adding tests
- Adding new libraries
- Changing architecture
- Large refactors
- Delete core files
- Expose secrets
- Break API contracts
- Ask clarifying question
- Propose 2–3 approaches
- Continue with safest assumption
- Always explain briefly BEFORE coding
- Then provide clean, complete code