install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/development/elite-rust" ~/.claude/skills/diegosouzapw-awesome-omni-skill-elite-rust && rm -rf "$T"
manifest:
skills/development/elite-rust/SKILL.mdsource content
Rust Elite Standards (Edition 2024)
Architecture
- Edition: Must use Rust Edition 2024.
- Dependencies: Use Standard Polars
(ensure patch version compatibility).0.52.x
Safety & Error Handling
- No Panic Policy: Strictly forbid
andunwrap()
in business logic.expect() - Typed Errors: Use
for library errors andthiserror
for application-level errors.anyhow - Async: Use
for async runtime unless specified otherwise.tokio
Testing & Quality (Atomic Simulator VAS)
- TDD Requirement: "No Test, No Commit". Every feature must have a "Red Phase" failing test before logic implementation.
- Performance Benchmarks: Core operations (e.g., Ledger queries) must meet sub-100ms targets for 1000 rows.
- Verification: Every Mission must conclude with a
documenting test results.walkthrough.md
Interoperability (Tauri/TS)
- Data Contract: All event payloads between Rust and TypeScript MUST use
. UsecamelCase
on structs.#[serde(rename_all = "camelCase")] - Glass Panel Philosophy: UI is strictly a "Glass Panel". Zero business logic, zero state inferencing, and zero data modification allowed in the Frontend. UI ONLY renders what the Core (Rust) dictates.
- IPC Safety: Use
or#[tauri::arg(rename = "camelCase")]
to reconcile Rust's#[allow(non_snake_case)]
with Frontend'ssnake_case
without breaking convention.camelCase
Observability
- Traceability: Every result-bearing function must be traced or logged using the
crate. Usetracing
on core logic.#[tracing::instrument]
Extraction (Unified Orchestrator)
- Architecture: Use the "Unified Extraction Orchestrator" pattern. Orchestrators must be stateless, purely gaging capability and dispatching to lanes.
- Stability & Isolation: Heavy FFI tasks (PDF/Office) MUST be isolated in sub-processes via
.WorkerManager - Fate-sharing: Workers must monitor
. If parent drops, worker must exit immediately to avoid "ghost processes".stdin - Resource Governor: Limit maximum concurrent workers using a
. Cap based on CPU core count or memory availability.Semaphore - Contract Enforcement: All lanes must speak the
JSON protocol.ExtractionProduct
Interoperability (IPC Protocol)
- JSON Stream: Communication between Main (Rust) and Worker (Python) must be conducted via JSON over
.stdin/stdout - CamelCase Alignment: All IPC payloads MUST be
.camelCase - Timeout Policy: Every worker task must have a hard timeout to prevent blocking the dispatcher.
- Zero-Lag IPC: Round-trip time (RTT) for IPC MUST NOT exceed 20ms. Use persistent worker pools to avoid cold-start overhead. Any refactoring that degrades IPC performance beyond this threshold MUST be rejected.
Polars Integration (Mission 018+)
- Version Lock: Use Polars
for stability and API consistency.0.52.x - DataFrame Construction:
- Use
(notDataFrame::new(Vec<Column>)
)Vec<Series> - Convert
→Series
viaColumn
or.into_column()Column::from(series)
- Use
- Type Safety:
- Column names must use
for.into()
compatibilityPlSmallStr - Example:
Series::new((&col_name).into(), &values) - Avoid
on DataFrame operations — use.unwrap()
propagationResult
- Column names must use
- Testing:
- Every Polars operation must have a unit test with known input/output
- Benchmark DataFrame creation < 50ms per table (per
)LATENCY_BUDGET.md
- Documentation:
- Always check Polars docs for current version before implementation
- Polars API changes frequently between minor versions
Lessons Learned (Mission 018)
❌ What Went Wrong
- Ignored Skill Standards: Used Polars
instead of0.45
specified in skill0.52.x - No TDD: Wrote implementation before tests, leading to trial-and-error debugging
- API Assumptions: Guessed Polars API instead of reading docs, wasted time on type mismatches
- Missing Observability: No
on core functions#[tracing::instrument]
✅ What Was Fixed
- Version Alignment: Upgraded to Polars
— clean build with no breaking changes0.52 - Type Corrections:
→Vec<Series>
for DataFrame constructionVec<Column>- Added
for.into()
column namesPlSmallStr
- Dependency Management: Added missing
for timestamp handlingchrono
📋 Process Improvements
- Read Skill First: Always check skill requirements before choosing dependencies
- TDD Discipline: Write failing test → implement → verify (Red-Green-Refactor)
- Version Lock Early: Pin exact versions in
to avoid API driftCargo.toml - Document Assumptions: If deviating from skill, document why in commit message
Refactor & Safety Audit (Elite Mandatory)
-
Unsafe Policy
blocks are forbidden by default.unsafe- If unavoidable:
- Must be isolated in a single module.
- Must include SAFETY comments explaining invariants.
- Must be reviewed and traced.
-
Refactor Discipline
- Eliminate all
/unwrap()
(including tests & examples).expect() - Replace with
andResult<T, E>
.? - No silent fallback.
- Eliminate all
-
Public API Contract
- Any public function that can fail MUST return
.Result - Error types must be explicit at library boundaries.
- Any public function that can fail MUST return
-
Refactor Workflow
- Analyze module responsibilities.
- Identify unsafe / panic / implicit failure.
- Propose refactor plan before applying major logic changes.
- Refactor module-by-module under
.src/ - Update call sites, tests, examples, and documentation.
Data Purity Protocol (The Janitor's Decree)
- Architectural Separation: Data cleaning (Janitor) is STRICTLY separated from data validation (TableTruth).
- Stateless & Pure: The Janitor layer must be a pure transformer. It does not hold state or infer business logic.
- Reporting Hierarchy:
is non-authoritative. It is an audit trail for the Dashboard, but MUST NEVER be used by theJanitorReport
layer to determine validity.Truth - I/O Boundary Enforcement (Encoding): All external text (e.g., from PythonWorkers) must pass through an
for UTF-8 and Mojibake validation before reaching the Janitor.EncodingGatekeeper - Ghost Rules:
- Ejection of "Ghost Columns" is preferred for structural hallucinations.
- Row ejection is only allowed for 100% empty rows with no semantic significance (e.g., header rows, spacer rows).
- SIMD Usage: Prefer standard library optimizations (Regex, Arrow) for SIMD. Avoid manual intrinsics unless explicitly authorized for a specific Mission.
- Syntactic Cleaning Only: Janitor cleans characters and formats (1.250,50 -> 1250.5). It NEVER performs semantic conversion (m3 -> liters). Parse failures are left "as-is" to be rejected by Truth.
Iron Truth Contract & Clean Hands Doctrine (Mission 024-027)
- LAW-07 (Fail Safe & Human-Gated): Systems MUST detect and reject anomalies (Mojibake, structural rot) but MUST NEVER attempt autonomous repair. All repairs are human-gated.
- Clean Hands Doctrine: The Truth Engine (
) must remain pure. It only validates data. Any repair logic resides in theTableTruth
layer and results must be re-submitted for validation. "The Judge does not write the Law, and the Janitor does not argue with the Truth."Adapter/Engine - Iron Truth Contract V1.0:
is the singular source of truth for structural validity.TableTruth
is the derived authority for cross-source reconciliation.ProjectTruth- Any conflict between Reality and Truth results in
status by default.Rejected
- Global Singletons: Use
for global, thread-safe singletons (e.g.,std::sync::OnceLock
). AvoidEncodingNormalizer
unless complex macro execution is required.lazy_static - UI Architecture:
- 4-Panel Arbiter Layout: Mandatory for data-dense forensic tools.
- Virtualization: Mandatory for tables > 100 rows to maintain sub-1s interactivity. Row height fixed at 32px for precision.
- Forbidden Patterns: Non-deterministic loaders (spinners), softening of rejection language ("Check again" -> "TỪ CHỐI"), and autonomous "Fix" buttons are strictly forbidden.
Project Intelligence & Lineage Protocol (Mission 030)
- Truth Lineage: Every aggregated metric (e.g.,
) MUST carry atotal_cost
.LineageMap - Shadow Columns: Use a
prefix for forensic metadata columns in Polars. These columns are for sideboat metadata only and MUST NOT participate in primary business logic (sort/filter/calc)._lineage_ - Deterministic GlobalId:
for any entity (cell, row, table) must be deterministic and hash-based:GlobalId
. Never use random UUIDs for forensic data.hash(v1_id, v2_id...) - Backward Compatibility: When adding new fields to core data contracts (e.g.,
), useTableCell
to ensure compatibility with existing serialized mocks and project files.#[serde(default)] - Polars String Handling (0.52): To check if a column name exists in
, convert to adf.get_column_names()
first or handleVec<String>
types carefully to avoidPlSmallStr
vs&str
type mismatches in&&str
..contains() - Forensic State Persistence: Tauri backend
must act as the primary cache for derived truths (likeForensicState
) to ensure consistency across independent IPC commands (Drill-down, Export).ProjectTruth
Tauri v2 & Serde Interop Protocol (RC-1 Legacy)
- Trait Scoping (Emitter):
- To use
on an AppHandle in Tauri v2, you MUST import the trait:.emit()
. Theuse tauri::Emitter;
trait is no longer sufficient for event emission.Manager
- To use
- Serialization Mismatches ("The Camel Trap"):
- Rule: Tauri v2 often defaults to
for serialized output.camelCase - Risk: Rust structs with
fields (e.g.,snake_case
) may arrive at Frontend ascell_id
orcellId
, leading tocell_id
errors.undefined - Prescription:
- Explicitly explicitly decorate structs with
if the frontend expects a specific casing.#[serde(rename = "your_field_name")] - Or use
for the entire struct.#[serde(rename_all = "camelCase")] - Frontend Defense: Always use optional chaining (e.g.,
) and verify field existence before operations.payload?.cell_id?.split(...)
- Explicitly explicitly decorate structs with
- Rule: Tauri v2 often defaults to
- Clean Hands Compilation:
- Zero Tolerance:
warnings (unused imports, dead fields) are unacceptable in Release Candidates.cargo check - Prefixing: Unused fields in structs (required for FFI compatibility but not logic) MUST be prefixed with
(e.g.,_
,_ctx
)._start_time - Comment Out: If a function or import is truly unused, comment it out or remove it. Do not suppress warnings with
unless it is a temporary bridge.#[allow(...)]
- Zero Tolerance: