This skill should be used when the user asks to "create a hedera plugin", "build a hedera agent kit plugin", "extend hedera agent kit", "create custom hedera tools", "add hedera functionality", "write a hedera tool", "implement hedera tool", or needs guidance on Hedera Agent Kit plugin architecture, tool definitions, mutation tools, query tools, or parameter schemas using Zod.
From agent-kit-pluginnpx claudepluginhub hedera-dev/hedera-skills --plugin agent-kit-pluginThis skill uses the workspace's default tool permissions.
examples/simple-plugin/index.tsexamples/simple-plugin/tools/greeting.tsexamples/token-plugin/index.tsexamples/token-plugin/tools/create-token.tsexamples/token-plugin/tools/get-token-info.tsreferences/error-handling.mdreferences/plugin-interface.mdreferences/prompt-patterns.mdreferences/zod-schema-patterns.mdDesigns and optimizes AI agent action spaces, tool definitions, observation formats, error recovery, and context for higher task completion rates.
Enables AI agents to execute x402 payments with per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents pay for APIs, services, or other agents.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
This skill provides guidance for creating custom plugins that extend the Hedera Agent Kit. Plugins allow adding new tools for Hedera network interactions—token operations, account management, consensus service, smart contracts, and custom integrations.
To create a Hedera plugin in 5 steps:
hedera-agent-kit and @hashgraph/sdkindex.ts with the plugin definition and a tools/ directoryPluginRegistryEvery Hedera plugin implements this interface from hedera-agent-kit:
import { Plugin } from 'hedera-agent-kit';
export interface Plugin {
name: string; // Unique kebab-case identifier
version?: string; // Semantic version (e.g., "1.0.0")
description?: string; // Brief explanation of plugin purpose
tools: (context: Context) => Tool[]; // Factory returning tools
}
The tools function receives a Context object containing network configuration and returns an array of Tool objects.
Each tool implements this interface:
import { Tool } from 'hedera-agent-kit';
export interface Tool {
method: string; // Unique snake_case identifier (e.g., "create_token_tool")
name: string; // Human-readable display name
description: string; // LLM-friendly description for the AI agent
parameters: z.ZodObject; // Zod schema for input validation
execute: (client: Client, context: Context, params: any) => Promise<any>;
outputParser?: (rawOutput: string) => { raw: any; humanMessage: string };
}
Mutation Tools - Perform state-changing operations:
handleTransaction() for executiontransactionToolOutputParser for outputQuery Tools - Read data without state changes:
untypedQueryOutputParser for outputFollow this structure for all Hedera plugins:
my-hedera-plugin/
├── index.ts # Plugin definition and exports
└── tools/
└── category/ # Group related tools
├── create-something.ts
└── get-something.ts
export const MY_TOOL_NAME = 'my_tool_name_tool';
Use UPPER_SNAKE_CASE with _TOOL suffix for the constant. The value should be lowercase snake_case.
const myToolPrompt = (context: Context = {}) => {
return `This tool does X on Hedera.
Parameters:
- param1 (str, required): Description of param1
- param2 (int, optional): Description of param2, defaults to 0`;
};
Descriptions guide the AI agent on when and how to use the tool. Be specific about parameter types and requirements.
import { z } from 'zod';
const myToolParameters = (context: Context = {}) => {
return z.object({
param1: z.string().describe('Description of param1'),
param2: z.number().optional().describe('Description of param2'),
});
};
See references/zod-schema-patterns.md for common Hedera parameter patterns.
const myToolExecute = async (
client: Client,
context: Context,
params: z.infer<ReturnType<typeof myToolParameters>>,
) => {
try {
// Build and execute Hedera transaction
const result = await handleTransaction(tx, client, context, postProcess);
return result;
} catch (error) {
const message = 'Failed to execute' + (error instanceof Error ? `: ${error.message}` : '');
return { raw: { error: message }, humanMessage: message };
}
};
const tool = (context: Context): Tool => ({
method: MY_TOOL_NAME,
name: 'My Tool Display Name',
description: myToolPrompt(context),
parameters: myToolParameters(context),
execute: myToolExecute,
outputParser: transactionToolOutputParser,
});
export default tool;
import { Context } from 'hedera-agent-kit';
import { Plugin } from 'hedera-agent-kit';
import myTool, { MY_TOOL_NAME } from './tools/category/my-tool';
export const myPlugin: Plugin = {
name: 'my-hedera-plugin',
version: '1.0.0',
description: 'A plugin for custom Hedera operations',
tools: (context: Context) => {
return [
myTool(context),
];
},
};
export const myPluginToolNames = {
MY_TOOL_NAME,
} as const;
export default { myPlugin, myPluginToolNames };
Create human-readable output from transaction results:
const postProcess = (response: RawTransactionResponse) => {
if (response.scheduleId) {
return `Scheduled transaction created.
Transaction ID: ${response.transactionId}
Schedule ID: ${response.scheduleId.toString()}`;
}
return `Operation completed.
Transaction ID: ${response.transactionId}
Result: ${response.someValue}`;
};
| Element | Convention | Example |
|---|---|---|
| Plugin name | kebab-case | my-token-plugin |
| Plugin variable | camelCase | myTokenPlugin |
| Tool constant | UPPER_SNAKE_CASE + _TOOL | CREATE_TOKEN_TOOL |
| Tool method value | snake_case + _tool | create_token_tool |
| Tool file | kebab-case | create-token.ts |
| Tool names export | camelCase + ToolNames | myTokenPluginToolNames |
// From hedera-agent-kit
import { Context } from 'hedera-agent-kit';
import { Plugin } from 'hedera-agent-kit';
import { Tool } from 'hedera-agent-kit';
import { handleTransaction, RawTransactionResponse } from 'hedera-agent-kit';
import { transactionToolOutputParser, untypedQueryOutputParser } from 'hedera-agent-kit';
// From Hedera SDK
import { Client, Status } from '@hashgraph/sdk';
// For parameter validation
import { z } from 'zod';
For detailed patterns and techniques, consult:
references/plugin-interface.md - Complete Plugin and Tool interface documentationreferences/zod-schema-patterns.md - Common Zod schemas for Hedera parametersreferences/prompt-patterns.md - Prompt generation patterns for tool descriptionsreferences/error-handling.md - Error handling and output parsing patternsWorking examples in examples/:
examples/simple-plugin/ - Basic plugin with one tool (starter template)examples/token-plugin/ - Full token plugin with mutation and query toolstools/.describe() callspostProcess to format results for usersAfter creating a plugin, register it with the Hedera Agent Kit:
import { PluginRegistry } from 'hedera-agent-kit';
import { myPlugin } from './my-hedera-plugin';
const registry = new PluginRegistry();
registry.register(myPlugin);
// Get all tools from registered plugins
const tools = registry.getTools(context);
index.ts and tools/ subdirectoryPluginRegistryFor complete working examples, see the examples/ directory.