Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

clean-code

/clean-code

Pisze, przegląda i refaktoryzuje kod według zasad Clean Code: nazwy, małe funkcje, komentarze, obsługa błędów i testy.

Licencja
MIT
Ostatnia zmiana repozytorium
12.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
4
Przestarzałość

Brak sygnałów. Repozytorium zmienione 12.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Pisze, przegląda i refaktoryzuje kod według zasad Clean Code: nazwy, małe funkcje, komentarze, obsługa błędów i testy.

Oryginalny opis (EN)

Use when writing, reviewing or refactoring code to make it clean, readable and maintainable following Robert C. Martin's Clean Code principles (naming, small functions, comments, error handling, tests, code smells) — código limpo, refatorar, revisar código, boas práticas.

Jak działa

  1. 🧠 Core Philosophy
  2. When to Use
  3. 1. Meaningful Names
  4. 2. Functions
  5. 3. Comments
  6. 4. Formatting
  7. 5. Objects and Data Structures
  8. 6. Error Handling
  9. 7. Unit Tests
  10. 8. Classes
Sekcje z nagłówków SKILL.md, w oryginale · 108 linii, 817 słów
Podgląd SKILL.md
---
name: clean-code
description: "Use when writing, reviewing or refactoring code to make it clean, readable and maintainable following Robert C. Martin's Clean Code principles (naming, small functions, comments, error handling, tests, code smells) — código limpo, refatorar, revisar código, boas práticas."
license: MIT
metadata:
  author: sickn33 (agentic-awesome-skills)
  source: https://github.com/sickn33/agentic-awesome-skills/tree/main/skills/clean-code
  original-source: https://github.com/jackjin1997/ClawForge/tree/main/skills/clean-code
---

# Clean Code Skill

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."

## 🧠 Core Philosophy
> "Code is clean if it can be read, and enhanced by a developer other than its original author." — Grady Booch

## When to Use
Use this skill when:
- **Writing new code**: To ensure high quality from the start.
- **Reviewing Pull Requests**: To provide constructive, principle-based feedback.
- **Refactoring legacy code**: To identify and remove code smells.
- **Improving team standards**: To align on industry-standard best practices.

These are design heuristics, not universal language rules or authority to change behavior. Follow the actual repository conventions; exceptions versus result types, nullability, argument counts and test cadence depend on the language and task. Preserve necessary rationale, security and license comments. Refactor only within scope and verify the relevant behavior.

## 1. Meaningful Names
- **Use Intention-Revealing Names**: `elapsedTimeInDays` instead of `d`.
- **Avoid Disinformation**: Don't use `accountList` if it's actually a `Map`.
- **Make Meaningful Distinctions**: Avoid `ProductData` vs `ProductInfo`.
- **Use Pronounceable/Searchable Names**: Avoid `genymdhms`.
- **Class Names**: Use nouns (`Customer`, `WikiPage`). Avoid `Manager`, `Data`.
- **Method Names**: Use verbs (`postPayment`, `deletePage`).

## 2. Functions
- **Small!**: Functions should be shorter than you think.
- **Do One Thing**: A function should do only one thing, and do it well.
- **One Level of Abstraction**: Don't mix high-level business logic with low-level details (like regex).
- **Descriptive Names**: `isPasswordValid` is better than `check`.
- **Arguments**: 0 is ideal, 1-2 is okay, 3+ requires a very strong justification.
- **No Side Effects**: Functions shouldn't secretly change global state.

## 3. Comments
- **Don't Comment Bad Code—Rewrite It**: Most comments are a sign of failure to express ourselves in code.
- **Explain Yourself in Code**: 
  ```python
  # Check if employee is eligible for full benefits
  if employee.flags & HOURLY and employee.age > 65:
  ```
  vs
  ```python
  if employee.isEligibleForFullBenefits():
  ```
- **Good Comments**: Legal, Informative (regex intent), Clarification (external libraries), TODOs.
- **Bad Comments**: Mumbling, Redundant, Misleading, Mandated, Noise, Position Markers.

## 4. Formatting
- **The Newspaper Metaphor**: High-level concepts at the top, details at the bottom.
- **Vertical Density**: Related lines should be close to each other.
- **Distance**: Variables should be declared near their usage.
- **Indentation**: Essential for structural readability.

