Skip to main content
ClaudeWave
Skill538 repo starsupdated 1mo ago

tool-creator

The tool-creator skill enables creation of new executable agent tools and modification of existing ones by writing Python functions decorated with `@tool` from `langchain_core.tools`. Use this skill whenever a user requests custom tool development, script conversion into reusable tools, tool upgrades, or additions of new callable capabilities to the agent, whether explicitly stated or implied through requests like "make a tool for X" or "improve the Y tool."

Install in Claude Code
Copy
git clone --depth 1 https://github.com/AgentTeam-TaichuAI/ScienceClaw /tmp/tool-creator && cp -r /tmp/tool-creator/ScienceClaw/backend/builtin_skills/tool-creator ~/.claude/skills/tool-creator
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# Tool Creator

A skill for creating new agent tools and upgrading existing ones.

Tools are Python functions decorated with `@tool` from `langchain_core.tools` that the agent can call directly during conversations. Unlike skills (which are instruction documents), tools are executable code that extend the agent's capabilities.

## Tool Format

Every tool MUST follow this exact pattern to be compatible with the deepagents framework:

```python
import logging
from langchain_core.tools import tool

logger = logging.getLogger(__name__)


@tool
def my_tool_name(param1: str, param2: int) -> str:
    """Clear description of what this tool does.

    Provide enough detail so the agent knows WHEN and HOW to use this tool.
    The docstring is the primary mechanism for the agent to decide whether to call it.

    Args:
        param1: Description of param1
        param2: Description of param2

    Returns:
        Description of what is returned
    """
    logger.info(f"[my_tool_name] params: param1={param1}, param2={param2}")

    # Tool logic here
    result = f"Processed {param1} with {param2}"

    logger.info(f"[my_tool_name] result: {result}")
    return result
```

### Critical Rules

1. **One tool per file**: Each `.py` file in the Tools directory should contain exactly one `@tool` function.
2. **File name = function name**: The file should be named after the tool function (e.g., `my_tool_name.py` contains `def my_tool_name(...)`).
3. **Type hints are required**: All parameters and return types must have type annotations.
4. **Docstring is essential**: The docstring serves as the tool's description for the agent. Write it clearly — it determines when and how the agent will use the tool.
5. **Use logging**: Always log inputs and outputs using the `logger` for debugging.
6. **Tools run in the sandbox**: All `@tool` functions execute in the sandbox container — the same environment where test scripts run. This means the testing environment IS the production environment. You can import any package available in the sandbox.
7. **Pure functions preferred**: Tools should ideally be stateless. If state is needed, use file I/O or external services.
8. **Return serializable types**: Return `str`, `int`, `float`, `bool`, `dict`, or `list` — types that can be serialized in the agent's conversation.

### Available Packages (Sandbox Environment)

All `@tool` functions execute in the **sandbox container** — the same environment where test scripts run. The following packages are pre-installed:

- Python standard library (json, os, re, math, datetime, pathlib, etc.)
- `httpx` — HTTP client for API calls
- `pydantic` — Data validation
- `langchain_core` — Required for `@tool` decorator
- `pyyaml` — YAML parsing
- `seekr_sdk` — Provides `web_search`, `web_crawl`, `web_crawl_many` for internet search and page crawling. When writing `@tool` functions that need to search the web or crawl pages, **always prefer `seekr_sdk` over raw `httpx` calls**. See the "Web-Enabled Tool (using seekr_sdk)" example below.

Since tools run in the same sandbox where you test them, **if your test passes in the sandbox, the tool will also work in production**. If a tool needs a package not in this list, install it in the sandbox Dockerfile (docker-compose.yml sandbox service).

### Docstring Writing Guide

The docstring is how the agent decides whether to call a tool. Good docstrings:

- **First line**: A concise summary of what the tool does (this appears in tool listings)
- **Body**: Explain when to use this tool, what scenarios it covers, and any important constraints
- **Args section**: Describe each parameter with its expected format and examples
- **Returns section**: Describe the return value and its format

Make descriptions specific and "pushy" enough that the agent reliably triggers the tool for relevant tasks. For example:

