add-agent-tool
Add a new LangChain tool to the Medox ReAct agent. Use when creating a new tool file, registering it in the graph, and writing its test.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add a new LangChain tool to the Medox ReAct agent. Use when creating a new tool file, registering it in the graph, and writing its test.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Run the LangSmith evaluation suite and display pass/fail results
Create a git commit with Medox conventions (co-author, conventional type/scope). Invoke manually with /commit — do NOT trigger automatically.
Audit code changes on the current branch and update docs/ + .claude/rules/ to stay in sync. Run before /pr.
Create or update a GitHub pull request following Medox conventions (author spicode-bot, reviewer spideystreet). Invoke manually with /pr — do NOT trigger automatically.
Fetch and display the full status of the current PR — CI checks, GitHub Actions runs, reviews, and code comments — using GitHub MCP tools. Invoke manually with /pr-status.
Rebuild ChromaDB Gold layer indexes after source data changes. Invoke manually — deletes and recreates collections, do NOT trigger automatically.
| name | add-agent-tool |
| description | Add a new LangChain tool to the Medox ReAct agent. Use when creating a new tool file, registering it in the graph, and writing its test. |
| argument-hint | <tool-name> |
Create the tool file at src/medox/agent/tools/tool_<name>.py:
"""One-line description of the data source and lookup strategy."""
from langchain_core.tools import tool
from medox.pipeline.config_pipeline import PipelineSettings
@tool
def <tool_name>(<param>: str) -> str:
"""
<What this tool does — written for the LLM, not a human developer.>
Include:
- What the parameter means and expected format
- Example values or class names the LLM should pass
- What the tool returns and how to interpret it
Example: pass 'ANTIVITAMINES K' for warfarine, 'STATINES' for simvastatine.
"""
settings = PipelineSettings()
# ... implementation
Register the tool in src/medox/agent/graph_agent.py:
tools = [...] list passed to build_agent()Docstring rules (critical — the LLM uses this to decide when/how to call the tool):
Write the test at tests/agent/test_tool_<name>.py:
def test_<tool_name>_returns_expected():
result = <tool_name>.invoke({"<param>": "<known_value>"})
assert "<expected_substring>" in result
def test_<tool_name>_handles_unknown():
result = <tool_name>.invoke({"<param>": "nonexistent_xyz"})
assert result # returns graceful message, not exception
Update .claude/rules/agent.md — add the tool to the tools table.
Validate:
uv run pytest tests/agent/test_tool_<name>.py -v
uv run pytest tests/agent/ -v
tool_<name>.py — matches the @tool function name@tool per file