public/SKILLS/Web3 & Blockchain/move-testing/SKILL.md
Expert on testing Move smart contracts including unit tests, integration tests, Move Prover formal verification, debugging strategies, test coverage, and CI/CD integration for Aptos development.
npx skillsauth add eric861129/skills_all-in-one aptos-move-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert on testing Move smart contracts on Aptos blockchain.
#[test]
fun test_basic() { }
#[test(account = @0x1)]
fun test_with_signer(account: &signer) { }
#[test(alice = @0x123, bob = @0x456)]
fun test_multi_signer(alice: &signer, bob: &signer) { }
#[test]
#[expected_failure(abort_code = ERROR_CODE)]
fun test_should_fail() { }
#[test_only]
fun helper_function() { }
#[test(account = @0x123)]
fun test_resource_creation(account: &signer) {
let addr = signer::address_of(account);
// Create resource
create_resource(account);
// Verify exists
assert!(exists<MyResource>(addr), 0);
// Verify state
let resource = borrow_global<MyResource>(addr);
assert!(resource.value == expected, 1);
}
# Run all tests
aptos move test
# Run specific test
aptos move test --filter test_name
# With coverage
aptos move test --coverage
# With gas profiling
aptos move test --gas
# Verbose
aptos move test --verbose
#[test(alice = @0x123, bob = @0x456)]
fun test_transfer(alice: &signer, bob: &signer) {
let alice_addr = signer::address_of(alice);
let bob_addr = signer::address_of(bob);
initialize(alice);
initialize(bob);
transfer(alice, bob_addr, 100);
assert!(get_balance(alice_addr) == 900, 0);
assert!(get_balance(bob_addr) == 100, 1);
}
#[test]
#[expected_failure(abort_code = ERROR_INSUFFICIENT_BALANCE)]
fun test_insufficient_balance() {
transfer(from, to, amount_too_large);
}
#[test]
#[expected_failure] // Any failure
fun test_any_failure() {
assert!(false, 0);
}
#[test_only]
module test_helpers {
public fun setup_account(account: &signer): address {
let addr = signer::address_of(account);
// Setup logic
addr
}
}
#[test_only]
use std::debug;
#[test]
fun test_with_debug() {
debug::print(&b"Value:");
debug::print(&value);
}
spec transfer {
requires sender_balance >= amount;
ensures global<Balance>(sender).value ==
old(global<Balance>(sender).value) - amount;
aborts_if sender_balance < amount;
}
spec module {
invariant forall addr: address:
exists<Balance>(addr) ==> global<Balance>(addr).value >= 0;
}
# Run prover
aptos move prove
aptos move prove --filter MyModule
Test coverage should include:
// Check existence first
if (!exists<Resource>(addr)) {
move_to(account, Resource {});
}
// Use test parameter
#[test(account = @0x1)]
fun test_with_signer(account: &signer) { }
// Reduce iterations
#[test]
fun test_optimized() {
for (i in 0..100) { } // Not 1000000
}
name: Move Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Aptos CLI
run: curl -fsSL "https://aptos.dev/scripts/install_cli.py" | python3
- name: Run Tests
run: aptos move test --coverage
- name: Run Prover
run: aptos move prove
development
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.
development
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.
development
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.
tools
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.