clean-code skill
✓ DoğrulandıUygulama kodu oluştururken veya değiştirirken tek sorumluluk, isimlendirme netliği ve karmaşıklık yönetimi gibi kodlama standartlarını uygular.
- GitHub yıldızları
- 211
- Dosyalar
- 2
- Son commit
- 24 Eki 2026
- Lisans
- MIT
- İzin verilen araçlar
- —
clean-code skill ne işe yarar?
clean-code bir agent skill'dir. Uygulama kodu oluştururken veya değiştirirken tek sorumluluk, isimlendirme netliği ve karmaşıklık yönetimi gibi kodlama standartlarını uygular.
Özet, skill'in SKILL.md dosyasından oluşturuldu.
clean-code skilli hakkında
Kodlama sürecinde yüksek uygulama kalitesini korumak bu SKILL'in temel işlevidir. Her bir kod biriminin isimlendirme netliği, tek sorumluluk ve karmaşıklık yönetimi konusunda katı standartlara uymasını sağlaması gereken geliştiriciler için tasarlanmıştır. Kullanıcı kod kalitesini artırmak veya belirli kodlama yönergeleri talep ettiğinde; code-forge, refactor-safely ve bug-fix gibi özel ajanlar tarafından otomatik olarak yüklenir.
Bu araç, geniş mimari veya güvenlik konularına odaklanmak yerine, belirli fonksiyon ve değişkenlerin yazım sanatını yönetir. Hata yönetimi ve tip sistemleri için özel standartlar veya dile özgü deyimler uygulamak üzere .lattice/config.yaml dosyasını okuyan bir yapılandırma sistemine dayanır. SKILL; fonksiyon boyutu, döngüsel karmaşıklık ve parametre sayılarını izlemek için kendi kendine doğrulama kontrol listesini kullanarak kodun kendi kendini belgeleyen ve test edilmesi kolay bir yapıda kalmasını sağlar. Ayrıca, teknik borcun kod tabanına girmesini önlemek için derin iç içe geçme (deep nesting), anlaşılmaz isimlendirmeler ve yutulan hatalar gibi anti-pattern'ler için aktif tarama yapar.
Bir agent bununla neler yapabilir
- 1Fonksiyonlarda tek sorumluluk ilkesini zorunlu kılınAjanın, birden fazla görev gerçekleştiren büyük bir fonksiyonu daha küçük ve odaklanmış birimlere dönüştürmesini (refactor) isteyin.
- 2Döngüsel karmaşıklığı azaltınAjanın, belirli bir kod bloğu içindeki karmaşık koşullu mantığı basitleştirmesini talep edin.
- 3Değişken ve fonksiyon isimlendirmelerini iyileştirinYapay zekaya, değişkenleri ve fonksiyonları ek yorumlara gerek kalmadan niyetleri net olacak şekilde yeniden adlandırması talimatını verin.
Skill'in SKILL.md dosyasından yazılmıştır. Her kullanım durumu oradaki bir alıntı ile kontrol edilir.
clean-code skill nasıl kurulur
Her komut, skill klasörünü istemcinin skills dizinine kopyalar. Yüklemek için istemciyi yeniden başlatın veya yeni bir oturum başlatın.clean-code skill'ini Eklenti uygulamasına kur
/plugin marketplace add techygarg/lattice /plugin install lattice@lattice
clean-code skill'ini Claude Code uygulamasına kur
~/.claude/skills/clean-code/SKILL.md
$ npx degit techygarg/lattice/skills/clean-code ~/.claude/skills/clean-codeclean-code skill'ini Claude Code (project) uygulamasına kur
.claude/skills/clean-code/SKILL.md
$ npx degit techygarg/lattice/skills/clean-code .claude/skills/clean-codeclean-code skill'ini Codex uygulamasına kur
~/.agents/skills/clean-code/SKILL.md
$ npx degit techygarg/lattice/skills/clean-code ~/.agents/skills/clean-codeclean-code skill'ini Gemini CLI uygulamasına kur
~/.gemini/skills/clean-code/SKILL.md
$ npx degit techygarg/lattice/skills/clean-code ~/.gemini/skills/clean-codeclean-code skill'ini Claude.ai uygulamasına kur
npx degit techygarg/lattice/skills/clean-code clean-code && zip -r clean-code.zip clean-code # claude.ai → Customize → Skills → + → Create skill → Upload a skill → clean-code.zip
Otomatik kontroller
Çalıştırıldı 14 Kas 2026Tam rapor →Otomatik kontrollerimizi geçti. Bu bir güvenlik denetimi değil: bir ajanın çalıştırmasına izin vermeden önce betikleri okuyun. Kontroller nasıl çalışır
- Kaynak deposu bağlantılı ve erişilebilirtechygarg/lattice/skills/clean-code is public and reachablegithub.com/techygarg/lattice/tree/HEAD/skills/clean-code ↗Geçti
- Açık kaynak lisansı (OSI)MITspdx.org/licenses/MIT.html ↗Geçti
- Son bir yıl içinde commit veya sürüm mevcutLast commit 2026-10-24github.com/techygarg/lattice/commits ↗Geçti
- Betiklerde indir-çalıştır veya kimlik bilgisi hırsızlığı yokNo scripts in the skill folderGeçti
- SKILL.md içinde gizli talimat yokNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/techygarg/lattice/blob/HEAD/skills/clean-code/SKI ↗Geçti
- Önceden izin verilen araçlar sınırlıNo pre-approved tools; the agent asks before using onegithub.com/techygarg/lattice/blob/HEAD/skills/clean-code/SKI ↗Geçti
SKILL.md
GitHub'da görüntüleClean Code
Config Resolution
Projects can customize this skill's standards. Resolution order:
- Read
.lattice/config.yamlin the repo root. - If found, check
paths.clean_codefor a custom document path. - If a custom document exists at that path, read it and check its YAML frontmatter for
mode:mode: override: the custom document has full precedence. Use it instead of the embedded defaults. It must be comprehensive -- treat it as the sole reference.mode: overlay(or no mode field): read the embedded./references/defaults.mdfirst, then apply the custom document's sections on top. A custom section replaces the matching default section (matched by exact heading); new sections append after the defaults.
- If a custom path is configured but no document exists at it → tell the user which configured path is missing, then fall back to
./references/defaults.md. - If there is no config file or no
paths.clean_codekey, read./references/defaults.md. - Language adaptation: if
paths.language_idiomsis set in the config and the document exists, read it and adapt the defaults using these sections:- "Error Handling" → adapt §8 (Error Handling) patterns to the language's idioms. Language idioms take precedence over the pseudocode defaults.
- "Type System & Object Model" → adapt §1 (Single Responsibility) cohesion guidance to the language's constructs (e.g., struct vs class).
- "Naming Conventions" → adapt §4 (Meaningful Naming) patterns to the language's conventions.
- "Parameter & Function Design" → adapt §2 (Small, Focused Functions) and §5 (Parameter Design) to the language's capabilities.
- "Dependency Management" → adapt §9 (Test-Friendly Code) dependency-injection patterns to the language's idioms.
Self-Validation Checklist
STOP after generating each component. Verify ALL checks. Fix every failed check before presenting. Judgment calls → present options (see Ambiguity Signals).
- SINGLE RESPONSIBILITY: Can you describe each function without "and"? If not → extract a separate function.
- SIZE: Is each function under the size threshold from the loaded doc (~20 lines default)? If not → extract a sub-operation into its own named function.
- COMPLEXITY: Is cyclomatic complexity under the threshold from the loaded doc (~10 default)? If not → flatten with a guard clause or extract a branch.
- ABSTRACTION LEVEL: Does each function operate at one level of abstraction? If high-level logic mixes with low-level detail → extract the detail.
- NAMING: Does each function/variable name reveal intent without needing surrounding context? If not → rename to be self-documenting.
- PARAMETERS: Is the parameter count under the threshold from the loaded doc (4 default)? If not → group parameters into an object.
- PRIMITIVE OBSESSION: Would a string/number/boolean be clearer as a named type? If so → introduce a parameter object or typed wrapper.
- ERROR HANDLING: Does every fail-able operation have explicit handling with an actionable message? Is it handled at the right level?
Project-specific checks: if the loaded doc (from Config Resolution) contains a Validation Checklist section (§10 from the clean-code-refiner template), apply those checks as additional project-specific validation after the checklist above.
All checks pass → state "Passes clean-code. [next step]."
Active Anti-Pattern Scan
After the checklist, scan for each of these. Any box you can check → fix before presenting.
- God Function: a function exceeds ~30 lines doing multiple things; describing it requires "and" → extract focused functions.
- Deep Nesting: three or more levels of indentation → flatten with early returns / guard clauses.
- Cryptic Naming: variables like
d,tmp2,processData→ rename to reveal intent. - Long Parameter Lists: five or more parameters → group into an object or split the function.
- Premature Abstraction: a utility extracted from only two similar blocks → inline it until the Rule of Three (third instance with the same reason to change).
- Swallowed Errors: empty catch blocks, generic "something went wrong" messages, silent null returns → handle explicitly.
- Comments as Deodorant: a comment explains convoluted code instead of the code being fixed → rename to self-document; keep only "why" comments, remove "what" comments.
- Hidden Side Effects: a function named
getXalso writes a cache or sends notifications → rename or separate the concern. - Dead Code: commented-out blocks, unused imports, unreachable branches → delete them (version control preserves history).
- Untestable Logic: side effects tangled with business logic; unit testing requires mocking I/O → push side effects to the boundary, extract pure functions, inject dependencies.
Ambiguity Signals
Multiple valid outcomes exist. Present the options rather than silently choosing. If framework:collaborative-judgment is loaded, use its presentation format. See ./references/defaults.md for resolution guidance on each signal below.
- Single Responsibility: two tightly-coupled sequential operations may be one responsibility (a pipeline), not two. The "and" test catches true violations AND false positives.
- Function Size: near-threshold size (20–30 lines) with one clear purpose -- extraction may create five unclear smaller functions. Present the tradeoff.
- DRY vs Premature Abstraction: two identical blocks may serve different purposes and diverge independently. Until a third instance with the same reason to change appears, this is genuinely ambiguous.
- Error Handling Strategy: exception vs Result type vs error codes depends on language idiom and team convention, not on universal rules.
Bu becerideki dosyalar
2clean-code skill soruları
clean-code skill'ini Claude Code uygulamasına nasıl kurarım?
npx degit techygarg/lattice/skills/clean-code ~/.claude/skills/clean-code komutunu çalıştırın. Claude Code, skill'leri ~/.claude/skills (tüm projeler) veya .claude/skills (tek proje) konumundan yükler ve açıklaması görevle eşleştiğinde skill'i kullanır.
clean-code skill'ini hangi istemciler kullanabilir?
Agent Skills biçimini okuyan her istemci: Claude Code, Codex, Gemini CLI ve claude.ai (ZIP olarak yükleyin). Skill içindeki betikler yalnızca istemcinin kod çalıştırmaya izin verdiği yerlerde çalışır.
Fonksiyon boyutu ve karmaşıklığı için varsayılan eşikler nelerdir?
Varsayılan olarak fonksiyonlar yaklaşık 20 satırın altında olmalı ve döngüsel karmaşıklık (cyclomatic complexity) yaklaşık 10 değerinin altında tutulmalıdır.
Bir proje temiz kod standartlarını nasıl özelleştirebilir?
Projeler, .lattice/config.yaml dosyasında özel bir belge yolu tanımlayarak standartları özelleştirebilir; tam öncelik için 'override' modunu veya varsayılanları tamamlamak için 'overlay' modunu kullanabilirler.