Automated summary
Iteratively reviews a single Rust source file and fixes logic errors, async lock hazards and misleading names, while trimming redundant tests and comments until nothing is left to fix.
Strengths
- Prioritized checklist (logic errors, then lock issues, then simplification) instead of an open-ended review
- Catches concrete Rust footguns: DashMap/RwLock guards held across .await, asymmetric add/remove index cleanup, message loss from offset/commit ordering
- Treats tests as something to consolidate and delete, not just add, which counters the usual test-bloat drift
- An explicit 'what not to do' section keeps the loop from turning into an unrequested rewrite
Limitations
- Loops until 'nothing left to fix' with no hard stop; the stopping criterion is the model's judgement, so it can keep churning
- Scoped to one file at a time; cross-file or architectural problems are only touched through the callers it happens to read
- Assumes a Rust project checkable with `cargo check` and describes no automated verification step for its own fixes
Use it when a Rust file is suspect — a bucket-style data structure, lock-heavy async code — and you want a focused bug hunt plus cleanup rather than a broad PR review.
Avoid it on files you don't want modified in place, or when you need a whole-crate or architecture review instead of a single-file pass.
Security analysis
SafeThe skill instructs an AI agent to read, analyze, and fix Rust source files, including running cargo check and relevant unit tests. It does not contain destructive commands, exfiltration, obfuscated payloads, or instructions to disable safety. The actions are standard development workflow operations on user-provided code.
No concerns found
How this analysis is madeExamples
/review-and-fix src/mqtt-broker/src/subscribe/buckets.rsRun /review-and-fix on src/mqtt-broker/src/subscribe/directly_push.rs — I suspect a DashMap guard is held across an .await in the push path./review-and-fix src/store/src/offset.rs — pay extra attention to the test module, it probably has too many near-duplicate cases.name: review-and-fix description: Deep analysis and iterative fixing of a Rust source file. Finds logic errors, lock/concurrency issues, and simplification opportunities, then fixes them one by one until the file is clean.
review-and-fix
Deep-analyze the specified file, find logic errors, memory/lock issues, and simplification opportunities, and fix them iteratively until no problems remain.
Usage
/review-and-fix <file_path>
Examples
/review-and-fix src/mqtt-broker/src/subscribe/buckets.rs
/review-and-fix src/mqtt-broker/src/subscribe/directly_push.rs
Execution Flow
Each round follows this sequence until nothing left to fix:
1. Read
Fully read the target file. Read related files as needed (callers, struct definitions it depends on) to understand context.
2. Analyze
Check in priority order:
Logic Errors (must fix)
- Asymmetric data structure operations:
addwrites N indexes,removeonly cleans N-1 - offset/commit semantics: committing after push failure causes message loss
- Key collisions: separator choice produces identical keys for different inputs
Concurrency/Lock Issues (must fix)
- DashMap
entry(),get(),get_mut()returnRef/RefMutthat hold shard locks — not released during.await RwLockread lock held during.awaitblocks write lock- Fix:
.clone()the data to drop the guard before awaiting; or storeArc<T>
Simplification (apply judiciously)
- Repeated
get_mut+else { insert }→entry().or_default() - Redundant
else { return x }→ remove the else - Two-step
let x = ...; let x = match x { Some(v) => v, None => return }→let Some(x) = ... else { return } - Nested
if !condition { ... }→if condition { continue } - Duplicate import lines → merge
- Temporary flag variables (
let mut failed = false; ... if !failed { commit() }) → early return
Comments (keep lean)
- Remove redundant or obvious comments; the code should speak for itself
- Keep only comments that explain a non-obvious why (an invariant, a subtle ordering, a footgun)
- Do not over-comment — fewer, higher-signal comments beat many noisy ones
Test Cases (deep review, then trim — do not just add)
- Deep-review every existing test before adding anything: does it assert a real behavior, or just re-exercise the happy path another test already covers? Does the assertion actually fail if the logic under test is broken (mutate the code mentally and check)?
- Default action is consolidation, not addition: merge near-duplicate tests into one parametrized/table-driven case, delete tests that assert trivial defaults or that duplicate coverage another test already provides
- Only add a new test when a real gap exists: a pure decision function or bug-prone branch with zero coverage. One targeted case per gap — do not pad with variations that don't exercise a new path
- Prefer testing the pure/extractable logic directly over standing up heavy mocks for orchestration glue; if a path can only be tested by mocking a large dependency, that's usually a sign to extract the pure logic rather than write the mock
- Keep the total test count as small as possible while still covering every distinct branch/outcome once — "few, focused, high-signal" beats "thorough-looking"
Naming (align names with behavior)
- Function names: does the name describe what the function actually does? Rename misleading or vague names (e.g. a
get_*that mutates, a*_switchthat only computes) - File / module names: does the file name match its content and responsibility? Flag/rename when it has drifted
- When renaming, update every reference (callers, imports,
moddeclarations) and re-runcargo check. Be conservative with widely-used public names — only rename when the current name is genuinely misleading, not for taste
What NOT to do
- Do not refactor correct code just to be "more Rusty"
- Do not introduce new abstractions or traits
- Do not change public API signatures (unless there is a bug, or a name is genuinely misleading — then rename and update all call sites)
- Do not add unnecessary comments
3. Fix
- Only fix issues you are certain about — do not guess
- After each fix, run
cargo check -p <crate>to verify compilation - For core logic changes, run the relevant unit tests
4. Loop
After each round of fixes, re-analyze the file to confirm nothing was missed. Stop only when you can clearly state: "no logic errors, no lock issues, no worthwhile simplification remaining, names match behavior, test coverage adequate and focused, comments lean."
Output Format
- Start each round by stating what problems were found
- After fixing, explain what changed and why
- On the final round, explicitly state "no issues, stopping"
- Do not output meaningless progress descriptions
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/review-and-fix-ms2s7bcm/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/review-and-fix-ms2s7bcm' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/review-and-fix-ms2s7bcm/download' --output '.skill-downloads/review-and-fix-ms2s7bcm/SKILL.md.part' && mv '.skill-downloads/review-and-fix-ms2s7bcm/SKILL.md.part' '.skill-downloads/review-and-fix-ms2s7bcm/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/review-and-fix-ms2s7bcm/SKILL.md' && test -s '.skill-downloads/review-and-fix-ms2s7bcm/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/review-and-fix' && cp -R '.skill-downloads/review-and-fix-ms2s7bcm' '.claude/skills/review-and-fix'Cursor
test -f '.skill-downloads/review-and-fix-ms2s7bcm/SKILL.md' && test -s '.skill-downloads/review-and-fix-ms2s7bcm/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/review-and-fix' && cp -R '.skill-downloads/review-and-fix-ms2s7bcm' '.cursor/skills/review-and-fix'Codex
test -f '.skill-downloads/review-and-fix-ms2s7bcm/SKILL.md' && test -s '.skill-downloads/review-and-fix-ms2s7bcm/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/review-and-fix' && cp -R '.skill-downloads/review-and-fix-ms2s7bcm' '.agents/skills/review-and-fix'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/review-and-fix-ms2s7bcm'openskills read 'review-and-fix-ms2s7bcm'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/review-and-fix-ms2s7bcm/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.