pinocchio

Build high-performance Solana programs in Rust using the Pinocchio zero-copy framework.

6|20|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/andresdefi/cryptoskills --skill pinocchio-andresdefi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pinocchio
Source: https://github.com/andresdefi/cryptoskills/tree/main/skills/pinocchio
Command: npx skills add https://github.com/andresdefi/cryptoskills --skill pinocchio-andresdefi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Writing Solana programs with Anchor or the native solana-program crate consumes excessive compute units and produces large binaries, while Pinocchio's low-level API lacks guardrails, making account validation, CPI calls, and PDA handling error-prone for developers. ## Core Features & Use Cases - Zero-Copy Program Patterns: Provides bytemuck-based account structs, single-byte discriminators, and manual serialization patterns that reduce compute usage by 88-95% compared to Anchor. - CPI and PDA References: Includes ready-to-use System Program and Token Program CPI examples, PDA derivation and signing patterns, and manual CPI construction for third-party programs. - Anchor Migration & Optimization: Ships a step-by-step Anchor-to-Pinocchio migration guide, an optimization checklist, edge-case documentation, and a scaffolding script that generates a complete project skeleton. - Use Case: A developer building a high-throughput DEX on Solana uses this Skill to scaffold a Pinocchio program, implement validated account contexts, and migrate an existing Anchor vault to cut transaction compute costs. ## Quick Start Ask the AI to scaffold a new Pinocchio Solana program with a PDA vault that supports initialize, deposit, and withdraw instructions.

Frequently Asked Questions about pinocchio

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

FAQPage Schema
How do I build a Solana program with Pinocchio?

Define an entrypoint with entrypoint!(process_instruction), route instructions by a single-byte discriminator, and validate accounts manually using AccountInfo checks. Use pinocchio-system and pinocchio-token crates for CPI helpers and bytemuck for zero-copy account data.

Pinocchio vs Anchor: which should I use for Solana development?

Pinocchio reduces compute units by 88-95% and binary size by about 40% compared to Anchor, suiting high-throughput programs like DEXs and orderbooks. Anchor is better for rapid prototyping, complex account relationships, and teams unfamiliar with low-level Rust.

How do I migrate a Solana program from Anchor to Pinocchio?

Replace #[account] structs with bytemuck Pod types using manual one-byte discriminators, convert Anchor constraints into explicit is_signer and is_writable checks, and swap CpiContext calls for pinocchio-system invoke helpers. Use Shank to generate the IDL that Anchor produced automatically.

Does Pinocchio support Token-2022 and CPI calls?

Yes, the pinocchio-token crate provides Token-2022 instructions including metadata pointers and token metadata initialization, though support is under active development. Standard CPIs use invoke and invoke_signed with AccountMeta and Instruction structs.

Why does my Pinocchio program fail with alignment or borrow errors?

Bytemuck structs must be padded to 8-byte alignment, and account data cannot be borrowed mutably while an immutable borrow exists. Drop the first borrow before borrowing again, and add explicit padding fields after any field smaller than 8 bytes.

Is Pinocchio safe for production Solana programs?

Pinocchio is currently unaudited, so use it with caution in production despite being maintained by Anza, the Solana Agave client developers. Thorough testing with solana-program-test and manual security validation of all accounts is essential.