check-code-quality
Executes Rust tooling including cargo build, clippy, and test to ensure code compilation, documentation, and linting.
Install
mkdir -p .claude/skills/check-code-quality && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/7327" && unzip -o skill.zip -d .claude/skills/check-code-quality && rm skill.zipInstalls to .claude/skills/check-code-quality
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Run comprehensive Rust code quality checks including compilation, linting, documentation, and tests. Use after completing code changes and before creating commits.Key capabilities
- →Run full suite of Rust quality checks
- →Execute typechecks, builds, and linting
- →Validate documentation and intra-doc links
- →Perform external URL link rot checks
- →Verify concurrency and bounds safety
How it works
The skill executes a series of automated scripts that run cargo commands, perform link validation, and enforce code style standards. It includes automatic recovery mechanisms for compiler errors.
Inputs & outputs
When to use check-code-quality
- →Validate code before creating a pull request
- →Check documentation coverage
- →Run unit and integration tests
- →Clean up code style with linting
About this skill
Rust Code Quality Checks
When to Use
- After completing significant code changes
- Before creating commits
- Before creating pull requests
- When user says "check code quality", "run quality checks", "make sure code is good", etc.
Non-Blocking Execution via Subagents
Long-running verification commands (such as ./check.fish --test, ./check.fish --doc, ./check.fish --quick-doc, and ./check.fish --full) can take multiple minutes. To keep the primary conversation responsive and unblocked:
- Fast Synchronous Checks: Lightweight checks like
./check.fish --check(fast typecheck) and./check.fish --fmttake only a few seconds and can run directly in the conversation. - Long-Running Checks via Subagent: Delegate time-consuming checks to a background subagent (e.g.,
invoke_subagentwithTypeName: "self"). - Continuous Collaboration: While the subagent runs tests or builds docs in the background, the primary agent remains completely free to converse, review diffs, answer questions, or plan next steps with the user.
Quick Approach (Recommended)
Run the comprehensive check script which handles everything automatically:
./check.fish --full
This runs all checks in order: typecheck → build → clippy → tests → doctests → docs
Benefits of using check.fish --full:
- ICE recovery: Automatically cleans cache and retries on Internal Compiler Errors
- Toolchain escalation: If ICE persists, escalates to
rust-toolchain-update.fishto find a stable nightly - Config change detection: Auto-cleans stale artifacts when Cargo.toml or toolchain changes
- Performance optimized: Uses tmpfs, ionice, and parallel jobs for speed
Other check.fish Commands
For granular control, use individual commands:
| Command | What it runs |
|---|---|
./check.fish --check | cargo check (fast typecheck) |
./check.fish --build | cargo build (compile production) |
./check.fish --clippy | cargo clippy --all-targets (linting) |
./check.fish --fmt | cargo fmt + cargo rustdoc-fmt on git-changed files |
./check.fish --test | cargo test + doctests |
./check.fish --doc | cargo doc --no-deps (quick docs) |
./check.fish --quick-doc | cargo doc --no-deps (fastest, no staging/sync) |
./check.fish --full | All of the above + lychee link rot check |
Step-by-Step Approach (Alternative)
If you need more control or want to run checks manually:
1. Fast Typecheck
./check.fish --check
# (runs: cargo check)
Quickly verifies the code compiles without generating artifacts.
2. Compile Production Code
./check.fish --build
# (runs: cargo build)
Ensures production code builds successfully.
3. Format Rustdoc Comments
Invoke the write-documentation skill to format rustdoc comments using cargo rustdoc-fmt.
This formats markdown tables, converts inline links to reference-style, and ensures dashes, en dashes, or em dashes (-, –, or —) are not used to connect sentences/clauses (prefer separate sentences or colons/semicolons).
4. Generate Documentation
./check.fish --quick-doc
# (runs: cargo doc --no-deps, directly to serving dir - fastest for iteration)
Verify there are no documentation build warnings or errors. Use --quick-doc for fast feedback
during development. Use --doc for final verification before commits (includes staging/sync).
If there are link warnings, use the /fix-intradoc-links command to resolve them.
Heading Anchor (Slug) Integrity:
If you modified any heading text (e.g., # My Heading), the automatically generated HTML anchor
(e.g., #my-heading) will change.
- Identify Changes: Look for changed headings in git-dirty files.
- Proactive Search: Use
grep_searchto find any existing links (e.g.,path#old-slug) that point to the old anchors and update them. - Validation: While
cargo docwarns about many broken fragments, proactive searching prevents "orphan" links in external documentation or complex intra-doc paths.
CRITICAL: Never remove intra-doc links to fix warnings. When you encounter:
- Unresolved link to a symbol → Fix the path using
crate::prefix (seewrite-documentationskill) - Unresolved link to a test module → Add
#[cfg(any(test, doc))]visibility (seeorganize-modulesskill) - Unresolved link to a platform-specific module → Use
#[cfg(all(any(test, doc), target_os = "..."))]
Links provide refactoring safety - cargo doc catches stale references. Converting to plain backticks removes this protection.
5. Link Rot Check (External URLs)
Included automatically in ./check.fish --full. Runs lychee on git-modified files to detect
broken external URLs in rustdoc comments.
cargo doc --no-deps (step 4) validates intra-doc links but not external HTTP/HTTPS URLs.
lychee fills that gap. Config in lychee.toml (repo root) excludes known false positives
(example file:// URIs, test fixture URLs, sites that block automated requests).
If lychee reports 404s, fix the URL by finding the new location. See the task file
task/add-lychee-to-detect-link-rot.md for the full categorization of findings.
6. Clean Inline Crate Prefixes
Invoke the remove-crate-prefix skill to ensure the codebase follows the strict "Clean Imports over Inline Absolute Paths" rule before finalizing quality checks.
7. Git Diff Audit (Surgical Precision)
git diff
Inspect git diff on all modified files to audit line-by-line that only intended modifications were made and zero collateral formatting, lost comments, or doc section drift occurred.
8. Linting
./check.fish --clippy
# or invoke the `run-clippy` skill
Runs clippy and enforces code style standards. You MUST fix all warnings. Do not just report them. If ./check.fish --clippy reports warnings, use cargo clippy --all-targets --fix --allow-dirty to auto-fix where possible, and manually fix any remaining warnings. Never ignore warnings during a quality check.
9. Concurrency Safety Check
Invoke the concurrency-safety skill to verify thread-safety patterns.
Checklist:
- Loud Lock Releases: Are
drop(guard)calls explicit and as early as possible? - Chain of Custody: Are
MutexGuards passed and returned by value to prevent stale usage? - Ergonomic Atomics: Is
AtomicU8Extused instead of rawload/store? - No Deadlocks: Are locks released before calling macros or long-running async blocks?
10. Bounds Safety Check
Invoke the check-bounds-safety skill to verify index and length handling.
Checklist:
- Type Safety: Are
IndexandLengthtypes used instead of rawusize? - Correct Trait: Is
ArrayBoundsCheckused for buffer access andCursorBoundsCheckfor positioning? - CSI Zero Prevention: Are
TermRowDeltaandTermColDeltaused for relative cursor movement? - Off-by-One: verify
index < lengthfor access andindex <= lengthfor cursor.
11. Audit Test Coverage (Zero Bloat) on Modified Files
For every source file that is modified in the current working tree, invoke the check-test-coverage skill:
- Branch-Targeted Verification: Ensure all custom logic branches, match arms, error paths, and state transitions are covered by tests.
- Eliminate Test Bloat: Confirm zero test bloat (no redundant tests asserting standard library behaviors, compiler derives like
#[derive(Default)], or third-party macros likestrumandclap). - One Test per Branch: Confirm that each test serves a distinct purpose covering our code.
12. Run All Tests
./check.fish --test
# (runs: cargo test --all-targets && cargo test --doc)
Runs all tests (unit, integration, doctests).
- Test Scope Principle: Ensure tests strictly target our codebase's branches, state transitions, and logic paths (see
organize-testsskill). Do NOT write redundant tests that merely re-verify standard library or third-party crate behaviors. - If tests fail, use the Task tool with
subagent_type='test-runner'to fix failures.
13. Stress Test (Optional - After Major Refactors)
After major refactors or changes that affect process spawning, PTY tests, or async infrastructure, run the full test suite 20 times back-to-back to detect flaky regressions:
for i in {1..20}; do echo "=== Run $i/20 ===" && cargo test --all-targets -- --nocapture 2>&1 | grep -E "^test result:" | head -3 || { echo "FAILED on run $i"; exit 1; }; done && echo "ALL 20 RUNS PASSED"
When to run:
- After refactoring PTY test infrastructure (
generate_pty_test!,spawn_controlled_in_pty) - After changes to process lifecycle, signal handling, or async I/O code
- After modifying the resilient reactor thread (RRT) restart logic
- Before merging large cross-cutting changes that touch many test files
14. Cross-Platform Verification (Optional)
For code with platform-specific #[cfg] gates (especially Unix-only code), verify Windows compatibility:
cargo rustc -p <crate_name> --target x86_64-pc-windows-gnu -- --emit=metadata
This checks that #[cfg(unix)] and #[cfg(not(unix))] gates compile correctly on Windows without needing a full cross-compiler toolchain.
When to run:
- After adding or modifying
#[cfg(unix)]or#[cfg(target_os = "...")]attributes - When working on platform-abstraction code
- Before committing changes to
DirectToAnsiinput handling or other Unix-specific code
15. Final Step: Manual Review
A task, phase, or sub-phase is not complete until a manual review has been performed by the user. This is the final verification before marking a task as done.
- Type-Safe Errors: Did you use custom error types (enums/structs with
thiserrorandmiette) instead of rawStringforResulterrors? - No
.and_then(): Did you avoid using.and_then()for Option/Result combinators, preferring idiomatic?ope
Content truncated.
When not to use it
- →Running checks on non-Rust projects
- →Performing manual code reviews without automated validation
Prerequisites
Limitations
- →Requires fish shell for script execution
- →External URL checks depend on lychee configuration
How it compares
This approach automates the entire verification pipeline including link rot detection and ICE recovery, rather than running individual cargo commands manually.
Compared to similar skills
check-code-quality side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| check-code-quality (this skill) | 1 | 2mo | Review | Advanced |
| pre_commit | 0 | 7mo | Review | Beginner |
| feature-flags | 6 | 8mo | Review | Intermediate |
| rust-tests-guidelines | 7 | 7mo | No flags | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by r3bl-org
View all by r3bl-org →You might also like
pre_commit
pums974
Standardized pre-commit workflow for linting, formatting, and local quality gates.
feature-flags
Use when feature flag tests fail, flags need updating, understanding @gate pragmas, debugging channel-specific test failures, or adding new flags to React.
rust-tests-guidelines
RediSearch
Guidelines for writing Rust tests.
check-rust-coverage
RediSearch
Check which Rust lines are not covered by Rust tests.
superpowers-review
anthonylee991
Reviews changes for correctness, edge cases, style, security, and maintainability with severity levels (Blocker/Major/Minor/Nit). Use before finalizing changes.
contrib-pr-review
homeassistant-ai
Review a contribution PR for safety, quality, and readiness. Checks for security concerns, test coverage, size appropriateness, and intent alignment. Use when reviewing external contributions.