| name | math-calculator |
| description | Calculate mathematical expressions using shell commands. Use when the user asks to perform arithmetic calculations like addition, subtraction, multiplication, division, or powers. |
| license | Apache-2.0 |
| compatibility | Requires bash with bc (basic calculator) |
Math Calculator Skill
This skill calculates mathematical expressions using shell commands.
When to Use
Use this skill when the user asks to evaluate a numeric expression, such as:
- Basic arithmetic (add, subtract, multiply, divide)
- Expressions with parentheses
- Powers and square roots
Method
Pipe the expression into the bc (basic calculator) command:
echo "(2 + 3) * 4" | bc
echo "2 ^ 10" | bc
For decimal results, set the scale first:
echo "scale=2; 10 / 3" | bc
Instructions
- Translate the user's question into a single
bc expression.
- Run it with the
bash tool: echo "<expression>" | bc.
- Report the number printed by
bc as the answer.