🛡️ Elite UI/UX Rust Protocol (The "Clean Hands" Doctrine)
This skill encapsulates the battle-hardened standards for building industrial-grade user interfaces using Tauri (Rust), React 19, and Tailwind CSS v4. It is forged from the "so-sai" ecosystem experience.
I. The "Clean Hands" Doctrine
"If it is unused, it must die."
- •
Dead Code Zero Tolerance:
- •NEVER keep CSS classes "just in case" (e.g.,
btn-primary,rigid-borderif not used). - •If a linter or build tool complains about syntax, first check if the code is even needed. deleting > fixing.
- •Audit Rule: Before every release build, grep for custom classes in
src/. If 0 hits, remove fromindex.css.
- •NEVER keep CSS classes "just in case" (e.g.,
- •
No "Ghost" Windows:
- •Production builds MUST NOT show a command prompt / terminal window.
- •Fix: Add
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]tosrc-tauri/src/main.rs.
- •
Import Sanitation:
- •Duplicate or unused imports in
.tsxor.rsfiles block the production pipeline (tscorcargo). - •Action: Use
cargo fix --workspace --allow-dirtyfor Rust and always verifynpx tsc --noEmitfor React before building.
- •Duplicate or unused imports in
II. Tailwind CSS v4 Engine Mode
Recovering from v3 habits is critical.
- •
Initialization:
- •DO NOT USE:
@tailwind base;/@tailwind components; - •MUST USE:
@import "tailwindcss";
- •DO NOT USE:
- •
No Invalid Utilities:
- •Avoid:
@utility btn:hover. Colons are illegal in utility names. - •Use Nesting:
css
@utility btn-primary { /* styles */ &:hover { /* styles */ } }
- •Avoid:
- •
Scoped Isolation:
- •Do not pollute global scope with scrollbar hacks.
- •YES:
.custom-class { &::-webkit-scrollbar { ... } } - •NO:
::-webkit-scrollbar { ... }(Global pollution)
III. AEC Design Constitution (Architectural Standard)
Software for Engineers must feel like a precision instrument.
- •
The Rigid Frame:
- •Layouts MUST NOT shift pixel-by-pixel.
- •Use
scrollbar-gutter: stableoroverflow: hiddenon body. - •Dimensions:
- •Sidebar:
280px(Fixed) - •Header:
56pxto64px - •Status Bar (Refined Action Bar):
40px
- •Sidebar:
- •
Typography of Truth:
- •Inter: For User Interface, Labels, Instructions. (Human readable)
- •JetBrains Mono: For DATA, NUMBERS, HASHES. (Machine readable, monospaced alignment).
- •Never mix them up.
- •
Color Semantics:
- •Action Blue: Primary operations (
#2563EB). - •Alert Orange: Non-fatal warnings (
#F59E0B). - •Forensic Gray: Backgrounds and borders (
#E5E7EB,#F9FAFB). Avoid pure black#000.
- •Action Blue: Primary operations (
IV. Production Hygiene (The Build Loop)
- •
Capability Schema Validation:
- •Tauri v2 uses strict permission identifiers (e.g.,
fs:default,fs:read-all). - •Warning: Avoid using non-standard identifiers like
fs:allow-read-recursivewhich triggerexit code: 1during build.
- •Tauri v2 uses strict permission identifiers (e.g.,
- •
Clean Build Cycle:
- •Run
cargo cleanif linking errors occur. - •Command:
npm run tauri build.
- •Run
- •
Installer Verification:
- •Check
target/release/bundle/msiornsis. - •Verify file size > 5MB.
- •Check
V. The Scrub Protocol (V.1.1.0 Evolution)
"A clean engine leaves no digital fingerprints."
- •Runtime Hygiene:
- •Implement AEC-CRASH-DUMP: Error boundaries must offer a one-click state dump (JSON) for forensic debugging without developer console access.
- •Post-Build Sanitation:
- •Automatically clean up stale
target/artifacts if they exceed the project threshold (recommend 5GB).
- •Automatically clean up stale
- •Privacy Purge:
- •Ensure all
blob:URLs and temp buffers from PDF/Excel parsing are revoked/dropped immediately after render to prevent persistent memory footprints.
- •Ensure all