Works with the AI Agents you already use
Anchor Patterns And Pitfalls
by BanditXBT
Safe Anchor constraint recipes, space and PDA design, zero-copy, and the traps that survive Anchor.
$3.15
About this skill
Anchor removes boilerplate, not responsibility: its safety exists only where you declare constraints.
Account<'info, T>: owner == program, discriminator matchesT, data deserialized. Use for your own state.Signer<'info>:is_signerverified. Authority accounts must use this (or#[account(signer)]).Program<'info, P>/Interface<'info, I>: validates callee program ID (use for CPI targets;Interfacefor Token-2022 compatibility).InterfaceAccount<'info, Mint|TokenAccount>: works for SPL Token and Token-2022.SystemAccount,Sysvar<'info, T>: validated type/address.UncheckedAccount/AccountInfo: no checks. Require a/// CHECK:comment that states the manual validation actually performed, and perform it.
space = 8 (discriminator) + field sizes; Pubkey 32, u64 8, bool 1, Option<T> 1+size, String 4+max_len, Vec<T> 4+max_len·size, enums = 1 + max variant. Use #[derive(InitSpace)] with #[max_len(n)]. Wrong space causes runtime deserialization failures or silent truncation of intended fields. Plan versioning: reserve padding (_reserved: [u8; N]) or a version field for upgrades.
Accounts above ~10 KB or hot-path structs: use #[account(zero_copy)] with AccountLoader (no deserialization copy; stack is 4 KB per frame, heap 32 KB). Zero-copy structs need #[repr(C)]/Pod alignment and explicit padding; test layout with size_of. Use realloc constraint (realloc::payer, realloc::zero) for growth; max +10 KiB per instruction.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 13 days ago
- Software
- RustAnchor
Permissions
No special permissions declared or detected
What's inside
Frequently Asked Questions
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.