Skill: 0xjaspreet/wger-openclaw (version 1.0.0)

--- name: wger-fitness description: Manage gym routines and fitness tracking in wger via API. Use for viewing, editing, creating workouts, logs, nutrition plans, and progress analysis. Integrates with OpenClaw crons/subagents for automated tracking. Triggers on fitness/gym/wger queries: (1) Log workouts, (2) View routines/plans, (3) Update goals, (4) Generate reports, (5) API-based pulls/pushes. --- # wger Fitness Manager wger is an open-source fitness tracker with REST API for routines, logs, nutrition, and progress. This skill handles API interactions for seamless integration with OpenClaw (exec/curl for calls, subagents for analysis). ## Setup (One-Time) - API Base: https://wger.de/api/v2/ (or self-hosted URL). - Auth: Token from wger dashboard (User > API). Set env WGER_TOKEN=your_key or pass in commands. - Test: exec curl -H "Authorization: Token $WGER_TOKEN" https://wger.de/api/v2/workout/ (lists routines). ## Core Workflows ### 1. View Routines & Plans Load current workouts/logs. Example: - List routines: exec curl -H "Authorization: Token $WGER_TOKEN" "https://wger.de/api/v2/workout/?format=json&limit=5" - Get log: exec curl -H "Authorization: Token $WGER_TOKEN" "https://wger.de/api/v2/workoutlog/?workout=[ID]&format=json" - Analyze: Subagent parses JSON (reps/weight trends), ties to goals (e.g., "Squat progress +10lbs—good for stamina"). Action: Use read tool on scripts/view_logs.py for formatted output. ### 2. Edit/Create Workouts Add/update routines/logs. Example: - Create log: exec curl -X POST -H "Authorization: Token $WGER_TOKEN" -H "Content-Type: application/json" -d '{"date": "2026-04-15", "workout": [ID], "exercises": [{"reps": 10, "weight": 135, "exercise": [SQUAT_ID]}]}' https://wger.de/api/v2/workoutlog/ - Update routine: exec curl -X PATCH -H "Authorization: Token $WGER_TOKEN" -H "Content-Type: application/json" -d '{"name": "Updated Cyber Grind"}' https://wger.de/api/v2/workout/[ID]/ Action: Run scripts/create_log.py or edit_log.py with params (date, exercise, reps). ### 3. Nutrition & Goals Track meals, set targets. Example: - Log meal: exec curl -X POST -H "Authorization: Token $WGER_TOKEN" -d '{"date": "2026-04-15", "meal": [ID], "nutritional_values": {"calories": 500, "protein": 30}}' https://wger.de/api/v2/nutritionlog/ - View goals: exec curl -H "Authorization: Token $WGER_TOKEN" https://wger.de/api/v2/weight/ Action: Use references/nutrition.md for macros; scripts/set_goal.py for updates. ### 4. Reports & Analysis Generate progress, export. Example: - Progress report: exec python scripts/generate_report.py --period week --output pdf (uses API for data, matplotlib for charts). - Cron Integration: In subagents, pull data, analyze (e.g., "Adherence 80%—suggest HIIT for JITA"). ## Bundled Resources - scripts/view_logs.py: Fetch and format logs (JSON to readable). - scripts/create_log.py: POST new workout entry (params: date, routine_id, exercises). - references/api_endpoints.md: Full wger API ref (routines, logs, nutrition). - assets/progress_template.html: Basic chart template for reports. ## When to Use Trigger on: "Log my workout", "View wger routine", "Update fitness plan", "wger API call", "Fitness progress report". For automation: Crons/subagents (e.g., daily pull to health.md). Security: Token in env; self-host for privacy (Docker setup in references/selfhost.md). Rate: 100/min—fine for pulls.

path: references/api_endpoints.md
content: # wger API Endpoints Reference

## Authentication
- Header: Authorization: Token [your_token]
- Base: https://wger.de/api/v2/

## Workouts & Logs
- List routines: GET /workout/?format=json&limit=10
- Create log: POST /workoutlog/ {date, workout, exercises[]}
- View log: GET /workoutlog/[id]/ {reps, weight, date}
- Update log: PATCH /workoutlog/[id]/ 

## Nutrition
- Log meal: POST /nutritionlog/ {date, meal_id, nutritional_values {calories, protein}}
- Goals: GET /weight/ for weight logs

## Exercises
- Search: GET /exercise/?search=squat&language=2 (EN)

Full docs: https://wger.readthedocs.io/en/latest/api.html


path: references/selfhost.md
content: # Self-Host wger (Docker)

docker-compose.yml:
version: '3'
services:
  db:
    image: postgres:15
    environment:
      POSTGRES_DB: wger
      POSTGRES_USER: wger
      POSTGRES_PASSWORD: pass
    volumes:
      - db_data:/var/lib/postgresql/data
  wger:
    image: wger/server:latest
    ports:
      - "8000:80"
    environment:
      DB_HOST: db
      DB_NAME: wger
      DB_USER: wger
      DB_PASS: pass
    depends_on:
      - db
volumes:
  db_data:

Run: docker compose up -d
Access: http://localhost:8000
API: http://localhost:8000/api/v2/
Secure with Tailscale/VPN.


path: scripts/create_log.py
content: #!/usr/bin/env python3
import requests
import json
import sys
import os

BASE_URL = 'https://wger.de/api/v2/'
[REDACTED_SECRET]'WGER_TOKEN')

if not [REDACTED_SECRET]"Error: Set WGER_TOKEN env var")
    sys.exit(1)

def create_log(date, workout_id, exercises):
    headers = {'Authorization': f'Token {TOKEN}', 'Content-Type': 'application/json'}
    data = {
        'date': date,
        'workout': workout_id,
        'exercises': exercises  # List of dicts: [{'reps': 10, 'weight': 135, 'exercise': exercise_id}]
    }
    response = requests.post(f'{BASE_URL}workoutlog/', json=data, headers=headers)
    if response.status_code in [200, 201]:
        print(f"Log created: {response.json()}")
    else:
        print(f"Error: {response.status_code} - {response.text}")

if __name__ == '__main__':
    if len(sys.argv) < 4:
        print("Usage: python create_log.py <date YYYY-MM-DD> <workout_id> <exercises JSON>")
        sys.exit(1)
    date = sys.argv[1]
    workout_id = int(sys.argv[2])
    exercises = json.loads(sys.argv[3])
    create_log(date, workout_id, exercises)


path: scripts/view_logs.py
content: #!/usr/bin/env python3
import requests
import json
import sys
import os

# wger API integration for viewing logs
BASE_URL = 'https://wger.de/api/v2/'
[REDACTED_SECRET]'WGER_TOKEN')  # Set env WGER_TOKEN=your_key

if not [REDACTED_SECRET]"Error: Set WGER_TOKEN env var")
    sys.exit(1)

def view_logs(limit=7, workout_id=None):
    headers = {'Authorization': f'Token {TOKEN}', 'Content-Type': 'application/json'}
    url = f'{BASE_URL}workoutlog/?limit={limit}&format=json'
    if workout_id:
        url += f'&workout={workout_id}'
    response = requests.get(url, headers=headers)
    if response.status_code == 200:
        data = response.json()
        print(json.dumps(data, indent=2))
    else:
        print(f"Error: {response.status_code} - {response.text}")

if __name__ == '__main__':
    limit = int(sys.argv[1]) if len(sys.argv) > 1 else 7
    workout_id = sys.argv[2] if len(sys.argv) > 2 else None
    view_logs(limit, workout_id)


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)