Skill in 《LangChain Tool Builder》

Skill Description

Build LangChain (Python) tools using Claude Code's fail-closed design pattern — unified name, schema, security, and execution in one class, with automatic three-layer execution (validate → permission → call). New tools are safe by default.

Skill.md

LangChain Tool Builder

Writing LangChain tools by hand has a subtle failure mode: security properties end up scattered — permission logic bleeds into execution logic, a new tool forgets to set is_read_only and becomes implicitly write-capable. This skill applies Claude Code's buildTool() pattern to fix this at the source: one class co-locates identity, schema, security metadata, and execution, and new tools are fail-closed safe by default.

Core Framework

LayerMethodResponsibility
Security metadataClass attributesis_read_only, is_destructive, is_concurrency_safe — all default False (fail-closed)
Semantic validation_validate_input_semanticsReject malformed inputs before execution; error messages must be actionable
Permission check_check_permissionsReject unauthorized access (path traversal, missing env vars, wrong org)
Core logic_callBusiness execution — only runs after the first two layers pass

Supported Query Types

  • "Build a tool to search / query / create / delete X"
  • "Add permission checking to this tool"
  • "Add input validation to this tool"
  • "Set up ClaudeStyleTool base class in my project"
  • "build_tool" / "Claude Code style tool" / "create a LangChain tool"

How to Use

  1. Open Claude Code and say "build a tool for X" or "create a LangChain tool"
  2. The skill checks if ClaudeStyleTool base class is installed, and copies it if not
  3. Collects tool name, description, schema fields, and security property answers
  4. Generates a complete .py tool file in correct field order
  5. Prints a one-line security posture summary for quick verification
  6. For simple tools with no custom validation, uses the build_tool() factory instead

Limitations

Security properties require developer judgment — the skill will ask the right questions, but whether a tool is truly concurrency-safe depends on your business logic. The _call body is scaffolded with a placeholder; you fill in the actual implementation.

Install & Use

Install command

npx skills add simbajigege/book2skills/skills/langchain-tool-builder
OR

Direct download

Related Skills

Tool Permission System AI Skill

Design a configurable, layered permission/safety system for agent tools: one permission pipeline decides allow / ask / deny across enterprise/user/project scopes.

Agent Memory Implementation Guide AI Skill

Restructures a bloated or chaotic MEMORY.md into the 2-layer architecture Claude Code's autoDream service uses intern...

Harness Step 3 — Session State Management AI Skill

Creates init.sh (environment health check), tasks.json (structured task queue), and progress.md (append-only session ...

Session Dream AI Skill

On-demand session memory distillation — extracts key decisions, eliminated approaches, new discoveries, and current b...

Compact Memory Implementation Guide AI Skill

A developer implementation guide for adding compact memory to an Agent built with the Anthropic API or Claude Agent S...

Harness Step 1 — Create AGENTS.md & Knowledge Base AI Skill

Scans your codebase and generates AGENTS.md (the agent's orientation file) plus a complete docs/ knowledge base skele...

Harness Step 2 — Fill docs/ with Real Content AI Skill

Deep-reads your codebase and fills every docs/ file with specific, accurate content grounded in what the code actuall...

Compact with Memory AI Skill

Executes /compact correctly — generates a high-quality conversation summary that preserves reasoning, decisions, and ...

Query Loop Implementation AI Skill

Implement a production-ready LLM query loop for AI applications: tool calling, structured tool_result feedback, ReAct...

Understanding Financial Statements AI Skill

Analyze company financials using Tsinghua Professor Xiao Xing's three-statement framework. Apply to any company: bala...

Poor Charlie's Almanack AI Skill

Transform Charlie Munger's latticework of mental models and worldly wisdom into an AI analysis tool for investments, ...