check-code-quality

1
0
Source

Run comprehensive Rust code quality checks including compilation, linting, documentation, and tests. Use after completing code changes and before creating commits.

Install

mkdir -p .claude/skills/check-code-quality && curl -L -o skill.zip "https://mcp.directory/api/skills/download/7327" && unzip -o skill.zip -d .claude/skills/check-code-quality && rm skill.zip

Installs to .claude/skills/check-code-quality

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.

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.fish to 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:

CommandWhat it runs
./check.fish --checkcargo check (fast typecheck)
./check.fish --buildcargo build (compile production)
./check.fish --clippycargo clippy --all-targets (linting)
./check.fish --testcargo test + doctests
./check.fish --doccargo doc --no-deps (quick docs)
./check.fish --quick-doccargo doc --no-deps (fastest, no staging/sync)
./check.fish --fullAll 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 and converts inline links to reference-style.

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_search to find any existing links (e.g., path#old-slug) that point to the old anchors and update them.
  • Validation: While cargo doc warns 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 (see write-documentation skill)
  • Unresolved link to a test module → Add #[cfg(any(test, doc))] visibility (see organize-modules skill)
  • 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. Linting

./check.fish --clippy
# or invoke the `run-clippy` skill

Runs clippy and enforces code style standards.

7. Run All Tests

./check.fish --test
# (runs: cargo test --all-targets && cargo test --doc)

Runs all tests (unit, integration, doctests).

If tests fail, use the Task tool with subagent_type='test-runner' to fix failures.

8. 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

9. 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 DirectToAnsi input handling or other Unix-specific code

ICE Recovery and Toolchain Escalation

The ./check.fish --full command includes automatic recovery from Internal Compiler Errors:

ICE detected → cleanup target/ → retry
                                   ↓
                            still ICE?
                                   ↓
              escalate to rust-toolchain-update.fish
              (searches 46 nightly candidates, validates each)
                                   ↓
                         new stable nightly installed
                                   ↓
                               retry checks

This is especially important since we use nightly Rust (for the parallel compiler frontend). Nightly toolchains occasionally have ICE bugs, and this automatic escalation finds a working version.

Reporting Results

After running all checks, report results concisely to the user:

  • ✅ All checks passed → "All quality checks passed! Ready to commit."
  • ⚠️ Some checks failed → Summarize which steps failed and what needs fixing
  • 🔧 Auto-fixed issues → Report what was automatically fixed

Optional Performance Analysis

For performance-critical code changes, consider also running:

  • cargo bench - Benchmarks (mark tests with #[bench])
  • cargo flamegraph - Profiling (requires flamegraph crate)
  • Invoke the analyze-performance skill for flamegraph-based regression detection

Supporting Files in This Skill

This skill includes additional reference material:

  • reference.md - Comprehensive guide to all cargo commands used in the quality checklist. Includes detailed explanations of what each command does, when to use it, common flags, and build optimizations (wild linker, parallel frontend, tmpfs). Read this when:
    • You need to understand what a specific cargo command does
    • Troubleshooting build issues
    • Want to know about build optimizations in .cargo/config.toml
    • Understanding the difference between cargo test --all-targets and cargo test --doc

Related Skills

  • write-documentation - For rustdoc formatting (step 3) and fixing doc link warnings (step 4)
  • run-clippy - For linting and code style (step 5)
  • analyze-performance - For optional performance checks
  • test-runner agent - For fixing test failures (step 6)

Related Commands

  • /check - Explicitly invokes this skill

analyze-performance

r3bl-org

Establish performance baselines and detect regressions using flamegraph analysis. Use when optimizing performance-critical code, investigating performance issues, or before creating commits with performance-sensitive changes.

122

run-clippy

r3bl-org

Run clippy linting, enforce comment punctuation rules, format code with cargo fmt, and verify module organization patterns. Use after code changes and before creating commits.

10

design-philosophy

r3bl-org

Core design principles for the codebase - cognitive load, progressive disclosure, type safety, abstraction worth. Use when designing APIs, modules, or data structures.

40

check-bounds-safety

r3bl-org

Apply type-safe bounds checking patterns using Index/Length types instead of usize. Use when working with arrays, buffers, cursors, viewports, or any code that handles indices and lengths.

00

write-documentation

r3bl-org

Write and format Rust documentation correctly. Apply proactively when writing code with rustdoc comments (//! or ///). Covers voice & tone, prose style (opening lines, explicit subjects, verb tense), structure (inverted pyramid), intra-doc links (crate:: paths, reference-style), constant conventions (binary/byte literal/decimal), and formatting (cargo rustdoc-fmt). Also use retroactively via /fix-intradoc-links, /fix-comments, or /fix-md-tables commands.

10

analyze-log-files

r3bl-org

Analyze log files by stripping ANSI escape sequences first. Use when asked to process, handle, read, or analyze log files that may contain terminal escape codes.

10

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

9521,094

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

846846

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

571699

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

548492

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

673466

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

514280

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.