> Requires caremax-auth as a sibling directory (../caremax-auth/, same layout as skills/caremax-auth + skills/caremax-indicators in this repo, or under ~/.agents/skills/). If missing: npx skills add KittenYang/caremax-skills and select caremax-auth.
Agents should describe this in user-friendly terms (“帮你记一笔今天的体重”“看看现在能快捷记录哪些项目”) and only use the API steps below to implement it after the user is authenticated.
This skill also covers the agent/skill indicator endpoints under /api/skill/indicators/* for listing, categories, and trends.
Working directory: this skill’s root folder (caremax-indicators/, sibling of caremax-auth/). Scripts in auth are reached with ../caremax-auth/scripts/.
# shorthand — run from caremax-indicators/
APICALL="bash ../caremax-auth/scripts/api-call.sh"
LIST_PRESETS="bash ../caremax-auth/scripts/list-system-presets.sh"
QUICK_LOG="bash ../caremax-auth/scripts/quick-log.sh"
If any script returns {"error":"no_credentials",...} → immediately run bash ../caremax-auth/scripts/auth-flow.sh [base_url] in background. If the user specified a custom URL (e.g., http://localhost:8788), pass it as the argument. It opens the browser and auto-polls. Tell the user "please authorize in browser". Once it outputs authorized, retry.
$APICALL GET /api/skill/indicators
# with category filter:
$APICALL GET "/api/skill/indicators?category=血常规"
Response fields: id (UUID, needed for trend), canonical_name, display_name, canonical_unit, category, latest_value, data_count
$APICALL GET /api/skill/indicators/categories
Important: Get the indicator UUID from the list endpoint first.
$APICALL GET "/api/skill/indicators/trend?id={indicator_uuid}"
Returns time-series: date, value, unit, reference_range, is_abnormal (0/1)
Prefer the dedicated scripts (wrap api-call.sh with the same OAuth user token). Do not hand-roll curl.
Typical user intents: “记一下体重 70”“今天身高 175”“帮妈妈记血压 120/80” — always run list-system-presets.sh first so you use a valid preset_key and know default units; use --member when logging for a family profile.
$LIST_PRESETS
Response: presets[] — use preset_key for quick-log.sh; show display_name / canonical_unit when confirming with the user. Do not assume a fixed list of metrics in prose.
$QUICK_LOG weight 72.5 --unit kg --date 2026-03-28
$QUICK_LOG height 175 --member <family_member_uuid>
preset_key, value (required).--unit, --date YYYY-MM-DD (omit date → server default today), --member (family member UUID).$APICALL GET /api/indicators/system-presets
$APICALL POST /api/indicators/quick-log '{"preset_key":"weight","value":"72.5","unit":"kg","test_date":"2026-03-28","member_id":"..."}'
# User: "帮我记身高" / "quick log my weight"
$LIST_PRESETS
# Match user wording to preset_key (or ask if ambiguous)
$QUICK_LOG <preset_key> <value> [--date ...] [--member ...]
# Confirm aloud: value, unit, date, whose profile
$APICALL GET "/api/skill/indicators/trends-by-category?category={category_name}"
When user asks "show my creatinine trend":
# 1. List all indicators, find the matching one
$APICALL GET /api/skill/indicators
# 2. Extract the id (UUID) of the matching indicator from the response
# 3. Get trend data
$APICALL GET "/api/skill/indicators/trend?id={uuid}"
# 4. Present with dates, values, units, highlight abnormals
When user asks "what are my abnormal indicators":
# 1. Get all indicators
$APICALL GET /api/skill/indicators
# 2. Filter response for those with abnormal latest values
# 3. Present with values and reference ranges
共 1 个版本