Get the FREE Ultimate OpenClaw Setup Guide →

simple-math

Scanned
npx machina-cli add skill cisco-ai-defense/skill-scanner/simple-math --openclaw
Files (1)
SKILL.md
523 B

Simple Math Skill

Performs basic arithmetic operations safely.

Features

  • Addition, subtraction, multiplication, division
  • No eval() or exec()
  • Input validation
  • Safe implementation

Usage

When user requests calculations, use standard Python operators.

Example

User: "What's 25 + 17?" Agent: uses simple-math skill The result is 42.

Source

git clone https://github.com/cisco-ai-defense/skill-scanner/blob/main/evals/skills/safe-skills/simple-math/SKILL.mdView on GitHub

Overview

Performs addition, subtraction, multiplication, and division using Python's native operators. It validates inputs and avoids eval or exec to ensure safe, reliable calculations in chat and automation. This makes quick math accurate and safe in conversations and decision-support flows.

How This Skill Works

When a calculation is requested, the skill uses Python's native operators to compute the result ( +, -, *, / ). It validates inputs to ensure numbers and handles division by zero gracefully, all without using eval or exec to maintain safety.

When to Use It

  • Calculating straightforward results like a + b or a * b in chat
  • Totalling costs or quantities (e.g., price × quantity) in a message
  • Providing numeric results during guidance or planning conversations
  • Handling expressions without using eval/exec for safety
  • Responding to user questions that require quick, reliable math results

Quick Start

  1. Step 1: Detect a calculation request in user input
  2. Step 2: Validate operands and operator, then compute using Python operators
  3. Step 3: Return the numeric result and handle any input errors gracefully

Best Practices

  • Validate operands are numbers (int or float) before calculating
  • Use direct Python operators rather than dynamic evaluation
  • Handle division by zero and return a clear message
  • Return consistent numeric types (int when possible, float for decimals)
  • Document and log inputs and results for auditing

Example Use Cases

  • User: What's 25 + 17? Agent: 42
  • User: 3.5 * 2? Agent: 7.0
  • User: What's 100 - 45? Agent: 55
  • User: What's 20 / 4? Agent: 5.0
  • User: Is 9 / 0 valid? Agent: Division by zero is not allowed; please provide a non-zero divisor

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers