solana-anchor
0
总安装量
1
周安装量
安装命令
npx skills add https://github.com/hairyf/blockchain-master --skill solana-anchor
Agent 安装分布
mcpjam
1
claude-code
1
replit
1
junie
1
windsurf
1
zencoder
1
Skill 文档
Skill based on Anchor (Solana program framework), generated from
sources/solana-anchor/docs/at 2026-02-25.
Anchor is a Solana program framework: Rust eDSL with macros (declare_id, #[program], #[derive(Accounts)], #[account]), IDL generation, TypeScript/Rust clients, and CLI for build, test, and deploy. Use this skill when implementing or reviewing Anchor programs, CPIs, account validation, and client integration.
Core References
| Topic | Description | Reference |
|---|---|---|
| Program Structure | declare_id, #[program], #[derive(Accounts)], #[account], Context, discriminators | core-program-structure |
| CPI | Cross-program invocation, CpiContext, PDA signers, invoke/invoke_signed | core-cpi |
| IDL | Interface Description Language, instructions/accounts/discriminators, client use | core-idl |
| PDA | Program Derived Addresses, seeds, bump, seeds::program, init, IDL resolution | core-pda |
| Workspace | init, new, program layout, build/test/deploy flow | core-workspace |
| Realloc | Resize accounts, realloc::payer, realloc::zero | core-realloc |
| Close Account | close = target, rent reclamation | core-close-account |
| Remaining Accounts | ctx.remaining_accounts, variadic instructions, CPI | core-remaining-accounts |
References (Program & Config)
| Topic | Description | Reference |
|---|---|---|
| Account Types | Account, Signer, Program, AccountLoader, UncheckedAccount, etc. | references-account-types |
| Account Constraints | init, mut, seeds/bump, has_one, close, realloc, SPL, #[instruction] | references-account-constraints |
| Anchor.toml | provider, scripts, workspace, programs, test, toolchain, hooks | references-anchor-toml |
| CLI | build, deploy, test, idl, keys, migrate, upgrade, verify | references-cli |
| Space | Account size calculation, InitSpace, type sizes | references-space |
| Type Conversion | Rust â TypeScript type mapping for IDL/client | references-type-conversion |
Features
| Topic | Description | Reference |
|---|---|---|
| Events | emit!, emit_cpi!, addEventListener, decoding | features-events |
| Errors | #[error_code], err!, require! and variants | features-errors |
| Zero-Copy | AccountLoader, load_init/load_mut/load, init vs zero | features-zero-copy |
| declare_program! | IDL-based CPI and Rust client generation | features-declare-program |
| Tokens (SPL) | anchor-spl, mints, token accounts, ATAs, Token 2022, InterfaceAccount | features-tokens |
| Token 2022 Extensions | ExtensionType, tlv_data, extension lifecycle, anchor-spl token_2022_extensions | features-token-extensions |
| Example Programs | Curated program-examples repoâBasics, Tokens, Token 2022âwhen to use each | features-examples |
| Testing | Mollusk (Rust instruction harness), LiteSVM (Rust/TS/Python VM) | features-testing |
| Upgrade and Migrate | anchor upgrade, migrate script, upgrade authority | features-upgrade-migrate |
Clients
| Topic | Description | Reference |
|---|---|---|
| TypeScript | Program, methods, accounts, signers, rpc/transaction/instruction, fetch | clients-typescript |
| Rust | anchor-client, declare_program!, request/instructions/send, account fetch | clients-rust |
Best Practices
| Topic | Description | Reference |
|---|---|---|
| Security | Sealevel attacks, constraints, UncheckedAccount usage | best-practices-security |
| Constraints and Validation | When to use which constraints, avoid UncheckedAccount pitfalls | best-practices-constraints |
Advanced
| Topic | Description | Reference |
|---|---|---|
| Verifiable Builds | anchor build –verifiable, verify, Docker | advanced-verifiable-builds |
| AVM | Anchor Version Manager, install, use, list | advanced-avm |