Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

solana

БесплатноБез исполняемых скриптовНе проверен

Solana is a high-throughput blockchain with 400 ms slots and sub-cent fees. Use this skill to write on-chain programs in Rust with the Anchor framework, talk…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Solana

Overview

Solana programs are compiled Rust (usually written with Anchor) that run on validators and own no state themselves: state lives in separate accounts that each transaction lists up front, which is what allows parallel execution. Checked here (October 2026): Anchor 1.2.1 (anchor-lang, CLI anchor-cli, TypeScript client @anchor-lang/core), Agave validator and Solana CLI 4.3.2, @solana/kit 8.5.0, @solana/web3.js 3.1.1, @solana/spl-token 0.4.15.

JavaScript SDK choice: @solana/kit is the renamed 2.x rewrite of web3.js (functional, tree-shakable, bigint lamports). @solana/web3.js 3.x keeps the old class-based API (Connection, PublicKey) on top of Kit; the 1.x line gets critical fixes only. Use Kit for new code. The Anchor TypeScript client still depends on web3.js 1.x types.

Instructions

Install the toolchain

Follow the official installation page (https://solana.com/docs/intro/installation): Rust through rustup, the Solana CLI through Anza's installer, then Anchor through AVM. Do not pipe a downloaded script into a shell on the user's behalf; download the installer, read it, then run it, or use a system that already has the tools. Linux needs build-essential pkg-config libudev-dev llvm libclang-dev protobuf-compiler libssl-dev.

cargo install --git https://github.com/otter-sec/anchor avm --force
avm install 1.2.1 && avm use 1.2.1
anchor --version                  # anchor-cli 1.2.1
solana config set --url devnet    # also -ul localhost, -um mainnet-beta
solana-keygen new                 # writes ~/.config/solana/id.json, never commit it
solana airdrop 2 && solana balance

Anchor project

anchor init counter               # Rust tests with LiteSVM by default; --test-template mocha for TypeScript tests
cd counter
anchor keys sync                  # make declare_id! and Anchor.toml match the program keypair
anchor build                      # outputs target/deploy/*.so and target/idl, target/types
anchor test
anchor deploy                     # to the cluster set in Anchor.toml

anchor init generates a modular layout by default (separate instruction, state and error files); --template single gives one lib.rs. The program below is written as a single file. The generated test targets the template program, so replace or delete it (in programs/counter/tests/, or tests/ with --test-template mocha) before anchor test on this program:

use anchor_lang::prelude::*;

declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"); // replaced by `anchor keys sync`

#[program]
pub mod counter {
    use super::*;

    pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
        let counter = &mut ctx.accounts.counter;
        counter.count = 0;
        counter.authority = ctx.accounts.authority.key();
        counter.bump = ctx.bumps.counter;
        Ok(())
    }

    pub fn increment(ctx: Context<Increment>) -> Result<()> {
        let counter = &mut ctx.accounts.counter;
        counter.count = counter.count.checked_add(1).ok_or(ErrorCode::Overflow)?;
        emit!(CounterIncremented { count: counter.count, authority: ctx.accounts.authority.key() });
        Ok(())
    }
}

#[derive(Accounts)]
pub struct Initialize<'info> {
    #[account(init, payer = authority, space = 8 + Counter::INIT_SPACE,
              seeds = [b"counter", authority.key().as_ref()], bump)]
    pub counter: Account<'info, Counter>,
    #[account(mut)]
    pub authority: Signer<'info>,
    pub system_program: Program<'info, System>,
}

#[derive(Accounts)]
pub struct Increment<'info> {
    #[account(mut, seeds = [b"counter", authority.key().as_ref()], bump = counter.bump, has_one = authority)]
    pub counter: Account<'info, Counter>,
    pub authority: Signer<'info>,
}

#[account]
#[derive(InitSpace)]
pub struct Counter { pub count: u64, pub authority: Pubkey, pub bump: u8 }

#[event]
pub struct CounterIncremented { pub count: u64, pub authority: Pubkey }

#[error_code]
pub enum ErrorCode { #[msg("Counter overflow")] Overflow }

Client with @solana/kit

npm install @solana/kit @solana-program/system @solana-program/token
import {
  address, appendTransactionMessageInstruction, assertIsTransactionWithBlockhashLifetime, createSolanaRpc, createSolanaRpcSubscriptions,
  createTransactionMessage, generateKeyPairSigner, getSignatureFromTransaction, lamports, pipe,
  sendAndConfirmTransactionFactory, setTransactionMessageFeePayerSigner,
  setTransactionMessageLifetimeUsingBlockhash, signTransactionMessageWithSigners,
} from "@solana/kit";
import { getTransferSolInstruction } from "@solana-program/system";

const rpc = createSolanaRpc("https://api.devnet.solana.com");
const rpcSubscriptions = createSolanaRpcSubscriptions("wss://api.devnet.solana.com");
const sendAndConfirm = sendAndConfirmTransactionFactory({ rpc, rpcSubscriptions });

const payer = await generateKeyPairSigner();           // load a real signer from a fi
Полный SKILL.md на GitHub

Установить solana в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл solana?

Solana is a high-throughput blockchain with 400 ms slots and sub-cent fees. Use this skill to write on-chain programs in Rust with the Anchor framework, talk to the network from TypeScript with @solana/kit, create SPL tokens with the Solana CLI, and test and deploy to devnet. Trigger words: solana, anchor, smart contract, spl token, program derived address, solana web3.js, devnet.

Как установить скилл solana?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл solana запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить solana с