Index of every page on this site: llms.txt
All skills
domesticmouse avatar

/egui-app-architecture

@606a5d5
Run it yourself

Use this skill when exploring, understanding, scaffolding, structuring, or auditing a multi-crate Rust and egui application (strict L0–L7 dependency layering, xtask layer enforcement, panic-free/unsafe-free lint gates, and Cargo profile tuning for native + WebAssembly targets).

  • 2 files
  • 7.3 KB
  • Updated 3 weeks ago
  • GitHub
Use this Skill: https://skilld.dev/gh/domesticmouse/skills/egui-app-architecture

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈76 tokens for metadata: the name and description. ≈1k when used: this file. ≈762 more on demand in 1 file.

Description uses 3.8% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈302 characters, or 3.8%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Engine-First egui Application Architecture (L0–L7)

This skill guides you through setting up and maintaining a pure-Rust, engine-first desktop (eframe/egui), CLI, and WebAssembly application with strict architectural boundaries.

Architectural Principles

  1. Strict Acyclic Layering (L0–L7): Every workspace crate is assigned a layer in xtask/src/layers.rs. A crate at layer $N$ may only depend on crates in layers $< N$ (plus explicit intra-layer chains).
  2. Standalone Format & OS Helper Crates: Reusable parsers/encoders (codecs, formats) and isolated OS helpers are classified as Standalone at L0 and must have zero workspace dependencies so they remain independently publishable and testable.
  3. UI Containment (L6+ only): No crate below L6 may depend on UI or windowing crates (egui, eframe, winit, rfd). L0–L5 must compile headlessly and for wasm32-unknown-unknown.
  4. Never Crash (No Panic, No Unsafe): Workspace-wide unsafe_code = "forbid" and #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] on every library and binary crate. If an isolated OS integration crate requires FFI, isolate it in its own L0 crate with unsafe_code = "deny" and explicit SAFETY: comments and platform tests.

Step-by-Step Workflow

1. Organize the Cargo Workspace into Layers

Structure the repository into crates/*, apps/*, and xtask (adapt layers as needed for your domain):

  • L0 Foundation: Core primitives, geometry, math, and copy-on-write data containers.
  • L0 Standalone: Format parsers/writers and OS helpers with no workspace dependencies.
  • L1 Document / Domain Model: doc — pure serializable data structures (document tree, entities, metadata). No rendering or UI logic.
  • L2 Operations & Algorithms: ops (undo/redo history), algo (domain transformations, queries, and processing).
  • L3 Rendering & Native Persistence: CPU/GPU rendering backends (wgpu) and format (content-addressed or structured native bundle).
  • L4 I/O & Plugins: io (maps standalone formats $\leftrightarrow$ doc::Document), optional sandboxed plugins.
  • L5 Engine Façade: engine (Session, CommandSpec registry, background Jobs, Preferences).
  • L6 Shells & Automation: ui-egui (thin egui frontend + optional JSON control protocol), automation (MCP server + headless JSON-RPC).
  • L7 Binaries (Exempt): apps/<app> (desktop eframe binary), apps/<app>-cli (headless CLI + MCP/RPC host), apps/<app>-web (browser Wasm), xtask.

2. Configure Workspace Lints and Cargo Profiles

Apply the workspace lint gates and build profiles in the root Cargo.toml. See layering-and-profiles.md for the exact Cargo.toml configuration:

  • Optimize dependencies in dev builds ([profile.dev.package."*"] opt-level = 2) so rendering and compute loops run at interactive speeds during development.
  • Use debug = "line-tables-only" in [profile.dev] to halve link times and symbol sizes.
  • Set [profile.test.package.<ui-crate>] opt-level = 0 to speed up UI test compilation.
  • Configure [profile.wasm-release] with lto = "fat" and per-crate opt-level overrides ("z" for data/parsers/UI, 3 for hot compute crates).

3. Enforce Layering with cargo xtask layers

Whenever adding a crate or dependency:

  1. Register the crate in xtask/src/layers.rs (TABLE).
  2. Add the crate header lints (#![forbid(unsafe_code)] and #![deny(clippy::unwrap_used, ...)]) to its src/lib.rs.
  3. Write or update Cargo.toml atomically if working alongside parallel agents.

4. Validation Steps

Run these commands to verify architectural compliance (see egui-testing-infrastructure for the full 7-tier verification, corpus, performance, and scorecard workflow):

cargo xtask layers
cargo xtask wasm
cargo clippy --workspace --all-targets -- -D warnings

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 606a5d5. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 weeks ago

README badge

README badge for domesticmouse/skills/egui-app-architecture