component-identification-sizing
Component-identification-sizing maps architectural components within a codebase and calculates metrics like file count and code statements to identify oversized modules and plan decomposition. Use it when analyzing codebase structure, assessing which services are too large, creating component inventories, or determining decomposition starting points. Do not use for runtime performance analysis or infrastructure capacity planning.
git clone --depth 1 https://github.com/tech-leads-club/agent-skills /tmp/component-identification-sizing && cp -r /tmp/component-identification-sizing/packages/skills-catalog/skills/(architecture)/component-identification-sizing ~/.claude/skills/component-identification-sizingSKILL.md
# Component Identification and Sizing This skill identifies architectural components (logical building blocks) in a codebase and calculates size metrics to assess decomposition feasibility and identify oversized components. ## How to Use ### Quick Start Request analysis of your codebase: - **"Identify and size all components in this codebase"** - **"Find oversized components that need splitting"** - **"Create a component inventory for decomposition planning"** - **"Analyze component size distribution"** ### Usage Examples **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 recommendations ``` **Example 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 sizes ``` **Example 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 recommendations ``` ### Step-by-Step Process 1. **Initial Analysis**: Start with complete component inventory 2. **Identify Issues**: Find components that need attention 3. **Get Recommendations**: Request actionable split/consolidation suggestions 4. **Monitor Progress**: Track component growth over time ## When to Use Apply this skill when: - Starting a monolithic decomposition effort - Assessing codebase structure and organization - Identifying components that are too large or too small - Creating component inventory for migration planning - Analyzing code distribution across components - Preparing for component-based decomposition patterns ## Core Concepts ### Component Definition A **component** is an architectural building block that: - Has a well-defined role and responsibility - Is identified by a namespace, package structure, or directory path - Contains source code files (classes, functions, modules) grouped together - Performs specific business or infrastructure functionality **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. ### Size Metrics **Statements** (not lines of code): - Count executable statements terminated by semicolons or newlines - More accurate than lines of code for size comparison - Accounts for code complexity, not formatting **Component Size Indicators**: - **Percent of codebase**: Component statements / Total statements - **File count**: Number of source files in component - **Standard deviation**: Distance from mean component size ## Analysis Process ### Phase 1: Identify Components Scan the codebase directory structure: 1. **Map directory/namespace structure** - For Node.js: `services/`, `routes/`, `models/`, `utils/` - For Java: Package structure (e.g., `com.company.domain.service`) - For Python: Module paths (e.g., `app/billing/payment`) 2. **Identify leaf nodes** - Components are the deepest directories containing source files - Example: `services/BillingService/` is a component - Example: `services/BillingService/payment/` extends it, making `BillingService` a subdomain 3. **Create component inventory** - List each component with its namespace/path - Note any parent namespaces (subdomains) ### Phase 2: Calculate Size Metrics For each component: 1. **Count statements** - Parse source files in component directory - Count executable statements (not comments, blank lines, or declarations alone) - Sum across all files in component 2. **Count files** - Total source files (`.js`, `.ts`, `.java`, `.py`, etc.) - Exclude test files, config files, documentation 3. **Calculate percentage** ``` component_percent = (component_statements / total_statements) * 100 ``` 4. **Calculate statistics** - Mean component size: `total_statements / number_of_components` - Standard deviation: `sqrt(sum((size - mean)^2) / (n - 1))` - Component's deviation: `(component_size - mean) / std_dev` ### Phase 3: Identify Size Issues **Oversized Components** (candidates for splitting): - Exceeds 30% of total codebase (for small apps with <10 components) - Exceeds 10% of total codebase (for large apps with >20 components) - More than 2 standard deviations above mean - Contains multiple distinct functional areas **Undersized Components** (candidates for consolidation): - Less than 1% of codebase (may be too granular) - Less than 1 standard deviation below mean - Contains only a few files with minimal functionality **Well-Sized Components**: - Between 1-2 standard deviations from mean - Represents a single, cohesive functional area - Appropriate percentage for application size ## Output Format ### Component Inventory Table ```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**: - ✅ OK: Well-sized (within 1-2 std dev from mean) - ⚠️ Too Large: Exceeds size threshold or >2 std dev above mean - 🔍 Too Small: <1% of codebase or <1 std dev below
Audit and improve web accessibility following WCAG 2.1 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible". Do NOT use for SEO (use seo), performance (use core-web-vitals), or comprehensive site audits covering multiple areas (use web-quality-audit).
When the user wants to build an AI-powered outreach system, write cold emails, improve deliverability, or scale personalized outreach. Also use when the user mentions 'cold email,' 'cold outreach,' 'outreach automation,' 'Instantly,' 'Smartlead,' 'Clay,' 'email sequences,' 'deliverability,' 'personalization at scale,' 'reply rate,' or 'outreach stack.' This skill covers the complete AI cold outreach system from signal detection through conversion. Do NOT use for technical implementation, code review, or software architecture.
When the user wants to price an AI product, choose a charge metric, design pricing tiers, or optimize margins. Also use when the user mentions 'AI pricing,' 'usage-based pricing,' 'consumption pricing,' 'outcome pricing,' 'BYOK,' 'bring your own key,' 'per-seat pricing,' 'pricing tiers,' 'AI margins,' 'cost per token,' or 'pricing model.' This skill covers pricing strategy, packaging, and margin management for AI-native products. Do NOT use for technical implementation, code review, or software architecture.
When the user wants to deploy AI sales development reps, automate sales qualification, build signal-to-action routing, or design AI agent architecture for sales. Also use when the user mentions 'AI SDR,' 'AI sales agent,' 'automated qualification,' 'signal routing,' 'sales automation,' '11x,' 'Artisan,' 'AiSDR,' 'AI BDR,' or 'autonomous sales.' This skill covers AI SDR deployment, qualification automation, and agent architecture for sales development. Do NOT use for technical implementation, code review, or software architecture.
When the user wants to build programmatic SEO with AI, create competitor alternative pages, optimize for AI Overviews, or scale content production. Also use when the user mentions 'SEO,' 'programmatic SEO,' 'AI content,' 'competitor alternative pages,' 'AI Overviews,' 'search optimization,' 'DataForSEO,' 'content at scale,' 'keyword strategy,' or 'organic traffic.' This skill covers AI-powered SEO strategy from keyword research through programmatic page generation. Do NOT use for technical implementation, code review, or software architecture.
When the user wants to create UGC ad campaigns, recruit UGC creators, generate AI UGC content, or scale with user-generated content. Also use when the user mentions 'UGC,' 'user-generated content,' 'creator ads,' 'Spark Ads,' 'whitelisting,' 'AI UGC,' 'Arcads,' 'Creatify,' 'creator brief,' or 'UGC testing.' This skill covers the UGC growth framework from creator recruitment through AI-powered scaling. Do NOT use for technical implementation, code review, or software architecture.
Expert AWS Cloud Advisor for architecture design, security review, and implementation guidance. Leverages AWS MCP tools for accurate, documentation-backed answers. Use when user asks about AWS architecture, security, service selection, migrations, troubleshooting, or learning AWS. Triggers on AWS, Lambda, S3, EC2, ECS, EKS, DynamoDB, RDS, CloudFormation, CDK, Terraform, Serverless, SAM, IAM, VPC, API Gateway, or any AWS service. Do NOT use for non-AWS cloud providers or general infrastructure without AWS context.
Apply modern web development best practices for security, compatibility, and code quality. Use when asked to "apply best practices", "security audit", "modernize code", "code quality review", or "check for vulnerabilities". Do NOT use for accessibility (use web-accessibility), SEO (use seo), performance (use core-web-vitals), or comprehensive multi-area audits (use web-quality-audit).