Searches aptos-core and daily-move for reference implementations before writing contracts. Triggers on: 'search examples', 'find example', 'check aptos-core', 'is there an example', 'reference implementation', 'how does aptos implement', 'similar contract', 'daily-move'.
60
71%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./.claude/skills/search-aptos-examples/SKILL.mdThis skill helps you find relevant examples in official Aptos repositories before writing new contracts. Always search examples first to follow established patterns.
Repositories:
aptos-labs/aptos-core/aptos-move/move-examples/ — 53+ official Move examples demonstrating best practicesaptos-labs/daily-move/snippets/ — 17 curated educational examples covering design patterns, Move 2 features, composable NFTs, and moreCategorize your contract:
Priority Examples by Category:
token_objects/ - Modern object-based tokens (V2 pattern)mint_nft/ - NFT minting patternsnft_dao/ - NFT-gated governancecollection_manager/ - Collection managementcomposable-nfts/ - NFTs that contain other NFTsmodifying-nfts/ - Mutable NFT metadata patternsparallel-nfts/ - Concurrent NFT mintingliquid-nfts/ - Fractionalized/liquid NFTsWhen to use: Building NFT collections, digital collectibles, tokenized assets
fungible_asset/ - Modern fungible token standardcoin/ - Basic coin implementationmanaged_fungible_asset/ - Controlled fungible assetsfa-lockup-example/ - FA lockup and escrow patternsfractional-token/ - Fractional token ownershipcontrolled-mint/ - Controlled minting with access controlWhen to use: Creating tokens, currencies, reward points
marketplace/ - NFT marketplace patternsswap/ - Simple token swapliquidity_pool/ - AMM pool implementationstaking/ - Staking mechanismsWhen to use: Building DEXs, marketplaces, trading platforms
dao/ - DAO governance patternsvoting/ - Voting mechanismsmultisig/ - Multi-signature accountsWhen to use: Building DAOs, governance systems, voting
hello_blockchain/ - Module structure basicsmessage_board/ - Simple state managementresource_account/ - Resource patterns (legacy - avoid for new code)error-codes/ - Error code conventions and patternsprivate-vs-public/ - Function visibility and accessobjects/ - Object model fundamentalsWhen to use: Learning Move basics, simple contracts
object_playground/ - Object model explorationcapability/ - Capability-based securityupgradeable/ - Upgradeable contractsdesign-patterns/ - Autonomous objects and other design patternsstruct-capabilities/ - Struct-based capability patternsmove-2/ - Move 2 language features and idiomsstorage/ - Storage layout and optimization patternsdata-structures/ - Heap data structure implementationWhen to use: Complex architectures, security patterns
lootbox/ - Randomized loot box mechanicsWhen to use: Building games, randomized rewards, loot systems
What to look for:
Module Structure:
Object Creation:
Access Control:
Operations:
Testing:
Don't copy blindly - adapt:
| Building | Search For | Source | Key Files |
|---|---|---|---|
| NFT Collection | token_objects, mint_nft | aptos-core | token_objects/sources/token.move |
| Fungible Token | fungible_asset | aptos-core | fungible_asset/sources/fungible_asset.move |
| Marketplace | marketplace | aptos-core | marketplace/sources/marketplace.move |
| DAO | dao, voting | aptos-core | dao/sources/dao.move |
| Token Swap | swap, liquidity_pool | aptos-core | swap/sources/swap.move |
| Staking | staking | aptos-core | staking/sources/staking.move |
| Simple Contract | hello_blockchain, message_board | aptos-core | hello_blockchain/sources/hello.move |
| Object Patterns | object_playground | aptos-core | object_playground/sources/playground.move |
| Composable NFTs | composable-nfts | daily-move | snippets/composable-nfts/ |
| FA Lockup/Escrow | fa-lockup-example | daily-move | snippets/fa-lockup-example/ |
| Design Patterns | design-patterns | daily-move | snippets/design-patterns/ |
| Move 2 Features | move-2 | daily-move | snippets/move-2/ |
| Data Structures | data-structures | daily-move | snippets/data-structures/ |
| Storage Patterns | storage | daily-move | snippets/storage/ |
| Loot Box Patterns | lootbox | daily-move | snippets/lootbox/ |
https://github.com/aptos-labs/aptos-core/tree/main/aptos-move/move-examplesBrowse online and read source files directly.
# Clone Aptos core
git clone https://github.com/aptos-labs/aptos-core.git
# Navigate to examples
cd aptos-core/aptos-move/move-examples
# List all examples
ls -la
# View specific example
cd token_objects
cat sources/token.moveBrowse online:
https://github.com/aptos-labs/daily-move/tree/main/snippetsClone locally:
git clone https://github.com/aptos-labs/daily-move.git
cd daily-move/snippets
ls -lahttps://aptos.dev/build/smart-contractsMany examples are documented with explanations.
// From: token_objects/sources/token.move
public entry fun create_token(
creator: &signer,
collection_name: String,
description: String,
name: String,
uri: String,
) {
let constructor_ref = token::create_named_token(
creator,
collection_name,
description,
name,
option::none(),
uri,
);
// ... additional setup
}Takeaway: Use named tokens for collections, create_object for unique items.
// From: dao/sources/dao.move
public entry fun execute_proposal(
proposer: &signer,
proposal_id: u64
) acquires DAO, Proposal {
let dao = borrow_global_mut<DAO>(@dao_addr);
let proposal = vector::borrow_mut(&mut dao.proposals, proposal_id);
// Verify proposal passed
assert!(proposal.votes_for > proposal.votes_against, E_PROPOSAL_NOT_PASSED);
// Execute actions
// ...
}Takeaway: Verify state conditions before executing critical operations.
// From: fungible_asset/sources/fungible_asset.move
public fun transfer<T: key>(
from: &signer,
to: address,
amount: u64
) acquires FungibleStore {
// Verify sender has sufficient balance
let from_store = borrow_global_mut<FungibleStore<T>>(signer::address_of(from));
assert!(from_store.balance >= amount, E_INSUFFICIENT_BALANCE);
// Deduct from sender
from_store.balance = from_store.balance - amount;
// Add to recipient
let to_store = borrow_global_mut<FungibleStore<T>>(to);
to_store.balance = to_store.balance + amount;
}Takeaway: Check-effects-interactions pattern (verify, deduct, add).
"0x..." placeholdersBefore writing contract code:
Search: Find token_objects example
Review Structure:
token_objects/
├── sources/
│ ├── collection.move # Collection management
│ ├── token.move # Token operations
│ └── property_map.move # Metadata handling
└── tests/
└── token_tests.moveIdentify Key Patterns:
create_collectioncreate_named_tokenPropertyMapTransferRefAdapt to Your Needs:
Reference in Code:
// Adapted from: aptos-core/move-examples/token_objects
module my_addr::custom_nft {
// ... your implementation
}Official Examples:
Related Skills:
write-contracts - Apply patterns after searchingsecurity-audit - Verify security of adapted codegenerate-tests - Test adapted patternsRemember: Search examples first. Understand patterns. Adapt securely. Test thoroughly.
919362b
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.