tool-definition

Define Claude Code Tools with schema-first validation and permission gating.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a repeatable pattern for defining Claude Code Tools with a schema-first approach, ensuring validation, permissions, and safe defaults are baked in from the start.

Core Features & Use Cases

  • Schema-first design using Zod to define inputs and ensure runtime validation and TypeScript types stay in sync.
  • Safe tool composition with buildTool factory, default flags, and a centralized permission check that runs before execution.
  • Use cases include adding new tools or updating existing tool behavior while maintaining security, reliability, and consistency across the Code environment.

Quick Start

Implement a new tool by calling buildTool with the appropriate inputSchema, permission checks, and default configurations.

Frequently Asked Questions about tool-definition

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

FAQPage Schema
How do I define Claude Code tools with schema-first validation?▼

You define Claude Code tools using a schema-first approach by calling the buildTool factory with a Zod inputSchema, applying permission checks, and returning { data } on success to ensure runtime validation and safe defaults.

What is the best way to add permission gating to Claude Code tools?▼

The best way to add permission gating is by using a centralized pre-call permission check within a buildTool-based workflow, ensuring the check runs before tool execution to enforce safe tool composition.

How does Zod validation work when building new Claude Code tools?▼

Zod validation works by defining an inputSchema getter that ensures runtime validation and TypeScript types stay in sync, providing schema-first design for safe and reliable tool execution.

Can I use buildTool to update existing tool behavior across projects?▼

Yes, you can use buildTool to update existing tool behavior across projects by applying its repeatable pattern with default flags, mandatory inputSchema getters, and pre-call permission checks to maintain consistency.

Why should I use a schema-first approach for Claude Code tool definition?▼

A schema-first approach for tool definition ensures validation, permissions, and safe defaults are baked in from the start, keeping runtime validation and TypeScript types synchronized while preventing unsafe tool execution.

Do I need to return a specific format on success when defining tools?▼

Yes, you need to return { data } on success when defining tools, which is a mandatory part of the buildTool-based workflow pattern to ensure consistent and safe output handling.