Introducing a new way to review your PRs.

Read the announcement

solana-foundation / solana-dev-skill

Skills for agentic development on Solana

View on GitHub

7 documents · Updated Nov 6, 2026

docs / solana-development-practices

Solana development practices

Solana development joins application clients, on-chain programs, local simulation, and safety review around one account and transaction model. This guidance favors Solana Kit 8 plugin clients for new applications, Anchor 1.2.x for most programs, Surfpool for integration work, and current source material for decisions that depend on versions or network behavior.

Development model

Solana features cross a client boundary and a program boundary. The client selects a cluster, reads accounts, builds instructions, obtains signatures, and tracks results. The program checks the supplied accounts and applies the state change. Shared interface descriptions, generated clients, tests, and security checks keep these boundaries aligned.

The main work areas are:

Task boundaries

Classify a request before choosing tools. A UI or wallet task needs a browser client and user signing. A script or backend usually needs Kit with an explicit signer. A program task needs account and instruction contracts. A test task needs the smallest environment that can answer its question. An infrastructure task needs explicit RPC, indexing, or monitoring decisions. A one-shot account or transaction lookup needs public RPC and curl rather than a new project scaffold.

This classification keeps a local test tool out of production code and avoids turning a quick read into application work. The task layer points to the child page with the next level of guidance.

References: skills/…/SKILL.md• L109-118 skills/…/rpc-quick-lookups.md• L1-5

Delivery path

Most work follows a short path from a product action to a checked network result. New transaction code uses version 1 when the wallet and cluster support it. Readers must still handle legacy and version 0 transactions. Wallet clients need a fallback when a connected wallet cannot sign version 1.

The client, program, and test environment form one contract as the flow moves from intent to confirmed state.

This diagram shows how a product action becomes checked and confirmed network state.

flowchart LR
    A[Product action] --> B[Define accounts and signers]
    B --> C[Compose client and instructions]
    C --> D[Validate program rules]
    D --> E[Simulate locally or on the target cluster]
    E --> F[Review fee and signing summary]
    F --> G[Submit and track confirmation]
    G --> H[Refresh affected state]

The client and program must agree on account ownership, writability, signer status, PDA seeds, serialized values, and token program variant. A change to one side can therefore require a matching IDL, generated client, test fixture, or indexer change.

References: skills/…/SKILL.md• L126-144 skills/…/transactions-v1.md• L8-12 skills/…/transactions-v1.md• L30-66 skills/…/overview.md• L281-296

Client choice

Client choice controls how an application reaches RPC, wallets, signers, program interfaces, and transaction execution. New application work uses @solana/kit 8 with plugins so one typed client can represent the capabilities needed by a browser, service, local cluster, or test.

Kit-first clients

Create a client and add capabilities with .use(). The payer pays fees and account rent. The identity authorizes actions. They are often the same signer, but separate roles are valid when a service pays for a user action.

For new transactions, configure the RPC or local client with transactionConfig: { version: 1 }. Kit plugin clients plan, simulate, and estimate resource limits for version 1. Use the lower-level pipe() path only when the flow needs control over lifetimes, offline or multi-party signing, custom planning, or a special resource setting.

Version 1 raises the transaction size limit to 4096 bytes. Its compute budget is in message configuration instead of Compute Budget instructions. A priority fee is a total lamport value. A wallet-backed client must check connected.supportedTransactionVersions.has(1) before asking a wallet to sign. Keep a version 0 path when the wallet cannot sign version 1 and the transaction fits the smaller limit.

Use Wallet Standard discovery with @solana/kit-plugin-wallet and @solana/react 8 for new React or Next.js work. Keep one configured client near the application root and expose it to UI components through ClientProvider. Use Kit branded types and codecs for addresses, signatures, lamports, and account bytes. Do not start new work with the deprecated framework-kit or wallet-adapter bindings.

Service signing and fee roles

Some flows separate the user’s authority from the account that pays fees or signs on a server. Use the service boundary that matches the need instead of moving private keys into application code.

NeedGuidance
Users transact without SOL or pay fees in another supported assetRoute the flow through Kora as the paymaster boundary.
A server, bot, or agent must signUse Solana Keychain with managed custody such as KMS, MPC, or a managed wallet.
A regulated or allowlisted token is requiredUse Mosaic guidance and the secure token and payment page.

