clean-code skill
✓ 인증됨구현 코드를 생성하거나 수정할 때 단일 책임 원칙, 명확한 명명 규칙, 복잡도 관리와 같은 코딩 표준을 강제합니다.
- GitHub 스타
- 211
- 파일
- 2
- 마지막 커밋
- 2026년 10월 24일
- 라이선스
- MIT
- 허용된 도구
- —
clean-code skill은 무엇을 하나요?
clean-code은(는) agent skill입니다. 구현 코드를 생성하거나 수정할 때 단일 책임 원칙, 명확한 명명 규칙, 복잡도 관리와 같은 코딩 표준을 강제합니다.
skill의 SKILL.md에서 생성된 요약입니다.
clean-code skill 정보
코딩 과정에서 높은 구현 품질을 유지하는 것이 이 SKILL의 주요 기능입니다. 모든 개별 코드 단위가 명확한 명명, 단일 책임, 복잡도 관리에 관한 엄격한 표준을 따르도록 보장해야 하는 개발자를 위해 설계되었습니다. 사용자가 코드 품질 개선이나 특정 코딩 가이드라인을 요청하면 code-forge, refactor-safely, bug-fix와 같은 특화된 에이전트에 의해 자동으로 로드됩니다.
이 도구는 광범위한 아키텍처나 보안에 집중하는 대신, 특정 함수와 변수를 작성하는 기술적인 측면을 관리합니다. .lattice/config.yaml을 읽는 설정 시스템을 기반으로 사용자 정의 표준이나 에러 처리 및 타입 시스템을 위한 언어별 관용구를 적용합니다. 이 SKILL은 자체 검증 체크리스트를 사용하여 함수 크기, 순환 복잡도, 파라미터 수를 모니터링함으로써 코드가 자기 문서화(self-documenting)가 가능하고 테스트하기 쉬운 상태를 유지하도록 합니다. 또한 깊은 중첩, 모호한 명명, 에러 무시와 같은 안티 패턴을 능동적으로 스캔하여 기술 부채가 코드베이스에 유입되는 것을 방지합니다.
agent가 수행할 수 있는 작업
- 1함수의 단일 책임 원칙 강제여러 작업을 수행하는 거대한 함수를 더 작고 집중된 단위로 리팩터링하도록 에이전트에게 요청합니다.
- 2순환 복잡도 감소특정 코드 블록 내의 복잡한 조건부 로직을 단순화하도록 에이전트에게 요청합니다.
- 3변수 및 함수 명명 개선추가 주석 없이도 의도가 명확해지도록 변수와 함수의 이름을 변경하도록 AI에게 지시합니다.
skill의 SKILL.md를 기반으로 작성되었습니다. 모든 사용 사례는 해당 문서의 인용구와 대조 확인되었습니다.
clean-code skill 설치 방법
각 명령은 skill 폴더를 클라이언트의 skills 디렉터리에 복사합니다. 클라이언트를 재시작하거나 새 세션을 시작하여 로드하세요.플러그인에 clean-code skill 설치
/plugin marketplace add techygarg/lattice /plugin install lattice@lattice
Claude Code에 clean-code skill 설치
~/.claude/skills/clean-code/SKILL.md
$ npx degit techygarg/lattice/skills/clean-code ~/.claude/skills/clean-codeClaude Code (project)에 clean-code skill 설치
.claude/skills/clean-code/SKILL.md
$ npx degit techygarg/lattice/skills/clean-code .claude/skills/clean-codeCodex에 clean-code skill 설치
~/.agents/skills/clean-code/SKILL.md
$ npx degit techygarg/lattice/skills/clean-code ~/.agents/skills/clean-codeGemini CLI에 clean-code skill 설치
~/.gemini/skills/clean-code/SKILL.md
$ npx degit techygarg/lattice/skills/clean-code ~/.gemini/skills/clean-codeClaude.ai에 clean-code skill 설치
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
자동 검사
2026년 11월 14일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 보안 감사는 아닙니다. 에이전트가 실행하기 전에 스크립트를 읽어 보세요. 검사 방식
- 소스 저장소 연결 및 접근 가능techygarg/lattice/skills/clean-code is public and reachablegithub.com/techygarg/lattice/tree/HEAD/skills/clean-code ↗통과
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit 2026-10-24github.com/techygarg/lattice/commits ↗통과
- 스크립트에 다운로드 후 실행이나 자격 증명 탈취가 없음No scripts in the skill folder통과
- SKILL.md에 숨겨진 지침 없음No override phrases, safeguard switches, credential requests or hidden charactersgithub.com/techygarg/lattice/blob/HEAD/skills/clean-code/SKI ↗통과
- 사전 허용 도구가 제한됨No pre-approved tools; the agent asks before using onegithub.com/techygarg/lattice/blob/HEAD/skills/clean-code/SKI ↗통과
SKILL.md
GitHub에서 보기Clean 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.
이 스킬의 파일
2clean-code skill 질문
Claude Code에 clean-code skill을 어떻게 설치하나요?
npx degit techygarg/lattice/skills/clean-code ~/.claude/skills/clean-code를 실행합니다. Claude Code는 ~/.claude/skills(모든 프로젝트) 또는 .claude/skills(한 프로젝트)에서 skills를 로드하며, 설명이 작업과 일치할 때 skill을 사용합니다.
clean-code skill을 사용할 수 있는 클라이언트는 무엇인가요?
Agent Skills 형식을 읽는 모든 클라이언트(Claude Code, Codex, Gemini CLI, claude.ai(ZIP으로 업로드))가 사용할 수 있습니다. skill 내 스크립트는 클라이언트가 코드 실행을 허용하는 경우에만 실행됩니다.
함수 크기와 복잡도에 대한 기본 임계값은 무엇인가요?
기본적으로 함수는 약 20행 미만이어야 하며, 순환 복잡도(cyclomatic complexity)는 약 10 미만으로 유지해야 합니다.
프로젝트에서 클린 코드 표준을 어떻게 맞춤 설정할 수 있나요?
.lattice/config.yaml에 사용자 정의 문서 경로를 정의하여 표준을 맞춤 설정할 수 있습니다. 전체 우선순위를 적용하는 'override' 모드 또는 기본값을 보완하는 'overlay' 모드를 사용할 수 있습니다.