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分で読めます。
仕組み
エージェントは、ディレクトリの構造をマッピングし、各フォルダーを、components、services、config、styles、utils、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
よくある質問
エージェントはフォルダーをどのように分類しますか?
一般的な名前や中身をもとに、components、services、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.8kエージェントが、AIMEやTerminal-Benchなどの標準的なAIベンチマークテストをセットアップして実行し、異なる改善方法を比較できるよう支援します。
experiment-guide
7.8kエージェントが、プログラムを改善する方法を調べる間に、小さな実験を計画し、その結果を読み、発見を記録できるよう支援します。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。