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가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
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:
- Constructor options interface — what config each component accepts (id, title, className, etc.)
- DOM structure — how the element tree is built (header, content area, resize handles)
- Lifecycle methods — constructor, destroy, show/hide, refresh
- State management — loading/error/content states, fetching guards
- 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:
- Circuit breaker / resilience — retry logic, cooldown, cached fallback
- Interface definitions — typed data shapes returned by each service
- Fetch pattern — how HTTP calls are made (direct fetch, proxy, batching)
- Caching strategy — TTLs, stale-while-revalidate, in-memory cache
- 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:
- File-per-endpoint structure — one file per API domain
- CORS handling — origin allowlist, preflight response
- API key isolation —
process.env.*usage, never exposed to frontend - Cache headers —
Cache-Control,s-maxage,stale-while-revalidate - Error wrapping — structured JSON errors, never raw upstream responses
- 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:
- CSS custom properties — color tokens, font stacks, spacing
- Theme structure — dark/light mode switch mechanism
- Grid layout —
grid-template-columns,auto-fill,minmax()values - Component styles — panel base styles, header, content, scrollbar
- Semantic colors — positive/negative, severity levels, status indicators
- 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.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.