mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-12-02 00:37:18 +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>
3.2 KiB
3.2 KiB
Documentation and Rustdoc Examples
Rule
Document non-obvious public API behavior; when the project intentionally maintains rustdoc examples, write them as fallible snippets that use ? instead of unwrap.
Why
Rustdoc should explain intent, contracts, and caveats that names and types cannot express. Over-documenting obvious items adds noise, while maintained examples that panic teach careless error handling.
Do
- Add rustdoc when a public item has non-obvious behavior, invariants, caveats, side effects, or examples.
- Use module docs (
//!) for modules that define an important concept or public surface. - Use item docs (
///) for public types, traits, functions, and methods whose contract is not obvious. - Include
# Errorswhen a publicResultfunction has caller-relevant failure modes. - Include
# Panicswhen a public function can panic. - Include
# Safetyfor everyunsafefunction or unsafe trait. - Add rustdoc examples only when they materially clarify public API use and the project has opted into maintaining them.
- When rustdoc examples are used, prefer snippets that compile and use
?. - Hide boilerplate with
#lines when it distracts from the example.
Avoid
- Do not require
#![deny(missing_docs)]as house style. - Do not restate the name in prose.
- Do not document private helpers unless the explanation prevents mistakes.
- Do not use doctests as default test coverage.
- Do not use bare
unwrapin public rustdoc examples. - Do not include long examples that become harder to maintain than the API.
- Do not mark examples
ignorejust to avoid maintaining them; move behavior coverage to normal tests instead.
Public API Notes
For reusable libraries, prioritize docs on public concepts, constructors, fallible operations, trait contracts, and behavior that affects callers. Internal application crates may keep docs sparse unless the module is a shared boundary or the behavior is easy to misuse.
Example
use std::path::Path;
/// Loads application configuration from a TOML file.
///
/// Environment-specific overrides are applied after the file is parsed.
///
/// # Errors
///
/// Returns an error if the file cannot be read, the TOML is invalid, or a
/// required setting is missing.
///
/// # Examples
///
/// ```rust,no_run
/// # use example_config::Config;
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let config = Config::load("app.toml")?;
/// assert_eq!(config.profile(), "default");
/// # Ok(())
/// # }
/// ```
pub fn load(path: impl AsRef<Path>) -> Result<Config, ConfigError> {
todo!()
}
Use expect only for setup invariants that are part of the example:
/// ```
/// # use example_config::Config;
/// let config = Config::from_static(include_str!("../../fixtures/app.toml"))
/// .expect("fixture app.toml should be valid");
/// assert_eq!(config.profile(), "default");
/// ```
Exceptions
- Use
no_runfor examples that should compile but would start servers, make network calls, or read or mutate real state. - Use
ignoreonly when an example cannot be made portable. - Use
expectin examples for fixed fixtures or impossible setup failures when a falliblemainwould obscure the API being shown.