component-common-domain-detection

4
1
Source

Identifies duplicate domain functionality across components and suggests consolidation opportunities. Use when finding common domain logic, detecting duplicate functionality, analyzing shared classes, planning component consolidation, or when the user asks about common components, duplicate code, or domain consolidation.

Install

mkdir -p .claude/skills/component-common-domain-detection && curl -L -o skill.zip "https://mcp.directory/api/skills/download/3398" && unzip -o skill.zip -d .claude/skills/component-common-domain-detection && rm skill.zip

Installs to .claude/skills/component-common-domain-detection

About this skill

Common Domain Component Detection

This skill identifies common domain functionality that is duplicated across multiple components and suggests consolidation opportunities to reduce duplication and improve maintainability.

How to Use

Quick Start

Request analysis of your codebase:

  • "Find common domain functionality across components"
  • "Identify duplicate domain logic that should be consolidated"
  • "Detect shared classes used across multiple components"
  • "Analyze consolidation opportunities for common components"

Usage Examples

Example 1: Find Common Functionality

User: "Find common domain functionality across components"

The skill will:
1. Scan component namespaces for common patterns
2. Detect shared classes used across components
3. Identify duplicate domain logic
4. Analyze coupling impact of consolidation
5. Suggest consolidation opportunities

Example 2: Detect Duplicate Notification Logic

User: "Are there multiple notification components that should be consolidated?"

The skill will:
1. Find all components with notification-related names
2. Analyze their functionality and dependencies
3. Calculate coupling impact if consolidated
4. Recommend consolidation approach

Example 3: Analyze Shared Classes

User: "Find classes that are shared across multiple components"

The skill will:
1. Identify classes imported/used by multiple components
2. Classify as domain vs infrastructure functionality
3. Suggest consolidation or shared library approach
4. Assess impact on coupling

Step-by-Step Process

  1. Scan Components: Identify components with common namespace patterns
  2. Detect Shared Code: Find classes/files used across components
  3. Analyze Functionality: Determine if functionality is truly common
  4. Assess Coupling: Calculate coupling impact before consolidation
  5. Recommend Actions: Suggest consolidation or shared library approach

When to Use

Apply this skill when:

  • After identifying and sizing components (Pattern 1)
  • Before flattening components (Pattern 3)
  • When planning to reduce code duplication
  • Analyzing shared domain logic across the codebase
  • Preparing for component consolidation
  • Identifying candidates for shared services or libraries

Core Concepts

Domain vs Infrastructure Functionality

Domain Functionality (candidates for consolidation):

  • Business processing logic (notification, validation, auditing, formatting)
  • Common to some processes, not all
  • Examples: Customer notification, ticket auditing, data validation

Infrastructure Functionality (usually not consolidated here):

  • Operational concerns (logging, metrics, security)
  • Common to all processes
  • Examples: Logging, authentication, database connections

Common Domain Patterns

Common domain functionality often appears as:

  1. Namespace Patterns: Components ending in same leaf node

    • *.notification, *.audit, *.validation, *.formatting
    • Example: TicketNotification, BillingNotification, SurveyNotification
  2. Shared Classes: Same class used across multiple components

    • Example: SMTPConnection used by 5 different components
    • Example: AuditLogger used by multiple domain components
  3. Similar Functionality: Different components doing similar things

    • Example: Multiple components sending emails with slight variations
    • Example: Multiple components writing audit logs

Consolidation Approaches

Shared Service:

  • Common functionality becomes a separate service
  • Other components call this service
  • Good for: Frequently changing logic, complex operations

Shared Library:

  • Common code packaged as library (JAR, DLL, npm package)
  • Components import and use the library
  • Good for: Stable functionality, simple utilities

Component Consolidation:

  • Merge multiple components into one
  • Good for: Highly related functionality, low coupling impact

Analysis Process

Phase 1: Identify Common Namespace Patterns

Scan component namespaces for common leaf node names:

  1. Extract leaf nodes from all component namespaces

    • Example: services/billing/notificationnotification
    • Example: services/ticket/notificationnotification
  2. Group by common leaf nodes

    • Find components with same leaf node name
    • Example: All components ending in .notification
  3. Filter out infrastructure patterns

    • Exclude: .util, .helper, .common (usually infrastructure)
    • Focus on: .notification, .audit, .validation, .formatting

Example Output:

## Common Namespace Patterns Found

**Notification Components**:

- services/customer/notification
- services/ticket/notification
- services/survey/notification

**Audit Components**:

- services/billing/audit
- services/ticket/audit
- services/survey/audit

Phase 2: Detect Shared Classes

Find classes/files used across multiple components:

  1. Scan imports/dependencies in each component

    • Track which classes are imported from where
    • Note classes used by multiple components
  2. Identify shared classes

    • Classes imported by 2+ components
    • Exclude infrastructure classes (Logger, Config, etc.)
  3. Classify as domain vs infrastructure

    • Domain: Business logic classes (SMTPConnection, AuditLogger)
    • Infrastructure: Technical utilities (Logger, DatabaseConnection)

Example Output:

## Shared Classes Found

**Domain Classes**:

- `SMTPConnection` - Used by 5 components (notification-related)
- `AuditLogger` - Used by 8 components (audit-related)
- `DataFormatter` - Used by 3 components (formatting-related)

**Infrastructure Classes** (exclude from consolidation):

- `Logger` - Used by all components (infrastructure)
- `Config` - Used by all components (infrastructure)

Phase 3: Analyze Functionality Similarity

