This skill should be used before committing code to ensure it meets Breenix quality standards. Use for running clippy checks, fixing compiler warnings, verifying no log side-effects, checking for dead code, and enforcing project coding standards from CLAUDE.md.
Pre-commit code quality verification for Breenix kernel development.
Breenix enforces strict code quality standards. This skill provides the checks and fixes required before committing code.
Once) to avoid unsafe warnings#[allow(dead_code)] for legitimate API functionsBefore every commit:
# 1. Build kernel and check for warnings
cd kernel
cargo build --target x86_64-unknown-none 2>&1 | grep warning
# 2. Run clippy
cargo clippy --target x86_64-unknown-none
# 3. Run tests (if modifying core subsystems)
cd ..
cargo test
# 4. Check for log side-effects (manual)
grep -R "log::trace!.*(" kernel/src/ | grep -vE '\".*\"' | grep -vE '\.(as_|to_|into_|len|is_|get)'
cd kernel
RUSTFLAGS="-Aclippy::redundant_closure_for_method_calls" \
cargo clippy --target x86_64-unknown-none \
-- -Dclippy::debug_assert_with_mut_call \
-Dclippy::print_stdout \
-Wclippy::suspicious_operation_groupings
debug_assert_with_mut_call: Prevent side-effects in debug assertionsprint_stdout: No print!/println! in kernel (use log! macros)suspicious_operation_groupings: Catch likely logic errorsUnused imports:
// BAD
use x86_64::{VirtAddr, PageTable, PageTableFlags}; // PageTable unused
// GOOD
use x86_64::{VirtAddr, PageTableFlags};
Unused variables:
// BAD
let result = some_function(); // result unused
// GOOD
let _result = some_function(); // Explicitly unused
// OR
some_function(); // Don't capture if not needed
Dead code:
// BAD - function never called
fn helper_function() { ... }
// GOOD - remove it
// OR add #[allow(dead_code)] if it's part of a public API
// GOOD - legitimate API function
#[allow(dead_code)] // Part of public allocator API
pub fn dealloc_stack(&mut self, stack_id: usize) { ... }
Redundant closure:
// BAD
items.map(|x| x.to_string())
// GOOD (but we allow this via RUSTFLAGS)
items.map(ToString::to_string)
Debug assert with mutation:
// BAD - side effect in assertion
debug_assert!(list.pop().is_some());
// GOOD - separate the effect
let item = list.pop();
debug_assert!(item.is_some());
Problem: Function calls in log statements execute even when logging disabled.
// BAD - get_state() called even if TRACE disabled
log::trace!("State: {:?}", get_state());
// GOOD - only format if needed
let state = get_state();
log::trace!("State: {:?}", state);
// BETTER - for expensive operations
if log::log_enabled!(log::Level::Trace) {
let state = expensive_get_state();
log::trace!("State: {:?}", state);
}
The .github/workflows/code-quality.yml runs these checks automatically:
# Full quality check
cd kernel
cargo build --target x86_64-unknown-none 2>&1 | tee /tmp/build-warnings.txt
cargo clippy --target x86_64-unknown-none 2>&1 | tee /tmp/clippy-warnings.txt
# Review warnings
grep warning /tmp/build-warnings.txt
less /tmp/clippy-warnings.txt
# Fix all warnings before committing!
| Warning | Fix | |---------|-----| | unused import | Remove from use statement | | unused variable | Prefix with _ or remove | | dead code | Remove or add #[allow(dead_code)] for API | | redundant closure | Allow via RUSTFLAGS or fix | | print_stdout | Replace print! with log::info! | | debug_assert mutation | Extract to separate statement |
# Before committing
git status # See what you're about to commit
cd kernel
cargo clippy --target x86_64-unknown-none # Fix all warnings
# Then commit
git add kernel/src/...
git commit -m "Fix: ..."
Code quality standards enforce:
Run checks before every commit to maintain high code quality.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer