Clean code
collection of reusable engineering skills for AI coding agents
npx -y skills add piyushzala158/agent-skills --skill clean-codeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Improve general code clarity, maintainability, and refactoring quality. Use when Codex reviews messy code, reduces duplication, names functions or variables, splits responsibilities, removes dead code, simplifies conditionals, improves module boundaries, or decides whether a refactor is worthwhile.
SKILL.md
2.8 KB, as published. Nobody here has run it
Clean Code
Purpose
Help the agent make code easier to read, change, test, and reason about without adding unnecessary abstraction.
Use this skill when
- Refactoring code
- Reviewing maintainability
- Naming variables, functions, or modules
- Reducing duplication
- Splitting responsibilities
- Simplifying conditionals or control flow
Goals
- Clear intent
- Small, cohesive units
- Minimal duplication
- Predictable control flow
- Testable behavior
- Local consistency with the codebase
Core Principles
- Prefer clarity over cleverness.
- Name things after domain meaning and behavior.
- Keep functions focused on one level of abstraction.
- Remove duplication when it represents the same concept.
- Avoid abstraction until it pays for itself.
- Keep side effects visible and contained.
- Preserve behavior with tests or focused validation.
Best Practices
- Extract functions around meaningful domain steps.
- Replace nested conditionals with early returns when it improves flow.
- Keep modules responsible for one coherent area.
- Delete unused code.
- Prefer explicit data flow over hidden shared mutation.
- Keep names specific enough to remove nearby explanation.
- Match existing project conventions.
Anti-patterns
- Refactoring unrelated code while fixing a small issue.
- Creating generic abstractions for two barely similar call sites.
- Naming by implementation detail instead of business meaning.
- Hiding side effects inside innocent-looking helpers.
- Keeping dead code because it might be useful later.
Decision Rules
If two blocks duplicate the same business rule, extract or centralize it.
If two blocks only look similar but mean different things, keep them separate.
If a function is hard to name, clarify its responsibility before extracting it.
If a refactor changes behavior risk, add or run tests around that behavior.
Completion Checklist
Before finishing, ensure:
- Names reveal intent.
- Functions have focused responsibilities.
- Control flow is easy to follow.
- Duplication is intentional or removed.
- Side effects are visible.
- Dead code is removed.
- Existing conventions are preserved.
- Behavior is validated.
Additional Resources
Read these supporting files when the task needs more detail: