component-common-domain-detection
Skill này làm gì
Skill này để AI quét codebase tìm các quy tắc nghiệp vụ giống nhau lặp lại ở các component khác nhau, rồi gợi ý nơi nên hợp nhất chúng. Phù hợp với lập trình viên lên kế hoạch refactor và muốn ít logic trùng lặp hơn.
Khi nào nên dùng
- ✓Khi bạn hỏi quy tắc nghiệp vụ nào đang được lặp lại giữa các service hoặc module.
- ✓Khi bạn lên kế hoạch refactor và muốn biết những gì có thể gộp lại.
- ✓Khi bạn muốn xem những lớp nào được dùng chung giữa nhiều component.
Liên kết skill
https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(architecture)/component-common-domain-detection/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tìm logic nghiệp vụ bị trùng lặp giữa các service của chúng tôi và gợi ý những gì nên gộp trước.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI lập bản đồ các component, tìm các lớp dùng chung và các quy tắc tương tự, ước tính tác động ghép nối nếu gộp chúng, rồi đề xuất cách hợp nhất.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
- Scan Components: Identify components with common namespace patterns
- Detect Shared Code: Find classes/files used across components
- Analyze Functionality: Determine if functionality is truly common
- Assess Coupling: Calculate coupling impact before consolidation
- 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:
Namespace Patterns: Components ending in same leaf node
*.notification,*.audit,*.validation,*.formatting- Example:
TicketNotification,BillingNotification,SurveyNotification
Shared Classes: Same class used across multiple components
- Example:
SMTPConnectionused by 5 different components - Example:
AuditLoggerused by multiple domain components
- Example:
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:
Extract leaf nodes from all component namespaces
- Example:
services/billing/notification→notification - Example:
services/ticket/notification→notification
- Example:
Group by common leaf nodes
- Find components with same leaf node name
- Example: All components ending in
.notification
Filter out infrastructure patterns
- Exclude:
.util,.helper,
- Exclude:
Câu hỏi thường gặp
Nó có tìm các dòng mã bị sao chép không?
Không. Các công cụ lint phù hợp hơn cho việc đó. Skill này xem logic nghiệp vụ dùng chung giữa các component.
Nó có thay đổi mã của tôi không?
Nhiệm vụ của nó là phân tích và gợi ý hợp nhất, không tự thực hiện thay đổi.
Nó có dùng để kiểm tra phụ thuộc không?
Không. Kiểm tra phụ thuộc do một skill phân tích ghép nối riêng đảm nhận.
Chi tiết
Mô tả gốc của tác giả
Finds duplicate business logic spread across multiple components and suggests consolidation. Use when asking "where is this logic duplicated?", "find common code between services", "what can be consolidated?", "detect shared domain logic", or analyzing component overlap before refactoring. Do NOT use for code-level duplication detection (use linters) or dependency analysis (use coupling-analysis).
Độ phổ biến
- Sao GitHub
- 7.1k
- Vị trí xếp hạng
- #13499
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
component-flattening-analysis
7.1kGiúp agent của bạn tìm mã nằm sai chỗ và làm phẳng các cấu trúc thư mục component lộn xộn, để mỗi phần nằm đúng vị trí.
component-identification-sizing
7.1kGiúp agent của bạn lập bản đồ các phần của codebase và đo kích thước của chúng, để tìm module nên tách trước.
coupling-analysis
7.1kGiúp agent của bạn kiểm tra mức độ phụ thuộc chặt chẽ giữa các phần của codebase, và nên nới lỏng những kết nối nào trước.
decomposition-planning-roadmap
7.1kGiúp agent của bạn lên kế hoạch thứ tự từng bước để chia một ứng dụng lớn thành các service riêng, với ưu tiên và các giai đoạn.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.