mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-11-30 00:07:37 +00:00
## Summary
Adds the `rust-style-guide` Agent Skill under
`.fabro/skills/rust-style-guide/` so Fabro workflow agent stages can
apply the project's Rust conventions when writing or reviewing Rust
code.
Skills are discovered by convention from
`{git_root}/.fabro/skills/*/SKILL.md` at agent-session startup — there's
no manifest wiring or per-workflow declaration. Once present, every
agent stage lists the skill in its system prompt and registers the
`use_skill` tool, so an agent can load it (or a node prompt can
reference `/rust-style-guide`). Committing it here (rather than relying
on a local `~/.fabro/skills` copy) is what makes it available to
**remote, clone-based runs** (Docker/Daytona), which only see committed
+ pushed files.
## Contents (44 files)
- `SKILL.md` — entry point (with a short note pointing the agent at the
in-repo location of the supporting files, since Fabro hands the agent
the `SKILL.md` body and it reads the rest itself)
- `guidelines.md` + `guidelines/` — 38 Rust style policy pages
- `workflows/` — 4 procedure pages (new project, library release,
performance investigation, code review/refactor)
## Source / attribution
Vendored from https://github.com/brynary/rust-style-guide (commit
`8fd2a4f`), trimmed to the runtime skill payload; the upstream repo's
mdBook site and authoring scaffolding are omitted. Note: the upstream
repo has **no LICENSE file** — flagging for a call on
attribution/licensing before merge.
## Notes
- No behavior/code change — this is skill content only; nothing is
compiled or bundled.
- No `{{user_input}}` placeholder was added; agents reference the skill
in prose or via `use_skill`. (If we later want deterministic
`/rust-style-guide <task>` slash expansion in node prompts, add the
placeholder to `SKILL.md` then.)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7.8 KiB
7.8 KiB
Guidelines
Load this file for Rust style policy, then load only the guideline pages needed for the task.
Guideline pages are policy. Do not load every guideline page by default.
Foundations
- House style and Rust philosophy - load for overall code shape, OO-leaning defaults, and Rust idiom tradeoffs.
- Library vs application conventions - load before choosing policies that differ for libraries, apps, CLIs, tests, or services.
- Rust edition and MSRV - load when setting edition,
rust-version, stable/nightly posture, or checking MSRV impact.
Tooling and Project Shape
- rustfmt and formatting - load when configuring rustfmt or handling formatting exceptions.
- rustc and Clippy lints - load when configuring lints, fixing Clippy, or justifying lint exceptions.
- Cargo, workspaces, features, and dependencies - load for workspace layout, features, dependency choices, and MSRV-aware dependency changes.
- Modules, visibility, and re-exports - load when changing
mod,pub, facades, re-exports, or public paths. - Naming, imports, and prelude policy - load for item names, acronym casing, imports, getters, and preludes.
- Documentation and rustdoc examples - load when writing rustdoc, public docs, examples, or
Errors/Panics/Safetysections.
Type and API Design
- Struct design and encapsulation - load when designing structs, fields, invariants, receivers, or encapsulation boundaries.
- Constructors and builders - load when choosing
new,try_new,Default, builders, or typestate builders. - Newtype pattern and semantic wrappers - load when adding IDs, units, validated strings, value objects, or orphan-rule wrappers.
- Enums vs traits vs generics vs trait objects - load when choosing closed sets, extension points, static dispatch, or dynamic dispatch.
- Trait design - load when designing traits, bounds, associated types, blanket impls, sealed traits, or object-safe APIs.
- Deriving and common trait implementations - load when adding derives or manual impls for standard traits.
- Conversions, getters, and method naming - load for
From,TryFrom,AsRef,Deref, accessors, andas_/to_/into_names. - Typestate and state machines - load for ordered workflow states, data-bearing enums,
PhantomData, or compile-time transitions. - Public API evolution - load for externally consumed APIs, semver,
#[non_exhaustive],#[must_use], public fields, or sealed traits.
Ownership and Data Flow
- Ownership, borrowing, and clone policy - load when choosing borrowed inputs, owned outputs,
String/&str,Pathparameters,IntoIterator,AsRef,Cow, accessors, snapshots, or clone tradeoffs. - Lifetimes - load when explicit lifetimes, borrowed structs, or lifetime-heavy APIs appear.
- Smart pointers and interior mutability - load when choosing
Box,Rc,Cell,RefCell,Weak, or one-time initialization. - Collections and data structures - load when choosing
Vec, maps, sets, deterministic ordering, capacity, or specialized collection crates.
Errors, Safety, and Diagnostics
- Error taxonomy and layer boundaries - load when defining domain, infrastructure, boundary, or branch-oriented error layers.
- Library errors vs application errors - load before choosing
thiserror,anyhow,miette, or public error stability. - Error propagation, context, and messages - load when adding
?, context, source chains, or error message text. - Panics, unwrap, expect, and assertions - load when using panic,
unwrap,expect, assertions,unreachable!,todo!, or public panic docs. - Validation and invariants - load when parsing inputs, enforcing constructors, encoding invariants, or re-checking stale state.
- Logging and observability - load when adding
tracing, spans, fields, levels, error logs, or redaction.
Async and Concurrency
- Async runtime and when to use async - load when deciding sync vs async posture, Tokio use, or runtime boundaries.
- Async API design and task lifecycle - load when adding async APIs, async traits, spawning, task owners,
Send, or shutdown handles. - Cancellation, shutdown, and blocking work - load for cancellation tokens,
select!, timeouts,spawn_blocking, CPU work, or graceful shutdown. - Concurrency primitives - load when adding channels, locks, atomics,
Arcshared state, worker pools, or blocking APIs on async paths.
Everyday Implementation
- Control flow - load when choosing
match,if let,let else, guards, early returns, combinators, mutable locals, or in-place updates. - Option and Result idioms - load when transforming
Option/Result, usingok_or_else,transpose,map, or explicit branching. - Iterators, closures, and loops - load when choosing iterator chains, loops, closure capture,
collect,fold, ortry_fold.
Testing and Release
- Testing and doctests - load when writing unit tests, integration tests, doctests, fixtures, or test helpers.
- Property tests, snapshots, benchmarks, and CI - load when configuring test commands, snapshots, property tests, benchmarks, or CI gates.
- Unsafe code and macros - load when touching
unsafe, FFI, raw pointers,macro_rules!, proc macros, or generated APIs.
Routing Notes
- For new Rust project setup, load workflows/new-rust-project.md before individual setup guidelines.
- For reusable library release verification, load workflows/reusable-library-release.md before individual release guidelines.
- For performance investigation, load workflows/performance-investigation.md before individual performance-related guidelines.
- For code review or refactor work, load workflows/code-review-refactor.md before individual review guidelines.
- For public API work, always include public API evolution.
- For async service work, include logging and observability.
- For error-handling work, distinguish library errors from application errors before choosing crates.
- For advanced topics like typestate, unsafe, macros, or specialized collections, load the page only when the task directly needs it.