Requirements
- Target platform
- OpenClaw
- Install method
- Manual import
- Extraction
- Extract archive
- Prerequisites
- OpenClaw
- Primary doc
- SKILL.md
Analyze Sui Move test coverage, identify untested code, write missing tests, and perform security audits. Includes Python tools for parsing coverage output and generating reports.
Analyze Sui Move test coverage, identify untested code, write missing tests, and perform security audits. Includes Python tools for parsing coverage output and generating reports.
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
Analyze and automatically improve Sui Move test coverage with security analysis. GitHub: https://github.com/EasonC13-agent/sui-skills/tree/main/sui-coverage
# macOS (recommended) brew install sui # Other platforms: see official docs # https://docs.sui.io/guides/developer/getting-started/sui-install Verify: sui --version
# Location of tools (adjust to your skill installation path) SKILL_DIR=<your-workspace>/skills/sui-coverage # Full workflow cd /path/to/move/package sui move test --coverage --trace python3 $SKILL_DIR/analyze_source.py -m <module> -o coverage.md
cd <package_path> sui move test --coverage --trace python3 $SKILL_DIR/analyze_source.py -m <module_name> -o coverage.md
Read the generated coverage.md to identify: 🔴 Uncalled functions - Functions never executed 🔴 Uncovered assertions - assert!() failure paths not tested 🔴 Uncovered branches - if/else paths not taken
For each uncovered item, write a test: A. Uncalled Function #[test] fun test_<function_name>() { // Setup let mut ctx = tx_context::dummy(); // Call the uncovered function <function_name>(...); // Assert expected behavior } B. Assertion Failure Path (expect_failure) #[test] #[expected_failure(abort_code = <ERROR_CODE>)] fun test_<function>_fails_when_<condition>() { let mut ctx = tx_context::dummy(); // Setup state that triggers the assertion failure <function_call_that_should_fail>(); } C. Branch Coverage (if/else) #[test] fun test_<function>_when_<condition_true>() { ... } #[test] fun test_<function>_when_<condition_false>() { ... }
sui move test --coverage --trace python3 $SKILL_DIR/analyze_source.py -m <module_name>
python3 $SKILL_DIR/analyze_source.py --module <name> [options] Options: -m, --module Module name (required) -p, --path Package path (default: .) -o, --output Output file (e.g., coverage.md) --json JSON output --markdown Markdown to stdout
sui move coverage lcov python3 $SKILL_DIR/analyze.py lcov.info -f "<package>" -s sources/ Options: -f, --filter Filter by path pattern -s, --source-dir Source directory for context -i, --issues-only Only show files with issues -j, --json JSON output
sui move coverage bytecode --module <name> | python3 $SKILL_DIR/parse_bytecode.py
// Source code: public fun withdraw(balance: &mut u64, amount: u64) { assert!(*balance >= amount, EInsufficientBalance); // ← This failure path *balance = *balance - amount; } // Test for the failure path: #[test] #[expected_failure(abort_code = EInsufficientBalance)] fun test_withdraw_insufficient_balance() { let mut balance = 50; withdraw(&mut balance, 100); // Should fail: 50 < 100 }
// Source code: public fun classify(value: u64): u8 { if (value == 0) { 0 } else if (value < 100) { 1 } else { 2 } } // Tests for all branches: #[test] fun test_classify_zero() { assert!(classify(0) == 0, 0); } #[test] fun test_classify_small() { assert!(classify(50) == 1, 0); } #[test] fun test_classify_large() { assert!(classify(100) == 2, 0); }
#[test] fun test_full_lifecycle() { let mut ctx = tx_context::dummy(); // Create let obj = create(&mut ctx); assert!(get_value(&obj) == 0, 0); // Modify increment(&mut obj); assert!(get_value(&obj) == 1, 0); // Destroy destroy(obj); }
When writing #[expected_failure] tests, use the error constant name: // If the module defines: const EInvalidInput: u64 = 1; const ENotAuthorized: u64 = 2; // Use in test: #[expected_failure(abort_code = EInvalidInput)] fun test_invalid_input() { ... } // Or use the module-qualified name: #[expected_failure(abort_code = my_module::EInvalidInput)] fun test_invalid_input() { ... }
# 1. Analyze current coverage cd /path/to/my_package sui move test --coverage --trace python3 $SKILL_DIR/analyze_source.py -m my_module -o coverage.md # 2. Review what's missing cat coverage.md # Shows: # - decrement() not called # - assert!(value > 0, EValueZero) failure not tested # 3. Add tests to sources/my_module.move or tests/my_module_tests.move # (write the missing tests) # 4. Verify improvement sui move test --coverage --trace python3 $SKILL_DIR/analyze_source.py -m my_module # 5. Repeat until 100% coverage
When asked to improve test coverage: Run analysis - Get current coverage state Read source - Understand the module's logic Identify gaps - List uncovered functions/branches/assertions Security review - Analyze for vulnerabilities while writing tests Write tests - Create tests for each gap + security edge cases Report findings - Document any security concerns discovered Verify - Re-run coverage to confirm improvement Always commit test improvements: git add sources/ tests/ git commit -m "Improve test coverage for <module>"
Writing tests = Understanding the contract = Finding vulnerabilities When writing tests, actively look for these issues:
// SECURITY: Testing that non-owner cannot withdraw #[test] #[expected_failure(abort_code = ENotOwner)] fun test_unauthorized_withdraw() { // Setup: Create vault owned by ALICE // Action: BOB tries to withdraw // Expected: Should fail with ENotOwner } // SECURITY: Testing overflow protection #[test] fun test_deposit_overflow_protection() { // Deposit near u64::MAX // Verify no overflow occurs } // SECURITY: Testing economic invariant #[test] fun test_total_supply_invariant() { // After any operations: // sum(all_balances) == total_supply }
# 1. Coverage analysis sui move test --coverage --trace python3 $SKILL_DIR/analyze_source.py -m <module> -o coverage.md # 2. While writing tests, document security findings # Create SECURITY.md alongside coverage.md # 3. After tests pass, summarize: # - Coverage: X% → 100% # - Security issues found: N # - Recommendations: ...
This skill is part of the Sui development skill suite: SkillDescriptionsui-decompileFetch and read on-chain contract source codesui-moveWrite and deploy Move smart contractssui-coverageAnalyze test coverage with security analysissui-agent-walletBuild and test DApps frontend Workflow: sui-decompile → sui-move → sui-coverage → sui-agent-wallet Study Write Test & Audit Build DApps All skills: https://github.com/EasonC13-agent/sui-skills
Data access, storage, extraction, analysis, reporting, and insight generation.
Largest current source with strong distribution and engagement signals.