fabro/.fabro/skills/rust-style-guide/workflows/code-review-refactor.md
Scott Werner 9af0296469
Add rust-style-guide skill for workflow agents (#558)
## 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>
2026-07-07 21:12:04 -04:00

3.5 KiB

Code Review and Refactor

Use this workflow when reviewing, refactoring, or changing existing Rust code in a project that already has structure and conventions.

Required Guidelines

Load guidelines.md, then load these guideline pages as needed:

Load narrower pages for the code you touch, such as newtypes, traits, async task lifecycle, validation, collections, or documentation.

Workflow

  1. Classify the code first: published library API, shared in-repo library, application/service, CLI, test support, or tests.
  2. Identify the behavioral surface being changed and the callers affected. Treat externally consumed APIs as stricter than internal application code.
  3. Load only the guideline pages relevant to that surface.
  4. Scan high-risk patterns before editing: accidental public API changes, hidden panics, flattened errors, unnecessary clones or lifetimes, locks across .await, blocking work on async paths, unredacted logs, unsafe, and macro-generated behavior.
  5. Make the smallest coherent change. Preserve existing local style unless it conflicts with this guide or the requested behavior.
  6. Add or update tests at the level where the behavior is observable.
  7. Run verification appropriate to the change: formatter, Clippy, tests, MSRV/all-features checks, or a narrower command when the project makes the full suite impractical.
  8. Report what changed, what was verified, and any exceptions or skipped checks with the reason.

Review Checklist

  • Scope: Did the change affect library, application, CLI, or test-only behavior?
  • API: Did pub, re-exports, features, MSRV, or public dependencies change?
  • Errors: Are recoverable failures returned with source chains and boundary context?
  • Panics: Are unwrap, expect, panic!, and assertions limited to invariants?
  • Ownership: Are clones, borrows, and owned snapshots named honestly?
  • Async/concurrency: Are task ownership, cancellation, blocking work, and lock scopes explicit?
  • Observability: Are logs structured, low-noise, and free of secrets?
  • Unsafe/macros: Is any unsafe or macro complexity justified, isolated, and documented?
  • Tests: Does coverage protect behavior rather than private implementation churn?
  • Verification: Were the commands run fresh, and are skipped checks explained?

Avoid

  • Do not load every guideline page by default.
  • Do not refactor unrelated code while reviewing a focused change.
  • Do not apply library-level ceremony to private application internals without a reason.
  • Do not relax lint, test, or safety policy to make a local change easier.
  • Do not report a change as verified without naming the commands that ran.
  • Do not hide exceptions; document why the local case differs from the default rule.