home / skills / louloulin / claude-agent-sdk / example-calculator

This skill helps you perform basic arithmetic operations by adding, subtracting, multiplying, and dividing numbers accurately.

npx playbooks add skill louloulin/claude-agent-sdk --skill example-calculator

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
671 B
---
name: example-calculator
description: "A simple calculator skill demonstrating SKILL.md format"
version: "1.0.0"
author: "Claude Agent SDK Team"
tags:
  - example
  - calculator
  - math
dependencies: []
---

# Example Calculator Skill

This is an example skill that demonstrates the SKILL.md file format with YAML frontmatter.

## Capabilities

This skill can:
- Add numbers
- Subtract numbers
- Multiply numbers
- Divide numbers

## Usage

Simply ask for a calculation like "What is 2 + 2?"

## Notes

This is a demonstration skill showing the complete SKILL.md format with:
- YAML frontmatter metadata
- Markdown content
- Optional resources in the same directory

Overview

This skill provides a simple calculator interface for basic arithmetic operations. It performs addition, subtraction, multiplication, and division with a concise natural-language query style. The implementation demonstrates a lightweight Rust-based agent approach for parsing and evaluating numeric expressions.

How this skill works

The skill parses short natural-language or symbolic expressions (for example, "2 + 2" or "What is 7 times 3?") into tokens, identifies the operator and operands, and performs the requested arithmetic operation. It returns the numeric result and handles common edge cases such as division by zero and malformed input with clear error messages.

When to use it

  • Quick arithmetic calculations during a conversation or workflow.
  • Testing numeric parsing and simple operator handling in an agent environment.
  • Teaching or demonstrating how an agent integrates small Rust-based components.
  • Replacing a mental or handheld calculator for one-off computations.
  • Embedding in examples that need deterministic, reliable basic math results.

Best practices

  • Provide expressions as short, unambiguous phrases (e.g., "12.5 * 4" or "10 divided by 2").
  • Use parentheses sparingly; the skill is optimized for single-operator calculations.
  • Check returned messages for explicit error text when inputs might be malformed.
  • Normalize number formats (use dots for decimals) to avoid locale parsing issues.
  • Validate important results in systems that require high precision or tolerance control.

Example use cases

  • Ask for quick arithmetic while composing text or notes: "What is 15 + 27?"
  • Include as a demo in agent tutorials to show parsing and execution of simple commands.
  • Use in unit tests to verify basic numeric handling in a larger Rust agent pipeline.
  • Calculate simple finance or inventory items during chat-based workflows.
  • Teach newcomers how input parsing maps to operations and outputs in an agent.

FAQ

How does the skill handle division by zero?

It detects division by zero and returns a clear error message instead of producing Infinity or crashing.

Can it evaluate multi-operator expressions or respect operator precedence?

The skill is designed for single-operator expressions. For complex expressions or strict precedence handling, use a dedicated expression evaluator.