Mechanism Flowchart
Generates Mermaid flowchart code and visual representations of medical mechanisms, pathophysiology, and drug action pathways.
When to Use
- - Use this skill when the task needs Generates Mermaid flowchart code and visual diagrams for pathophysiological.
- Use this skill for data analysis 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
See ## Features above for related details.
- - Scope-focused workflow aligned to: Generates Mermaid flowchart code and visual diagrams for pathophysiological.
- 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. - INLINECODE6 :
unspecified. Declared in requirements.txt. - INLINECODE9 :
unspecified. Declared in requirements.txt.
Example Usage
CODEBLOCK0
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.
Features
- - Automatic flowchart generation from text descriptions
- Multiple diagram types (flowchart, sequence, state)
- Customizable styling for publication
- Support for complex branching logic
- Export to multiple formats
Use Cases
- - Creating educational diagrams for presentations
- Visualizing drug mechanism of action
- Illustrating disease pathways
- Thesis and publication figure preparation
Input Parameters
| Parameter | Type | Required | Description |
|---|
| INLINECODE15 | str | Yes | Text description of the mechanism |
| INLINECODE16 |
str | No | Type: "flowchart", "sequence", "state" (default: "flowchart") |
|
direction | str | No | Flow direction: "TB", "LR", "RL", "BT" |
|
style | str | No | Visual style: "default", "medical", "minimal" |
Output Format
CODEBLOCK3
Sample Output
CODEBLOCK4
Limitations
- - Requires Mermaid renderer for visualization
- Complex mechanisms may need manual refinement
- Limited to Mermaid-supported diagram types
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
CODEBLOCK5
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 mechanism-flowchart 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:
INLINECODE21 only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.
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.
机制流程图
生成医学机制、病理生理学和药物作用通路的Mermaid流程图代码及可视化表示。
使用时机
- - 当任务需要生成病理生理学的Mermaid流程图代码和可视化图表时使用此技能。
- 用于需要明确假设、限定范围及可重复输出格式的数据分析任务。
- 当需要为缺失输入、执行错误或部分证据提供文档化的回退路径时使用此技能。
主要特性
相关详情请参见上方## 特性部分。
- - 聚焦范围的工作流程,对齐目标:生成病理生理学的Mermaid流程图代码和可视化图表。
- 打包的可执行路径:scripts/main.py。
- 参考资料位于references/目录,提供任务特定指导。
- 结构化执行路径,确保输出一致且可审查。
依赖项
相关详情请参见上方## 前提条件部分。
- - Python:3.10+。当前打包技能的仓库基线版本。
- dataclasses:未指定。在requirements.txt中声明。
- enum:未指定。在requirements.txt中声明。
使用示例
python
from mechanism_flowchart import MechanismDiagram
diagram = MechanismDiagram()
result = diagram.generate(
2型糖尿病:胰岛素抵抗导致高血糖,
引起β细胞功能障碍并进一步升高血糖
)
print(result[mermaid_code])
实现细节
相关详情请参见上方## 工作流程部分。
- - 执行模型:验证请求,选择打包的工作流程,生成限定范围的可交付成果。
- 输入控制:在运行任何脚本前确认源文件、范围限制、输出格式和验收标准。
- 主要实现接口:scripts/main.py。
- 参考指南:references/目录包含支持性规则、提示或检查清单。
- 需首先明确的参数:输入路径、输出路径、范围过滤器、阈值及任何领域特定约束。
- 输出规范:保持结果可重复,明确标识假设,避免未文档化的副作用。
快速检查
使用以下命令验证打包脚本入口点是否可解析,再进行深入执行。
bash
python -m py_compile scripts/main.py
审计就绪命令
使用以下具体命令进行验证。这些命令有意保持自包含,避免使用占位符路径。
bash
python -m py_compile scripts/main.py
python scripts/main.py
工作流程
- 1. 在开展详细工作前,确认用户目标、所需输入及不可协商的约束条件。
- 验证请求是否匹配文档化范围,若任务需要不支持的假设则提前终止。
- 仅使用实际可用的输入,通过打包脚本路径或文档化的推理路径执行。
- 返回结构化结果,将假设、可交付成果、风险及未解决事项分开呈现。
- 若执行失败或输入不完整,切换至回退路径,并明确说明阻碍完整完成的具体原因。
特性
- - 根据文本描述自动生成流程图
- 支持多种图表类型(流程图、序列图、状态图)
- 可自定义样式,适用于出版用途
- 支持复杂分支逻辑
- 导出为多种格式
使用场景
- - 为演示文稿创建教育性图表
- 可视化药物作用机制
- 说明疾病通路
- 论文及出版物的图表准备
输入参数
| 参数 | 类型 | 必填 | 描述 |
|---|
| mechanismdescription | str | 是 | 机制的文本描述 |
| diagramtype |
str | 否 | 类型:flowchart、sequence、state(默认:flowchart) |
| direction | str | 否 | 流向:TB、LR、RL、BT |
| style | str | 否 | 视觉样式:default、medical、minimal |
输出格式
json
{
mermaid_code: string,
diagram_type: string,
nodes: [string],
edges: [string],
rendered_svg: string (可选)
}
示例输出
mermaid
flowchart TB
A[胰岛素抵抗] --> B[高血糖]
B --> C[β细胞功能障碍]
C --> D[血糖控制恶化]
B --> D
局限性
- - 需要Mermaid渲染器进行可视化
- 复杂机制可能需要手动优化
- 仅限于Mermaid支持的图表类型
风险评估
| 风险指标 | 评估 | 等级 |
|---|
| 代码执行 | Python/R脚本在本地执行 | 中 |
| 网络访问 |
无外部API调用 | 低 |
| 文件系统访问 | 读取输入文件,写入输出文件 | 中 |
| 指令篡改 | 标准提示指南 | 低 |
| 数据泄露 | 输出文件保存至工作区 | 低 |
安全检查清单
- - [ ] 无硬编码凭据或API密钥
- [ ] 无未经授权的文件系统访问(../)
- [ ] 输出不暴露敏感信息
- [ ] 已实施提示注入防护
- [ ] 输入文件路径已验证(无../遍历)
- [ ] 输出目录限制在工作区内
- [ ] 脚本在沙盒环境中执行
- [ ] 错误消息已清理(不暴露堆栈跟踪)
- [ ] 依赖项已审计
前提条件
text
Python依赖项
pip install -r requirements.txt
评估标准
成功指标
- - [ ] 成功执行主要功能
- [ ] 输出符合质量标准
- [ ] 优雅处理边缘情况
- [ ] 性能可接受
测试用例
- 1. 基本功能:标准输入 → 预期输出
- 边缘情况:无效输入 → 优雅的错误处理
- 性能:大数据集 → 可接受的处理时间
生命周期状态
- - 当前阶段:草稿
- 下次评审日期:2026-03-06
- 已知问题:无
- 计划改进:
- 性能优化
- 额外功能支持
输出要求
每个最终响应在相关时应明确以下内容:
- - 目标或请求的可交付成果
- 使用的输入及引入的假设
- 工作流程或决策路径
- 核心结果、建议或产物
- 约束条件、风险、注意事项或验证需求
- 未解决事项及后续检查步骤
错误处理
- - 若缺少必需输入,明确说明哪些字段缺失,并仅请求最少额外信息。
- 若任务超出文档化范围,停止执行而非猜测或悄然扩大任务范围。
- 若scripts/main.py执行失败,报告失败点,总结仍可安全完成的内容,并提供手动回退方案。
- 不得捏造文件、引用、数据、搜索结果或执行结果。
输入验证
本技能仅接受匹配mechanism-flowchart文档化目的且包含足够上下文以安全完成工作流程的请求。
当请求超出范围、缺少关键输入或需要不支持的假设时,不得继续工作流程。应回复:
mechanism-flowchart仅处理其文档化的工作流程。请提供缺失的必需输入,或切换至更合适的技能。
响应模板
对于非简单请求,使用以下固定结构:
- 1. 目标
- 收到的输入
- 假设
- 工作流程
- 可交付成果
- 风险与限制
- 后续检查
若请求简单,可压缩结构,但当假设和限制影响正确性时,仍需明确说明。