Skillpedia
برمجة عامة7.1k · #13500

component-flattening-analysis

ما الذي تفعله

تفحص هذه المهارة تداخل المجلدات والوحدات في قاعدة الكود، وتجد الفئات الموضوعة في المستوى الخطأ، وتقترح بنية أنظف. وهي مخصصة للمطورين الذين يريدون قاعدة كود منظمة قبل إعادة الهيكلة.

متى تستخدمها

  • ✓عندما تقع فئات طائشة في المستوى الجذري بدل أن تكون داخل مكون.
  • ✓عندما تكون المكونات متداخلة داخل مكونات أخرى وتريد تسطيحها.
  • ✓عندما تريد خطة إعادة هيكلة لتنظيف تسلسل الوحدات.

رابط المهارة

https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(architecture)/component-flattening-analysis/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(architecture)/component-flattening-analysis/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“انظر إلى هيكل المجلدات لدينا، وابحث عن الفئات الموضوعة في المكان الخطأ، واقترح طريقة لإصلاحها.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

يرسم الذكاء الاصطناعي مساحات الأسماء، ويجد الفئات اليتيمة والمكونات المبنية على مكونات أخرى، ويقترح خطوات التسطيح في صورة خطة.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

Component Flattening Analysis

This skill identifies component hierarchy issues and ensures components exist only as leaf nodes in directory/namespace structures, removing orphaned classes from root namespaces.

How to Use

Quick Start

Request analysis of your codebase:

  • "Find orphaned classes in root namespaces"
  • "Flatten component hierarchies"
  • "Identify components that need flattening"
  • "Analyze component structure for hierarchy issues"

Usage Examples

Example 1: Find Orphaned Classes

User: "Find orphaned classes in root namespaces"

The skill will:
1. Scan component namespaces for hierarchy issues
2. Identify orphaned classes in root namespaces
3. Detect components built on top of other components
4. Suggest flattening strategies
5. Create refactoring plan

Example 2: Flatten Components

User: "Flatten component hierarchies in this codebase"

The skill will:
1. Identify components with hierarchy issues
2. Analyze orphaned classes
3. Suggest consolidation or splitting strategies
4. Create refactoring plan
5. Estimate effort

Example 3: Component Structure Analysis

User: "Analyze component structure for hierarchy issues"

The skill will:
1. Map component namespace structure
2. Identify root namespaces with code
3. Find components built on components
4. Flag hierarchy violations
5. Provide recommendations

Step-by-Step Process

  1. Scan Structure: Map component namespace hierarchies
  2. Identify Issues: Find orphaned classes and component nesting
  3. Analyze Options: Determine flattening strategy (consolidate vs split)
  4. Create Plan: Generate refactoring plan with steps
  5. Execute: Refactor components to remove hierarchy

When to Use

Apply this skill when:

  • After gathering common domain components (Pattern 2)
  • Before determining component dependencies (Pattern 4)
  • When components have nested structures
  • Finding orphaned classes in root namespaces
  • Preparing for domain grouping
  • Cleaning up component structure
  • Ensuring components are leaf nodes only

Core Concepts

Component Definition

A component is identified by a leaf node in directory/namespace structure:

  • Leaf Node: The deepest directory containing source files
  • Component: Source code files in leaf node namespace
  • Subdomain: Parent namespace that has been extended

Key Rule: Components exist only as leaf nodes. If a namespace is extended, the parent becomes a subdomain, not a component.

Root Namespace

A root namespace is a namespace node that has been extended:

  • Extended: Another namespace node added below it
  • Example: ss.survey extended to ss.survey.templates
  • Result: ss.survey becomes a root namespace (subdomain)

Orphaned Classes

Orphaned classes are source files in root namespaces:

  • Location: Root namespace (non-leaf node)
  • Problem: No definable component associated with them
  • Solution: Move to leaf node namespace (component)

Example:

ss.survey/              ← Root namespace (extended by .templates)
├── Survey.js           ← Orphaned class (in root namespace)
└── templates/          ← Component (leaf node)
    └── Template.js

Flattening Strategies

Strategy 1: Consolidate Down

  • Move code from leaf nodes into root namespace
  • Makes root namespace the component
  • Example: Move ss.survey.templates → ss.survey

Strategy 2: Split Up

  • Move code from root namespace into new leaf nodes
  • Creates new components from root namespace
  • Example: Split ss.survey → ss.survey.create + ss.survey.process

Strategy 3: Move Shared Code

  • Move shared code to dedicated component
  • Creates .shared component
  • Example: ss.survey shared code → ss.survey.shared

Analysis Process

Phase 1: Map Component Structure

Scan directory/namespace structure to identify hierarchy:

  1. Map Namespace Tree

    • Build tree of all namespaces
    • Identify parent-child relationships
    • Mark leaf nodes (components)
  2. Identify Root Namespaces

    • Find namespaces that have been extended
    • Mark as root namespaces (subdomains)
    • Note which namespaces extend them
  3. Locate Source Files

    • Find all source files in each namespace
    • Map files to their namespace location
    • Identify files in root namespaces

Example Structure Mapping:

## Component Structure Map

ss.survey/ ← Root namespace (extended) ├─

الأسئلة الشائعة

هل يغيّر الكود تلقائيًا؟

مخرجها الأساسي تحليل وخطة إعادة هيكلة تراجعها قبل أي شيء.

هل هي نفسها تحليل الاعتماديات؟

لا. تحليل الاعتماديات تتولاه مهارة تحليل الترابط.

هل تجمع الكود حسب مجال العمل؟

لا. التجميع حسب المجال مهارة منفصلة.

التفاصيل

الوصف الأصلي من المؤلف

Detects misplaced classes and fixes component hierarchy problems — finds code that should belong inside a component but sits at the root level. Use when asking "clean up component structure", "find orphaned classes", "fix module hierarchy", "flatten nested components", or analyzing why namespaces have misplaced code. Do NOT use for dependency analysis (use coupling-analysis) or domain grouping (use domain-identification-grouping).

repo: tech-leads-club/agent-skills

الشعبية

نجوم GitHub
7.1k
الترتيب
#13500
الترخيص
—
آخر تحديث
2‏/11‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة