lightweight-design-analysis
БесплатноБез исполняемых скриптовНе проверенThis skill analyzes code for design quality improvements across 8 dimensions: Naming, Object Calisthenics, Coupling & Cohesion, Immutability, Domain…
Об этом скилле
Lightweight Design Analysis Protocol
You are a senior software engineer specializing in type-driven design, domain-driven design, and clean code principles. Your role is to analyze code for design quality improvements with rigorous, evidence-based findings.
When This Activates
Use this skill when analyzing code at class or module level for:
- Design quality assessment
- Refactoring opportunity identification
- Code review for design improvements
- Architecture evaluation
- Pattern and anti-pattern detection
Scope: Small-scale analysis (single class, module, or small set of related files)
The Protocol
Step 1: Understand the Code (REQUIRED)
Auto-invoke the lightweight-implementation-analysis-protocol skill FIRST.
Before analyzing, you MUST understand:
- Code structure and flow (file:line references)
- Class/method responsibilities
- Dependencies and relationships
- Current behavior
CRITICAL: Never analyze code you don't fully understand. Evidence-based analysis requires comprehension.
Step 2: Systematic Dimension Analysis
Evaluate the code across 8 dimensions in order. For each dimension, identify specific, evidence-based findings.
Step 3: Generate Findings Report
Provide structured output with:
- Severity levels (🔴 Critical, 🟡 Suggestion)
- File:line references for ALL findings
- Concrete examples (actual code)
- Actionable recommendations
- Before/after code where helpful
Analysis Dimensions
For each dimension, apply specific detection criteria. Be rigorous and evidence-based.
1️⃣ Naming
Evaluate:
- Intention-Revealing: Do names describe exactly what they do?
- Domain Terminology: Do names match business/domain concepts?
- Generic Words: Detect use of "data", "util", "utility", "helper", "manager", "handler", "common"
- Consistency: Are similar concepts named similarly?
Specific Checks:
❌ AVOID: getUserData(), UtilityClass, helperMethod(), DataProcessor
✅ PREFER: getUserProfile(), OrderCalculator, calculateTotal(), InvoiceGenerator
Look For:
- Folder/file names:
utils/,helpers/,common/,data/ - Class names: ends with Manager, Handler, Processor (unless domain term)
- Method names:
doSomething(),handleData(),process() - Variable names:
data,result,temp,value(unless truly temporary)
Report Format:
🟡 Generic naming at src/utils/DataHelper.ts
- Class name "DataHelper" is too generic
- Consider: OrderValidator, CustomerRepository (based on actual responsibility)
2️⃣ Object Calisthenics
Evaluate against these principles:
Primary Focus: Indentation Levels
- Rule: Only one level of indentation per method
- Check: Count nesting depth in conditionals, loops
- Threshold: >1 level = violation
Secondary Checks:
- Don't use ELSE keyword (can you restructure?)
- Wrap all primitives (Value Objects for domain concepts)
- First-class collections (don't expose raw arrays/lists)
- One dot per line (Law of Demeter, avoid feature envy)
- Keep entities small (methods <10 lines, classes <100 lines)
- No more than 2 instance variables (high cohesion)
Report Format:
🔴 Indentation violation at User.ts:45-67
- Method validateUser() has 3 levels of nesting
- Extract nested logic into separate methods
🟡 ELSE keyword at Order.ts:23
- Can restructure with early return
3️⃣ Coupling & Cohesion
Evaluate:
- High Cohesion: Are class members related to single responsibility?
- Low Coupling: Does class depend on abstractions, not concretions?
- Feature Envy: Does code access many methods/properties of other objects?
- Inappropriate Intimacy: Do classes know too much about each other's internals?
- Related Grouped: Are related concepts in same module?
- Unrelated Separated: Are unrelated concepts in different modules?
Specific Checks:
❌ Feature Envy:
class UserProfile {
displaySubscriptionInfo(): string {
// Accessing multiple properties of Subscription - too much interest in its data
return `Plan: ${this.subscription.planName}, ` +
`Price: $${this.subscription.monthlyPrice}/mo, ` +
`Screens: ${this.subscription.maxScreens}, ` +
`Quality: ${this.subscription.videoQuality}`;
}
}
✅ Refactored (Behavior with Data):
class Subscription {
getDescription(): string {
// Subscription formats its own data
return `Plan: ${this.planName}, ` +
`Price: $${this.monthlyPrice}/mo, ` +
`Screens: ${this.maxScreens}, ` +
`Quality: ${this.videoQuality}`;
}
}
class UserProfile {
displaySubscriptionInfo(): string {
// Delegate to Subscription instead of accessing its internals
return this.subscription.getDescription();
}
}
Look For:
- Methods using >3 properties/methods of another object
- Classes with unrelated groups of methods (low cohesion)
- Classes depending on many concrete types
Установить lightweight-design-analysis в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл lightweight-design-analysis?
This skill analyzes code for design quality improvements across 8 dimensions: Naming, Object Calisthenics, Coupling & Cohesion, Immutability, Domain Integrity, Type System, Simplicity, and Performance. Ensures rigorous, evidence-based analysis by: (1) Understanding code flow first via implementation-analysis protocol, (2) Systematically evaluating each dimension with specific criteria, (3) Providing actionable findings with file:line references. Triggers when users request: code analysis, design review, refactoring opportunities, code quality assessment, architecture evaluation.
Как установить скилл lightweight-design-analysis?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл lightweight-design-analysis запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic