move-code-quality

0
0
Source

Analyzes Move language packages against the official Move Book Code Quality Checklist. Use this skill when reviewing Move code, checking Move 2024 Edition compliance, or analyzing Move packages for best practices. Activates automatically when working with .move files or Move.toml manifests.

Install

mkdir -p .claude/skills/move-code-quality && curl -L -o skill.zip "https://mcp.directory/api/skills/download/8013" && unzip -o skill.zip -d .claude/skills/move-code-quality && rm skill.zip

Installs to .claude/skills/move-code-quality

About this skill

Move Code Quality Checker

You are an expert Move language code reviewer with deep knowledge of the Move Book Code Quality Checklist. Your role is to analyze Move packages and provide specific, actionable feedback based on modern Move 2024 Edition best practices.

When to Use This Skill

Activate this skill when:

  • User asks to "check Move code quality", "review Move code", or "analyze Move package"
  • User mentions Move 2024 Edition compliance
  • Working in a directory containing .move files or Move.toml
  • User asks to review code against the Move checklist

Analysis Workflow

Phase 1: Discovery

  1. Detect Move project structure

    • Look for Move.toml in current directory
    • Find all .move files using glob patterns
    • Identify test modules (files/modules with _tests suffix)
  2. Read Move.toml

    • Check edition specification
    • Review dependencies (should be implicit for Sui 1.45+)
    • Examine named addresses for proper prefixing
  3. Understand scope

    • Ask user if they want full package scan or specific file/category analysis
    • Determine if this is new code review or existing code audit

Phase 2: Systematic Analysis

Analyze code across these 11 categories with 50+ specific rules:

1. Code Organization

Use Move Formatter

  • Check if code appears formatted consistently
  • Recommend formatter tools: CLI (npm), CI/CD integration, VSCode/Cursor plugin

2. Package Manifest (Move.toml)

Use Right Edition

  • ✅ MUST have: edition = "2024.beta" or edition = "2024"
  • ❌ CRITICAL if missing: All checklist features require Move 2024 Edition

Implicit Framework Dependency

  • ✅ For Sui 1.45+: No explicit Sui, Bridge, MoveStdlib, SuiSystem in [dependencies]
  • ❌ OUTDATED: Explicit framework dependencies listed

Prefix Named Addresses

  • ✅ GOOD: my_protocol_math = "0x0" (project-specific prefix)
  • ❌ BAD: math = "0x0" (generic, conflict-prone)

3. Imports, Modules & Constants

Using Module Label (Modern Syntax)

  • ✅ GOOD: module my_package::my_module; followed by declarations
  • ❌ BAD: module my_package::my_module { ... } (legacy curly braces)

No Single Self in Use Statements

  • ✅ GOOD: use my_package::my_module;
  • ❌ BAD: use my_package::my_module::{Self}; (redundant braces)
  • ✅ GOOD when importing members: use my_package::my_module::{Self, Member};

Group Use Statements with Self

  • ✅ GOOD: use my_package::my_module::{Self, OtherMember};
  • ❌ BAD: Separate imports for module and its members

Error Constants in EPascalCase

  • ✅ GOOD: const ENotAuthorized: u64 = 0;
  • ❌ BAD: const NOT_AUTHORIZED: u64 = 0; (all-caps reserved for regular constants)

Regular Constants in ALL_CAPS

  • ✅ GOOD: const MY_CONSTANT: vector<u8> = b"value";
  • ❌ BAD: const MyConstant: vector<u8> = b"value"; (PascalCase suggests error)

4. Structs

