skills/clean-code/SKILL.md
클린 코드 원칙 및 적용 가이드를 실행합니다.
npx skillsauth add excatt/superclaude-plusplus clean-codeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
클린 코드 원칙 및 적용 가이드를 실행합니다.
// ❌ Bad
const d = 86400;
const list = users.filter(u => u.a > 18);
// ✅ Good
const SECONDS_PER_DAY = 86400;
const adultUsers = users.filter(user => user.age > 18);
// ❌ Bad
setTimeout(fn, 86400000);
// ✅ Good
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
setTimeout(fn, MILLISECONDS_PER_DAY);
// ❌ Bad
const yyyymmdstr = moment().format('YYYY/MM/DD');
// ✅ Good
const currentDate = moment().format('YYYY/MM/DD');
// ❌ Bad: 너무 긴 함수
function processOrder(order) {
// 100줄의 코드...
}
// ✅ Good: 작은 함수들로 분리
function processOrder(order) {
validateOrder(order);
calculateTotal(order);
applyDiscounts(order);
saveOrder(order);
sendConfirmation(order);
}
// ❌ Bad: 여러 일을 함
function emailClients(clients) {
clients.forEach(client => {
const record = database.lookup(client);
if (record.isActive()) {
email(client);
}
});
}
// ✅ Good: 하나의 일만
function emailActiveClients(clients) {
clients
.filter(isActiveClient)
.forEach(email);
}
function isActiveClient(client) {
const record = database.lookup(client);
return record.isActive();
}
// ❌ Bad: 인수가 많음
function createUser(name, email, age, address, phone, role) {}
// ✅ Good: 객체로 전달
function createUser({ name, email, age, address, phone, role }) {}
// 또는 Builder 패턴
new UserBuilder()
.setName('John')
.setEmail('[email protected]')
.build();
// ❌ Bad: 숨겨진 부수 효과
function checkPassword(user, password) {
if (cryptographer.decrypt(user.password) === password) {
Session.initialize(); // 숨겨진 부수 효과!
return true;
}
return false;
}
// ✅ Good: 명확한 의도
function checkPassword(user, password) {
return cryptographer.decrypt(user.password) === password;
}
function loginUser(user, password) {
if (checkPassword(user, password)) {
Session.initialize();
return true;
}
return false;
}
// ❌ Bad: 주석으로 설명
// 직원이 혜택을 받을 자격이 있는지 확인
if (employee.flags & HOURLY_FLAG && employee.age > 65) {}
// ✅ Good: 코드가 설명
if (employee.isEligibleForFullBenefits()) {}
// 정규표현식 설명 (복잡한 패턴)
// Format: kk:mm:ss EEE, MMM dd, yyyy
const pattern = /\d{2}:\d{2}:\d{2} \w{3}, \w{3} \d{2}, \d{4}/;
// TODO: 임시 해결책, #123 이슈에서 수정 예정
// WARNING: 이 메서드는 O(n²) 복잡도를 가짐
// NOTE: 외부 API 제한으로 인해 이 방식 사용
// ❌ 피해야 할 주석
i++; // i를 증가시킴 (불필요)
// 작성자: John, 날짜: 2024-01-15 (버전 관리 사용)
// function oldMethod() { ... } (죽은 코드)
// ❌ Bad: 에러 코드 반환
function withdraw(amount) {
if (balance < amount) return -1;
balance -= amount;
return 0;
}
// ✅ Good: 예외 던지기
function withdraw(amount) {
if (balance < amount) {
throw new InsufficientFundsError(amount, balance);
}
balance -= amount;
}
// ❌ Bad
throw new Error('Error');
// ✅ Good
throw new ValidationError('Email format is invalid', { field: 'email' });
// ❌ Bad: 기차 충돌 (Train Wreck)
const outputDir = ctxt.getOptions().getScratchDir().getAbsolutePath();
// ✅ Good
const options = ctxt.getOptions();
const scratchDir = options.getScratchDir();
const outputDir = scratchDir.getAbsolutePath();
// 또는 더 좋은 방법
const outputDir = ctxt.getOutputDirectory();
// 클래스는 하나의 책임만
// 메서드 수보다 책임의 수가 중요
// ❌ Bad: God Class
class Employee {
// 급여 계산, 세금 계산, HR 보고서, 이메일 발송 등...
}
// ✅ Good: 분리된 책임
class Employee { /* 직원 데이터 */ }
class PayrollCalculator { /* 급여 계산 */ }
class TaxCalculator { /* 세금 계산 */ }
class HRReporter { /* HR 보고서 */ }
// 높은 응집도: 모든 메서드가 모든 인스턴스 변수 사용
class Stack {
private items = [];
push(item) { this.items.push(item); }
pop() { return this.items.pop(); }
peek() { return this.items[this.items.length - 1]; }
isEmpty() { return this.items.length === 0; }
}
## Clean Code Review
### Issues Found
| 유형 | 위치 | 문제 | 개선안 |
|------|------|------|--------|
| 네이밍 | line 10 | 불명확한 변수명 | d → dayCount |
### Refactoring
```javascript
// Before
...
// After
...
---
요청에 맞는 클린 코드 분석 및 개선안을 제시하세요.
testing
사용자 계획을 기존 도메인 모델에 대해 stress-test하는 인터뷰 세션. 용어를 날카롭게 다듬고, 결정이 굳어질 때마다 CONTEXT.md(도메인 어휘 사전)와 ADR을 인라인으로 갱신한다. 새 기능 요구사항 탐색은 `/brainstorm`을, 기존 도메인 모델·용어와의 정합성 점검은 이 스킬을 사용한다.
development
# Excel (XLSX) Spreadsheet Skill Claude Code supports comprehensive spreadsheet operations through the **xlsx** skill, enabling creation, editing, and analysis of Excel files (.xlsx, .xlsm, .csv, .tsv). ## Trigger - When user needs Excel spreadsheet creation or editing - Financial modeling or data analysis required - Spreadsheet formulas and calculations needed - Data import from CSV/TSV files ## Core Capabilities **Primary functions include:** - Creating new spreadsheets with formulas and f
tools
Generate structured implementation workflows from PRDs and feature requirements
development
실시간 통신 설계 가이드를 실행합니다.