본문으로 건너뛰기
Skillpedia
일반 코딩7.1k · #13500

component-flattening-analysis

하는 일

이 스킬은 AI가 코드베이스의 폴더와 모듈이 어떻게 중첩되어 있는지 확인하고, 잘못된 단계에 있는 클래스를 찾아 더 깔끔한 구조를 제안하게 합니다. 리팩터링 전에 코드를 정돈하려는 개발자를 위한 것입니다.

사용하는 경우

  • ✓코드베이스의 루트 단계에 제자리를 벗어난 클래스가 있을 때.
  • ✓컴포넌트가 다른 컴포넌트 안에 중첩되어 있어서 평평하게 만들고 싶을 때.
  • ✓모듈 계층을 정리하는 리팩터링 계획이 필요할 때.

스킬 링크

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에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(architecture)/component-flattening-analysis/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“우리 폴더 구조를 살펴보고, 잘못된 위치에 있는 클래스를 찾아 고치는 방법을 제안해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 네임스페이스를 정리하고, 고아 클래스와 다른 컴포넌트 위에 만들어진 컴포넌트를 찾은 다음, 평평하게 만드는 단계를 계획으로 제안합니다.

기술 내용 (원본 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
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