← ClaudeAtlas

no-hardcodinglisted

Forbid hardcoded values in code. Use this when reviewing code, writing new features, or when magic numbers/strings are detected. Enforces constants, env variables, and config files.
aiskillstore/marketplace · ★ 329 · Code & Development · score 85
Install: claude install-skill aiskillstore/marketplace
# No Hardcoding Policy 코드에 하드코딩된 값을 금지하고 상수/환경변수/설정 파일을 사용하도록 강제하는 스킬입니다. ## Core Principle > **"코드에 직접 값을 쓰는 순간, 변경이 배포가 된다."** ## Rules | 유형 | 상태 | 대안 | |------|------|------| | Magic Number | 🔴 금지 | 상수/enum | | Magic String | 🔴 금지 | 상수/enum | | URL/경로 | 🔴 금지 | 환경변수/config | | 크리덴셜 | 🔴 **절대 금지** | `.env` + secrets | | 타임아웃/딜레이 | 🔴 금지 | 상수/config | | 포트 번호 | 🔴 금지 | 환경변수 | | API 키 | 🔴 **절대 금지** | 환경변수 + secrets | ## Detection Patterns ### Magic Numbers ```typescript // ❌ BAD: 의미 불명확 if (users.length > 100) { ... } setTimeout(callback, 3000); const tax = price * 0.1; // ✅ GOOD: 의미 명확 const MAX_USERS = 100; const DEBOUNCE_MS = 3000; const TAX_RATE = 0.1; if (users.length > MAX_USERS) { ... } setTimeout(callback, DEBOUNCE_MS); const tax = price * TAX_RATE; ``` ### Magic Strings ```typescript // ❌ BAD: 문자열 반복, 오타 위험 if (status === 'pending') { ... } if (status === 'pending') { ... } // 다른 곳에서 또 사용 // ✅ GOOD: 상수 또는 enum enum Status { PENDING = 'pending', APPROVED = 'approved', REJECTED = 'rejected', } if (status === Status.PENDING) { ... } ``` ### URLs/Endpoints ```typescript // ❌ BAD: URL 하드코딩 const response = await fetch('https://api.example.com/users'); // ✅ GOOD: 환경변수 const API_URL = process.env.NEXT_PUBLIC_API_URL; const response = await fetch(`${API_URL}/users`); ``` ### Credentials (절대 금지) ```typescript // ❌ CRITICAL: 절대 금지 - 보안 위협 const apiKey = 'sk-1234567890abcdef'; const password = 'admin123'; const dbConnection = 'mongodb://user:pass@ho