关于 math-router
Math Router 是面向数学请求的路由技能,通过模式匹配将意图转换为 CLI 命令,供需要运行数学计算脚本的用户使用。它支持多个数学类别,并可列出路由;无法识别时提示澄清或改用单项技能。
主要功能
- 01将数学意图路由到 CLI 命令
- 02按模式匹配提取参数
- 03支持多个数学类别的路由
- 04列出全部或分类路由
- 05提供未识别请求的回退方式
适用场景
- 01将积分请求转换为计算命令
- 02路由单位换算或几何操作
- 03查询可用数学命令
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ parcadei/ continuous-claude-v3 --skill math-router安装后在 Claude Code 中输入/math-router确认已加载。
详细介绍
Math Router
数学请求始终先使用此路由器。
无需阅读各个技能的文档,调用路由器即可获取确切命令:
使用方法
# Route any math intent to get the CLI command
uv run python scripts/cc_math/math_router.py route "<user's math request>"
示例工作流
- 用户说:“计算 sin(x) 从 0 到 pi 的积分”
- 你运行:
uv run python scripts/cc_math/math_router.py route "integrate sin(x) from 0 to pi" - 路由器返回:
{ "command": "uv run python scripts/cc_math/sympy_compute.py integrate \"sin(x)\" --var x --lower 0 --upper pi", "confidence": 0.95 } - 执行返回的命令
- 将结果返回给用户
为什么使用路由器
- 更快:无需阅读技能文档
- 确定性:基于模式,而非 LLM 推理
- 准确:正确提取参数
- 全面:涵盖 7 个脚本中的 32 条路由
可用路由
| 类别 | 命令 |
|---|---|
| sympy | integrate, diff, solve, simplify, limit, det, eigenvalues, inv, expand, factor, series, laplace, fourier |
| pint | convert, check |
| shapely | create, measure, pred, op |
| z3 | prove, sat, optimize |
| scratchpad | verify, explain |
| tutor | hint, steps, generate |
| plot | plot2d, plot3d, latex |
列出所有命令
# List all available routes
uv run python scripts/cc_math/math_router.py list
# List routes by category
uv run python scripts/cc_math/math_router.py list --category sympy
备用方案
如果路由器返回 {"command": null},则表示未识别该意图。接下来:
- 请用户澄清
- 或使用单独的技能:/sympy-compute、/z3-solve、/pint-compute 等
评论
支持 Markdown