These services change who pays or signs, but they do not remove the need to show the transaction, validate accounts, and track confirmation.

References: skills/…/SKILL.md• L30-52 skills/…/SKILL.md• L76-82 skills/…/overview.md• L22-73 skills/…/transactions-v1.md• L30-100

Legacy client boundaries

Treat web3.js v3 as the migration target for v1 codebases, not as the default for new code. A bare package install now resolves to v3, so pin @solana/web3.js@1 when an existing application must stay on v1. Route a v1 migration through the official migration skill and keep legacy class types inside adapter modules.

Do not add @solana/web3-compat to new work. Do not use the stale framework-kit or wallet-adapter packages for new applications. Upgrade a dependency that requires v1 objects when possible. Otherwise isolate that dependency at a small boundary instead of spreading legacy types through the application.

References: skills/…/SKILL.md• L59-63 skills/…/frontend.md• L248-251 skills/…/resources.md• L31-35

Solana concepts

Solana behavior follows a few runtime concepts that shape every client and program contract. These concepts explain account state, transaction limits, address derivation, and value precision without treating the network as a conventional database.

Accounts and rent

Accounts hold lamports, owner information, executable state, and program data. The owner controls how account data may be used. Rent is a redeemable deposit that makes storage rent-exempt rather than a recurring charge. A transaction that creates a non-exempt account fails. A supported close path returns the deposit.

Account data is untrusted input. Check ownership, expected length, and the account discriminator before decoding it. Treat a missing account as a valid state that the client or program must handle explicitly.

References: skills/…/concepts.md• L10-16 skills/…/security.md• L21-29

PDAs and account contracts

Program-derived addresses (PDAs) are off-curve addresses with no private key. The owning program authorizes them by supplying the expected seeds and bump. This makes a PDA a program-controlled account rather than a wallet address.

Seed order, program ID, account layout, discriminator, and serialized fields form one public contract. Derive the canonical bump during creation and validate the address on later use. Include user or pool identity in seeds when accounts must not be shared across users.

References: skills/…/concepts.md• L18-24 skills/…/design-patterns.md• L18-35 skills/…/security.md• L154-174

Transactions and account locks

Transactions carry signatures, a message, a recent blockhash, account addresses, and instructions. Signer and writable status apply across the whole transaction. A writable account is locked for the transaction even if only one instruction changes it. A hot shared account can therefore limit parallel work.

Compute units, account count, transaction size, CPI depth, and blockhash lifetime are finite resources. Program design and client planning must keep the full flow within these limits. Reuse accounts already present in a message when that reduces transaction size. Split shared state when shared writes reduce throughput.

Version 1 is active on current public clusters. It raises the transaction size limit to 4096 bytes and puts compute and fee settings in message configuration instead of Compute Budget instructions. RPC readers must opt in with maxSupportedTransactionVersion: 1. Indexers must read the version 1 configuration instead of looking only for Compute Budget instructions. A stale reader can fail on a block or silently report a zero budget.

References: skills/…/transactions-v1.md• L8-12 skills/…/transactions-v1.md• L102-131 skills/…/transactions-v1.md• L135-190 skills/…/common-errors.md• L415-466

Value and token units

Lamports are integer units used for SOL instructions. SOL is a fixed-point display value. Convert between them with Kit helpers instead of floating-point division. Token amounts also use integer units and require the mint decimals and token program variant to be known.

SPL Token and Token-2022 are different programs. Token-2022 extensions can change transfer amounts, authority, account size, closure rules, and transfer behavior. Never assume that a classic SPL Token path applies to a Token-2022 mint.

References: skills/…/overview.md• L126-141 skills/…/token.md• L6-10 skills/…/security.md• L413-427 skills/…/security.md• L467-527

Compatibility

Solana development depends on a matched toolchain rather than one package version. Anchor, Solana CLI, platform tools, Rust, Node.js, operating-system libraries, testing runtimes, and generated clients must agree on supported version lines.

Version alignment

For new Anchor programs, current guidance favors Anchor 1.2.x. The CI-tested pairing for Anchor 1.2.1 is Solana CLI 4.1.2. Keep the Anchor CLI and anchor-lang versions aligned. Keep all related anchor-* crates on the same exact version. For an existing project, follow the row that matches its Anchor and Solana crate era instead of upgrading one tool in isolation.

