build-tool-factory

Create Claude Code tools with safe defaults and lazy schemas.

5|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/TechyMT/claude-code-superpowers --skill build-tool-factory
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: build-tool-factory
Source: https://github.com/TechyMT/claude-code-superpowers/tree/main/skills/build-tool-factory
Command: npx skills add https://github.com/TechyMT/claude-code-superpowers --skill build-tool-factory

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding a new capability to Claude Code requires repeating many safety-focused defaults, eager schema construction at import time, and boilerplate for permissions and metadata. The buildTool factory centralizes those defaults, enforces lazy schema initialization, and makes a tool's true behavior easy to read and review.

Core Features & Use Cases

  • Safe defaults: fills in isConcurrencySafe, isReadOnly, isDestructive, checkPermissions, isEnabled, and userFacingName so authors only implement meaningful overrides.
  • Lazy schemas: uses lazySchema getters to avoid expensive schema construction at module load, improving startup performance.
  • Permission and metadata hooks: encourages implementing checkPermissions, strict input validation, and registration with tools.ts for production readiness.
  • Use Case: convert an ad-hoc utility function into a production tool with input validation, permission checks, and concise call logic.

Quick Start

Create a new tool by calling buildTool with a lazy inputSchema, implement call and checkPermissions only as needed, and register the tool in src/tools.ts.

Frequently Asked Questions about build-tool-factory

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new tool to Claude Code with safe defaults?

Use the buildTool factory to create new Claude Code tools with safe defaults. It automatically populates isConcurrencySafe, isReadOnly, isDestructive, and checkPermissions, letting you implement only meaningful overrides for production-ready tool implementations.

How do I set up lazy schema initialization for Claude Code tools?

Lazy schema initialization uses lazySchema getters within the buildTool factory to avoid expensive schema construction at module load. This defers input and output schema building until needed, significantly improving startup performance for Claude Code tools.

What's the best way to implement input validation and permission checks for Claude Code tools?

The buildTool factory provides built-in hooks for strict input validation and checkPermissions. By centralizing these safety-focused defaults, it enforces permission checks and concise call logic without requiring manual boilerplate for each new tool.

Can I convert a utility function into a production tool without writing boilerplate?

Yes, you can convert an ad-hoc utility function into a production tool using the buildTool factory. It handles registration hints, safety behaviors, and metadata defaults, transforming the function into a fully validated, permission-checked Claude Code tool.

Why does my Claude Code tool registration require concurrency and read-only metadata?

Concurrency and read-only metadata like isConcurrencySafe and isReadOnly are required for production-grade tool implementations to ensure safe execution. The buildTool factory defaults these safety behaviors to prevent destructive or conflicting operations.