AGENT SKILL

aptos-framework

Expert on Aptos Framework (0x1 standard library) modules including account, coin, fungible_asset, object, timestamp, table, smart_table, event, randomness, aggregator, and resource_account. Essential for all Aptos development.

License 许可
MIT
最近更新
2026-04-16
Stars
★ 52
Forks
13

01 前言 Front Matter

name
aptos-framework
model
sonnet
license
MIT
metadata
{ "author": "raintree", "version": "1.0" }
description
Expert on Aptos Framework (0x1 standard library) modules including account, coin, fungible_asset, object, timestamp, table, smart_table, event, randomness, aggregator, and resource_account. Essential for all Aptos development.
allowed-tools
Read, Write, Edit, Grep, Glob, Bash

03 SKILL.md 正文

Aptos Framework Expert

Expert on the Aptos Framework (0x1 address) - the standard library of core modules.

Triggers

  • aptos framework, 0x1::, aptos_framework::
  • account module, table, smarttable
  • event, timestamp, randomness
  • aggregator, resource account

Framework Architecture

Core Modules (0x1::)

aptos_framework/
├── account.move           - Account management
├── coin.move              - Fungible token standard (v1)
├── fungible_asset.move    - Fungible asset standard (v2)
├── object.move            - Object model primitives
├── timestamp.move         - Block timestamp access
├── table.move             - Key-value storage
├── smart_table.move       - Auto-split table
├── event.move             - Event emission
├── randomness.move        - Secure randomness (VRF)
├── aggregator_v2.move     - Parallel execution
├── resource_account.move  - Deterministic deployment

Standard Library (std::)

move-stdlib/
├── vector.move      - Dynamic arrays
├── option.move      - Optional values
├── string.move      - UTF8 strings
├── signer.move      - Signer operations
├── error.move       - Error codes

Key Modules

account.move

use aptos_framework::account;

// Create account
account::create_account(new_address);

// Get sequence number
account::get_sequence_number(addr);

// Check existence
account::exists_at(addr);

// SignerCapability pattern
let (resource_signer, signer_cap) = account::create_resource_account(deployer, b"SEED");

table.move / smart_table.move

use aptos_framework::table::{Self, Table};

struct Registry has key {
    data: Table<address, UserData>
}

table::add(&mut t, key, value);
table::borrow(&t, key);
table::borrow_mut(&mut t, key);
table::remove(&mut t, key);
table::contains(&t, key);

event.move (V2 - Recommended)

#[event]
struct TransferEvent has drop, store {
    from: address,
    to: address,
    amount: u64,
}

event::emit(TransferEvent { from, to, amount });

timestamp.move

use aptos_framework::timestamp;

timestamp::now_seconds();
timestamp::now_microseconds();

randomness.move

use aptos_framework::randomness;

#[randomness]
public entry fun random_mint(user: &signer) {
    let random_value = randomness::u64_integer();
    let amount = randomness::u64_range(100, 1000);
}

aggregator_v2.move

use aptos_framework::aggregator_v2::{Self, Aggregator};

struct Stats has key {
    total: Aggregator<u64>  // Parallel-safe counter
}

aggregator_v2::create_aggregator(0);
aggregator_v2::add(&mut agg, 1);
aggregator_v2::read(&agg);

resource_account.move

// Deterministic address: hash(creator_address, seed)
let (resource_signer, signer_cap) = account::create_resource_account(deployer, b"SEED");

// Store capability for later use
move_to(&resource_signer, Data { signer_cap });

// Use later
let signer = account::create_signer_with_capability(&signer_cap);

Common Patterns

Time-Locked Operations

struct TimeLock has key {
    unlock_time: u64,
}

public fun withdraw() acquires TimeLock {
    assert!(timestamp::now_seconds() >= timelock.unlock_time, ERROR_LOCKED);
}

Registry with Table

struct Registry<K: copy + drop, V: store> has key {
    data: Table<K, V>,
    count: u64,
}

Event-Driven State

#[event]
struct StateChanged has drop, store {
    old_state: u8,
    new_state: u8,
    timestamp: u64,
}

event::emit(StateChanged { old_state, new_state, timestamp: timestamp::now_seconds() });

Best Practices

  • Use SmartTable for large datasets (100k+ entries)
  • Use Event V2 API (simpler, cheaper)
  • Use Aggregator for global counters (parallel execution)
  • Use resource accounts for protocol addresses
  • Check timestamp carefully (validator-set, can drift)
  • Use randomness only in entry functions with #[randomness]

04 同仓库更多 Skills

eric861129
eric861129/SKILLS_All-in-one

what-if-oracle

Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like "what if...", "what would happen if...", "what are the possibilities", "explore scenarios", "scenario analysis", "possibility space", "what could go wrong", "best case / worst case", "risk analysis", "contingency planning", "strategic options", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.

Skill与智能体开发
★ 52
eric861129
eric861129/SKILLS_All-in-one

venue-templates

Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.

内容创作者写作与文案资料检索与研究
★ 52
eric861129
eric861129/SKILLS_All-in-one

the-fool

Use when challenging ideas, plans, decisions, or proposals using structured critical reasoning. Invoke to play devil's advocate, run a pre-mortem, red team, or audit evidence and assumptions.

开发工程师Skill与智能体开发
★ 52
eric861129
eric861129/SKILLS_All-in-one

scientific-writing

Core skill for the deep research and writing tool. Write scientific manuscripts in full paragraphs (never bullet points). Use two-stage process with (1) section outlines with key points using research-lookup then (2) convert to flowing prose. IMRAD structure, citations (APA/AMA/Vancouver), figures/tables, reporting guidelines (CONSORT/STROBE/PRISMA), for research papers and journal submissions.

内容创作者写作与文案Skill与智能体开发
★ 52
eric861129
eric861129/SKILLS_All-in-one

scientific-brainstorming

Creative research ideation and exploration. Use for open-ended brainstorming sessions, exploring interdisciplinary connections, challenging assumptions, or identifying research gaps. Best for early-stage research planning when you do not have specific observations yet. For formulating testable hypotheses from data use hypothesis-generation.

Skill与智能体开发
★ 52
eric861129
eric861129/SKILLS_All-in-one

research-lookup

Look up current research information using the Parallel Chat API (primary) or Perplexity sonar-pro-search (academic paper searches). Automatically routes queries to the best backend. Use for finding papers, gathering research data, and verifying scientific information.

开发工程师后端与接口资料检索与研究
★ 52