Review and fix local git changes against Gem Wallet Core coding standards and patterns
Review uncommitted changes against the coding standards and patterns defined in this repository, then fix any issues found.
--subagent: Run in a subagent (isolates context, runs in background)Check if --subagent is in the arguments:
--subagent is present: Use the Task tool with subagent_type: "general-purpose" to run this review in a subagent, passing all other arguments--subagent is NOT present: Run directly in current context (default)Current git diff to review:
!git diff --no-color
Changed files:
!git diff --name-only
Analyze the diff above and check for the following issues:
storage::DatabaseClient::new() inline; import types firstpub use re-exportssnake_case (e.g., asset_id.rs)snake_casePascalCaseSCREAMING_SNAKE_CASEutil, utils, normalize, or similar vague namesis_spot_swap over is_hypercore_spot_swap)_str, _int, _vec suffixes; Rust's type system makes them redundantError: Use plain Error types, not thiserror macrosFrom traits: For error conversion between types?: Prefer ? operator over manual map_err where possibleResult<T, Error>: Use consistent return typesErrorType::constructor(msg) instead of verbose ErrorType::Variant("redundant context".into())primitives::ValueAccess: For serde_json::Value access, use composable trait methods (get_value(key), at(index), string()) instead of manual .get().ok_or() chains. Chain for compound access: params.get_value("key")?.at(0)?.string()?TransactionLoadInput::get_data_extra()) to avoid pattern-matching boilerplate at call sitesmatches!: Don't use matches! for pattern matching; it's easy to miss cases later/// docs unless explicitly asked; remove any that were added (including in mod.rs files)#[allow(dead_code)]: Remove dead code instead of suppressing warnings; if code is needed, use it#[uniffi::remote] instead of creating duplicate structs with From implementations:
// Record example
use primitives::AuthNonce;
pub type GemAuthNonce = AuthNonce;
#[uniffi::remote(Record)]
pub struct GemAuthNonce { pub nonce: String, pub timestamp: u32 }
// Enum example
use primitives::SwapperMode;
pub type GemSwapperMode = SwapperMode;
#[uniffi::remote(Enum)]
pub enum GemSwapperMode { ExactIn, ExactOut }
mut: Prefer immutable bindings; use mut only when truly necessary#[serde(default)]: Only use when the field is genuinely optional in the API response; if the field is always present, omit itmatch, use typed accessor methods (e.g., metadata.get_sequence()? instead of match &metadata { Cosmos { sequence, .. } => ... })models.rs + client.rs, not everything in one file)mod.rs instead of a single filegem_solana, gem_evm), not in utility binaries; move shared code to appropriate cratestokio for async operationsArc<tokio::sync::Mutex<T>> for shared async stateResult<T, Error>as_primitive(): For conversion from database modelsDatabaseClient methodsgem_jsonrpc::JsonRpcClient: For blockchain RPC interactionsprimitives::hex: For hex encoding/decoding (not alloy_primitives::hex)u256_to_biguint and biguint_to_u256 from gem_evm/src/u256.rs*_mapper.rs files#[tokio::test]: Use for async teststest_ descriptivelyResult<(), Box<dyn std::error::Error + Send + Sync>>testdata/ and use include_str!().unwrap() not .expect(): Never use .expect() in tests; use .unwrap() for brevityassert! with contains: Use assert_eq! with concrete values; assert!(x.contains(...)) gives useless failure messagesunwrap_or(0)). Propagate errors with ? or return Result. Fail rather than mask issues with fallbacks.Type::mock() constructors in testkit/ modules instead of inline struct construction in testsPartialEq + assert_eq!: Derive PartialEq on test-relevant enums and use direct assert_eq! with constructed expected values instead of destructuring with let ... else { panic! } or match ... { _ => panic! }fn object(json: &str) -> EnumType, fn sign_message(chain, sign_type, data) -> Action) for frequently constructed enum variants in test modulesIterate at least 2-3 times to ensure all issues are caught and fixed:
rustfmt --edition 2024 <files> on modified filescargo clippy -p <crate> -- -D warnings on affected cratesAfter fixing issues, provide a summary:
Severity levels for reporting:
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer