OpenClawSkills
GitHub

Currency Converter

Community

Convert between currencies using live exchange rates.

Installation

Save as `currency.js`.

Source Code

JavaScript
Tutorial.terminal

// currency.js
// Usage: currency <amount> <from> <to>

module.exports = async function(context) {
    const amount = parseFloat(context.args[0]);
    const from = (context.args[1] || 'USD').toUpperCase();
    const to = (context.args[2] || 'EUR').toUpperCase();
    
    if (isNaN(amount)) return { error: "Invalid amount" };

    const url = `https://api.exchangerate-api.com/v4/latest/${from}`;
    const res = await fetch(url);
    const data = await res.json();
    
    const rate = data.rates[to];
    if (!rate) return { error: "Currency not supported" };
    
    return {
        from,
        to,
        rate,
        original: amount,
        converted: amount * rate
    };
};

Live Preview

● Live Demo
Agent Session
Starting session...

How to use

  • Ensure you have the necessary dependencies installed (if any).
  • Place the file in your OpenClaw skills folder (e.g., ~/.openclaw/skills/).
  • Restart your agent or reload configuration.
  • Invoke it using the filename (without extension) as the tool name, or through natural language if the description is clear.