← 返回 Skills 市场
Cn Math Expression
作者
freedompixels
· GitHub ↗
· v1.0.0
· MIT-0
24
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install cn-math-expression
功能描述
cn math expression
使用说明 (SKILL.md)
Math Expression Evaluator
Safely evaluate mathematical expressions with support for common functions.
Features
- Safe evaluation (no arbitrary code execution)
- Common mathematical functions: sqrt, sin, cos, tan, log
- Constants: pi, e
- Basic arithmetic: +, -, *, /, **, %
- Pure Python, no external dependencies
Supported Functions
| Function | Description | Example |
|---|---|---|
| sqrt(x) | Square root | sqrt(144) = 12 |
| sin(x) | Sine (radians) | sin(pi/2) = 1 |
| cos(x) | Cosine (radians) | cos(0) = 1 |
| tan(x) | Tangent (radians) | tan(pi/4) = 1 |
| log(x) | Natural log | log(e) = 1 |
| log10(x) | Base 10 log | log10(100) = 2 |
| abs(x) | Absolute value | abs(-5) = 5 |
| pow(x,y) | Power | pow(2,8) = 256 |
Supported Constants
pi= 3.141592653589793e= 2.718281828459045
Usage Examples
# Basic arithmetic
python3 scripts/math_eval.py --expr "2 + 3 * 4"
# Result: 14
# Using functions
python3 scripts/math_eval.py --expr "sqrt(144) + pow(2, 10)"
# Result: 1028.0
# Constants
python3 scripts/math_eval.py --expr "2 * pi * 10"
# Result: 62.8318...
# Complex expression
python3 scripts/math_eval.py --expr "log(pow(e, 5)) + sqrt(81)"
# Result: 14.0
Safety
The evaluator uses Python's eval() with a restricted namespace. Only mathematical functions and constants are available. No imports, no file access, no system commands.
Error Handling
If the expression is invalid or contains unsafe operations:
{"error": "name 'os' is not defined"}
Exit code 1 on error.
Technical Details
- Language: Python 3
- Dependencies: None (standard library only)
- License: MIT-0
安全使用建议
Review before installing. Do not use this skill on untrusted expressions unless the eval-based implementation is replaced with a strict math parser and resource limits.
功能分析
Type: OpenClaw Skill
Name: cn-math-expression
Version: 1.0.0
The skill implements a math expression evaluator in `scripts/math_eval.py` using Python's `eval()` function. While it attempts to sandbox execution by clearing `__builtins__` and providing a whitelist of functions, this approach is historically vulnerable to sandbox escape techniques that can lead to Remote Code Execution (RCE). It is classified as suspicious due to this critical security flaw, although there is no explicit evidence of intentional malicious logic or data exfiltration.
能力评估
Purpose & Capability
The math-expression purpose is coherent, but the implementation gives the expression to Python eval instead of a strict math parser, which is more powerful than the stated calculator capability.
Instruction Scope
The usage model invites arbitrary --expr input and says unsafe operations will fail, but the artifacts do not show an AST whitelist, attribute restrictions, or resource limits.
Install Mechanism
There is no install script, no external dependency, and the only runnable code is the included standard-library Python script.
Credentials
For a simple math helper, raw Python eval is disproportionate because a crafted expression may execute unexpected Python behavior or consume local CPU/memory.
Persistence & Privilege
The provided artifacts show no credentials, network calls, file writes, background persistence, or privilege escalation behavior.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install cn-math-expression - 安装完成后,直接呼叫该 Skill 的名称或使用
/cn-math-expression触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of Cn Math Expression (version 1.0.0)
- Safely evaluates mathematical expressions using pure Python (no external dependencies)
- Supports common math functions: sqrt, sin, cos, tan, log, log10, abs, pow
- Includes mathematical constants: pi and e
- Handles basic arithmetic operations: +, -, *, /, **, %
- Protects against arbitrary code execution with a restricted namespace
- Error messages provided for invalid or unsafe expressions
元数据
常见问题
Cn Math Expression 是什么?
cn math expression. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 24 次。
如何安装 Cn Math Expression?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install cn-math-expression」即可一键安装,无需额外配置。
Cn Math Expression 是免费的吗?
是的,Cn Math Expression 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Cn Math Expression 支持哪些平台?
Cn Math Expression 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Cn Math Expression?
由 freedompixels(@freedompixels)开发并维护,当前版本 v1.0.0。
推荐 Skills