Bad: `"""Calculate a score."""`

Good: `"""根据身高、体重、年龄计算人物综合打分。该工具根据人的身体数据进行综合评估打分,包括BMI健康指数评分和年龄评分。"""`

---

## Mode 1: Creating a New Tool

When the user wants to create a new tool from scratch or convert a script into a tool:

### Step 1: Understand Requirements

Ask the user:
1. What should this tool do? What problem does it solve?
2. What inputs does it need? (parameter names, types, examples)
3. What should it return? (type, format)
4. Does it need external API calls or only local computation?
5. Are there edge cases or error conditions to handle?

If the user already has a script or describes the logic clearly, extract the answers from context.

### Step 2: Write the Tool (as @tool from the start)

**CRITICAL**: Write the code directly as an `@tool` function from the very beginning. Do NOT first write a standalone script and then convert it — this leads to mismatches between tested and saved code.

Based on the requirements, write a complete tool file following the format above. Key considerations:

- Choose a clear, descriptive function name using `snake_case`
- Write a comprehensive docstring
- Add proper error handling (try/except, input validation)
- Log inputs and outputs
- Keep it focused — one tool does one thing well
- If the tool needs web search or crawling, use `seekr_sdk` (available in both backend and sandbox)

### Step 3: Test the @tool in Sandbox

Test the actual `@tool` function (NOT a separate standalone script):

1. Save the tool to `{workspace_dir}/tools_dev/{tool_name}.py`
2. Write a test script `{workspace_dir}/tools_dev/test_{tool_name}.py`:
   ```python
   import sys
   sys.path.insert(0, "{workspace_dir}/tools_dev")
   from {tool_name} import {tool_name}

   # Test cases — this calls the SAME @tool function that will be saved
   result = {tool_name}.invoke({{"param1": "value1", "param2": 42}})
   print(f"Result: {result}")
   ```
3. Run the test in the sandbox and verify the output
4. If there are errors, fix `{workspace_dir}/tools_dev/{tool_name}.py` and re-test

**IMPORTANT**: The test MUST import and invoke the `@tool` function from `tools_dev/{tool_name}.py`. Neve
docxSkill

Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.

feishu-setupSkill

自动配置飞书机器人应用。当用户要求配置飞书、创建飞书机器人、接入 Lark/飞书、设置飞书 app_id/app_secret、或询问如何配置飞书 IM 时触发此 skill。该 skill 通过 sandbox 内置浏览器自动完成飞书开放平台上的应用创建、权限配置、事件订阅和发布,用户仅需扫码登录。

find-skillsSkill

MANDATORY: When a user asks to install, find, search, or add ANY skill (e.g. 'install hello-world skill', 'find a skill for X', 'add a skill'), you MUST first run `skills find <query>` to search the skills ecosystem. NEVER create a skill from scratch without searching first. Even if the name sounds simple, always search — it may already exist as a published skill.

pdfSkill

Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.

pptxSkill

Use this skill any time a .pptx file is involved — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading or extracting text from .pptx files; editing or updating existing presentations; combining or splitting slide files; working with templates, layouts, speaker notes, or comments. Trigger whenever the user mentions 'deck', 'slides', 'presentation', or references a .pptx filename. If a .pptx file needs to be opened, created, or touched, use this skill.

skill-creatorSkill

Create new skills, modify and improve existing skills, and measure skill performance. MANDATORY: Use this skill whenever the user wants to create a custom skill from scratch, design a workflow as a skill, write their own SKILL.md, update or optimize an existing skill, run evals to test a skill, benchmark skill performance, or asks questions like 'how do I make a skill', 'create a skill for X', 'turn this into a skill', 'I want to build a skill'. Even if the user doesn't use the word 'skill' explicitly, trigger this if they want to capture a reusable workflow or set of instructions for the agent.

tooluniverseSkill

Access 1000+ scientific tools through ToolUniverse for drug discovery, protein analysis, genomics, literature search, clinical data, ADMET prediction, molecular docking, and more. Use when the user needs biomedical or scientific research capabilities.

xlsxSkill

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like \"the xlsx in my downloads\") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.