| name | ai-coach |
| description | Manage the AI coaching system for NutriProfile. Use this skill when working with personalized nutrition advice, daily tips, motivational messages, challenges, or the coaching features. Handles user context, streak management, and gamification integration. |
| allowed-tools | Read,Write,Edit,Grep,Glob,Bash |
NutriProfile AI Coach Skill
You are an AI coaching expert for the NutriProfile application. This skill helps you work with the personalized coaching system that provides nutrition advice, motivation, and challenges.
Context
NutriProfile's AI Coach uses Mistral and Llama models to generate personalized advice based on:
- User's nutritional profile (BMR, TDEE, goals)
- Recent meal history (7 days)
- Activity and weight tracking
- Current streaks and achievements
- Progress toward goals
Architecture
Backend Files
backend/app/agents/coach.py - Coaching agent implementation
backend/app/api/v1/coaching.py - Coaching API endpoints
backend/app/models/gamification.py - Achievement, Streak, UserStats models
backend/app/services/gamification.py - Gamification logic
Frontend Files
frontend/src/components/dashboard/CoachingCard.tsx - Daily coaching widget
frontend/src/components/dashboard/AchievementBadge.tsx - Badge display
frontend/src/components/dashboard/StreakCounter.tsx - Streak visualization
Data Models
UserStats Model
class UserStats(Base):
id: int
user_id: int
xp: int
level: int
total_meals_logged: int
total_recipes_generated: int
total_activities_logged: int
created_at: datetime
updated_at: datetime
Achievement Model
class Achievement(Base):
id: int
user_id: int
achievement_type: str
unlocked_at: datetime
Streak Model
class Streak(Base):
id: int
user_id: int
streak_type: str
current_count: int
longest_count: int
last_activity_date: date
Achievement Types (20+ Badges)
Meal Logging
first_meal - Log first meal
meal_streak_7 - 7-day meal logging streak
meal_streak_30 - 30-day meal logging streak
variety_champion - Log 20 different foods
Activity
first_workout - Log first activity
activity_streak_7 - 7-day activity streak
calorie_burner - Burn 10,000 calories total
Nutrition Goals
protein_master - Hit protein target 7 days
balanced_week - Stay within macros for 7 days
hydration_hero - Meet water goal 14 days
Recipes
chef_beginner - Generate first recipe
chef_expert - Generate 50 recipes
Engagement
early_adopter - Join in first month
loyal_user - Active for 90 days
Coach Agent Flow
async def generate_advice(self, user_id: int) -> CoachingResponse:
profile = await self.get_user_profile(user_id)
meals = await self.get_recent_meals(user_id, days=7)
stats = await self.get_user_stats(user_id)
streaks = await self.get_streaks(user_id)
context = self._build_coaching_context(profile, meals, stats, streaks)
advice = await self.query_model(context)
tips = self._generate_tips(profile, meals)
return CoachingResponse(
daily_tip=advice.daily_tip,
suggestions=advice.suggestions,
motivation_level=self._calculate_motivation(stats),
challenges=self._generate_challenges(profile),
confidence=advice.confidence
)
API Endpoints
Daily Coaching
GET /api/v1/coaching/daily
Response:
{
"daily_tip": "Vous avez bien progressé cette semaine !",
"suggestions": [
"Ajoutez plus de légumes verts",
"Pensez à vous hydrater"
],
"motivation_level": "high",
"challenges": [
{
"type": "protein",
"target": 120,
"current": 85,
"reward_xp": 50
}
],
"confidence": 0.82
}
Other Endpoints
GET /api/v1/coaching/stats - User statistics
GET /api/v1/coaching/achievements - Unlocked badges
GET /api/v1/coaching/streaks - Current streaks
POST /api/v1/coaching/complete-challenge - Mark challenge done
Freemium Limits
| Tier | Coach Messages/Day |
|---|
| Free | 1 |
| Premium | 5 |
| Pro | Unlimited |
XP and Leveling System
XP Sources
- Log meal: +10 XP
- Hit daily target: +25 XP
- Complete challenge: +50 XP
- Unlock achievement: +100 XP
- 7-day streak: +200 XP
Level Thresholds
def calculate_level(xp: int) -> int:
return min(50, int(1 + (xp / 100) ** 0.6))
Frontend Integration
Coaching Widget
const { data: coaching } = useQuery({
queryKey: ['coaching', 'daily'],
queryFn: () => coachingApi.getDaily(),
staleTime: 1000 * 60 * 60
})
i18n Namespace
Use dashboard namespace:
dashboard.coaching.title - Widget title
dashboard.coaching.tip - Daily tip label
dashboard.coaching.suggestions - Suggestions section
dashboard.coaching.challenge - Challenge label
Best Practices
- Personalize advice - Use user's specific data, not generic tips
- Stay positive - Focus on progress, not failures
- Be actionable - Give specific, doable suggestions
- Track engagement - Monitor which tips users act on
- Fallback gracefully - Have pre-defined tips if AI unavailable
Example Tasks
Add New Achievement Type
- Add to
ACHIEVEMENT_TYPES enum in gamification model
- Implement unlock logic in gamification service
- Create badge icon in frontend assets
- Add translations for badge name/description
- Test unlock conditions
Improve Coach Advice Quality
- Review prompts in
coach.py
- Add more context (weight trends, activity patterns)
- Test with various user profiles
- Collect user feedback on advice quality
Add New Challenge Type
- Define challenge in coaching model
- Add validation logic
- Set XP reward amount
- Update frontend challenge display
- Add i18n translations