ワンクリックで
rust-module-refactor
Use when splitting Rust modules, moving tests, tightening visibility, or preserving facades during refactors.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when splitting Rust modules, moving tests, tightening visibility, or preserving facades during refactors.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when changing Axum solver routes, HTTP contracts, limits, scan sessions, or the matching web solver client.
Use when changing Rust puzzle state, moves, notation, scrambles, or validation.
Use when extracting React components, changing shared primitives, composing pages, or adding Storybook surfaces.
Use when changing solve inputs, limits, validation, scanner review controls, or form submission behavior.
Use when changing routes, locales, SEO metadata, static generation, hydration, public SEO assets, or language routing.
Use when changing React state, hooks, stores, async workflow ownership, or visualization synchronization.
| name | rust-module-refactor |
| description | Use when splitting Rust modules, moving tests, tightening visibility, or preserving facades during refactors. |
Generated from ai/registry.json. Do not edit manually.
Canonical skill: ../../../ai/skills/rust-module-refactor.md.
Referenced context:
../../../ai/rules/rust-module-refactor-rules.md../../../ai/rules/testing-rules.md../../../ai/architecture/project-architecture.md../../../ai/architecture/rust-module-boundaries.md../../../ai/glossary/cube-terms.mdThis file is compiled from canonical AI knowledge files. Edit canonical files under ai, then run npm run ai:sync.
ai/skills/rust-module-refactor.mdUse this skill when splitting large Rust files, changing mod.rs facades, moving tests, tightening visibility, or improving Rust module boundaries without changing behavior.
Make Rust code easier to read and maintain by extracting concrete responsibilities while preserving public API, solver behavior, artifact compatibility, and verification coverage.
ai/rules/rust-module-refactor-rules.mdai/rules/testing-rules.mdai/architecture/project-architecture.mdai/architecture/rust-module-boundaries.mdai/glossary/cube-terms.mdcube-engine when the refactor touches cube state, moves, notation, facelets, or validation.solver-search when the refactor touches search, heuristics, pruning tables, or two-phase internals.api-boundary when the refactor touches Axum routes, request/response structs, or frontend-facing status contracts.pub use before moving implementation details.pub(crate) exports unless an existing caller needs the item.cargo fmt --check after Rust module changes.cargo test -p cube-engine after engine or solver module refactors.cargo test -p rubiks-cube-solver-api after API module refactors.npm run ai:check after AI knowledge changes.ai/rules/rust-module-refactor-rules.mdRules for splitting Rust files, tightening module boundaries, and reducing refactor risk.
mod.rs or the original file as a facade when moving code into submodules.pub use only for the existing public crate API or a current cross-module consumer.pub(crate) for internal solver, table, helper, and adapter seams.cargo fmt after module moves and the narrowest relevant cargo test before broad tests.crates/api, web, scanner code, or AI tooling.cargo fmt --check for every Rust module refactor.cargo test -p cube-engine or cargo test -p rubiks-cube-solver-api.ai/rules/testing-rules.mdTesting rules for this repository.
crates/api behavior changes.describe, it, expect, vi.fn, and vi.spyOn for web unit and component tests.web tests in __tests__/ folders beside the source area they cover.__tests__ directory, including the established root, client, and domain-level locations; use shared helpers under apps/web/src/test.apps/web/src/core tests under apps/web/src/core/<category>/__tests__/<name>.test.ts.web coverage thresholds at 90% for statements, branches, functions, and lines..only in committed test files.jest.mock patterns in Vitest tests.web tests as loose sibling *.test.ts(x) files when a nearby __tests__/ folder is available.apps/web/src/test/render.tsx or apps/web/src/test/api.ts already covers the setup.selectOption() or locator('option') for Radix Select controls; use helpers under tests/e2e/select-helpers.ts.cargo test -p cube-engine.npm run api:test or cargo test -p rubiks-cube-solver-api.cargo test.npm run build and npm run lint -w @rubiks-cube-solver/web.npm run test -w @rubiks-cube-solver/web.npm run test:coverage -w @rubiks-cube-solver/web.npm run storybook:build -w @rubiks-cube-solver/web.npm run test:e2e after the API, web app, and pruning-table prerequisites are available.npm run test:e2e:smoke for product/responsive/timer smoke, npm run test:e2e:scan for serial manual scan coverage, and npm run test:e2e:full for the complete non-heavy suite.npm run product:gate for release-level or cross-boundary validation.npm run ai:check.ai/architecture/project-architecture.mdThe target is a Rubik's Cube solver with a Rust engine, search algorithms, heuristics, pattern databases, a native HTTP API, optional scanner support, and a modern web visualization.
crates/cube-engine: Rust crate for cube representation, moves, notation, scramble handling, search, and heuristics.crates/api: Axum HTTP API around the Rust engine and generated pruning-table artifacts.apps/web: Vite React app built as static HTML for indexable routes, hydrated with React, then operated as an SPA.apps/wca-data: independent NestJS/Fastify workspace with a PostgreSQL-backed public WCA reference API and a separate import worker.packages/rubiks-cube: active private workspace for puzzle-specific Three.js visualization and playback adapters.scanner: Python scanner contracts, FastAPI runtime, and offline scanner training/evaluation tooling.ai: canonical AI knowledge base and route generation system.docs/project-plan.md: current technical direction, implementation rules, and puzzle boundaries.cube-engine binaries and loaded by crates/api.npm run dev to build/recreate the rubiks-dev Compose project, wait for health, and serve web/API/vision on ports 5173, 8788, and 8791.dev:local:prepare and dev:local for development/debugging when Docker is not desired.rubiks-prod Compose project. Use live:deploy after merges to pull origin/main, rebuild/recreate containers, wait for app health, and print status.live:restart only when the checkout is already current and containers need to be rebuilt/recreated.live:start runs production deploy first and then starts the Cloudflare tunnel for speedcube.com.br with cloudflared tunnel run --token "$CLOUDFLARED_TUNNEL_TOKEN". live:tunnel runs only the tunnel command and assumes production Docker is already healthy.BaseMove, BaseState, BasePuzzle, or inheritance-style puzzle hierarchy.crates/wasm: optional future wasm-bindgen bridge around the Rust engine if browser-local solving becomes a concrete product requirement./api/wca-data/v1 contract belong to apps/wca-data, not the Rust solver API.ai/architecture/rust-module-boundaries.mdRust module structure should make the cube domain and solver flow easier to read without adding speculative abstraction.
crates/cube-engine owns cube state, moves, validation, search, heuristics, pruning tables, solver orchestration, and reports.crates/api owns HTTP routing, request and response types, CORS, API safety caps, generated solver loading, and HTTP error mapping.web renders UI and calls the API; it should not receive solver internals.scanner owns Python scanner runtime and offline scanner model tooling; it should not receive solver internals.Use a facade module when preserving public paths matters:
solver/
mod.rs # public facade and reexports
config.rs
dispatch.rs
errors.rs
input.rs
playback.rs
result.rs
strategy.rs
Prefer narrow files named after concrete responsibilities. Good seams in this repository include:
errors: typed error enums and Display implementations.metadata: stable artifact, report, or solver metadata structs.table / artifact: pruning-table representation and binary IO.coordinates: phase or cubie coordinate structs and checked conversions.ordering: deterministic move ordering and pruning predicates.dispatch: public solver strategy selection.responses: API response mapping.pub(crate) or private to their parent module.ai/glossary/cube-terms.mdA physical movable piece of the cube. The core engine tracks cubies rather than face colors as the primary model.
A cubie with three stickers. A 3x3 cube has eight corners.
A cubie with two stickers. A 3x3 cube has twelve edges.
Which cubie occupies each position.
How a cubie is twisted or flipped in its current position.
A face turn such as R, U, R', or U2.
A sequence of moves applied from the solved state to produce a valid cube state.
An estimate of distance from a cube state to the solved state.
A heuristic that never overestimates the true distance to the solved state.
A precomputed lookup table mapping partial cube states to minimum solution distances.
A facelet string format commonly used by two-phase solvers. It can be an adapter format, not the primary engine model.