Langsung ke konten
Skillpedia
Pemrograman umum7.8k Β· #13039

codebase-pattern-analyzer

Fungsinya

Skill ini memandu agent AI untuk membaca basis kode referensi dan mendeskripsikan arsitektur yang dapat digunakan kembali. Skill ini ditujukan untuk pengembang yang ingin memahami atau menyalin struktur dan konvensi sebuah proyek.

Kapan dipakai

  • βœ“Saat Anda perlu memahami bagaimana basis kode besar diatur sebelum menyalinnya.
  • βœ“Saat Anda ingin satu pola tertentu, seperti lapisan layanan atau proxy API, diambil dari proyek referensi.
  • βœ“Saat Anda memulai proyek baru yang harus mengikuti konvensi proyek yang sudah ada.

Link skill

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

Salin 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

Gunakan skill ini untuk membantu saya: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/codebase-pattern-analyzer/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œPelajari proyek referensi ini dan deskripsikan pola komponen, layanan, dan API-nya agar saya bisa membangun aplikasi yang serupa.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent memetakan struktur direktori dan mengelompokkan setiap folder ke dalam peran seperti komponen, layanan, konfigurasi, gaya, utilitas, dan lapisan API. Setelah itu agent membaca file di setiap peran untuk mendeskripsikan pola dengan istilah yang sederhana dan dapat digunakan kembali.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum

Bagaimana agent mengelompokkan folder?

Agent memberi setiap folder sebuah peran, seperti komponen, layanan, atau lapisan API, berdasarkan nama dan isinya yang umum.

Apa keluarannya?

Skill ini menghasilkan deskripsi pola yang terstruktur dan nantinya dapat diubah menjadi skill mandiri.

Apakah proyek referensi diubah?

Skill ini adalah metode analisis, jadi agent membaca basis kode untuk mendeskripsikannya tanpa mengeditnya.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
7.8k
Peringkat
#13039
Lisensi
MIT
Diperbarui
1/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa