Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .claude/skills/fix-rust-fmt/SKILL.md
Comment thread
ajsutton marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# fix-rust-fmt

Fix Rust formatting issues in the optimism monorepo. When the `rust-fmt` CI job
fails, don't bother reading the errors — just run the formatter and commit
whatever it changes.
Comment thread
ajsutton marked this conversation as resolved.
Outdated

## When to Use

Use this skill when the `rust-fmt` CI job fails on a PR that touches Rust code.

### Trigger Phrases

- "Fix rust formatting"
- "rust-fmt is failing"
- "Fix the rust-fmt CI job"

## Prerequisites

- `mise` must be trusted and installed for this repo (`mise trust && mise install`)

## Workflow

### Step 1: Ensure mise tools are installed

From the repo root (or worktree root):

```bash
cd <REPO_ROOT> && mise install
```

This installs `rust`, `just`, and all other tools pinned in `mise.toml`.

### Step 2: Install the nightly toolchain with rustfmt

The justfile pins a specific nightly (see `NIGHTLY` variable in `rust/justfile`).
Install it:

```bash
cd <REPO_ROOT>/rust && mise exec -- just install-nightly
```

### Step 3: Run the formatter

```bash
cd <REPO_ROOT>/rust && mise exec -- just fmt-fix
```

Any files that change are the reason the CI job failed. Stage and commit them.

## Notes

- `mise exec --` activates the mise environment so `cargo`, `just`, and
`rustup` resolve to the versions pinned in `mise.toml`.
- The nightly toolchain is required because the workspace uses unstable
`rustfmt` options (see `rust/rustfmt.toml`).
- There is no need to inspect `rust-fmt` CI errors — if the job failed, running
`just fmt-fix` and committing the result is the complete fix.