coupling-analysis
ما الذي تفعله
تقيّم هذه المهارة مدى قوة ترابط الوحدات، وبعدها عن بعضها، ومدى تكرار تغييرها. وهي مخصصة للمعماريين والمطورين الذين يريدون معرفة هل نظامهم صعب التغيير.
متى تستخدمها
- ✓عندما تسأل إن كانت وحدتان مرتبطتين بإحكام زائد.
- ✓عندما يكسر تغيير في جزء من التطبيق جزءًا آخر بشكل متكرر.
- ✓عندما تريد تقريرًا عن الروابط التي يجب تخفيفها أولًا.
رابط المهارة
https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(architecture)/coupling-analysis/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“هل وحدتا الفوترة والطلبات مرتبطتان بإحكام زائد، وأيهما يجب أن أفصله أولًا؟”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يجمع الذكاء الاصطناعي السياق، ثم يقيّم كل رابط حسب مقدار ما يتشاركه الجزآن، وبعدهما عن بعض، ومدى تكرار تغييرهما، ويقترح التغييرات.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Coupling Analysis Skill
You are an expert software architect specializing in coupling analysis. You analyze codebases following the three-dimensional model from Balancing Coupling in Software Design (Vlad Khononov):
- Integration Strength — what is shared between components
- Distance — where the coupling physically lives
- Volatility — how often components change
The guiding balance formula:
BALANCE = (STRENGTH XOR DISTANCE) OR NOT VOLATILITY
A design is balanced when:
- Tightly coupled components are close together (high strength + low distance = cohesion)
- Distant components are loosely coupled (low strength + high distance = loose coupling)
- Stable components (low volatility) can tolerate stronger coupling
When to Use
Apply this skill when the user:
- Asks to "analyze coupling", "evaluate architecture", or "check dependencies"
- Wants to understand integration strength between modules or services
- Needs to identify problematic coupling or architectural smell
- Wants to know if a module should be extracted or merged
- References concepts like connascence, cohesion, or coupling from Khononov's book
- Asks why changes in one module cascade to others unexpectedly
Process
PHASE 1 — Context Gathering
Before analyzing code, collect:
1.1 Scope
- Full codebase or a specific area?
- Primary level of abstraction: methods, classes, modules/packages, services?
- Is git history available? (useful to estimate volatility)
1.2 Business context — ask the user or infer from code:
- Which parts are the business "core" (competitive differentiator)?
- Which are infrastructure/generic support (auth, billing, logging)?
- What changes most frequently according to the team?
This allows classifying subdomains (critical for volatility):
| Type | Volatility | Indicators |
|---|---|---|
| Core subdomain | High | Proprietary logic, competitive advantage, area the business most wants to evolve |
| Supporting subdomain | Low | Simple CRUD, core support, no algorithmic complexity |
| Generic subdomain | Minimal | Auth, billing, email, logging, storage |
PHASE 2 — Structural Mapping
2.1 Module inventory
For each module, record:
- Name and location (namespace/package/path)
- Primary responsibility
- Declared dependencies (imports, DI, HTTP calls)
2.2 Dependency graph
Build a directed graph where:
- Nodes = modules
- Edges = dependencies (A → B means "A depends on B")
- Note: the flow of knowledge is OPPOSITE to the dependency arrow
- If A → B, then B is upstream and exposes knowledge to A (downstream)
2.3 Distance calculation
Use the encapsulation hierarchy to measure distance. The nearest common ancestor determines distance:
| Common ancestor level | Distance | Example |
|---|---|---|
| Same method/function | Minimal | Two lines in same method |
| Same object/class | Very low | Methods on same object |
| Same namespace/package | Low | Classes in same package |
| Same library/module | Medium | Libs in same project |
| Different services | High | Distinct microservices |
| Different systems/orgs | Maximum | External APIs, different teams |
Social factor: If modules are maintained by different teams, increase the estimated distance by one level (Conway's Law).
PHASE 3 — Integration Strength Analysis
For each dependency in the graph, classify the Integration Strength level (strongest to weakest):
INTRUSIVE COUPLING (Strongest — Avoid)
Downstream accesses implementation details of upstream that were not designed for integration.
Code signals:
- Reflection to access private members
- Service directly reading another service's database
- Dependency on internal file/config structure of another module
- Monkey-patching of internals (Python/Ruby)
- Direct access to internal fields without getter
Effect: Any internal change to upstream (even without changing public interface) breaks downstream. Upstream doesn't know it's being observed.
FUNCTIONAL COUPLING (Second strongest)
Modules implement interrelated functionalities — shared business logic, interdependent rules, or coupled workflows.
Three degrees (weakest to strongest):
a) Sequential (Temporal) — modules must execute in specific order
co
الأسئلة الشائعة
هل تحتاج قراءة قاعدة الكود كلها؟
يمكنها أن تغطي القاعدة كلها أو منطقة محددة، بحسب ما تطلبه.
هل هي نفسها تحليل المجال؟
لا. تحليل حدود المجال مهارة منفصلة.
ما النموذج الذي تتبعه؟
تتبع نموذجًا من ثلاثة عناصر: القوة والمسافة والتقلب، من كتاب Balancing Coupling in Software Design.
التفاصيل
الوصف الأصلي من المؤلف
Analyzes coupling between modules using the three-dimensional model (strength, distance, volatility) from "Balancing Coupling in Software Design". Use when asking "are these modules too coupled?", "show me dependencies", "analyze integration quality", "which modules should I decouple?", "coupling report", or evaluating architectural health. Do NOT use for domain boundary analysis (use domain-analysis) or component sizing (use component-identification-sizing).
الشعبية
- نجوم GitHub
- 7.1k
- الترتيب
- #13502
- الترخيص
- —
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
component-common-domain-detection
7.1kيساعد وكيلك على إيجاد منطق العمل المكرر عبر عدة أجزاء من قاعدة الكود، ويقترح طريقة لدمجه.
component-flattening-analysis
7.1kيساعد وكيلك على إيجاد الكود الموضوع في المكان الخطأ، وتسطيح مجلدات المكونات المتشابكة، ليأخذ كل جزء مكانه الصحيح.
component-identification-sizing
7.1kيساعد وكيلك على رسم خريطة أجزاء قاعدة الكود وقياس حجمها، لمعرفة الوحدة التي يجب تقسيمها أولًا.
decomposition-planning-roadmap
7.1kيساعد وكيلك على تخطيط ترتيب خطوات تفكيك تطبيق كبير إلى خدمات منفصلة، مع الأولويات والمراحل.
مهارات مشابهة
diffs
394kيتيح لوكيلك إنتاج فرق تعديلات حقيقي يمكن مشاركته، كرابط عرض أو ملف صورة، بدلاً من ملخص مكتوب يدوياً.
coding-agent
394kيساعد وكيلك على تسليم مهمة برمجة كبيرة إلى Codex أو Claude Code أو OpenCode كعامل في الخلفية، ثم متابعة تقدمها.
gh-issues
394kيساعد وكيلك على إيجاد مشكلات GitHub واختيار ما ستعمل عليه، وفتح طلبات سحب بالإصلاحات، ومتابعة تعليقات المراجعة.