← ClaudeAtlas

hedera-policy-creationlisted

This skill should be used when the user asks to "create a hedera policy", "block a tool", "limit recipients", "extend AbstractPolicy", "reject a tool", "enforce a threshold", "rate limit a tool", "block transfers over X", "allowlist tools", or needs guidance on writing blocking validation rules for Hedera Agent Kit tools. Policies block tool execution by throwing — for non-blocking observation use the hook skill instead.
nickthelegend/xorv · ★ 0 · AI & Automation · score 70
Install: claude install-skill nickthelegend/xorv
# Creating Hedera Agent Kit Policies Policies are blocking validation rules layered on the `BaseTool` lifecycle. A policy checks the call at one or more stages and **throws** to abort execution — the error propagates back to the LLM agent. Use them to enforce thresholds, allowlists/blocklists, rate limits, business hours, compliance rules, etc. > Policies fire **only** for tools that extend `BaseTool`. A tool that implements the `Tool` interface directly without extending `BaseTool` bypasses policies entirely. ## Policy vs. hook | Goal | Use | |---|---| | Stop a call when a condition holds | **Policy** (this skill) | | Reject specific tool methods | **Policy** | | Threshold / rate-limit / allowlist / blocklist | **Policy** | | Log, audit, enrich context | **Hook** (see `agent-kit-hook` skill) | `AbstractPolicy` extends `AbstractHook`, so policies live in the same `Context.hooks` array and run through the same lifecycle. Built-in policies live in `@hashgraph/hedera-agent-kit/policies`: - `RejectToolPolicy(relevantTools: string[])` — blocks the listed tool methods unconditionally - `MaxRecipientsPolicy(maxRecipients, additionalTools?, customStrategies?)` — caps recipient count for transfer/airdrop tools ## How blocking actually works You **never** override `preToolExecutionHook` or any of the other `*Hook` methods on a policy — those are wired up by the base class to call your `shouldBlock...` method and throw if it returns `true`. Override one or more of these instead