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

codebase-pattern-analyzer

하는 일

이 스킬은 AI 에이전트가 참고 코드베이스를 읽고 재사용 가능한 구조를 설명하도록 안내합니다. 프로젝트의 구조와 관례를 이해하거나 따라 만들려는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓대형 코드베이스를 복사하기 전에 구성 방식을 이해해야 할 때.
  • ✓서비스 레이어나 API 프록시처럼 특정 패턴 하나를 참고 프로젝트에서 뽑아내고 싶을 때.
  • ✓기존 프로젝트의 관례를 따라야 하는 새 프로젝트를 시작할 때.

스킬 링크

https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/codebase-pattern-analyzer/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

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

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/codebase-pattern-analyzer/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 참고 프로젝트를 살펴보고 컴포넌트, 서비스, API 패턴을 설명해 주세요. 비슷한 앱을 만들 수 있도록 정리해 주세요.”

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

작동 방식

에이전트는 디렉터리 구조를 살펴보고 각 폴더를 컴포넌트, 서비스, 설정, 스타일, 유틸리티, API 레이어 같은 역할로 나눕니다. 그다음 역할별 파일을 읽어 패턴을 쉽고 재사용 가능한 말로 설명합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Codebase Pattern Analyzer

Systematically analyze a reference codebase and extract reusable architectural patterns into structured descriptions. These descriptions become the raw material for new skills (via the skill-template-generator skill).

When to Use

  • You need to understand how a large codebase is structured before replicating it
  • You want to extract a specific pattern (component architecture, service layer, API proxy, etc.) from a reference project
  • You are bootstrapping a new project that should follow the conventions of an existing one

Step 1: Map the Directory Structure

Read the top-level directory and identify the major code zones:

list_dir <project_root>
list_dir <project_root>/src

Classify each directory into one of these roles:

Role Typical Dirs What to Look For
Components src/components/ UI classes, base class inheritance, DOM manipulation
Services src/services/ Data fetching, API calls, circuit breakers, caching
Config src/config/ Constants, panel definitions, API endpoints, feature flags
Styles src/styles/ CSS custom properties, theme variables, grid layout
Utils src/utils/ Helper functions, formatting, DOM utilities
API Layer api/, server/ Serverless functions, route handlers, CORS, proxy logic
Entry Point src/main.ts Bootstrap, panel instantiation, scheduler setup

Step 2: Identify the Component Pattern

Find the base component class (usually the most imported file in components/):

read_file <project_root>/src/components/Panel.ts

Extract these structural elements:

  1. Constructor options interface — what config each component accepts (id, title, className, etc.)
  2. DOM structure — how the element tree is built (header, content area, resize handles)
  3. Lifecycle methods — constructor, destroy, show/hide, refresh
  4. State management — loading/error/content states, fetching guards
  5. Data binding — how data flows from service → render → DOM

Record the pattern as:

COMPONENT PATTERN:
  Base class: [name]
  Options: [list of constructor params]
  DOM tree: [element hierarchy]
  States: [loading, error, content]
  Lifecycle: [init → fetch → render → destroy]
  Key methods: [getElement, showLoading, showError, setContent, refresh, destroy]

Step 3: Identify the Service Layer Pattern

Examine 2-3 service files to find the common structure:

read_file <project_root>/src/services/news.ts
read_file <project_root>/src/services/stock-market.ts

Look for:

  1. Circuit breaker / resilience — retry logic, cooldown, cached fallback
  2. Interface definitions — typed data shapes returned by each service
  3. Fetch pattern — how HTTP calls are made (direct fetch, proxy, batching)
  4. Caching strategy — TTLs, stale-while-revalidate, in-memory cache
  5. Error handling — what happens on failure, default return values

Record as:

SERVICE PATTERN:
  Resilience: [circuit breaker with N failures → cooldown]
  Cache: [in-memory, TTL=Xms]
  Fetch: [browser fetch → /api/... proxy → external API]
  Error: [catch → recordFailure → return default]
  Exports: [async functions, not class instances]

Step 4: Identify the API Proxy Pattern

Read the server-side proxy layer:

list_dir <project_root>/api/
read_file <project_root>/api/_cors.js
read_file <project_root>/api/stocks.ts    # or similar endpoint

Extract:

  1. File-per-endpoint structure — one file per API domain
  2. CORS handling — origin allowlist, preflight response
  3. API key isolation — process.env.* usage, never exposed to frontend
  4. Cache headers — Cache-Control, s-maxage, stale-while-revalidate
  5. Error wrapping — structured JSON errors, never raw upstream responses
  6. Input validation — query parameter checks before upstream call

Step 5: Identify the Styling System

read_file <project_root>/src/styles/main.css   # first 100 lines for CSS variables

Extract:

  1. CSS custom properties — color tokens, font stacks, spacing
  2. Theme structure — dark/light mode switch mechanism
  3. Grid layout — grid-template-columns, auto-fill, minmax() values
  4. Component styles — panel base styles, header, content, scrollbar
  5. Semantic colors — positive/negative, severity levels, status indicators
  6. Typography — font family, sizes, letter-spacing, text-tr
자주 묻는 질문

에이전트는 폴더를 어떻게 나누나요?

흔한 이름과 내용을 바탕으로 컴포넌트, 서비스, API 레이어처럼 각 폴더에 역할을 부여합니다.

결과물은 무엇인가요?

나중에 독립 스킬로 바꿀 수 있는 구조화된 패턴 설명이 나온다고 스킬은 설명합니다.

참고 프로젝트를 바꾸나요?

아니요, 이 스킬은 분석 방법이므로 코드베이스를 편집하지 않고 읽어서 설명합니다.

상세 정보

작성자의 원본 설명

Analyze a reference codebase to discover and extract reusable architectural patterns. Produces structured pattern descriptions that can be turned into standalone skills. This is a meta-skill that bootstraps the skill evolution chain.

repo: HKUDS/AgentPilot

인기도

GitHub 스타
7.8k
순위
#13039
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