Capabilities Suffixed with Cap

  • ✅ GOOD: public struct AdminCap has key, store { id: UID }
  • ❌ BAD: public struct Admin has key, store { id: UID } (unclear it's a capability)

No Potato in Names

  • ✅ GOOD: public struct Promise {}
  • ❌ BAD: public struct PromisePotato {} (redundant, abilities show it's hot potato)

Events Named in Past Tense

  • ✅ GOOD: public struct UserRegistered has copy, drop { user: address }
  • ❌ BAD: public struct RegisterUser has copy, drop { user: address } (ambiguous)

Positional Structs for Dynamic Field Keys

  • ✅ CANONICAL: public struct DynamicFieldKey() has copy, drop, store;
  • ⚠️ ACCEPTABLE: public struct DynamicField has copy, drop, store {}

5. Functions

No Public Entry - Use Public or Entry

  • ✅ GOOD: public fun do_something(): T { ... } (composable, returns value)
  • ✅ GOOD: entry fun mint_and_transfer(...) { ... } (transaction endpoint only)
  • ❌ BAD: public entry fun do_something() { ... } (redundant combination)
  • Reason: Public functions are more permissive and enable PTB composition

Composable Functions for PTBs

  • ✅ GOOD: public fun mint(ctx: &mut TxContext): NFT { ... }
  • ❌ BAD: public fun mint_and_transfer(ctx: &mut TxContext) { transfer::transfer(...) } (not composable)
  • Benefit: Returning values enables Programmable Transaction Block chaining

Objects Go First (Except Clock)

  • ✅ GOOD parameter order:
    1. Objects (mutable, then immutable)
    2. Capabilities
    3. Primitive types (u8, u64, bool, etc.)
    4. Clock reference
    5. TxContext (always last)

Example:

// ✅ GOOD
public fun call_app(
    app: &mut App,
    cap: &AppCap,
    value: u8,
    is_smth: bool,
    clock: &Clock,
    ctx: &mut TxContext,
) { }

// ❌ BAD - parameters out of order
public fun call_app(
    value: u8,
    app: &mut App,
    is_smth: bool,
    cap: &AppCap,
    clock: &Clock,
    ctx: &mut TxContext,
) { }

Capabilities Go Second

  • ✅ GOOD: public fun authorize(app: &mut App, cap: &AdminCap)
  • ❌ BAD: public fun authorize(cap: &AdminCap, app: &mut App) (breaks method associativity)

Getters Named After Field + _mut

  • ✅ GOOD: public fun name(u: &User): String (immutable accessor)
  • ✅ GOOD: public fun details_mut(u: &mut User): &mut Details (mutable accessor)
  • ❌ BAD: public fun get_name(u: &User): String (unnecessary prefix)

6. Function Body: Struct Methods

Common Coin Operations

  • ✅ GOOD: payment.split(amount, ctx).into_balance()
  • ✅ BETTER: payment.balance_mut().split(amount)
  • ✅ CONVERT: balance.into_coin(ctx)
  • ❌ BAD: coin::into_balance(coin::split(&mut payment, amount, ctx))

Don't Import std::string::utf8

  • ✅ GOOD: b"hello, world!".to_string()
  • ✅ GOOD: b"hello, world!".to_ascii_string()
  • ❌ BAD: use std::string::utf8; let str = utf8(b"hello, world!");

UID Has Delete Method

  • ✅ GOOD: id.delete();
  • ❌ BAD: object::delete(id);

Context Has sender() Method

  • ✅ GOOD: ctx.sender()
  • ❌ BAD: tx_context::sender(ctx)

Vector Has Literal & Associated Functions

  • ✅ GOOD: let mut my_vec = vector[10];
  • ✅ GOOD: let first = my_vec[0];
  • ✅ GOOD: assert!(my_vec.length() == 1);
  • ❌ BAD: let mut my_vec = vector::empty(); vector::push_back(&mut my_vec, 10);

Collections Support Index Syntax

  • ✅ GOOD: &x[&10] and &mut x[&10] (for VecMap, etc.)
  • ❌ BAD: x.get(&10) and x.get_mut(&10)

7. Option Macros

Destroy And Call Function (do!)

  • ✅ GOOD: opt.do!(|value| call_function(value));
  • ❌ BAD:
if (opt.is_some()) {
    let inner = opt.destroy_some();
    call_function(inner);
}

Destroy Some With Default (destroy_or!)

  • ✅ GOOD: let value = opt.destroy_or!(default_value);
  • ✅ GOOD: let value = opt.destroy_or!(abort ECannotBeEmpty);
  • ❌ BAD:
let value = if (opt.is_some()) {
    opt.destroy_some()
} else {
    abort EError
};

8. Loop Macros

Do Operation N Times (do!)

  • ✅ GOOD: 32u8.do!(|_| do_action());
  • ❌ BAD: Manual while loop with counter

New Vector From Iteration (tabulate!)

  • ✅ GOOD: vector::tabulate!(32, |i| i);
  • ❌ BAD: Manual while loop with push_back

Do Operation on Every Element (do_ref!)

  • ✅ GOOD: vec.do_ref!(|e| call_function(e));
  • ❌ BAD: Manual index-based while loop

Destroy Vector & Call Function (destroy!)

  • ✅ GOOD: vec.destroy!(|e| call(e));
  • ❌ BAD: while (!vec.is_empty()) { call(vec.pop_back()); }

Fold Vector Into Single Value (fold!)

  • ✅ GOOD: let sum = source.fold!(0, |acc, v| acc + v);
  • ❌ BAD: Manual accumulation with while loop

Filter Elements of Vector (filter!)

  • ✅ GOOD: let filtered = source.filter!(|e| e > 10); (requires T: drop)
  • ❌ BAD: Manual filtering with conditional push_back

9. Other Improvements

Ignored Values in Unpack (.. syntax)

  • ✅ GOOD: let MyStruct { id, .. } = value; (Move 2024)
  • ❌ BAD: let MyStruct { id, field_1: _, field_2: _, field_3: _ } = value;

10. Testing

Merge #[test] and #[expected_failure]

  • ✅ GOOD: #[test, expected_failure]
  • ❌ BAD: Separate #[test] and #[expected_failure] on different lines

Don't Clean Up expected_failure Tests

  • ✅ GOOD: End with abort to show failure point
  • ❌ BAD: Include test.end() or other cleanup in expected_failure tests

Don't Prefix Tests with test_

  • ✅ GOOD: #[test] fun this_feature_works() { }
  • ❌ BAD: #[test] fun test_this_feature() { } (redundant in test module)

Don't Use TestScenario When Unnecessary

  • ✅ GOOD for simple tests: let ctx = &mut tx_context::dummy();
  • ❌ OVERKILL: Full TestScenario setup for basic functionality

Don't Use Abort Codes in assert!

  • ✅ GOOD: assert!(is_success);
  • ❌ BAD: assert!(is_success, 0); (may conflict with app error codes)

Use assert_eq! Whenever Possible

  • ✅ GOOD: assert_eq!(result, expected_value); (shows both values on failure)
  • ❌ BAD: assert!(result == expected_value);

Use "Black Hole" destroy Function

  • ✅ GOOD: use sui::test_utils::destroy; destroy(nft);
  • ❌ BAD: Custom destroy_for_testing() functions

11. Comments

Doc Comments Start With ///

  • ✅ GOOD: /// Cool method!
  • ❌ BAD: JavaDoc-style /** ... */ (not supported)

Complex Logic Needs Comments

  • ✅ GOOD: Explain non-obvious operations, potential issues, TODOs
  • Example:
// Note: can underflow if value is smaller than 10.
// TODO: add an `assert!` here
let value = external_call(value, ctx);

Phase 3: Reporting

Present findings in this format:

## Move Code Quality Analysis

### Summary
- ✅ X checks passed
- ⚠️  Y improvements recommended
- ❌ Z critical issues

### Critical Issues (Fix These First)

#### 1. Missing Move 2024 Edition

**File**: `Move.toml:2`

**Issue**: No edition specified in package manifest

**Impact**: Cannot use modern Move features required by checklist

**Fix**:
\`\`\`toml
[package]
name = "my_package"
edition = "2024.beta"  # Add this line
\`\`\`

### Important Improvements

#### 2. Legacy Module Syntax

**File**: `sources/my_module.move:1-10`

**Issue**: Usin

---

*Content truncated.*

scroll-experience

davila7

Expert in building immersive scroll-driven experiences - parallax storytelling, scroll animations, interactive narratives, and cinematic web experiences. Like NY Times interactives, Apple product pages, and award-winning web experiences. Makes websites feel like experiences, not just pages. Use when: scroll animation, parallax, scroll storytelling, interactive story, cinematic website.

10968

software-architecture

davila7

Guide for quality focused software architecture. This skill should be used when users want to write code, design architecture, analyze code, in any case that relates to software development.

14749

game-development

davila7

Game development orchestrator. Routes to platform-specific skills based on project needs.

10630

senior-fullstack

davila7

Comprehensive fullstack development skill for building complete web applications with React, Next.js, Node.js, GraphQL, and PostgreSQL. Includes project scaffolding, code quality analysis, architecture patterns, and complete tech stack guidance. Use when building new projects, analyzing code quality, implementing design patterns, or setting up development workflows.

9325

ml-paper-writing

davila7

Write publication-ready ML/AI papers for NeurIPS, ICML, ICLR, ACL, AAAI, COLM. Use when drafting papers from research repos, structuring arguments, verifying citations, or preparing camera-ready submissions. Includes LaTeX templates, reviewer guidelines, and citation verification workflows.

7823

senior-security

davila7

Comprehensive security engineering skill for application security, penetration testing, security architecture, and compliance auditing. Includes security assessment tools, threat modeling, crypto implementation, and security automation. Use when designing security architecture, conducting penetration tests, implementing cryptography, or performing security audits.

7921

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

9521,094

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

846846

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

571699

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

548492

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

673466

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

514280

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.