calculator

Compute arithmetic expressions safely using AST parsing with whitelisted operators.

Updated May 8, 2026
One-click install
npx skills add https://github.com/Ynyqy/ZAgent --skill calculator-ynyqy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: calculator
Source: https://github.com/Ynyqy/ZAgent/tree/main/zagent/workspace/skills/calculator
Command: npx skills add https://github.com/Ynyqy/ZAgent --skill calculator-ynyqy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Quickly and safely compute mathematical expressions without exposing your environment to unsafe evaluation.

Core Features & Use Cases

  • Safe evaluation of arithmetic expressions using a restricted AST parser.
  • Supports +, -, *, /, exponentiation (**) and modulus (%).
  • Use case: quickly evaluate complex formulas in a chat or coding session.

Quick Start

Ask the agent to evaluate a math expression, for example "2 + 3 * 4".

Frequently Asked Questions about calculator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely evaluate math expressions in Python without arbitrary code execution?

This Skill safely evaluates math expressions by parsing with a restricted AST parser that whitelists operators, preventing arbitrary code execution. It processes user-provided strings to compute arithmetic operations without exposing your environment to unsafe evaluation.

How do I compute arithmetic expressions in a chat or coding session?

To compute arithmetic expressions, ask the agent to evaluate a math string like "2 + 3 * 4". The Skill parses and calculates the result on demand, supporting basic arithmetic, exponentiation, and modulus operations.

What math operators are supported by safe AST expression evaluation?

Safe AST expression evaluation supports basic arithmetic including addition, subtraction, multiplication, division, exponentiation (**), and modulus (%). It restricts parsing to these whitelisted mathematical operations only.

Does safe expression evaluation prevent arbitrary code execution from user input?

Yes, safe expression evaluation prevents arbitrary code execution by whitelisting operators and parsing with AST. This restricted parser ensures only mathematical computations run on user-provided strings, blocking dangerous code execution.

Are there limitations to evaluating complex formulas using a restricted AST parser?

Evaluating complex formulas with a restricted AST parser is limited to basic arithmetic, exponentiation, and modulus operations. It does not support arbitrary Python functions or variables, as the whitelist enforces safe mathematical evaluation only.