Agave validator releases and SDK crate versions use separate version lines. Anchor 1.2.x uses the Solana 3.x crate line by default. Anchor 1.2.1 provides an opt-in solana-v4 feature. Rust clients that send or read version 1 use matching 4.x client crates and Agave 4.2 or later where the feature is active. A validator version does not by itself select the correct Anchor crate family.

The compatibility matrix is the decision table for a project that must support an older line. It also records Node.js, Rust, platform-tools, GLIBC, test runtime, token crate, and transaction v1 constraints. Treat the matrix as time-sensitive and verify it before changing a pinned toolchain.

References: skills/…/compatibility-matrix.md• L22-33 skills/…/compatibility-matrix.md• L39-56 skills/…/compatibility-matrix.md• L100-122 skills/…/compatibility-matrix.md• L331-360

Interface compatibility

Version changes can alter more than build commands. They can change account bytes, discriminators, instruction encoding, CPI inputs, IDL ownership, package names, and generated client types. An Anchor or framework migration is complete only when deployed programs, metadata, clients, tests, and monitoring use the same contract.

Keep generated interfaces tied to the program description. For Anchor, produce its IDL and use the Codama path for Kit-native clients. For native Rust programs, use the supported interface description path before rendering clients. Do not hand-maintain parallel serializers when an IDL can define the shared contract.

Anchor v1 also changes the TypeScript package name to @anchor-lang/core. A migration must update imports and IDL handling together with the Rust and CLI versions.

References: skills/…/compatibility-matrix.md• L126-195 skills/…/overview.md• L281-296 skills/…/SKILL.md• L185-199

Environment compatibility

Build and test failures can come from the host environment even when program code is correct. Newer Anchor binaries and native LiteSVM packages need newer GLIBC on Linux. Platform tools bundle their own Rust and Cargo behavior. Some bundled Cargo versions cannot parse crates that use edition 2024.

Use the compatibility table before selecting a host image. Commit program lockfiles when reproducible dependency resolution matters. Upgrade the host, build the affected tool from source, or use a suitable container when a prebuilt binary exceeds the host library floor. If platform tools lack edition 2024 support, pin the affected dependency versions until a compatible release is available.

Surfpool embedded mode also depends on a supported native binary and platform. Use attach mode when the host cannot load the embedded binary. This choice changes how the test gets a payer and performs teardown.

References: skills/…/compatibility-matrix.md• L58-101 skills/…/compatibility-matrix.md• L284-319 skills/…/common-errors.md• L470-512 skills/…/kit-plugin.md• L32-48

Error handling

Error handling must protect state and give the caller a useful next action. Solana failures can come from invalid accounts, insufficient funds, stale blockhashes, rejected signatures, RPC conditions, toolchain mismatch, or program-specific rules.

Program errors

Programs should reject malformed input before business logic runs. They should validate account ownership, signer and writable roles, PDA seeds, discriminator, token relationships, and CPI targets. Use checked arithmetic and return stable custom errors that describe the failed rule.

Anchor expresses many checks through typed accounts and constraints. Pinocchio requires the program author to place equivalent checks at the account and data conversion boundary. In both cases, a CPI can change account state, so refresh cached values before using them after the call.

References: skills/…/security.md• L32-118 skills/…/anchor.md• L180-194 skills/…/pinocchio.md• L350-413

Client errors

A client should simulate before asking a user to sign when the flow supports simulation. After submission, a signature means that the transaction was identified. It does not mean that the transaction reached the final state. Track the confirmation level needed by the product and refresh affected account data.

Show errors in terms of the next action. A wallet rejection needs no retry until the user acts. An expired blockhash needs a fresh transaction lifetime. An insufficient balance needs funding or a smaller request. A program error needs the failed rule and the relevant account or input context.

Version-aware reads need the same care as sends. Every getTransaction, getBlock, or blockSubscribe read that may see transaction v1 must set maxSupportedTransactionVersion: 1. Otherwise one unsupported v1 transaction can make a block read fail or cause a subscription to stop advancing.

References: skills/…/SKILL.md• L84-95 skills/…/frontend.md• L113-170 skills/…/transactions-v1.md• L135-159 skills/…/common-errors.md• L415-466

Safety boundaries

Signing is an explicit user action. Show the recipient, amount, token, fee payer, and cluster before requesting approval. Keep private keys and seed phrases in the wallet or managed signer boundary. Use localnet or devnet by default. Treat account data, RPC responses, and logs as untrusted input.

These boundaries apply before program-specific review. They stop a correct transaction from becoming an unsafe user action and prevent fetched chain data from controlling code or tool use.

References: skills/…/SKILL.md• L84-95 skills/…/transactions-v1.md• L273-285

Toolchain and RPC errors

Diagnose environment errors separately from network and program errors. GLIBC messages point to a host and binary mismatch. Cargo edition errors point to platform tools and dependency resolution. Connection errors point to the selected endpoint, local service lifecycle, or address family. RPC errors may also reflect rate limits or a cluster mismatch.

Start with the compatibility matrix and common-error guide. Confirm the cluster, RPC endpoint, WebSocket endpoint, tool versions, and local service state before changing program logic. For public RPC lookups, use the direct lookup guidance and do not assume that a returned account matches the expected schema.

The common-error guide covers native LiteSVM loading, damaged platform tools, edition 2024 dependency resolution, and transaction v1 budget or decoder gaps. These failures can occur before program logic runs or can silently produce wrong indexer data. Diagnosis must include the runtime and the reader version.

References: skills/…/common-errors.md• L239-286 skills/…/common-errors.md• L415-466 skills/…/common-errors.md• L470-675 skills/…/rpc-quick-lookups.md• L99-117

Reference discovery

Solana APIs and tool versions change quickly. Reference discovery is part of development. Use current source-of-truth material for concepts, API patterns, version behavior, and errors before relying on memory.

Current documentation

Use the Solana Developer MCP for current Solana documentation search, expert questions, and Anchor-specific help. Check that the host exposes it before starting a task. If it is not available, install it through the host's MCP setup or ask the user to add it. Use it before recommending an API pattern, when a concept needs a current explanation, or when an error is not already understood. Use Surfpool's MCP when the task needs control of a local simulated network.

The curated resources page gives the authoritative starting points for core Solana docs, RPC, Kit, web3.js migration, Anchor, Pinocchio, testing tools, IDLs, tokens, payments, security, and transaction v1. Prefer primary project documentation and repositories when a local summary does not answer a version-specific question.

References: skills/…/SKILL.md• L146-183 skills/…/resources.md• L14-35 skills/…/resources.md• L40-113

Progressive reading

Read only the guide that matches the task layer. Start with Kit for client composition, the concepts guide for runtime behavior, the compatibility matrix for version choice, and the common-error guide for diagnosis. Move to the child pages when the task needs application flow, program design, local simulation, or security-sensitive value movement.

For transaction v1 or larger transaction work, read the v1 guide and its primary proposal before choosing client, RPC, or indexer support. For a one-shot read, use the public RPC lookup guide. For setup questions, use the installation and validation page before changing project code.

This path keeps broad decisions separate from implementation detail. The related pages are the working references for deeper changes rather than a repeat of their full guidance on this overview page.

References: skills/…/SKILL.md• L185-212 skills/…/transactions-v1.md• L447-478 skills/…/rpc-quick-lookups.md• L1-5 skills/…/resources.md• L18-23

Change checklist

When these files or sections are changed, remember to consider these:

  • When changing a program account or instruction contract, update the IDL or Codama description, generated clients, codecs, PDA helpers, and deployed interface metadata.
  • When changing the selected cluster, update the RPC endpoint, WebSocket endpoint, wallet chain, confirmation policy, and live-data cache identity together.
  • When changing Anchor, Solana CLI, Rust, platform-tools, or Node.js versions, check the compatibility row, lockfiles, native test packages, and CI host image as one toolchain.
  • When changing token support, review the selected token program, mint extensions, decimals, rent size, transfer instruction, and accounting rules together.
  • When changing a CPI or signer role, review account privileges, fee payer and identity separation, PDA signing seeds, and post-CPI state reads.
  • When changing sponsored fees or server-side signing, review the fee payer, user authority, custody boundary, approval summary, and confirmation path together.
  • When changing transaction v1 support, review the cluster feature gate, Kit and plugin versions, message configuration, wallet capability check, RPC read ceiling, and indexer decoder versions together.
  • When changing a gRPC or protobuf reader, update the message schema and version classifier together. Pin the schema version when the client resolver can select an older schema that drops version 1 configuration.
  • When changing an error or event contract, update client decoding, user-facing messages, monitoring, and reference examples that use stable identifiers.

