| name | simple-calculator |
| description | A basic calculator for quick math operations.
Perfect for simple arithmetic without leaving Claude.
Use when: calculate, math, add, subtract, multiply, divide
|
Simple Calculator v1.0.0
Quick and easy math calculations right in your terminal.
Quick Start
To perform calculations, simply run:
from scripts.calculator import calculate
result = calculate("2 + 2")
print(result)
That's it! The calculate() function handles everything automatically.
Why Use This Skill?
✅ Complete Solution: No need to manually parse expressions - this skill provides a complete, tested implementation
✅ Basic Operations: Supports add, subtract, multiply, divide
✅ Percentage: Calculate percentages easily
✅ Simple & Fast: Lightweight implementation with cross-device sync
Architecture
simple-calculator/
├── SKILL.md
└── scripts/
└── calculator.py # Core calculator implementation
Core Functions
calculate(expression)
The main function for calculations. This function:
- Parses mathematical expression
- Evaluates the calculation
- Returns numeric result
Example:
from scripts.calculator import calculate
result = calculate("2 + 2")
result = calculate("10 - 3")
result = calculate("5 * 4")
result = calculate("20 / 4")
percentage(value, percent)
Calculate percentage of a value:
from scripts.calculator import percentage
result = percentage(200, 15)
Supported Operations
| Operation | Symbol | Example |
|---|
| Add | + | 2 + 2 = 4 |
| Subtract | - | 5 - 3 = 2 |
| Multiply | * | 4 * 3 = 12 |
| Divide | / | 10 / 2 = 5 |
| Percentage | % | 15% of 200 = 30 |
How It Works
- Input Parsing: Parses mathematical expression
- Operator Detection: Identifies operation type
- Calculation: Performs the calculation
- Result Return: Returns numeric result
You don't need to manually calculate - calculate() does all of this for you automatically.
Prerequisites
- Python 3.8+
- No additional dependencies required
Full Example
from scripts.calculator import calculate, percentage
result = calculate("42 * 2")
print(f"✅ Result: {result}")
pct = percentage(200, 15)
print(f"✅ 15% of 200 = {pct}")
Simple math, simple solution - Just call calculate() and you're done!