component-flattening-analysis
यह क्या करती है
यह स्किल AI से जँचवाती है कि कोडबेस के फ़ोल्डर और मॉड्यूल कैसे नेस्ट हैं, कौन सी क्लासें गलत स्तर पर हैं, और उसके लिए एक साफ़ ढाँचा सुझाती है। यह उन डेवलपर्स के लिए है जो रिफ़ैक्टर से पहले कोडबेस को व्यवस्थित करना चाहते हैं।
कब इस्तेमाल करें
- ✓जब कोडबेस में कुछ क्लासें कंपोनेंट के अंदर की बजाय रूट स्तर पर बिखरी हों।
- ✓जब कंपोनेंट दूसरे कंपोनेंट के अंदर नेस्ट हों और आप उन्हें सीधा करना चाहते हैं।
- ✓जब आप मॉड्यूल की श्रेणीबद्धता साफ़ करने की रिफ़ैक्टर योजना चाहते हैं।
Skill का लिंक
https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(architecture)/component-flattening-analysis/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“हमारी फ़ोल्डर संरचना देखिए, गलत जगह रखी क्लासें ढूँढिए, और उन्हें ठीक करने का तरीका सुझाइए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI namespaces का नक्शा बनाता है, अनाथ क्लासें और दूसरे कंपोनेंट्स पर बने कंपोनेंट्स ढूँढता है, और सीधा करने के चरण योजना के रूप में प्रस्तावित करता है।
तकनीकी सामग्री (मूल 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
- Scan Structure: Map component namespace hierarchies
- Identify Issues: Find orphaned classes and component nesting
- Analyze Options: Determine flattening strategy (consolidate vs split)
- Create Plan: Generate refactoring plan with steps
- 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.surveyextended toss.survey.templates - Result:
ss.surveybecomes 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
.sharedcomponent - Example:
ss.surveyshared code →ss.survey.shared
Analysis Process
Phase 1: Map Component Structure
Scan directory/namespace structure to identify hierarchy:
Map Namespace Tree
- Build tree of all namespaces
- Identify parent-child relationships
- Mark leaf nodes (components)
Identify Root Namespaces
- Find namespaces that have been extended
- Mark as root namespaces (subdomains)
- Note which namespaces extend them
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) ├─
अक्सर पूछे जाने वाले सवाल
क्या यह कोड अपने-आप बदल देता है?
इसका मुख्य नतीजा विश्लेषण और रिफ़ैक्टर योजना है, जिसे आप पहले समीक्षा कर सकते हैं।
क्या यह डिपेंडेंसी विश्लेषण जैसा है?
नहीं। डिपेंडेंसी विश्लेषण coupling analysis स्किल करती है।
क्या यह कोड को बिज़नेस डोमेन के हिसाब से समूहित करता है?
नहीं। डोमेन समूहन एक अलग स्किल है।
जानकारी
लेखक का मूल विवरण
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).
लोकप्रियता
- GitHub स्टार
- 7.1k
- रैंकिंग में स्थान
- #13500
- लाइसेंस
- —
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
component-common-domain-detection
7.1kयह आपके एजेंट को कोडबेस के कई हिस्सों में दोहराए गए बिज़नेस लॉजिक को ढूँढने और उन्हें मिलाने का तरीका सुझाने में मदद करती है।
component-identification-sizing
7.1kयह आपके एजेंट को कोडबेस के हिस्सों का नक्शा बनाने और उनका आकार मापने में मदद करती है, ताकि पता चले कि पहले किस मॉड्यूल को तोड़ना है।
coupling-analysis
7.1kयह आपके एजेंट को जाँचने में मदद करती है कि कोडबेस के हिस्से एक-दूसरे पर कितनी कसकर निर्भर हैं, और पहले कौन से जोड़ ढीले करने चाहिए।
decomposition-planning-roadmap
7.1kयह आपके एजेंट को बड़े ऐप को अलग सर्विसेज़ में तोड़ने के चरण-दर-चरण क्रम की योजना बनाने में मदद करती है, प्राथमिकताओं और चरणों के साथ।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।