/cycle
日期(格式:YYYY-MM-DD,默认今天)
$ npx -y skills add huifer/WellAlly-health --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/cycle
Context preview
What this command does when you run it.
日期(格式:YYYY-MM-DD,默认今天)
Command definition
cycle.mddescription: 女性健康周期追踪和症状管理
arguments:
- name: action
description: 操作类型:start(开始)/end(结束)/log(记录)/predict(预测)/history(历史)/analyze(分析)/status(状态)/settings(设置)
required: true
- name: description
description: 周期描述(自然语言)
required: false
- name: date
description: 日期(格式:YYYY-MM-DD,默认今天)
required: false女性健康周期追踪
追踪月经周期、PMS症状、排卵期预测,提供个性化健康洞察。
操作类型
1. 记录周期开始 - `start`
记录月经开始日期,自动计算预测日期。
**参数说明:**
- `description`: 周期描述(可选),自然语言描述
- `date`: 开始日期(可选),格式 YYYY-MM-DD,默认为今天
**示例:**
/cycle start 今天来月经了
/cycle start 2025-12-28
/cycle start 这个月28号
/cycle start 记录月经开始 12月28日 腹痛
**执行步骤:**
1. 解析输入
从自然语言中提取:
- **日期信息**:今天/指定日期
- **症状关键词**:腹痛、腰酸、头痛等
- **流量描述**:量很大、正常、量少等
2. 验证输入
**检查项:**
- 日期不能是未来日期
- 如果有未结束的周期,提示先结束
- 验证日期格式
**错误处理:**
⚠️ 检测到未结束的周期
当前周期:2025年11月28日开始
提示:请先使用 /cycle end 结束当前周期
3. 创建周期记录
**生成 cycle_id**:`cycle_YYYYMMDD`
- 示例:`cycle_20251228`
**周期数据结构:**
{
"cycle_id": "cycle_20251228",
"period_start": "2025-12-28",
"period_end": null,
"cycle_length": null,
"period_length": null,
"flow_pattern": {},
"pms_symptoms": {
"start_date": null,
"symptoms": {}
},
"daily_logs": [],
"ovulation_date": null,
"predictions": {},
"notes": "",
"created_at": "2025-12-28T08:00:00.000Z",
"completed": false
}4. 计算预测日期
**算法:**
1. **获取历史周期数据**:从 `cycle-tracker.json` 读取已完成的周期 2. **计算平均周期长度**:使用最近6个周期 3. **预测下次月经**:`period_start + average_cycle_length` 4. **预测排卵日期**:`next_period - 14 days` 5. **计算易孕期**:`ovulation_date - 5 days` 至 `ovulation_date + 1 day`
**默认值(无历史数据):**
- 平均周期长度:28天
- 平均经期长度:5天
- 排卵日期:下次月经前14天
5. 更新数据文件
**文件 1**:`data/cycle-tracker.json`
{
"cycles": [
// ... 添加新周期到数组
],
"current_cycle": {
"period_start": "2025-12-28",
"period_end": null,
"cycle_length": null,
"predicted_ovulation": "2026-01-11",
"predicted_next_period": "2026-01-25",
"days_since_start": 0
},
"statistics": {
// ... 更新统计数据
},
"predictions": {
"next_period": "2026-01-25",
"ovulation_date": "2026-01-11",
"fertile_window_start": "2026-01-06",
"fertile_window_end": "2026-01-12",
"confidence": "low"
}
}**文件 2**:`data/周期记录/YYYY-MM/YYYY-MM-DD_周期记录.json`
{
"id": "cycle_20251228",
"period_start": "2025-12-28",
"period_end": null,
"created_at": "2025-12-28T08:00:00.000Z",
"initial_symptoms": ["腹痛"],
"daily_logs": [],
"metadata": {
"completed": false
}
}6. 输出确认
✅ 周期记录已创建
周期信息:
━━━━━━━━━━━━━━━━━━━━━━━━━━
本次月经开始:2025年12月28日
预测信息:
━━━━━━━━━━━━━━━━━━━━━━━━━━
预计下次月经:2026年1月25日
预计排卵日期:2026年1月11日
易孕期:1月6日 - 1月12日
当前状态:
━━━━━━━━━━━━━━━━━━━━━━━━━━
周期第:1天
阶段:月经期
预测可信度:基础(基于医学平均值28天)
━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 提示:继续记录周期数据,预测将越来越准确
数据已保存至:data/周期记录/2025-12/2025-12-28_周期记录.json
⚠️ 重要声明:
本系统仅供周期追踪和健康参考,不能替代专业医疗建议。
如遇月经周期突然变得不规律、经量异常增多或严重痛经等情况,请及时就医。
---
2. 记录周期结束 - `end`
记录月经结束日期,完成周期统计。
**参数说明:**
- `date`: 结束日期(可选),格式 YYYY-MM-DD,默认为今天
**示例:**
/cycle end 今天结束了
/cycle end 2026-01-01
/cycle end 1月1日结束
**执行步骤:**
1. 验证当前周期
**检查项:**
- 是否存在活跃周期
- 结束日期必须在开始日期之后
- 结束日期不能是未来日期
2. 计算周期数据
**经期长度**:`end_date - start_date + 1`
**周期长度**:
- 如果有上一个周期:`current_start - previous_start`
- 如果没有:使用用户设置的平均值
**流量模式**:从 daily_logs 汇总
3. 完成周期记录
**更新周期数据:**
{
"cycle_id": "cycle_20251228",
"period_start": "2025-12-28",
"period_end": "2026-01-01",
"cycle_length": 28,
"period_length": 5,
"completed": true,
"last_updated": "2026-01-01T20:00:00.000Z"
}4. 更新统计数据
**重新计算:**
- 平均周期长度(最近6个周期)
- 平均经期长度
- 周期规律度评分
- 常见症状统计
**规律度计算:**
function calculateRegularityScore(cycles) {
const lengths = cycles.map(c => c.cycle_length);
const avg = lengths.reduce((a, b) => a + b, 0) / lengths.length;
const variance = lengths.reduce((a, b) =>
a + Math.pow(b - avg, 2), 0) / lengths.length;
const stdDev = Math.sqrt(variance);
const score = Math.max(0, 1 - (stdDev / 7));
return {
score: Math.round(score * 100) / 100,
stdDev: Math.round(stdDev * 10) / 10,
average: Math.round(avg * 10) / 10
};
}5. 重置当前周期
{
"current_cycle": null
}6. 输出确认
✅ 周期已完成
周期统计:
━━━━━━━━━━━━━━━━━━━━━━━━━━
开始日期:2025年12月28日
结束日期:2026年1月1日
经期长度:5天
周期长度:28天
流量模式:
━━━━━━━━━━━━━━━━━━━━━━━━━━
第1天:大量
第2天:大量
第3天:中等
第4天:少量
第5天:少量
累计统计(基于6个周期):
━━━━━━━━━━━━━━━━━━━━━━━━━━
平均周期长度:28.5天
平均经期长度:5.2天
周期规律度:92% (非常规律) ✅
下次预测:
━━━━━━━━━━━━━━━━━━━━━━━━━━
预计下次月经:2026年1月26日
预计排卵日期:2026年1月12日
易孕期:1月7日 - 1月13日
预测可信度:高 ✅
━━━━━━━━━━━━━━━━━━━━━━━━━━
数据已归档至:data/周期记录/2025-12/2025-12-28_周期记录.json
---
3. 记录每日日志 - `log`
记录每日流量、症状、情绪等详细信息。
**参数说明:**
- `description`: 日志内容(必填),自然语言描述
- `date`: 日志日期(可选),格式 YYYY-MM-DD,默认为今天
**示例:**
/cycle log 今天量很大 腹痛
/cycle log 第二天 中等量 乳房胀痛 情绪低落
/cycle log 经前头痛 经期前3天
/cycle log 流量少 腰酸 乏力
**执行步骤:**
1. 解析日志内容
**提取信息:**
**流量强度识别:** | 关键词 | 强度级别 | |--------|---------| | 极多、非常多、特别多、量大 | very_heavy (5) | | 大、很多、量很大 | heavy (4) | | 中等、正常、一般 | medium (3) | | 少、量少、不多 | light (2) | | 极少、点滴、几乎不用 | spotting (1) |
**症状识别:**
- **常见症状**:腹痛、腰酸、头痛、乳房胀痛、情绪波动、乏力、腹胀、腹泻、便秘等
- **情绪状态**:正常、低落、焦虑、易怒、烦躁、平静等
- **能量水平**:高、中、低
2. 确定周期阶段
**阶段划分:**
- **menstrual** (月经期): 第1-5天
- **follicular** (卵泡期): 第6-13天
- **ovulation** (排卵期): 第14-16天
- **luteal** (黄体期): 第17-28天
**计算规则:**
function getCyclePhase(dayNumber, cycleLength) {
if (dayNumber <= 5) return 'menstrual';
if (dayNumber <= 13) return 'follicular';
if (dayNumber <= 16) return 'ovulation';
return 'luteal';
}3. 创建日志记录
**数据结构:**
{
"id": "log_20251228001",
"date": "2025-12-28",
"cycle_day": 1,
"phase": "menstrual",
"flow": {
"intensity": "heavy",
"description": "量很大"
},
"symptoms": ["腹痛", "腰酸"],
"mood": "低落",
"energy_level": "low",
"medication_taken": [],
"notes": "",
"created_at": "2025-12-28T20:00:00.000Z"
}4. 更新周期数据
**更新 flow_pattern:**
{
"Read more
description: 女性健康周期追踪和症状管理
arguments:
- name: action
description: 操作类型:start(开始)/end(结束)/log(记录)/predict(预测)/history(历史)/analyze(分析)/status(状态)/settings(设置)
required: true
- name: description
description: 周期描述(自然语言)
required: false
- name: date
description: 日期(格式:YYYY-MM-DD,默认今天)
required: false女性健康周期追踪
追踪月经周期、PMS症状、排卵期预测,提供个性化健康洞察。
操作类型
1. 记录周期开始 - `start`
记录月经开始日期,自动计算预测日期。
**参数说明:**
- `description`: 周期描述(可选),自然语言描述
- `date`: 开始日期(可选),格式 YYYY-MM-DD,默认为今天
**示例:**
/cycle start 今天来月经了 /cycle start 2025-12-28 /cycle start 这个月28号 /cycle start 记录月经开始 12月28日 腹痛
**执行步骤:**
1. 解析输入
从自然语言中提取:
- **日期信息**:今天/指定日期
- **症状关键词**:腹痛、腰酸、头痛等
- **流量描述**:量很大、正常、量少等
2. 验证输入
**检查项:**
- 日期不能是未来日期
- 如果有未结束的周期,提示先结束
- 验证日期格式
**错误处理:**
⚠️ 检测到未结束的周期 当前周期:2025年11月28日开始 提示:请先使用 /cycle end 结束当前周期
3. 创建周期记录
**生成 cycle_id**:`cycle_YYYYMMDD`
- 示例:`cycle_20251228`
**周期数据结构:**
{
"cycle_id": "cycle_20251228",
"period_start": "2025-12-28",
"period_end": null,
"cycle_length": null,
"period_length": null,
"flow_pattern": {},
"pms_symptoms": {
"start_date": null,
"symptoms": {}
},
"daily_logs": [],
"ovulation_date": null,
"predictions": {},
"notes": "",
"created_at": "2025-12-28T08:00:00.000Z",
"completed": false
}4. 计算预测日期
**算法:**
1. **获取历史周期数据**:从 `cycle-tracker.json` 读取已完成的周期 2. **计算平均周期长度**:使用最近6个周期 3. **预测下次月经**:`period_start + average_cycle_length` 4. **预测排卵日期**:`next_period - 14 days` 5. **计算易孕期**:`ovulation_date - 5 days` 至 `ovulation_date + 1 day`
**默认值(无历史数据):**
- 平均周期长度:28天
- 平均经期长度:5天
- 排卵日期:下次月经前14天
5. 更新数据文件
**文件 1**:`data/cycle-tracker.json`
{
"cycles": [
// ... 添加新周期到数组
],
"current_cycle": {
"period_start": "2025-12-28",
"period_end": null,
"cycle_length": null,
"predicted_ovulation": "2026-01-11",
"predicted_next_period": "2026-01-25",
"days_since_start": 0
},
"statistics": {
// ... 更新统计数据
},
"predictions": {
"next_period": "2026-01-25",
"ovulation_date": "2026-01-11",
"fertile_window_start": "2026-01-06",
"fertile_window_end": "2026-01-12",
"confidence": "low"
}
}**文件 2**:`data/周期记录/YYYY-MM/YYYY-MM-DD_周期记录.json`
{
"id": "cycle_20251228",
"period_start": "2025-12-28",
"period_end": null,
"created_at": "2025-12-28T08:00:00.000Z",
"initial_symptoms": ["腹痛"],
"daily_logs": [],
"metadata": {
"completed": false
}
}6. 输出确认
✅ 周期记录已创建 周期信息: ━━━━━━━━━━━━━━━━━━━━━━━━━━ 本次月经开始:2025年12月28日 预测信息: ━━━━━━━━━━━━━━━━━━━━━━━━━━ 预计下次月经:2026年1月25日 预计排卵日期:2026年1月11日 易孕期:1月6日 - 1月12日 当前状态: ━━━━━━━━━━━━━━━━━━━━━━━━━━ 周期第:1天 阶段:月经期 预测可信度:基础(基于医学平均值28天) ━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 提示:继续记录周期数据,预测将越来越准确 数据已保存至:data/周期记录/2025-12/2025-12-28_周期记录.json ⚠️ 重要声明: 本系统仅供周期追踪和健康参考,不能替代专业医疗建议。 如遇月经周期突然变得不规律、经量异常增多或严重痛经等情况,请及时就医。
---
2. 记录周期结束 - `end`
记录月经结束日期,完成周期统计。
**参数说明:**
- `date`: 结束日期(可选),格式 YYYY-MM-DD,默认为今天
**示例:**
/cycle end 今天结束了 /cycle end 2026-01-01 /cycle end 1月1日结束
**执行步骤:**
1. 验证当前周期
**检查项:**
- 是否存在活跃周期
- 结束日期必须在开始日期之后
- 结束日期不能是未来日期
2. 计算周期数据
**经期长度**:`end_date - start_date + 1`
**周期长度**:
- 如果有上一个周期:`current_start - previous_start`
- 如果没有:使用用户设置的平均值
**流量模式**:从 daily_logs 汇总
3. 完成周期记录
**更新周期数据:**
{
"cycle_id": "cycle_20251228",
"period_start": "2025-12-28",
"period_end": "2026-01-01",
"cycle_length": 28,
"period_length": 5,
"completed": true,
"last_updated": "2026-01-01T20:00:00.000Z"
}4. 更新统计数据
**重新计算:**
- 平均周期长度(最近6个周期)
- 平均经期长度
- 周期规律度评分
- 常见症状统计
**规律度计算:**
function calculateRegularityScore(cycles) {
const lengths = cycles.map(c => c.cycle_length);
const avg = lengths.reduce((a, b) => a + b, 0) / lengths.length;
const variance = lengths.reduce((a, b) =>
a + Math.pow(b - avg, 2), 0) / lengths.length;
const stdDev = Math.sqrt(variance);
const score = Math.max(0, 1 - (stdDev / 7));
return {
score: Math.round(score * 100) / 100,
stdDev: Math.round(stdDev * 10) / 10,
average: Math.round(avg * 10) / 10
};
}5. 重置当前周期
{
"current_cycle": null
}6. 输出确认
✅ 周期已完成 周期统计: ━━━━━━━━━━━━━━━━━━━━━━━━━━ 开始日期:2025年12月28日 结束日期:2026年1月1日 经期长度:5天 周期长度:28天 流量模式: ━━━━━━━━━━━━━━━━━━━━━━━━━━ 第1天:大量 第2天:大量 第3天:中等 第4天:少量 第5天:少量 累计统计(基于6个周期): ━━━━━━━━━━━━━━━━━━━━━━━━━━ 平均周期长度:28.5天 平均经期长度:5.2天 周期规律度:92% (非常规律) ✅ 下次预测: ━━━━━━━━━━━━━━━━━━━━━━━━━━ 预计下次月经:2026年1月26日 预计排卵日期:2026年1月12日 易孕期:1月7日 - 1月13日 预测可信度:高 ✅ ━━━━━━━━━━━━━━━━━━━━━━━━━━ 数据已归档至:data/周期记录/2025-12/2025-12-28_周期记录.json
---
3. 记录每日日志 - `log`
记录每日流量、症状、情绪等详细信息。
**参数说明:**
- `description`: 日志内容(必填),自然语言描述
- `date`: 日志日期(可选),格式 YYYY-MM-DD,默认为今天
**示例:**
/cycle log 今天量很大 腹痛 /cycle log 第二天 中等量 乳房胀痛 情绪低落 /cycle log 经前头痛 经期前3天 /cycle log 流量少 腰酸 乏力
**执行步骤:**
1. 解析日志内容
**提取信息:**
**流量强度识别:** | 关键词 | 强度级别 | |--------|---------| | 极多、非常多、特别多、量大 | very_heavy (5) | | 大、很多、量很大 | heavy (4) | | 中等、正常、一般 | medium (3) | | 少、量少、不多 | light (2) | | 极少、点滴、几乎不用 | spotting (1) |
**症状识别:**
- **常见症状**:腹痛、腰酸、头痛、乳房胀痛、情绪波动、乏力、腹胀、腹泻、便秘等
- **情绪状态**:正常、低落、焦虑、易怒、烦躁、平静等
- **能量水平**:高、中、低
2. 确定周期阶段
**阶段划分:**
- **menstrual** (月经期): 第1-5天
- **follicular** (卵泡期): 第6-13天
- **ovulation** (排卵期): 第14-16天
- **luteal** (黄体期): 第17-28天
**计算规则:**
function getCyclePhase(dayNumber, cycleLength) {
if (dayNumber <= 5) return 'menstrual';
if (dayNumber <= 13) return 'follicular';
if (dayNumber <= 16) return 'ovulation';
return 'luteal';
}3. 创建日志记录
**数据结构:**
{
"id": "log_20251228001",
"date": "2025-12-28",
"cycle_day": 1,
"phase": "menstrual",
"flow": {
"intensity": "heavy",
"description": "量很大"
},
"symptoms": ["腹痛", "腰酸"],
"mood": "低落",
"energy_level": "low",
"medication_taken": [],
"notes": "",
"created_at": "2025-12-28T20:00:00.000Z"
}4. 更新周期数据
**更新 flow_pattern:**
{
"WellAlly Health is a local-first, AI-powered personal health record (PHR) system.