For each group of common components:

  1. Examine functionality

    • Read source code of each component
    • Identify what each component does
    • Note similarities and differences
  2. Assess consolidation feasibility

    • Are differences minor (configurable)?
    • Can differences be abstracted?
    • Is functionality truly the same?
  3. Calculate coupling impact

    • Count incoming dependencies (afferent coupling) before consolidation
    • Estimate incoming dependencies after consolidation
    • Compare total coupling levels

Example Analysis:

## Functionality Analysis

**Notification Components**:

- CustomerNotification: Sends billing notifications
- TicketNotification: Sends ticket assignment notifications
- SurveyNotification: Sends survey emails

**Similarities**: All send emails to customers
**Differences**: Email content/templates, triggers

**Consolidation Feasibility**: ✅ High

- Differences are in content, not mechanism
- Can be abstracted with templates/context

Phase 4: Assess Coupling Impact

Before recommending consolidation, analyze coupling:

  1. Calculate current coupling

    • Count components using each notification component
    • Sum total incoming dependencies
  2. Estimate consolidated coupling

    • Count components that would use consolidated component
    • Compare to current total
  3. Evaluate coupling increase

    • Is consolidated component too coupled?
    • Does it create a bottleneck?
    • Is coupling increase acceptable?

Example Coupling Analysis:

## Coupling Impact Analysis

**Before Consolidation**:

- CustomerNotification: Used by 2 components (CA = 2)
- TicketNotification: Used by 2 components (CA = 2)
- SurveyNotification: Used by 1 component (CA = 1)
- **Total CA**: 5

**After Consolidation**:

- Notification: Used by 5 components (CA = 5)
- **Total CA**: 5 (same!)

**Verdict**: ✅ No coupling increase, safe to consolidate

Phase 5: Recommend Consolidation Approach

Based on analysis, recommend approach:

Shared Service (if):

  • Functionality changes frequently
  • Complex operations
  • Needs independent scaling
  • Multiple deployment units will use it

Shared Library (if):

  • Stable functionality
  • Simple utilities
  • Compile-time dependency acceptable
  • No need for independent deployment

Component Consolidation (if):

  • Highly related functionality
  • Low coupling impact
  • Same deployment unit acceptable

Output Format

Common Domain Components Report

## Common Domain Components Found

### Notification Functionality

**Components**:

- services/customer/notification (2% - 1,433 statements)
- services/ticket/notification (2% - 1,765 statements)
- services/survey/notification (2% - 1,299 statements)

**Shared Classes**: SMTPConnection (used by all 3)

**Functionality Analysis**:

- All send emails to customers
- Differences: Content/templates, triggers
- Consolidation Feasibility: ✅ High

**Coupling Analysis**:

- Before: CA = 2 + 2 + 1 = 5
- After: CA = 5 (no increase)
- Verdict: ✅ Safe to consolidate

**Recommendation**: Consolidate into `services/notification`

- Approach: Shared Service
- Expected Size: ~4,500 statements (5% of codebase)
- Benefits: Reduced duplication, easier maintenance

Consolidation Opportunities Table

## Consolidation Opportunities

| Common Functionality | Components   | Current CA | After CA | Feasibility | Recommendation                |
| -------------------- | ------------ | ---------- | -------- | ----------- | ----------------------------- |
| Notification         | 3 components | 5          | 5        | ✅ High     | Consolidate to shared service |
| Audit                | 3 components | 8          | 12       | ⚠️ Medium   | Consolidate, monitor coupling |
| Validation           | 2 components | 3          | 3        | ✅ High     | Consolidate to shared library |

Detailed Consolidation Plan

## Consolidation Plan

### Priority: High

**Notification Components** → `services/notification`

**Step

---

*Content truncated.*

accessibility

tech-leads-club

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".

10727

perf-lighthouse

tech-leads-club

Run Lighthouse audits locally via CLI or Node API, parse and interpret reports, set performance budgets. Use when measuring site performance, understanding Lighthouse scores, setting up budgets, or integrating audits into CI. Triggers on: lighthouse, run lighthouse, lighthouse score, performance audit, performance budget.

599

subagent-creator

tech-leads-club

Guide for creating AI subagents with isolated context for complex multi-step workflows. Use when users want to create a subagent, specialized agent, verifier, debugger, or orchestrator that requires isolated context and deep specialization. Works with any agent that supports subagent delegation. Triggers on "create subagent", "new agent", "specialized assistant", "create verifier".

245

tlc-spec-driven

tech-leads-club

Project and feature planning with 4 phases - Specify, Design, Tasks, Implement+Validate. Creates atomic tasks with verification criteria and maintains persistent memory across sessions. Stack-agnostic. Use when: (1) Starting new projects (initialize vision, goals, roadmap), (2) Working with existing codebases (map stack, architecture, conventions), (3) Planning features (requirements, design, task breakdown), (4) Implementing with verification, (5) Tracking decisions/blockers across sessions, (6) Pausing/resuming work. Triggers on "initialize project", "map codebase", "specify feature", "design", "tasks", "implement", "pause work", "resume work".

34

aws-advisor

tech-leads-club

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.

274

domain-analysis

tech-leads-club

Identifies subdomains and suggests bounded contexts in any codebase following DDD Strategic Design. Use when analyzing domain boundaries, identifying business subdomains, assessing domain cohesion, mapping bounded contexts, or when the user asks about DDD strategic design, domain analysis, or subdomain classification.

63

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

1,5741,370

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

1,1161,191

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

1,4181,109

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

1,199751

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

1,157685

pdf-to-markdown

aliceisjustplaying

Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.

1,320617

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.