Important failure modes

TriggerConsequenceGuard
A new client uses a legacy wallet or framework-kit pathWallet discovery or client capabilities follow a stale contractUse Kit plugins, Wallet Standard, and @solana/react for new work
A version 1 client is paired with a wallet that does not support version 1The wallet rejects the signing requestCheck supportedTransactionVersions.has(1) and use a version 0 path when possible
A version 1 transaction leaves resource limits unsetAccount loading or execution fails because unset limits are zeroKeep plugin estimation enabled or set both limits through the manual resource path
A reader omits maxSupportedTransactionVersion: 1A transaction or whole block read fails, or a subscription stopsSet the version ceiling on every version-aware RPC read
An indexer scans only Compute Budget instructions for version 1 budgetsPriority fees and compute limits appear as zero without an errorRead the version 1 message configuration and use a decoder that preserves it
A gRPC decoder checks versioned before message configurationVersion 1 data is classified as version 0 and its budget is lostCheck config presence first, then versioned, and use a schema that includes the configuration field
Anchor CLI and crate versions use different release linesBuilds may warn or hide IDL and runtime differencesAlign the CLI, anchor-lang, and related anchor-* crates
A client decodes an account without owner, length, or discriminator checksUntrusted bytes become false application stateValidate the account before decoding
A program treats a Token-2022 mint like an SPL Token mintFees, hooks, authority, or account-size rules can break transfers or accountingDetect the token program and inspect its extensions
A signature is treated as final confirmationThe UI reports success while the transaction is dropped or still pendingTrack confirmation and refresh state after submission
A migration changes bytes or IDL without updating clientsExisting accounts or consumers become unreadableTreat the program, metadata, generated clients, and tests as one interface
A toolchain resolves an unsupported native binary or crateBuild or test fails before program logic runsCheck GLIBC, platform-tools, Cargo, lockfile, and compatibility constraints
An embedded Surfpool test omits teardown or uses attach-mode assumptionsTest processes hang or the client has no expected in-process handleStop the embedded surfnet in teardown and use the correct attach-mode lifecycle

Key files

FileWhy to read it
skills/…/SKILL.mdDefines the Kit-first choices, transaction v1 default, Anchor 1.2.x program guidance, task classification, safety guardrails, service boundaries, MCP use, and progressive reading path
skills/…/overview.mdExplains the shared client model for RPC, signers, wallets, account reads, transactions, and generated program packages
skills/…/plugins.mdShows how client capabilities fit together and which roles and environments each plugin supports
skills/…/frontend.mdDefines the browser wallet boundary, version support check, transaction UX, and live data flow
skills/…/transactions-v1.mdDefines the larger transaction format, send and read contracts, resource limits, and indexer changes
skills/…/compatibility-matrix.mdMaps Anchor 1.2.x and older lines to Solana CLI, Rust, Node.js, platform-tools, GLIBC, test runtimes, and transaction v1 support
skills/…/common-errors.mdProvides the main diagnostic paths for toolchain, build, testing, RPC, migration, LiteSVM, and v1 failures
skills/…/testing.mdDescribes the unit, integration, fork, smoke-test, fuzz, and CI testing layers
skills/…/kit-plugin.mdExplains the embedded and attached Surfpool test environments and their lifecycle boundary
skills/…/rpc-quick-lookups.mdDefines the small, read-only RPC path for balances, accounts, tokens, and transactions
skills/…/resources.mdProvides current primary links for Solana docs, SDKs, frameworks, testing, tokens, payments, security, and transaction v1
docs/application-client-development.mdDetailed client path for wallets, RPC, account state, generated interfaces, and transaction UX
docs/onchain-program-development.mdDetailed program path for framework choice, state contracts, account validation, CPIs, and migrations
docs/testing-and-local-simulation.mdDetailed test path for unit checks, Surfpool integration, forked state, fixtures, and CI
docs/secure-token-and-payment-features.mdDetailed safety path for token variants, payments, transfers, and security-sensitive functionality
docs/skill-installation-and-validation.mdSetup path for installing and checking the skill before using its guidance