clean-general
Skill193 starsChanged 7 months agoMITView on GitHub
Use when writing, fixing, editing, or reviewing Python code quality. Enforces Clean Code's core principles—DRY, single responsibility, clear intent, no magic numbers, proper abstractions.
2 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- phanijapps/memexword for word, first seen Oct 17, 2026
- ramybarsoum/claude-skillsedited, first seen Oct 13, 2026
Other versions2 projects use a version of this.
Word for word · 1
- phanijapps/memex★ 0100% same
Edited · 1
- ramybarsoum/claude-skills★ 099% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- boy-scoutSkill
- clean-commentsSkill
- clean-functionsSkill
- clean-namesSkill
- clean-testsSkill
- python-clean-codeSkill
- boy-scoutSkill
- clean-commentsSkill
- clean-functionsSkill
- clean-generalSkill
- clean-namesSkill
- clean-testsSkill
- typescript-clean-codeSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Every piece of knowledge has one authoritative representation.
- Distinctive: line 30
Don't be clever. Be clear.
- Distinctive: line 78
If you can extract another function, your function does more than one thing.
- Distinctive: line 92
When reviewing AI-generated code, verify:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
General Clean Code Principles
Critical Rules
G5: DRY (Don't Repeat Yourself)
Every piece of knowledge has one authoritative representation.
# Bad - duplication
tax_rate = 0.0825
ca_total = subtotal * 1.0825
ny_total = subtotal * 1.07
# Good - single source of truth
TAX_RATES = {"CA": 0.0825, "NY": 0.07}
def calculate_total(subtotal: float, state: str) -> float:
return subtotal * (1 + TAX_RATES[state])G16: No Obscured Intent
Don't be clever. Be clear.
# Bad - what does this do?
return (x & 0x0F) << 4 | (y & 0x0F)
# Good - obvious intent
return pack_coordinates(x, y)G23: Prefer Polymorphism to If/Else
# Bad - will grow forever
def calculate_pay(employee):
if employee.type == "SALARIED":
return employee.salary
elif employee.type == "HOURLY":
return employee.hours * employee.rate
elif employee.type == "COMMISSIONED":
return employee.base + employee.commission
# Good - open/closed principle
class SalariedEmployee:
def calculate_pay(self): return self.salary
class HourlyEmployee:
def calculate_pay(self): return self.hours * self.rate
class CommissionedEmployee:
def calculate_pay(self): return self.base + self.commissionG25: Replace Magic Numbers with Named Constants
# Bad
if elapsed_time > 86400:
...
# Good
SECONDS_PER_DAY = 86400
if elapsed_time > SECONDS_PER_DAY:
...G30: Functions Should Do One Thing
If you can extract another function, your function does more than one thing.
G36: Law of Demeter (Avoid Train Wrecks)
# Bad - reaching through multiple objects
output_dir = context.options.scratch_dir.absolute_path
# Good - one dot
output_dir = context.get_scratch_dir()Enforcement Checklist
When reviewing AI-generated code, verify:
- No duplication (G5)
- Clear intent, no magic numbers (G16, G25)
- Polymorphism over conditionals (G23)
- Functions do one thing (G30)
- No Law of Demeter violations (G36)
- Boundary conditions handled (G3)
- Dead code removed (G9)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

