AgentSkillsCN

efficient-codebase-nav

Sonic Flow 代码库探索指南。适用于在清理缓存后探索代码库,或定位特定领域代码时。触发条件包括:代码库导航、文件查找、架构理解等。

SKILL.md
--- frontmatter
name: efficient-codebase-nav
description: Sonic Flow コードベース探索ガイド。Use when exploring the codebase, after /clear, or when locating domain-specific code. Triggers include codebase navigation, file discovery, architecture understanding.

「efficient-codebase-navを起動します」と表示する。

Entry Points

レイヤーファイル役割
Main Processelectron/main.tsBrowserWindow作成、dev/prod分岐
Preloadelectron/preload.tscontextBridge、チャンネルホワイトリスト
Rendererfrontend/src/main.tsxProvider stack、React root

ディレクトリマップ

Electron (メインプロセス)

code
electron/
├── main.ts, preload.ts
├── database/
│   ├── db.ts              # SQLite singleton
│   ├── migrations.ts      # V1-V13
│   └── *Repository.ts     # データアクセス (10個)
├── ipc/
│   ├── registerAll.ts     # 全ハンドラ一括登録
│   └── *Handlers.ts       # ドメイン別 (14個)
└── services/
    ├── aiService.ts        # Gemini API
    └── safeStorageService.ts

Frontend (レンダラー)

code
frontend/src/
├── main.tsx, App.tsx
├── components/            # UIコンポーネント
├── context/               # Context + Provider (7個)
├── hooks/                 # カスタムフック
├── services/              # DataService抽象化
│   ├── DataService.ts     # インターフェース
│   ├── ElectronDataService.ts  # IPC実装
│   └── dataServiceFactory.ts
├── types/                 # 型定義
├── constants/             # 定数
├── i18n/locales/          # en.json, ja.json
└── test/                  # テストユーティリティ

ドメイン対応表

ドメインContextHookRepositoryIPC prefix
TasksTaskTreeContextuseTaskTreeAPItaskRepositorydb:tasks:*
TimerTimerContextuseTimerContexttimerRepositorydb:timer:*
SoundAudioContextuseLocalSoundMixersoundRepositorydb:sound:*
MemoMemoContextuseMemoContextmemoRepositorydb:memo:*
NoteNoteContextuseNoteContextnoteRepositorydb:notes:*
CalendarCalendarContextuseCalendarscalendarRepositorydb:calendars:*
AIaiSettingsRepositoryai:*
TemplatestemplateRepositorydb:templates:*

DataService フロー

code
Component → Context/Hook → getDataService() → ElectronDataService
  → window.electronAPI.invoke(channel) → preload(whitelist check)
  → ipcMain.handle → Repository → SQLite

探索手順

  1. ドメイン特定: 上の対応表でドメインを特定
  2. Context/Hook確認: frontend/src/context/frontend/src/hooks/
  3. IPC追跡: ElectronDataService.tspreload.ts*Handlers.ts*Repository.ts
  4. 型確認: frontend/src/types/
  5. UI確認: frontend/src/components/ でGlob

/clear 後の回復

  1. .claude/CLAUDE.md を読む(アーキテクチャ全体)
  2. 作業中のドメインのContext → Hook → Repository を読む
  3. 必要に応じて git log --oneline -10 で最近の変更を確認