component-flattening-analysis
Fungsinya
Skill ini membuat AI memeriksa bagaimana folder dan modul basis kode bersarang, menemukan kelas yang berada di level yang salah, dan menyarankan struktur yang lebih rapi. Skill ini ditujukan untuk pengembang yang menginginkan basis kode yang tertata sebelum refaktor.
Kapan dipakai
- βSaat basis kode punya kelas yang tercecer di level akar, bukan di dalam sebuah komponen.
- βKetika komponen bersarang di dalam komponen lain dan Anda ingin meratakannya.
- βKetika Anda ingin rencana refaktor untuk merapikan hierarki modul.
Link skill
https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(architecture)/component-flattening-analysis/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βLihat struktur folder kami, temukan kelas yang berada di tempat yang salah, dan sarankan cara memperbaikinya.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
AI memetakan namespace, menemukan kelas yatim dan komponen yang dibangun di atas komponen lain, lalu mengusulkan langkah perataan dalam bentuk rencana.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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) ββ
Pertanyaan umum
Apakah skill ini mengubah kode secara otomatis?
Hasil utamanya adalah analisis dan rencana refaktor yang bisa Anda tinjau terlebih dahulu.
Apakah ini sama dengan analisis dependensi?
Tidak. Analisis dependensi ditangani oleh skill analisis keterikatan.
Apakah skill ini mengelompokkan kode berdasarkan domain bisnis?
Tidak. Pengelompokan domain adalah skill tersendiri.
Detail
Deskripsi asli dari pembuat
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).
Popularitas
- Bintang GitHub
- 7.1k
- Peringkat
- #13500
- Lisensi
- β
- Diperbarui
- 2/11/2026
Komentar
- β¦
Skill lain dari repositori ini
component-common-domain-detection
7.1kMembantu agent Anda menemukan logika bisnis yang berulang di beberapa bagian basis kode dan menyarankan cara menggabungkannya.
component-identification-sizing
7.1kMembantu agent Anda memetakan bagian-bagian basis kode dan mengukur ukurannya, untuk menemukan modul mana yang sebaiknya dipecah lebih dulu.
coupling-analysis
7.1kMembantu agent Anda memeriksa seberapa erat bagian-bagian basis kode saling bergantung, dan koneksi mana yang sebaiknya dilonggarkan lebih dulu.
decomposition-planning-roadmap
7.1kMembantu agent Anda merencanakan urutan langkah untuk memecah aplikasi besar menjadi layanan terpisah, lengkap dengan prioritas dan fase.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.