## 5. Objects and Data Structures
- **Data Abstraction**: Hide the implementation behind interfaces.
- **The Law of Demeter**: A module should not know about the innards of the objects it manipulates. Avoid `a.getB().getC().doSomething()`.
- **Data Transfer Objects (DTO)**: Classes with public variables and no functions.

## 6. Error Handling
- **Use Exceptions instead of Return Codes**: Keeps logic clean.
- **Write Try-Catch-Finally First**: Defines the scope of the operation.
- **Don't Return Null**: It forces the caller to check for null every time.
- **Don't Pass Null**: Leads to `NullPointerException`.

## 7. Unit Tests
- **The Three Laws of TDD**:
  1. Don't write production code until you have a failing unit test.
  2. Don't write more of a unit test than is sufficient to fail.
  3. Don't write more production code than is sufficient to pass the failing test.
- **F.I.R.S.T. Principles**: Fast, Independent, Repeatable, Self-Validating, Timely.

## 8. Classes
- **Small!**: Classes should have a single responsibility (SRP).
- **The Stepdown Rule**: We want the code to read like a top-down narrative.

## 9. Smells and Heuristics
- **Rigidity**: Hard to change.
- **Fragility**: Breaks in many places.
- **Immobility**: Hard to reuse.
- **Viscosity**: Hard to do the right thing.
- **Needless Complexity/Repetition**.

## 🛠️ Implementation Checklist
- [ ] Is this function smaller than 20 lines?
- [ ] Does this function do exactly one thing?
- [ ] Are all names searchable and intention-revealing?
- [ ] Have I avoided comments by making the code clearer?
- [ ] Am I passing too many arguments?
- [ ] Is there a failing test for this change?

## Example

**User request:**

> Refactor this working code for clearer names, smaller units, explicit errors, and preserved behavior; verify it with focused tests.

## Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

## Créditos / Credits

- **Autor / Author:** [sickn33/agentic-awesome-skills](https://github.com/sickn33/agentic-awesome-skills/tree/main/skills/clean-code) — licença MIT (ver [`LICENSE`](LICENSE) nesta pasta).
- **Fonte original citada pelo autor / Original source cited by the author:** [jackjin1997/ClawForge](https://github.com/jackjin1997/ClawForge/tree/main/skills/clean-code).
- **Base teórica / Theory:** *Clean Code: A Handbook of Agile Software Craftsmanship*, Robert C. Martin (2008).
- **Alterações neste repositório / Changes in this repository:** `description` reescrita como gatilho bilíngue (a original tinha aspas não fechadas, invalidando o YAML); metadados de autoria adicionados; corpo mantido sem alterações.
Pliki w paczce (2)
  • LICENSE 1 KB
  • SKILL.md 6 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · hanspeterdietiker/open-agent-skills100MIT
FrancoStino/opencode-skills-collection100MIT
rootcastleco/rei-skills100MIT
iWiiCK/iwiick-ai-agent-plugin100MIT
sickn33/agentic-awesome-skills100MIT
sagargupta16/claude-skills100MIT
claude-dev-suite/claude-dev-suite100MIT
jonax1337/clean-code-skill100MIT
jeffersonvalente/cardume100MIT

Migawka bazy z 13.11.2026 · wersja paczki e085875a5cff (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100clean-code-reviewer
    Przegląda kod według zasad Clean Code Roberta Martina i daje konkretne uwagi uporządkowane według zasad, z przykładami przed i po.
  • 100clean-code-ts-react
    Przekłada zasady Clean Code na idiomy TypeScript i React (TS 5.x, React 19), z wytycznymi, kiedy ich nie stosować, oraz konfliktami zasad.
  • 100code-refactoring-refactor-clean
    Refaktoryzuje kod według zasad czystego kodu i wzorców SOLID, poprawiając jakość i utrzymywalność.
  • 100aif-best-practices
    Opisuje wytyczne jakości kodu i dobre praktyki czystego, utrzymywalnego kodu: nazewnictwo, struktura, obsługa błędów, testy i standardy code review.
  • 100write-readable-code
    Pisze i przegląda czytelny kod: nazwy oddające intencję, funkcje na jednym poziomie abstrakcji i komentarze o powodzie.
  • 100clean-architecture
    Opisuje zasady Clean Architecture z książki Roberta C. Martina przy projektowaniu systemów, przeglądzie struktury kodu i refaktoryzacji.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.