clean-code
Improves Rust codebase quality through small, safe refactoring steps without altering existing behavior.
Install
mkdir -p .claude/skills/clean-code-gregoire78 && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10296" && unzip -o skill.zip -d .claude/skills/clean-code-gregoire78 && rm skill.zipInstalls to .claude/skills/clean-code-gregoire78
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.
Apply clean code practices in this repository with small, safe refactors, explicit naming, reduced complexity, and behavior-preserving changes. Use for readability improvements, technical debt cleanup, and maintainability reviews in Rust code.Key capabilities
- →Rename symbols
- →Extract helper functions
- →Reduce branching complexity
- →Isolate side effects
How it works
It applies small, safe refactors like renaming or extraction to improve clarity while preserving behavior.
Inputs & outputs
When to use clean-code
- →Reducing cyclomatic complexity in Rust modules
- →Improving variable naming for better code intent
- →Isolating side-effect logic from pure transformations
About this skill
Clean Code Workflow
Use this skill to improve code quality without changing intended behavior.
When to Use
- Readability is low (unclear naming, long functions, dense branching).
- You need safer refactors before adding features.
- You want a structured review focused on maintainability.
Inputs to Collect
- Target files or module boundaries.
- Current pain points (duplication, complexity, unclear ownership).
- Non-negotiable behavior constraints.
- Test and verification expectations.
Core Principles
- Prefer small, reversible changes.
- Keep observable behavior stable unless explicitly requested.
- Improve names before changing architecture.
- Remove duplication only when semantics are confirmed equivalent.
- Keep side effects explicit and localized.
- Avoid broad refactors mixed with feature work.
Decision Flow
- Classify the issue:
- Naming and intent clarity
- Function/class/module size
- Control-flow complexity
- Duplication and coupling
- Error handling consistency
- Pick the lowest-risk action:
- Rename symbols for intent
- Extract small helper function
- Split long function into focused steps
- Isolate side-effecting logic from pure transformations
- Consolidate duplicated branches with shared helper
- Re-check constraints:
- Public API unchanged (unless requested)
- Error semantics unchanged
- Logging/output channels unchanged
- Performance impact acceptable
- Validate incrementally:
- Compile and run tests after each small batch
- Stop and reassess when behavior risk increases
Procedure
- Identify 1 to 3 high-impact readability issues.
- Propose a minimal refactor sequence.
- Apply changes in small commits/patches.
- Keep comments concise and only where intent is not obvious.
- Verify with formatter, lints, and tests.
- Summarize behavior guarantees and remaining debt.
Completion Criteria
- Intent is clearer (names and structure reflect behavior).
- Complexity is reduced in touched code.
- No unintended behavior regressions.
- Verification is documented (build/lint/tests or justified gaps).
Repo-Specific Guardrails (dabctl)
- Keep ETI-only assumptions intact; do not introduce RF/SDR paths.
- Preserve stdout/stderr/fd3 separation rules.
- Keep dablin decoding logic inside
src/dablin/. - Treat reference behavior parity as default correctness criteria.
Example Prompts
- "Use clean-code on src/dablin/runner.rs to reduce branching complexity while preserving behavior."
- "Use clean-code to improve naming and extraction in src/dablin/audio/mod.rs without API changes."
- "Use clean-code to review duplication in metadata emission paths and propose minimal safe refactors."
When not to use it
- →Broad architectural refactors
- →Feature work
Prerequisites
Limitations
- →Public API must remain stable
- →No unintended behavior regressions
How it compares
It focuses on surgical readability improvements rather than broad structural changes.
Compared to similar skills
clean-code side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| clean-code (this skill) | 0 | 2mo | No flags | Intermediate |
| organize-modules | 1 | 2mo | Review | Intermediate |
| m06-error-handling | 1 | 6mo | Review | Intermediate |
| m04-zero-cost | 0 | 6mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
organize-modules
r3bl-org
Apply private modules with public re-exports pattern for clean API design. Includes conditional visibility for docs and tests. Use when creating modules, organizing mod.rs files, or before creating commits.
m06-error-handling
actionbook
CRITICAL: Use for error handling. Triggers: Result, Option, Error, ?, unwrap, expect, panic, anyhow, thiserror, when to panic vs return Result, custom error, error propagation, 错误处理, Result 用法, 什么时候用 panic
m04-zero-cost
actionbook
CRITICAL: Use for generics, traits, zero-cost abstraction. Triggers: E0277, E0308, E0599, generic, trait, impl, dyn, where, monomorphization, static dispatch, dynamic dispatch, impl Trait, trait bound not satisfied, 泛型, 特征, 零成本抽象, 单态化
m05-type-driven
actionbook
CRITICAL: Use for type-driven design. Triggers: type state, PhantomData, newtype, marker trait, builder pattern, make invalid states unrepresentable, compile-time validation, sealed trait, ZST, 类型状态, 新类型模式, 类型驱动设计
minimize-rust-ffi-crate-surface
RediSearch
Remove Rust-defined C symbols that are either unused or only used in C/C++ unit tests.
upgrade-oxc
rolldown
Upgrade oxc, run codegen, and fix any breaking changes.