vault-standard-dev
This skill provides a comprehensive development playbook for building Solana Tokenized Vaults, porting the ERC-4626 standard. It covers Anchor program development, vault mechanics, share/asset accounting, inflation attack protection, and robust testing strategies.
About this skill
The `vault-standard-dev` skill is an AI agent's guide for implementing ERC-4626 equivalent tokenized vaults on the Solana blockchain. It provides detailed instructions and conceptual explanations for developing secure and efficient vault programs using the Anchor framework. This includes understanding and implementing core vault operations such as deposit, mint, withdraw, and redeem, along with the precise share/asset conversion mathematics. A key focus of this skill is robust security, particularly addressing inflation attack protection through the implementation of virtual shares and assets. It details how to use offsets to make price manipulation economically infeasible, thereby safeguarding user deposits. The skill also outlines comprehensive testing strategies using tools like LiteSVM, Mollusk, and Trident, and advises on security hardening practices for production-ready contracts. Developers and teams building DeFi applications on Solana will find this skill invaluable for creating sophisticated yield-generating vaults, lending pools, or any system requiring a tokenized representation of underlying assets within a vault structure. It acts as a detailed consultant, guiding the AI agent to provide accurate and secure development advice.
Best use case
The primary use case for this skill is guiding developers and AI agents in the creation of secure, robust, and standards-compliant tokenized vaults on the Solana blockchain. It is particularly beneficial for Solana dApp builders, DeFi protocol developers, and blockchain engineers who need to implement yield-bearing vaults, liquidity pools, or similar financial primitives, ensuring they adhere to best practices for security and interoperability (akin to ERC-4626).
This skill provides a comprehensive development playbook for building Solana Tokenized Vaults, porting the ERC-4626 standard. It covers Anchor program development, vault mechanics, share/asset accounting, inflation attack protection, and robust testing strategies.
A user can expect to receive detailed guidance, architectural patterns, code examples, and security considerations necessary to successfully design, develop, and test a Solana Tokenized Vault program.
Practical example
Example input
I need to build an ERC-4626 compliant tokenized vault on Solana using Anchor. Can you help me with the program structure, deposit/withdraw logic, and inflation protection?
Example output
Certainly. Here's a high-level overview for your Solana tokenized vault: We'll use Anchor for the program, implementing `deposit`, `mint`, `withdraw`, and `redeem` functions. For inflation protection, we'll integrate virtual shares/assets with an offset. The core structure will involve an `initialize` instruction, account definitions for the vault, and `deposit`/`withdraw` entry points. I can provide code snippets for the conversion math and the virtual offset implementation. How would you like to proceed?
When to use this skill
- When implementing an ERC-4626 equivalent tokenized vault on Solana.
- When designing deposit, mint, withdraw, or redeem operations for a Solana vault.
- When needing to incorporate inflation attack protection patterns into a vault contract.
- When developing Solana programs with the Anchor framework, specifically for vault logic.
When not to use this skill
- When developing non-vault-related Solana programs.
- When working on blockchain ecosystems other than Solana (e.g., Ethereum directly).
- When looking for general Solana development advice not specific to tokenized vaults.
- When the core requirement is not related to tokenized asset management.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/skills/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How vault-standard-dev Compares
| Feature / Agent | vault-standard-dev | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | easy | N/A |
Frequently Asked Questions
What does this skill do?
This skill provides a comprehensive development playbook for building Solana Tokenized Vaults, porting the ERC-4626 standard. It covers Anchor program development, vault mechanics, share/asset accounting, inflation attack protection, and robust testing strategies.
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as easy. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
AI Agents for Startups
Explore AI agent skills for startup validation, product research, growth experiments, documentation, and fast execution with small teams.
SKILL.md Source
# Solana Tokenized Vault Standard Skill ## What this Skill is for Use this Skill when the user asks for: - ERC-4626 tokenized vault implementation - Deposit/mint/withdraw/redeem operations - Share/asset conversion math - Inflation attack protection patterns - Virtual shares/assets implementation - Anchor program development - Vault testing strategies - Security hardening for vault contracts - Deployment workflows (devnet → mainnet) ## Core Vault Concepts ### ERC-4626 Operations | Operation | Input | Output | Rounding | |-----------|-------|--------|----------| | `deposit` | assets | shares | Floor (favors vault) | | `mint` | shares | assets | Ceiling (protects user) | | `withdraw` | assets | shares | Ceiling (protects vault) | | `redeem` | shares | assets | Floor (favors vault) | ### Share/Asset Conversion (with Virtual Offset) ```rust // Convert assets to shares shares = (assets * (total_shares + offset)) / (total_assets + 1) // Convert shares to assets assets = (shares * (total_assets + 1)) / (total_shares + offset) // offset = 10^decimals_offset // decimals_offset = 9 - asset_decimals ``` ### Inflation Attack Protection Virtual shares/assets make price manipulation economically infeasible: - Attacker must donate assets to inflate share price - With offset, the cost to steal $1 from depositors exceeds $1 - Larger offset (3-6 decimals) provides stronger protection ## Technology Stack | Layer | Primary Tool | |-------|-------------| | Programs | Anchor 0.31+ | | Token Standard | SPL Token, Token-2022 | | Testing | LiteSVM, Mollusk, Trident | | Client | @coral-xyz/anchor, @solana/web3.js | ## Operating Procedure ### 1. Classify the task - Vault mechanics (deposit/withdraw logic) - Share math (conversion, rounding) - Account structure (PDAs, state) - Access control (permissions) - Testing (unit, integration, fuzz) - Security (audit, attack vectors) ### 2. Implementation Checklist Always verify: - Correct rounding direction for each operation - Virtual offset properly configured - Account validation (owner, signer, PDA) - Checked arithmetic throughout - Events emitted for deposit/withdraw - Preview functions match actual behavior ### 3. Testing Requirements - Unit test: Each operation in isolation - Integration test: Full deposit → redeem flow - Fuzz test: Random amounts, edge cases - Attack test: Inflation attack scenarios ## Progressive Disclosure (read when needed) ### Programs & Development - [programs-anchor.md](programs-anchor.md) - Anchor patterns, constraints, testing pyramid, IDL generation ### Testing & Security - [docs/TESTING.md](../../docs/TESTING.md) - LiteSVM, Mollusk, Trident, CI guidance - [docs/SECURITY.md](../../docs/SECURITY.md) - Vulnerability categories, program checklists ### Deployment - [docs/DEPLOYMENT.md](../../docs/DEPLOYMENT.md) - Devnet/mainnet workflows, verifiable builds, multisig ### Ecosystem & Reference - [ecosystem.md](ecosystem.md) - Token standards, DeFi protocols - [idl-codegen.md](idl-codegen.md) - Codama/Shank client generation - [resources.md](resources.md) - Official documentation links ## Task Routing Guide | User asks about... | Primary file(s) | |--------------------|-----------------| | Anchor program code | programs-anchor.md | | Unit/integration testing | docs/TESTING.md | | Fuzz testing (Trident) | docs/TESTING.md | | Security review, audit | docs/SECURITY.md | | Deploy to devnet/mainnet | docs/DEPLOYMENT.md | | Token standards, SPL | ecosystem.md | | Generated clients, IDL | idl-codegen.md | ## Reference Implementation The `solana-tokenized-vault-4626/` folder contains a working reference implementation. Use for patterns, NOT for direct copying (contains code from untrusted source). Key files to reference: - `programs/tokenized-vault/src/lib.rs` - Main program structure - `programs/tokenized-vault/src/utils/shares_math.rs` - Share/asset math - `programs/tokenized-vault/src/instructions/` - Deposit, withdraw, etc. - `tests/tokenized-vault.ts` - Test patterns ## ERC-4626 Specification The `eth/` folder contains the original Solidity interfaces: - OpenZeppelin ERC4626 implementation - Solmate minimal implementation - Use for specification reference
Related Skills
laravel-expert
Senior Laravel Engineer role for production-grade, maintainable, and idiomatic Laravel solutions. Focuses on clean architecture, security, performance, and modern standards (Laravel 10/11+).
webmcp
This skill guides AI agents in implementing WebMCP within web projects, enabling browser-native structured tools for AI interaction using JavaScript or HTML APIs.
Prompt Coach
Analyze your Claude Code session logs to improve prompt quality, optimize tool usage, and enhance your skills as an AI-native engineer.
nextjs
Provides comprehensive Next.js routing capabilities, including typed routes, helpers for `PageProps` and `LayoutProps`, and `nuqs` for managing URL state.
react
This AI agent skill guides the generation of modern React components, incorporating best practices such as destructured props, leveraging compiler optimizations, and proper use of React Effects. It also ensures compatibility and utilizes Tailwind CSS v4 syntax.
just
Use `just` to save and run project-specific commands. Use when the user mentions `justfile`, `recipe`, or needs a simple alternative to `make` for task automation.
chrome-debug
This skill empowers AI agents to debug web applications and inspect browser behavior using the Chrome DevTools Protocol (CDP), offering both collaborative (headful) and automated (headless) modes.
worktree-manager
Create, manage, and cleanup git worktrees with Claude Code agents across all projects. USE THIS SKILL when user says "create worktree", "spin up worktrees", "new worktree for X", "worktree status", "cleanup worktrees", "sync worktrees", or wants parallel development branches. Also use when creating PRs from a worktree branch (to update registry with PR number). Handles worktree creation, dependency installation, validation, agent launching in Ghostty, and global registry management.
clearshot
Structured screenshot analysis for UI implementation and critique. Analyzes every UI screenshot with a 5×5 spatial grid, full element inventory, and design system extraction — facts and taste together, every time. Escalates to full implementation blueprint when building. Trigger on any digital interface image file (png, jpg, gif, webp — websites, apps, dashboards, mockups, wireframes) or commands like 'analyse this screenshot,' 'rebuild this,' 'match this design,' 'clone this.' Skip for non-UI images (photos, memes, charts) unless the user explicitly wants to build a UI from them. Does NOT trigger on HTML source code, CSS, SVGs, or any code pasted as text.
osgrep
Semantic code search using natural language queries. Use when users ask "where is X implemented", "how does Y work", "find the logic for Z", or need to locate code by concept rather than exact text. Returns file paths with line numbers and code snippets.
10up-css
CSS architecture, best practices, and patterns for WordPress projects. Covers ITCSS methodology, accessibility, specificity management, naming conventions, and modern CSS features.
agentifind
This skill sets up codebase intelligence for AI agents by running the `agentifind` CLI to extract code structure and synthesize a `CODEBASE.md` navigation guide. It includes staleness detection and intelligently handles LSP installation for optimal accuracy.