aptos
from raintree-technology/claude-starter
Platform-agnostic, production-ready Claude Code configurations with hooks, commands, skills, examples, and more.
35 stars5 forksUpdated Jan 21, 2026
npx skills add https://github.com/raintree-technology/claude-starter --skill aptosSKILL.md
Aptos Blockchain & Move Language Expert
Aptos is a Layer 1 blockchain with the Move programming language, designed for safe and scalable smart contracts.
When to Use
- Writing Move smart contracts
- Understanding Move type system (abilities, generics, resources)
- Using Aptos framework modules (coin, fungible_asset, object)
- Token standards (Coin, Fungible Asset, Digital Asset/NFT)
- Gas optimization and testing
- dApp integration with TypeScript SDK
Move Language Fundamentals
Abilities - Move's Core Feature
Every type has abilities that control what you can do with it:
| Ability | Meaning | Example |
|---|---|---|
copy | Can be duplicated | Primitives, configs |
drop | Can be discarded | Temporary data |
store | Can be stored in structs | Most data types |
key | Can be top-level resource | Account resources |
// Resource that can be stored globally
struct Balance has key, store {
coins: u64
}
// Value type that behaves like a primitive
struct Point has copy, drop, store {
x: u64,
y: u64
}
// No abilities = must be explicitly handled (hot potato)
struct Receipt {
amount: u64
}
Generics and Phantom Types
// Type parameter with ability constraint
struct Box<T: store> has key {
value: T
}
// Phantom type - zero runtime cost, type safety only
struct Coin<phantom CoinType> has store {
value: u64
}
// Different types can't be mixed
let btc: Coin<BTC> = Coin { value: 100 };
let eth: Coin<ETH> = Coin { value: 50 };
// btc + eth → compile error!
Global Storage Operations
// Store resource at signer's address
public fun initialize(account: &signer) {
move_to(account, MyResource { value: 0 });
}
// Read resource (requires acquires annotation)
public fun get_value(addr: address): u64 acquires MyResource {
borrow_global<MyResource>(addr).value
}
// Modify resource
public fun set_value(addr: address, val: u64) acquires MyResource {
borrow_global_mut<MyResource>(addr).value = val;
}
// Check existence
public fun exists_at(addr: address): bool {
exists<MyResource>(addr)
}
// Remove and return resource
public fun destroy(addr: address): MyResource acquires MyResource {
move_from<MyResource>(addr)
}
Signer - Authentication
use std::signer;
// Only the account owner can call this
public entry fun transfer(
sender: &signer,
recipient: address,
amount: u64
) acquires Balance {
let sender_addr = signer::address_of(sender);
// sender proves ownership of sender_addr
}
Visibility Modifiers
module example {
// Private (default) - only within module
fun internal() { }
// Public - callable from anywhere
public fun library_fn() { }
// Friend - only from declared friend modules
public(friend) fun restricted() { }
// Entry - transaction entry point
public entry fun user_action(account: &signer) { }
}
Aptos Framework (0x1)
Core Modules
| Module | Purpose |
|---|---|
account | Account creation, auth key rotation |
coin | Original fungible token standard |
fungible_asset | New flexible token standard |
object | Object model for composable assets |
aptos_coin | Native APT token |
timestamp | Block timestamp |
event | Event emission |
Coin Standard (0x1::coin)
use aptos_framework::coin;
// Register to receive a coin type
public entry fun register<CoinType>(account: &signer) {
coin::register<CoinType>(account);
}
// Transfer coins
public entry fun transfer<CoinType>(
from: &signer,
to: address,
amount: u64
) {
coin::transfer<CoinType>(from, to, amount);
}
// Check balance
public fun balance<CoinType>(addr: address): u64 {
coin::balance<CoinType>(addr)
}
Fungible Asset Standard (0x1::fungible_asset)
Modern, flexible token standard:
use aptos_framework::fungible_asset::{Self, FungibleAsset, Metadata};
use aptos_framework::primary_fungible_store;
// Create fungible asset metadata
public fun create_fa(creator: &signer): Object<Metadata> {
let constructor_ref = object::create_named_object(creator, b"MY_FA");
primary_fungible_store::create_primary_store_enabled_fungible_asset(
&constructor_ref,
option::none(), // max supply
utf8(b"My Token"),
utf8(b"MTK"),
8, // decimals
utf8(b"https://example.com/icon.png"),
utf8(b"https://example.com"),
);
object::object_from_constructor_ref(&constructor_ref)
}
// Transfer FA
public entry fun transfer_fa(
sender: &signer,
metadata: Object<Metadata>,
recipient: address,
amount: u64
) {
primary_fungible_store::transfer(sender, metadata, recipient, amount);
}
Object Model (0x1::object)
Composable, transferable objects:
use aptos_framework::object::{Self, Object, ConstructorRef};
struct MyObject has key {
value: u64
}
// Create object
public
...
Repository Stats
Stars35
Forks5
LicenseMIT License