Skill: Medication Adherence Message Gen
ID: 136
Name: medication-adherence-message-gen
Description: Uses behavioral psychology principles to generate SMS/push notification copy for reminding patients to take medication.
Version: 1.0.0
When to Use
- - Use this skill when the task needs Use medication adherence message gen for academic writing workflows that need structured execution, explicit assumptions, and clear output boundaries.
- Use this skill for academic writing tasks that require explicit assumptions, bounded scope, and a reproducible output format.
- Use this skill when you need a documented fallback path for missing inputs, execution errors, or partial evidence.
Key Features
- - Scope-focused workflow aligned to: Use medication adherence message gen for academic writing workflows that need structured execution, explicit assumptions, and clear output boundaries.
- Packaged executable path(s):
scripts/main.py. - Reference material available in
references/ for task-specific guidance. - Structured execution path designed to keep outputs consistent and reviewable.
Dependencies
See ## Prerequisites above for related details.
- -
Python: 3.10+. Repository baseline for current packaged skills. - INLINECODE5 :
unspecified. Declared in requirements.txt. - INLINECODE8 :
unspecified. Declared in requirements.txt.
Example Usage
See ## Usage above for related details.
CODEBLOCK0
Example run plan:
- 1. Confirm the user input, output path, and any required config values.
- Edit the in-file
CONFIG block or documented parameters if the script uses fixed settings. - Run
python scripts/main.py with the validated inputs. - Review the generated output and return the final artifact with any assumptions called out.
Implementation Details
See ## Workflow above for related details.
- - Execution model: validate the request, choose the packaged workflow, and produce a bounded deliverable.
- Input controls: confirm the source files, scope limits, output format, and acceptance criteria before running any script.
- Primary implementation surface:
scripts/main.py. - Reference guidance:
references/ contains supporting rules, prompts, or checklists. - Parameters to clarify first: input path, output path, scope filters, thresholds, and any domain-specific constraints.
- Output discipline: keep results reproducible, identify assumptions explicitly, and avoid undocumented side effects.
Quick Check
Use this command to verify that the packaged script entry point can be parsed before deeper execution.
CODEBLOCK1
Audit-Ready Commands
Use these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.
CODEBLOCK2
Workflow
- 1. Confirm the user objective, required inputs, and non-negotiable constraints before doing detailed work.
- Validate that the request matches the documented scope and stop early if the task would require unsupported assumptions.
- Use the packaged script path or the documented reasoning path with only the inputs that are actually available.
- Return a structured result that separates assumptions, deliverables, risks, and unresolved items.
- If execution fails or inputs are incomplete, switch to the fallback path and state exactly what blocked full completion.
Overview
This skill generates personalized medication reminder messages based on behavioral psychology and behavioral economics principles. By applying psychological mechanisms such as social norms, loss aversion, implementation intentions, commitment consistency, etc., it improves patient medication adherence.
Psychological Principles Used
| Principle | English | Description |
|---|
| Social Norms | Social Norms | Emphasizes "most patients can adhere to medication" |
| Loss Aversion |
Loss Aversion | Emphasizes what will be lost if medication is not taken on time |
| Implementation Intentions | Implementation Intentions | "If-then" plans |
| Immediate Rewards | Immediate Rewards | Immediate positive feedback after taking medication |
| Commitment Consistency | Commitment | Reinforces patient commitment and responsibility |
| Self-Efficacy | Self-Efficacy | Enhances patient confidence in self-management |
| Anchoring Effect | Anchoring | Provides specific quantifiable goals |
| Scarcity | Scarcity | Emphasizes timeliness of treatment |
Usage
Command Line
CODEBLOCK3
Options
| Parameter | Short | Type | Required | Description |
|---|
| INLINECODE17 | INLINECODE18 | str | No | Patient name |
| INLINECODE19 |
-m | str | Yes | Medication name |
|
--dosage |
-d | str | No | Dosage information |
|
--time |
-t | str | No | Medication time |
|
--principle |
-p | str | No | Psychology principle (social
norms/lossaversion/implementation/intent/reward/commitment/self_efficacy/anchoring/scarcity/random) |
|
--tone | | str | No | Tone style (gentle/firm/encouraging/urgent) |
|
--language |
-l | str | No | Language (zh/en) |
|
--output |
-o | str | No | Output format (text/json) |
Examples
CODEBLOCK4
Python API
CODEBLOCK5
Output Format
Text Mode
CODEBLOCK6
JSON Mode
CODEBLOCK7
Message Templates
Each psychology principle has multiple copy templates, randomly selected to avoid repetition fatigue.
Author: OpenClaw
License: MIT
Risk Assessment
| Risk Indicator | Assessment | Level |
|---|
| Code Execution | Python/R scripts executed locally | Medium |
| Network Access |
No external API calls | Low |
| File System Access | Read input files, write output files | Medium |
| Instruction Tampering | Standard prompt guidelines | Low |
| Data Exposure | Output files saved to workspace | Low |
Security Checklist
- - [ ] No hardcoded credentials or API keys
- [ ] No unauthorized file system access (../)
- [ ] Output does not expose sensitive information
- [ ] Prompt injection protections in place
- [ ] Input file paths validated (no ../ traversal)
- [ ] Output directory restricted to workspace
- [ ] Script execution in sandboxed environment
- [ ] Error messages sanitized (no stack traces exposed)
- [ ] Dependencies audited
Prerequisites
CODEBLOCK8
Evaluation Criteria
Success Metrics
- - [ ] Successfully executes main functionality
- [ ] Output meets quality standards
- [ ] Handles edge cases gracefully
- [ ] Performance is acceptable
Test Cases
- 1. Basic Functionality: Standard input → Expected output
- Edge Case: Invalid input → Graceful error handling
- Performance: Large dataset → Acceptable processing time
Lifecycle Status
- - Current Stage: Draft
- Next Review Date: 2026-03-06
- Known Issues: None
- Planned Improvements:
- Performance optimization
- Additional feature support
Output Requirements
Every final response should make these items explicit when they are relevant:
- - Objective or requested deliverable
- Inputs used and assumptions introduced
- Workflow or decision path
- Core result, recommendation, or artifact
- Constraints, risks, caveats, or validation needs
- Unresolved items and next-step checks
Error Handling
- - If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.
- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.
- If
scripts/main.py fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback. - Do not fabricate files, citations, data, search results, or execution outcomes.
Input Validation
This skill accepts requests that match the documented purpose of medication-adherence-message-gen and include enough context to complete the workflow safely.
Do not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:
INLINECODE34 only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.
References
Response Template
Use the following fixed structure for non-trivial requests:
- 1. Objective
- Inputs Received
- Assumptions
- Workflow
- Deliverable
- Risks and Limits
- Next Checks
If the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.
技能:用药依从性消息生成
ID: 136
名称: medication-adherence-message-gen
描述: 运用行为心理学原理,生成用于提醒患者服药的短信/推送通知文案。
版本: 1.0.0
使用时机
- - 当任务需要使用用药依从性消息生成功能,且适用于需要结构化执行、明确假设和清晰输出边界的学术写作工作流时,使用此技能。
- 当学术写作任务需要明确假设、限定范围和可复现的输出格式时,使用此技能。
- 当需要为缺失输入、执行错误或部分证据提供有记录的备用路径时,使用此技能。
主要特性
- - 以范围为中心的工作流,对齐于:使用用药依从性消息生成功能,适用于需要结构化执行、明确假设和清晰输出边界的学术写作工作流。
- 打包的可执行路径:scripts/main.py。
- 参考资料位于 references/ 目录下,提供任务特定指导。
- 结构化执行路径,旨在保持输出的一致性和可审查性。
依赖项
相关详情请参见上方的 ## 前提条件。
- - Python:3.10+。当前打包技能的仓库基线版本。
- dataclasses:未指定版本。在 requirements.txt 中声明。
- enum:未指定版本。在 requirements.txt 中声明。
使用示例
相关详情请参见上方的 ## 用法。
bash
cd 20260318/scientific-skills/Academic Writing/medication-adherence-message-gen
python -m py_compile scripts/main.py
python scripts/main.py --help
示例运行计划:
- 1. 确认用户输入、输出路径以及任何必需的配置值。
- 如果脚本使用固定设置,请编辑文件内的 CONFIG 块或已记录的参数。
- 使用验证过的输入运行 python scripts/main.py。
- 审查生成的输出,并返回最终产物,同时注明任何假设条件。
实现细节
相关详情请参见上方的 ## 工作流。
- - 执行模型:验证请求,选择打包的工作流,并生成有边界的可交付成果。
- 输入控制:在运行任何脚本之前,确认源文件、范围限制、输出格式和验收标准。
- 主要实现界面:scripts/main.py。
- 参考指南:references/ 目录包含支持性规则、提示或检查清单。
- 首先需要明确的参数:输入路径、输出路径、范围过滤器、阈值以及任何领域特定的约束条件。
- 输出规范:保持结果可复现,明确标识假设条件,避免未记录的副作用。
快速检查
在深入执行之前,使用此命令验证打包脚本的入口点是否可解析。
bash
python -m py_compile scripts/main.py
审计就绪命令
使用这些具体命令进行验证。它们特意设计为自包含,避免使用占位符路径。
bash
python -m py_compile scripts/main.py
python scripts/main.py --help
工作流
- 1. 在进行详细工作之前,确认用户目标、所需输入以及不可协商的约束条件。
- 验证请求是否与记录的范围匹配,如果任务需要不支持的假设,则提前停止。
- 仅使用实际可用的输入,使用打包的脚本路径或记录的推理路径。
- 返回一个结构化结果,将假设、可交付成果、风险和未解决事项分开。
- 如果执行失败或输入不完整,切换到备用路径,并准确说明阻止完整完成的原因。
概述
此技能基于行为心理学和行为经济学原理,生成个性化的用药提醒消息。通过应用社会规范、损失厌恶、执行意图、承诺一致性等心理机制,提高患者的用药依从性。
使用的心理学原理
| 原理 | 英文 | 描述 |
|---|
| 社会规范 | Social Norms | 强调“大多数患者都能坚持服药” |
| 损失厌恶 |
Loss Aversion | 强调如果不按时服药将会失去什么 |
| 执行意图 | Implementation Intentions | “如果-那么”计划 |
| 即时奖励 | Immediate Rewards | 服药后立即获得积极反馈 |
| 承诺一致性 | Commitment | 强化患者的承诺和责任感 |
| 自我效能 | Self-Efficacy | 增强患者对自我管理的信心 |
| 锚定效应 | Anchoring | 提供具体的量化目标 |
| 稀缺性 | Scarcity | 强调治疗的时效性 |
用法
命令行
text
python scripts/main.py [选项]
选项
| 参数 | 简写 | 类型 | 必需 | 描述 |
|---|
| --name | -n | str | 否 | 患者姓名 |
| --medication |
-m | str | 是 | 药物名称 |
| --dosage | -d | str | 否 | 剂量信息 |
| --time | -t | str | 否 | 服药时间 |
| --principle | -p | str | 否 | 心理学原理(social
norms/lossaversion/implementation/intent/reward/commitment/self_efficacy/anchoring/scarcity/random) |
| --tone | | str | 否 | 语气风格(gentle/firm/encouraging/urgent) |
| --language | -l | str | 否 | 语言(zh/en) |
| --output | -o | str | 否 | 输出格式(text/json) |
示例
text
基本用法
python scripts/main.py -m 阿托伐他汀 -n 张先生
指定心理学原理
python scripts/main.py -m 二甲双胍 -p loss_aversion -t 早餐后
生成 JSON 格式
python scripts/main.py -m 降压药 -p social_norms -o json
英文输出
python scripts/main.py -m Metformin -n John -l en -p commitment
Python API
python
from scripts.main import generate_message
message = generate_message(
medication=阿托伐他汀,
patient_name=张先生,
dosage=20mg,
time=晚餐后,
principle=social_norms,
tone=encouraging
)
print(message)
输出格式
文本模式
【用药提醒】张先生,晚餐后时间到了。95%服用阿托伐他汀的患者都能坚持每日服药,您也是其中之一!请服用20mg,保持心脏健康。
JSON 模式
json
{
medication: 阿托伐他汀,
patient_name: 张先生,
principle: social_norms,
tone: encouraging,
message: 【用药提醒】张先生,晚餐后时间到了...,
psychology_insight: 运用社会规范原理,通过强调高依从率来增强患者的行为动机
}
消息模板
每个心理学原理都有多个文案模板,随机选择以避免重复疲劳。
作者: OpenClaw
许可证: MIT
风险评估
| 风险指标 | 评估 | 级别 |
|---|
| 代码执行 | Python/R 脚本在本地执行 | 中 |
| 网络访问 |
无外部 API 调用 | 低 |
| 文件系统访问 | 读取输入文件,写入输出文件 | 中 |
| 指令篡改 | 标准提示指南 | 低 |
| 数据泄露 | 输出文件保存到工作空间 | 低 |
安全检查清单
- - [ ] 无硬编码的凭据或 API 密钥
- [ ] 无未经授权的文件系统访问(../)
- [ ] 输出不暴露敏感信息
- [ ] 已采取提示注入防护措施
- [ ] 输入文件路径已验证(无 ../ 遍历)
- [ ] 输出目录限制在工作空间内
- [ ] 脚本在沙盒环境中执行
- [ ] 错误消息已清理(不暴露堆栈跟踪)
- [ ] 依赖项已审计
前提条件
text
Python 依赖项
pip install -r requirements.txt
评估标准
成功指标
- - [ ] 成功执行主要功能
- [ ] 输出符合质量标准
- [ ] 优雅处理边缘情况
- [ ] 性能可接受
测试用例
- 1. 基本功能:标准输入 → 预期输出
- 边缘情况:无效输入 → 优雅的错误处理
- 性能:大数据集 → 可接受的处理时间
生命周期状态
- - 当前阶段:草稿
- 下次审查日期:2026-03-06
- 已知问题:无
- 计划改进:
- 性能优化