SM

smart-accounts-kit

Build dApps using ERC-4337 smart accounts with MetaMask. Includes support for gas abstraction, multiple signers, and delegations.

Install

mkdir -p .claude/skills/smart-accounts-kit && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11212" && unzip -o skill.zip -d .claude/skills/smart-accounts-kit && rm skill.zip

Installs to .claude/skills/smart-accounts-kit

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Web3 development using MetaMask Smart Accounts Kit. Use when the user wants to build dApps with ERC-4337 smart accounts, send user operations, batch transactions, configure signers (EOA, passkey, multisig), implement gas abstraction with paymasters, create delegations, or request advanced permissions (ERC-7715). Supports Viem integration, multiple signer types (Dynamic, Web3Auth, Wagmi), gasless transactions, and the Delegation Framework.
442 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Advanced

Key capabilities

  • Create ERC-4337 smart accounts
  • Batch blockchain transactions
  • Implement gasless transactions via paymasters
  • Configure multisig or passkey signers
  • Manage ERC-7715 advanced permissions

How it works

It provides a toolkit to interface with ERC-4337 smart accounts, enabling developers to manage delegations, sign transactions, and request permissions through a standardized API.

Inputs & outputs

You give it
Smart account implementation type and signer configuration
You get back
Signed user operations or delegation objects

When to use smart-accounts-kit

  • Create ERC-4337 accounts
  • Implement gasless transactions
  • Batch blockchain transactions
  • Configure multisig signers

About this skill

Quick Reference

This skill file provides quick access to the MetaMask Smart Accounts Kit v0.3.0. For detailed information, refer to the specific reference files.

📚 Detailed References:

Package Installation

npm install @metamask/[email protected]

For custom caveat enforcers:

forge install metamask/[email protected]

Core Concepts Summary

1. Smart Accounts (ERC-4337)

Three implementation types:

ImplementationBest ForKey Feature
Hybrid (Implementation.Hybrid)Standard dApp usersEOA + passkey signers, most flexible
MultiSig (Implementation.MultiSig)Treasury/DAO operationsThreshold-based security, Safe-compatible
Stateless7702 (Implementation.Stateless7702)Power users with existing EOAKeep same address, add smart account features via EIP-7702

Decision Guide:

  • Building for general users? → Hybrid
  • Managing treasuries or multi-party control? → MultiSig
  • Upgrading existing EOAs without address change? → Stateless7702

2. Delegation Framework (ERC-7710)

Grant permissions from delegator to delegate:

  • Scopes - Initial authority (spending limits, function calls)
  • Caveats - Restrictions enforced by smart contracts
  • Types - Root, open root, redelegation, open redelegation
  • Lifecycle - Create → Sign → Store → Redeem

3. Advanced Permissions (ERC-7715)

Request permissions via MetaMask extension:

  • Human-readable UI confirmations
  • ERC-20 and native token permissions
  • Requires MetaMask Flask 13.5.0+
  • User must have smart account

Quick Code Examples

Create Smart Account

import { Implementation, toMetaMaskSmartAccount } from '@metamask/smart-accounts-kit'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...')

const smartAccount = await toMetaMaskSmartAccount({
  client: publicClient,
  implementation: Implementation.Hybrid,
  deployParams: [account.address, [], [], []],
  deploySalt: '0x',
  signer: { account },
})

Create Delegation

import { createDelegation } from '@metamask/smart-accounts-kit'
import { parseUnits } from 'viem'

const delegation = createDelegation({
  to: delegateAddress,
  from: delegatorSmartAccount.address,
  environment: delegatorSmartAccount.environment,
  scope: {
    type: 'erc20TransferAmount',
    tokenAddress: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238',
    maxAmount: parseUnits('10', 6),
  },
  caveats: [
    { type: 'timestamp', afterThreshold: now, beforeThreshold: expiry },
    { type: 'limitedCalls', limit: 5 },
  ],
})

Sign Delegation

const signature = await smartAccount.signDelegation({ delegation })
const signedDelegation = { ...delegation, signature }

