{"id":"b674c640-c65f-40b3-a60c-b6f348318f7b","shortId":"9aH6t6","kind":"skill","title":"clean-code","tagline":"This skill embodies the principles of \"Clean Code\" by Robert C. Martin (Uncle Bob). Use it to transform \"code that works\" into \"code that is clean.\"","description":"# Clean Code Skill\n\nThis skill embodies the principles of \"Clean Code\" by Robert C. Martin (Uncle Bob). Use it to transform \"code that works\" into \"code that is clean.\"\n\n## 🧠 Core Philosophy\n> \"Code is clean if it can be read, and enhanced by a developer other than its original author.\" — Grady Booch\n\n## When to Use\nUse this skill when:\n- **Writing new code**: To ensure high quality from the start.\n- **Reviewing Pull Requests**: To provide constructive, principle-based feedback.\n- **Refactoring legacy code**: To identify and remove code smells.\n- **Improving team standards**: To align on industry-standard best practices.\n\n## 1. Meaningful Names\n- **Use Intention-Revealing Names**: `elapsedTimeInDays` instead of `d`.\n- **Avoid Disinformation**: Don't use `accountList` if it's actually a `Map`.\n- **Make Meaningful Distinctions**: Avoid `ProductData` vs `ProductInfo`.\n- **Use Pronounceable/Searchable Names**: Avoid `genymdhms`.\n- **Class Names**: Use nouns (`Customer`, `WikiPage`). Avoid `Manager`, `Data`.\n- **Method Names**: Use verbs (`postPayment`, `deletePage`).\n\n## 2. Functions\n- **Small!**: Functions should be shorter than you think.\n- **Do One Thing**: A function should do only one thing, and do it well.\n- **One Level of Abstraction**: Don't mix high-level business logic with low-level details (like regex).\n- **Descriptive Names**: `isPasswordValid` is better than `check`.\n- **Arguments**: 0 is ideal, 1-2 is okay, 3+ requires a very strong justification.\n- **No Side Effects**: Functions shouldn't secretly change global state.\n\n## 3. Comments\n- **Don't Comment Bad Code—Rewrite It**: Most comments are a sign of failure to express ourselves in code.\n- **Explain Yourself in Code**: \n  ```python\n  # Check if employee is eligible for full benefits\n  if employee.flags & HOURLY and employee.age > 65:\n  ```\n  vs\n  ```python\n  if employee.isEligibleForFullBenefits():\n  ```\n- **Good Comments**: Legal, Informative (regex intent), Clarification (external libraries), TODOs.\n- **Bad Comments**: Mumbling, Redundant, Misleading, Mandated, Noise, Position Markers.\n\n## 4. Formatting\n- **The Newspaper Metaphor**: High-level concepts at the top, details at the bottom.\n- **Vertical Density**: Related lines should be close to each other.\n- **Distance**: Variables should be declared near their usage.\n- **Indentation**: Essential for structural readability.\n\n## 5. Objects and Data Structures\n- **Data Abstraction**: Hide the implementation behind interfaces.\n- **The Law of Demeter**: A module should not know about the innards of the objects it manipulates. Avoid `a.getB().getC().doSomething()`.\n- **Data Transfer Objects (DTO)**: Classes with public variables and no functions.\n\n## 6. Error Handling\n- **Use Exceptions instead of Return Codes**: Keeps logic clean.\n- **Write Try-Catch-Finally First**: Defines the scope of the operation.\n- **Don't Return Null**: It forces the caller to check for null every time.\n- **Don't Pass Null**: Leads to `NullPointerException`.\n\n## 7. Unit Tests\n- **The Three Laws of TDD**:\n  1. Don't write production code until you have a failing unit test.\n  2. Don't write more of a unit test than is sufficient to fail.\n  3. Don't write more production code than is sufficient to pass the failing test.\n- **F.I.R.S.T. Principles**: Fast, Independent, Repeatable, Self-Validating, Timely.\n\n## 8. Classes\n- **Small!**: Classes should have a single responsibility (SRP).\n- **The Stepdown Rule**: We want the code to read like a top-down narrative.\n\n## 9. Smells and Heuristics\n- **Rigidity**: Hard to change.\n- **Fragility**: Breaks in many places.\n- **Immobility**: Hard to reuse.\n- **Viscosity**: Hard to do the right thing.\n- **Needless Complexity/Repetition**.\n\n## 🛠️ Implementation Checklist\n- [ ] Is this function smaller than 20 lines?\n- [ ] Does this function do exactly one thing?\n- [ ] Are all names searchable and intention-revealing?\n- [ ] Have I avoided comments by making the code clearer?\n- [ ] Am I passing too many arguments?\n- [ ] Is there a failing test for this change?\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["clean","code","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows"],"capabilities":["skill","source-sickn33","skill-clean-code","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/clean-code","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 35034 github stars · SKILL.md body (4,363 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-25T12:50:34.496Z","embedding":null,"createdAt":"2026-04-18T20:26:48.884Z","updatedAt":"2026-04-25T12:50:34.496Z","lastSeenAt":"2026-04-25T12:50:34.496Z","tsv":"'-2':234 '0':230 '1':128,233,452 '2':179,465 '20':561 '3':237,253,479 '4':316 '5':355 '6':399 '65':292 '7':444 '8':503 '9':528 'a.getb':385 'abstract':206,361 'accountlist':145 'actual':149 'align':121 'argument':229,592 'ask':634 'author':78 'avoid':140,155,162,170,384,580 'bad':258,307 'base':106 'behind':365 'benefit':286 'best':126 'better':226 'bob':17,46 'booch':80 'bottom':331 'boundari':642 'break':537 'busi':213 'c':14,43 'caller':430 'catch':414 'chang':250,535,600 'check':228,279,432 'checklist':555 'clarif':303,636 'class':164,392,504,506 'clean':2,10,29,30,39,58,63,410 'clean-cod':1 'clear':609 'clearer':586 'close':338 'code':3,11,22,26,31,40,51,55,61,90,110,115,259,273,277,407,457,485,519,585 'comment':254,257,263,298,308,581 'complexity/repetition':553 'concept':324 'construct':103 'core':59 'criteria':645 'custom':168 'd':139 'data':172,358,360,388 'declar':346 'defin':417 'deletepag':178 'demet':370 'densiti':333 'describ':613 'descript':222 'detail':219,328 'develop':73 'disinform':141 'distanc':342 'distinct':154 'dosometh':387 'dto':391 'effect':245 'elapsedtimeinday':136 'elig':283 'embodi':6,35 'employe':281 'employee.age':291 'employee.flags':288 'employee.iseligibleforfullbenefits':296 'enhanc':70 'ensur':92 'environ':625 'environment-specif':624 'error':400 'essenti':351 'everi':435 'exact':567 'except':403 'expert':630 'explain':274 'express':270 'extern':304 'f.i.r.s.t':494 'fail':462,478,492,596 'failur':268 'fast':496 'feedback':107 'final':415 'first':416 'forc':428 'format':317 'fragil':536 'full':285 'function':180,182,193,246,398,558,565 'genymdhm':163 'getc':386 'global':251 'good':297 'gradi':79 'handl':401 'hard':533,542,546 'heurist':531 'hide':362 'high':93,211,322 'high-level':210,321 'hour':289 'ideal':232 'identifi':112 'immobl':541 'implement':364,554 'improv':117 'indent':350 'independ':497 'industri':124 'industry-standard':123 'inform':300 'innard':378 'input':639 'instead':137,404 'intent':133,302,576 'intention-rev':132,575 'interfac':366 'ispasswordvalid':224 'justif':242 'keep':408 'know':375 'law':368,449 'lead':441 'legaci':109 'legal':299 'level':204,212,218,323 'librari':305 'like':220,522 'limit':601 'line':335,562 'logic':214,409 'low':217 'low-level':216 'make':152,583 'manag':171 'mandat':312 'mani':539,591 'manipul':383 'map':151 'marker':315 'martin':15,44 'match':610 'meaning':129,153 'metaphor':320 'method':173 'mislead':311 'miss':647 'mix':209 'modul':372 'mumbl':309 'name':130,135,161,165,174,223,572 'narrat':527 'near':347 'needless':552 'new':89 'newspap':319 'nois':313 'noun':167 'null':426,434,440 'nullpointerexcept':443 'object':356,381,390 'okay':236 'one':190,197,203,568 'oper':422 'origin':77 'output':619 'pass':439,490,589 'permiss':640 'philosophi':60 'place':540 'posit':314 'postpay':177 'practic':127 'principl':8,37,105,495 'principle-bas':104 'product':456,484 'productdata':156 'productinfo':158 'pronounceable/searchable':160 'provid':102 'public':394 'pull':99 'python':278,294 'qualiti':94 'read':68,521 'readabl':354 'redund':310 'refactor':108 'regex':221,301 'relat':334 'remov':114 'repeat':498 'request':100 'requir':238,638 'respons':511 'return':406,425 'reus':544 'reveal':134,577 'review':98,631 'rewrit':260 'right':550 'rigid':532 'robert':13,42 'rule':515 'safeti':641 'scope':419,612 'searchabl':573 'secret':249 'self':500 'self-valid':499 'shorter':185 'shouldn':247 'side':244 'sign':266 'singl':510 'skill':5,32,34,86,604 'skill-clean-code' 'small':181,505 'smaller':559 'smell':116,529 'source-sickn33' 'specif':626 'srp':512 'standard':119,125 'start':97 'state':252 'stepdown':514 'stop':632 'strong':241 'structur':353,359 'substitut':622 'success':644 'suffici':476,488 'task':608 'tdd':451 'team':118 'test':446,464,473,493,597,628 'thing':191,198,551,569 'think':188 'three':448 'time':436,502 'todo':306 'top':327,525 'top-down':524 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'transfer':389 'transform':21,50 'treat':617 'tri':413 'try-catch-fin':412 'uncl':16,45 'unit':445,463,472 'usag':349 'use':18,47,83,84,131,144,159,166,175,402,602 'valid':501,627 'variabl':343,395 'verb':176 'vertic':332 'viscos':545 'vs':157,293 'want':517 'well':202 'wikipag':169 'work':24,53 'write':88,411,455,468,482","prices":[{"id":"7fe5c549-bab7-4f20-be58-4e0f61fba484","listingId":"b674c640-c65f-40b3-a60c-b6f348318f7b","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T20:26:48.884Z"}],"sources":[{"listingId":"b674c640-c65f-40b3-a60c-b6f348318f7b","source":"github","sourceId":"sickn33/antigravity-awesome-skills/clean-code","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/clean-code","isPrimary":false,"firstSeenAt":"2026-04-18T21:34:26.507Z","lastSeenAt":"2026-04-25T12:50:34.496Z"},{"listingId":"b674c640-c65f-40b3-a60c-b6f348318f7b","source":"skills_sh","sourceId":"sickn33/antigravity-awesome-skills/clean-code","sourceUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/clean-code","isPrimary":true,"firstSeenAt":"2026-04-18T20:26:48.884Z","lastSeenAt":"2026-04-25T12:40:14.548Z"}],"details":{"listingId":"b674c640-c65f-40b3-a60c-b6f348318f7b","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"clean-code","github":{"repo":"sickn33/antigravity-awesome-skills","stars":35034,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-25T06:33:17Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"ac11a9e0df28dabeedadc8c5490a6e5e05ea1e52","skill_md_path":"skills/clean-code/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/clean-code"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"clean-code","description":"This skill embodies the principles of \"Clean Code\" by Robert C. Martin (Uncle Bob). Use it to transform \"code that works\" into \"code that is clean.\""},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/clean-code"},"updatedAt":"2026-04-25T12:50:34.496Z"}}