Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Maps architectural components in a codebase and measures their size to identify what should be extracted first. Use when asking "how big is each module?", "what components do I have?", "which service is too large?", "analyze codebase structure", "size my monolith", or planning where to start decomposing. Do NOT use for runtime performance sizing or infrastructure capacity planning.
.claude/skills/tech-leads-club-component-identification-sizing/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 78% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 118% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 224% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 150% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 141% | 0% |
This skill identifies architectural components (logical building blocks) in a codebase and calculates size metrics to assess decomposition feasibility and identify oversized components.
Request analysis of your codebase:
Example 1: Complete Analysis
User: "Identify and size all components in this codebase"
The skill will:
1. Map directory/namespace structures
2. Identify all components (leaf nodes)
3. Calculate size metrics (statements, files, percentages)
4. Generate component inventory table
5. Flag oversized/undersized components
6. Provide recommendationsExample 2: Find Oversized Components
User: "Which components are too large?"
The skill will:
1. Calculate mean and standard deviation
2. Identify components >2 std dev or >10% threshold
3. Analyze functional areas within large components
4. Suggest specific splits with estimated sizesExample 3: Component Size Analysis
User: "Analyze component sizes and distribution"
The skill will:
1. Calculate all size metrics
2. Generate size distribution summary
3. Identify outliers
4. Provide statistics and recommendationsApply this skill when:
A component is an architectural building block that:
Key Rule: Components are identified by leaf nodes in directory/namespace structures. If a namespace is extended (e.g., services/billing extended to services/billing/payment), the parent becomes a subdomain, not a component.
Statements (not lines of code):
Component Size Indicators:
Scan the codebase directory structure:
services/, routes/, models/, utils/com.company.domain.service)app/billing/payment)services/BillingService/ is a componentservices/BillingService/payment/ extends it, making BillingService a subdomainFor each component:
.js, .ts, .java, .py, etc.) component_percent = (component_statements / total_statements) * 100
total_statements / number_of_componentssqrt(sum((size - mean)^2) / (n - 1))(component_size - mean) / std_devOversized Components (candidates for splitting):
Undersized Components (candidates for consolidation):
Well-Sized Components:
markdown## Component Inventory | Component Name | Namespace/Path | Statements | Files | Percent | Status | | --------------- | ---------------------------- | ---------- | ----- | ------- | ------------ | | Billing Payment | services/BillingService | 4,312 | 23 | 5% | ✅ OK | | Reporting | services/ReportingService | 27,765 | 162 | 33% | ⚠️ Too Large | | Notification | services/NotificationService | 1,433 | 7 | 2% | ✅ OK |
Status Legend:
markdown## Size Analysis Summary **Total Components**: 18 **Total Statements**: 82,931 **Mean Component Size**: 4,607 statements **Standard Deviation**: 5,234 statements **Oversized Components** (>2 std dev or >10%): - Reporting (33% - 27,765 statements) - Consider splitting into: - Ticket Reports - Expert Reports - Financial Reports **Well-Sized Components** (within 1-2 std dev): - Billing Payment (5%) - Customer Profile (5%) - Ticket Assignment (9%) **Undersized Components** (<1 std dev): - Login (2% - 1,865 statements) - Consider consolidating with Authentication
markdown## Component Size Distribution
Component Size Distribution (by percent of codebase)
Visual representation or histogram if possible]
Largest: ████████████████████████████████████ 33% (Reporting) ████████ 9% (Ticket Assign) ██████ 8% (Ticket) ██████ 6% (Expert Profile) █████ 5% (Billing Payment) ████ 4% (Billing History) ...
`### Recommendations
Reporting Component (33% of codebase):
Login Component (2% of codebase):
Most components are appropriately sized. Continue monitoring during decomposition.
`## Analysis Checklist **Component Identification**: - [ ] Mapped all directory/namespace structures - [ ] Identified leaf nodes (components) vs parent nodes (subdomains) - [ ] Created complete component inventory - [ ] Documented namespace/path for each component **Size Calculation**: - [ ] Counted statements (not lines) for each component - [ ] Counted source files (excluding tests/configs) - [ ] Calculated percentage of total codebase - [ ] Calculated mean and standard deviation **Size Assessment**: - [ ] Identified oversized components (>threshold or >2 std dev) - [ ] Identified undersized components (<1% or <1 std dev) - [ ] Flagged components for splitting or consolidation - [ ] Documented size distribution **Recommendations**: - [ ] Suggested splits for oversized components - [ ] Suggested consolidations for undersized components - [ ] Prioritized recommendations by impact - [ ] Created architecture stories for refactoring ## Implementation Notes ### For Node.js/Express Applications Components typically found in: - `services/` - Business logic components - `routes/` - API endpoint components - `models/` - Data model components - `utils/` - Utility components - `middleware/` - Middleware components **Example Component Identification**:
services/ ├── BillingService/ ← Component (leaf node) │ ├── index.js │ └── BillingService.js ├── CustomerService/ ← Component (leaf node) │ └── CustomerService.js └── NotificationService/ ← Component (leaf node) └── NotificationService.js
### For Java Applications
Components identified by package structure:
- `com.company.domain.service` - Service components
- `com.company.domain.model` - Model components
- `com.company.domain.repository` - Repository components
**Example Component Identification**:
com.company.billing.payment ← Component (leaf package) com.company.billing.history ← Component (leaf package) com.company.billing ← Subdomain (parent of payment/history)
### Statement Counting
**JavaScript/TypeScript**:
- Count statements terminated by `;` or newline
- Include: assignments, function calls, returns, conditionals, loops
- Exclude: comments, blank lines, declarations without assignment
**Java**:
- Count statements terminated by `;`
- Include: method calls, assignments, returns, conditionals
- Exclude: class/interface declarations, comments, blank lines
**Python**:
- Count executable statements (not comments or blank lines)
- Include: assignments, function calls, returns, conditionals
- Exclude: docstrings, comments, blank lines
## Fitness Functions
After identifying and sizing components, create automated checks:
### Component Size Threshold
// Alert if any component exceeds 10% of codebase function checkComponentSize(components, threshold = 0.1) { const totalStatements = components.reduce((sum, c) => sum + c.statements, 0) return components .filter((c) => c.statements / totalStatements > threshold) .map((c) => ({ component: c.name, percent: ((c.statements / totalStatements) 100).toFixed(1), issue: 'Exceeds size threshold', })) }
### Standard Deviation Check
// Alert if component is >2 standard deviations from mean function checkStandardDeviation(components) { const sizes = components.map((c) => c.statements) const mean = sizes.reduce((a, b) => a + b, 0) / sizes.length const stdDev = Math.sqrt(sizes.reduce((sum, size) => sum + Math.pow(size - mean, 2), 0) / (sizes.length - 1))
return components .filter((c) => Math.abs(c.statements - mean) > 2 stdDev) .map((c) => ({ component: c.name, deviation: ((c.statements - mean) / stdDev).toFixed(2), issue: 'More than 2 standard deviations from mean', })) }
## Best Practices
### Do's ✅
- Use statements, not lines of code
- Identify components as leaf nodes only
- Calculate both percentage and standard deviation
- Consider application size when setting thresholds
- Document namespace/path for each component
- Create visual size distribution if possible
### Don'ts ❌
- Don't count test files in component size
- Don't treat parent directories as components
- Don't use fixed thresholds without considering app size
- Don't ignore small components (may need consolidation)
- Don't skip standard deviation calculation
- Don't mix infrastructure and domain components in same analysis
## Next Steps
After completing component identification and sizing:
1. **Apply Gather Common Domain Components Pattern** - Identify duplicate functionality
2. **Apply Flatten Components Pattern** - Remove orphaned classes from root namespaces
3. **Apply Determine Component Dependencies Pattern** - Analyze coupling between components
4. **Create Component Domains** - Group components into logical domains
## Notes
- Component size thresholds vary by application size
- Small apps (<10 components): 30% threshold may be appropriate
- Large apps (>20 components): 10% threshold is more appropriate
- Standard deviation is more reliable than fixed percentages
- Well-sized components are 1-2 standard deviations from mean
- Oversized components often contain multiple functional areas that can be split| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 31,571 | 23,195 | -27% | 1 | 1 | 0% | 6,222 | 7,649 | +23% | 0 | 0 | — |
case-02 | fail→pass | 20,626 | 22,328 | +8% | 1 | 1 | 0% | 4,201 | 7,478 | +78% | 0 | 0 | — |
case-03 | fail→fail | 19,633 | 2,177 | -89% | 1 | 1 | 0% | 3,813 | 3,483 | -9% | 0 | 0 | — |
case-04 | pass→pass | 10,624 | 7,134 | -33% | 1 | 1 | 0% | 1,884 | 4,647 | +147% | 0 | 0 | — |
case-05 | fail→pass | 11,504 | 6,886 | -40% | 1 | 1 | 0% | 2,059 | 4,486 | +118% | 0 | 0 | — |
case-06 | pass→pass | 8,926 | 5,187 | -42% | 1 | 1 | 0% | 1,663 | 3,946 | +137% | 0 | 0 | — |
case-07 | fail→pass | 21,130 | 3,815 | -82% | 1 | 1 | 0% | 1,206 | 3,913 | +224% | 0 | 0 | — |
case-08 | fail→pass | 8,356 | 3,433 | -59% | 1 | 1 | 0% | 1,516 | 3,796 | +150% | 0 | 0 | — |
case-09 | fail→pass | 9,036 | 5,277 | -42% | 1 | 1 | 0% | 1,760 | 4,242 | +141% | 0 | 0 | — |
case-10 | pass→pass | 13,678 | 3,425 | -75% | 1 | 1 | 0% | 2,286 | 3,793 | +66% | 0 | 0 | — |
case-11 | fail→pass | 8,415 | 2,567 | -69% | 1 | 1 | 0% | 1,282 | 3,519 | +174% | 0 | 0 | — |
case-12 | fail→pass | 7,509 | 2,032 | -73% | 1 | 1 | 0% | 1,129 | 3,528 | +212% | 0 | 0 | — |
case-13 | pass→pass | 7,400 | 2,860 | -61% | 1 | 1 | 0% | 1,257 | 3,688 | +193% | 0 | 0 | — |
case-14 | pass→pass | 12,048 | 5,428 | -55% | 1 | 1 | 0% | 1,950 | 4,129 | +112% | 0 | 0 | — |
case-15 | fail→pass | 8,295 | 3,898 | -53% | 1 | 1 | 0% | 1,576 | 3,893 | +147% | 0 | 0 | — |
case-16 | fail→pass | 13,471 | 6,345 | -53% | 1 | 1 | 0% | 2,324 | 4,274 | +84% | 0 | 0 | — |
case-17 | pass→pass | 12,406 | 5,996 | -52% | 1 | 1 | 0% | 1,957 | 4,158 | +112% | 0 | 0 | — |
case-18 | pass→pass | 8,068 | 5,396 | -33% | 1 | 1 | 0% | 1,491 | 4,160 | +179% | 0 | 0 | — |
case-19 | fail→pass | 20,850 | 9,451 | -55% | 1 | 1 | 0% | 1,408 | 5,042 | +258% | 0 | 0 | — |
case-20 | fail→pass | 9,954 | 4,853 | -51% | 1 | 1 | 0% | 617 | 4,156 | +574% | 0 | 0 | — |
case-21 | fail→pass | 10,985 | 4,717 | -57% | 1 | 1 | 0% | 1,766 | 3,955 | +124% | 0 | 0 | — |
case-22 | pass→pass | 11,999 | 11,601 | -3% | 1 | 1 | 0% | 1,947 | 5,061 | +160% | 0 | 0 | — |
case-23 | fail→fail | 6,965 | 15,845 | +127% | 1 | 1 | 0% | 1,200 | 5,808 | +384% | 0 | 0 | — |
case-24 | pass→pass | 12,857 | 13,393 | +4% | 1 | 1 | 0% | 2,455 | 5,805 | +136% | 0 | 0 | — |
case-25 | pass→pass | 9,567 | 13,272 | +39% | 1 | 1 | 0% | 1,699 | 5,939 | +250% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 25 cases were attempted, and 22 counted toward the lift figure. The other 3 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +48 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.