Redeem Delegation

import { createExecution, ExecutionMode } from '@metamask/smart-accounts-kit'
import { DelegationManager } from '@metamask/smart-accounts-kit/contracts'
import { encodeFunctionData, erc20Abi } from 'viem'

const callData = encodeFunctionData({
  abi: erc20Abi,
  args: [recipient, parseUnits('1', 6)],
  functionName: 'transfer',
})

const execution = createExecution({ target: tokenAddress, callData })

const redeemCalldata = DelegationManager.encode.redeemDelegations({
  delegations: [[signedDelegation]],
  modes: [ExecutionMode.SingleDefault],
  executions: [[execution]],
})

// Via smart account
const userOpHash = await bundlerClient.sendUserOperation({
  account: delegateSmartAccount,
  calls: [{ to: delegateSmartAccount.address, data: redeemCalldata }],
})

// Via EOA
const txHash = await delegateWalletClient.sendTransaction({
  to: environment.DelegationManager,
  data: redeemCalldata,
})

Request Advanced Permissions

import { erc7715ProviderActions } from '@metamask/smart-accounts-kit/actions'

const walletClient = createWalletClient({
  transport: custom(window.ethereum),
}).extend(erc7715ProviderActions())

const grantedPermissions = await walletClient.requestExecutionPermissions([
  {
    chainId: chain.id,
    expiry: now + 604800,
    signer: {
      type: 'account',
      data: { address: sessionAccount.address },
    },
    permission: {
      type: 'erc20-token-periodic',
      data: {
        tokenAddress,
        periodAmount: parseUnits('10', 6),
        periodDuration: 86400,
        justification: 'Transfer 10 USDC daily',
      },
    },
    isAdjustmentAllowed: true,
  },
])

Redeem Advanced Permissions

// Smart account
import { erc7710BundlerActions } from '@metamask/smart-accounts-kit/actions'

const bundlerClient = createBundlerClient({
  client: publicClient,
  transport: http(bundlerUrl),
}).extend(erc7710BundlerActions())

const permissionsContext = grantedPermissions[0].context
const delegationManager = grantedPermissions[0].signerMeta.delegationManager

const userOpHash = await bundlerClient.sendUserOperationWithDelegation({
  publicClient,
  account: sessionAccount,
  calls: [
    {
      to: tokenAddress,
      data: calldata,
      permissionsContext,
      delegationManager,
    },
  ],
})

// EOA
import { erc7710WalletActions } from '@metamask/smart-accounts-kit/actions'

const walletClient = createWalletClient({
  account: sessionAccount,
  chain,
  transport: http(),
}).extend(erc7710WalletActions())

const txHash = await walletClient.sendTransactionWithDelegation({
  to: tokenAddress,
  data: calldata,
  permissionsContext,
  delegationManager,
})

Key API Methods

Smart Accounts

  • toMetaMaskSmartAccount() - Create smart account
  • aggregateSignature() - Combine multisig signatures
  • signDelegation() - Sign delegation
  • signUserOperation() - Sign user operation
  • signMessage() / signTypedData() - Standard signing

Delegations

  • createDelegation() - Create delegation with delegate
  • createOpenDelegation() - Create open delegation
  • createCaveatBuilder() - Build caveats array
  • createExecution() - Create execution struct
  • redeemDelegations() - Encode redemption calldata
  • signDelegation() - Sign with private key
  • getSmartAccountsEnvironment() - Resolve environment
  • deploySmartAccountsEnvironment() - Deploy contracts
  • overrideDeployedEnvironment() - Override environment

Advanced Permissions

  • erc7715ProviderActions() - Wallet client extension for requesting
  • requestExecutionPermissions() - Request permissions
  • erc7710BundlerActions() - Bundler client extension
  • sendUserOperationWithDelegation() - Redeem with smart account
  • erc7710WalletActions() - Wallet client extension
  • sendTransactionWithDelegation() - Redeem with EOA

Supported ERC-7715 Permission Types

ERC-20 Token Permissions

Permission TypeDescription
erc20-token-periodicPer-period limit that resets at each period
erc20-token-streamLinear streaming with amountPerSecond rate

Native Token Permissions

Permission TypeDescription
native-token-periodicPer-period ETH limit that resets
native-token-streamLinear ETH streaming with amountPerSecond rate

Common Delegation Scopes

Spending Limits

ScopeDescription
erc20TransferAmountFixed ERC-20 limit
erc20PeriodTransferPer-period ERC-20 limit
erc20StreamingLinear streaming ERC-20
nativeTokenTransferAmountFixed native token limit
nativeTokenPeriodTransferPer-period native token limit
nativeTokenStreamingLinear streaming native
erc721TransferERC-721 (NFT) transfer

Function Calls

ScopeDescription
functionCallSpecific methods/addresses allowed
ownershipTransferOwnership transfers only

Common Caveat Enforcers

Target & Method

  • allowedTargets - Limit callable addresses
  • allowedMethods - Limit callable methods
  • allowedCalldata - Validate specific calldata
  • exactCalldata / exactCalldataBatch - Exact calldata match
  • exactExecution / exactExecutionBatch - Exact execution match

Value & Token

  • valueLte - Limit native token value
  • erc20TransferAmount - Limit ERC-20 amount
  • erc20BalanceChange - Validate ERC-20 balance change
  • erc721Transfer / erc721BalanceChange - ERC-721 restrictions
  • erc1155BalanceChange - ERC-1155 validation

Time & Frequency

  • timestamp - Valid time range (seconds)
  • blockNumber - Valid block range
  • limitedCalls - Limit redemption count
  • erc20PeriodTransfer / erc20Streaming - Time-based ERC-20
  • nativeTokenPeriodTransfer / nativeTokenStreaming - Time-based native

Security & State

  • redeemer - Limit redemption to specific addresses
  • id - One-time delegation with ID
  • nonce - Bulk revocation via nonce
  • deployed - Auto-deploy contract
  • ownershipTransfer - Ownership transfer only
  • nativeTokenPayment - Require payment
  • nativeBalanceChange - Validate native balance
  • multiTokenPeriod - Multi-token period limits

Execution Modes

ModeChainsProcessingOn Failure
SingleDefaultOneSequentialRevert
SingleTryOneSequentialContinue
BatchDefaultMultipleInterleavedRe

Content truncated.

When not to use it

  • When building dApps that do not require smart account features

Prerequisites

npm package @metamask/smart-accounts-kitMetaMask Flask 13.5.0+ for advanced permissions

Limitations

  • Requires specific MetaMask versions for advanced features
  • Delegation chains must be properly ordered

How it compares

It abstracts the complexity of ERC-4337 and delegation frameworks into a unified library, avoiding manual contract interaction and low-level user operation construction.

Compared to similar skills

smart-accounts-kit side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
smart-accounts-kit (this skill)03moReviewAdvanced
fastapi-templates5202moNo flagsIntermediate
android-kotlin-development2685moReviewAdvanced
fastapi-pro794moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

5201,086

android-kotlin-development

aj-geddes

Develop native Android apps with Kotlin. Covers MVVM with Jetpack, Compose for modern UI, Retrofit for API calls, Room for local storage, and navigation architecture.

268679

fastapi-pro

sickn33

Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async patterns. Use PROACTIVELY for FastAPI development, async optimization, or API architecture.

79181

telegram-bot-builder

davila7

Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.

106130

telegram-mini-app

davila7

Expert in building Telegram Mini Apps (TWA) - web apps that run inside Telegram with native-like experience. Covers the TON ecosystem, Telegram Web App API, payments, user authentication, and building viral mini apps that monetize. Use when: telegram mini app, TWA, telegram web app, TON app, mini app.

62163

stripe-integration

wshobson

Implement Stripe payment processing for robust, PCI-compliant payment flows including checkout, subscriptions, and webhooks. Use when integrating Stripe payments, building subscription systems, or implementing secure checkout flows.

48165

Search skills

Search the agent skills registry