ソース情報
- リポジトリ
- 2233admin/CICADA
- ソースの最終更新活動
- 2026年5月9日 07:11
- 検出された SKILL.md の言語
- 英語
- スター
- 1
- フォーク
- 1
インストール方法
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
ソースファイルを確認
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
メニュー
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/2233admin/CICADA --skill refactorコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
SOC 職業分類に基づく
SKILL.md を表示中
| name | refactor |
| description | Identify code smells and suggest refactoring improvements |
| allowed-tools | ["Read","Grep","Glob","Bash"] |
| origin | bundled |
| version | 1.0.0 |
Identify code smells, suggest improvements, and guide safe refactoring following best practices.
Smell: Function > 50 lines Fix: Extract smaller functions
// Before: 80-line function
function processOrder(order) {
// validation (20 lines)
// calculation (30 lines)
// database save (20 lines)
// notification (10 lines)
}
// After: Extracted functions
function processOrder(order) {
validateOrder(order);
const total = calculateTotal(order);
saveOrder(order, total);
notifyCustomer(order);
}
Smell: File > 800 lines Fix: Split by responsibility
// Before: user-service.ts (1200 lines)
UserService
- authentication
- profile management
- permissions
- notifications
// After: Split into focused files
auth-service.ts (300 lines)
profile-service.ts (250 lines)
permission-service.ts (200 lines)
notification-service.ts (150 lines)
Smell: Same logic in multiple places Fix: Extract to shared function
// Before: Duplicated validation
function createUser(data) {
if (!data.email || !data.email.includes('@')) {
throw new Error('Invalid email');
}
// ...
}
function updateUser(id, data) {
if (!data.email || !data.email.includes('@')) {
throw new Error('Invalid email');
}
// ...
}
// After: Extracted validation
function validateEmail(email) {
if (!email || !email.includes('@')) {
throw new Error('Invalid email');
}
}
function createUser(data) {
validateEmail(data.email);
// ...
}
function updateUser(id, data) {
validateEmail(data.email);
// ...
}
Smell: Nesting > 4 levels Fix: Early returns, extract functions
// Before: Deep nesting
function processData(data) {
if (data) {
if (data.isValid) {
if (data.user) {
if (data.user.isActive) {
// actual logic here
}
}
}
}
}
// After: Early returns
function processData(data) {
if (!data) return;
if (!data.isValid) return;
if (!data.user) return;
if (!data.user.isActive) return;
// actual logic here
}
Smell: Hardcoded values without explanation Fix: Named constants
// Before: Magic numbers
function calculateDiscount(price) {
if (price > 100) {
return price * 0.1;
}
return 0;
}
// After: Named constants
const DISCOUNT_THRESHOLD = 100;
const DISCOUNT_RATE = 0.1;
function calculateDiscount(price) {
if (price > DISCOUNT_THRESHOLD) {
return price * DISCOUNT_RATE;
}
return 0;
}
Smell: Class with too many responsibilities Fix: Split by Single Responsibility Principle
// Before: God class
class UserManager {
authenticate() { }
validateEmail() { }
sendNotification() { }
generateReport() { }
processPayment() { }
}
// After: Focused classes
class AuthService {
authenticate() { }
}
class EmailValidator {
validate() { }
}
class NotificationService {
send() { }
}
class ReportGenerator {
generate() { }
}
class PaymentProcessor {
process() { }
}
Smell: Function with > 4 parameters Fix: Parameter object
// Before: Too many parameters
function createUser(
email: string,
name: string,
age: number,
address: string,
phone: string,
role: string
) { }
// After: Parameter object
interface UserData {
email: string;
name: string;
age: number;
address: string;
phone: string;
role: string;
}
function createUser(userData: UserData) { }
Smell: Direct mutation of objects Fix: Immutable updates
// Before: Mutation
function updateUser(user, newEmail) {
user.email = newEmail;
return user;
}
// After: Immutable
function updateUser(user, newEmail) {
return {
...user,
email: newEmail
};
}
Move code block into a named function
Replace complex expression with named variable
Replace function call with function body (if trivial)
Give better names to variables, functions, classes
Move function to more appropriate class/module
Use inheritance/interfaces instead of if/switch
Group related parameters into object
Name hardcoded values
# Run tests before refactoring
npm test
# Check coverage
npm run coverage
# After each refactoring step
npm test
Before refactoring:
During refactoring:
After refactoring:
High Priority:
Medium Priority:
Low Priority: