todome / server
AGENTS.md1 starsChanged 7 months agoMITView on GitHub
server/ 配下を編集するときの追加ルール。 新規コードは責務に合う場所へ入れる。 ws/handlers から ai/*、storage/*、github/* を呼ぶ方向はよいが、逆方向の依存は作らない。 変更後は必要に応じてこれを通す。
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/skills/vercel-composition-patterns/AGENTS.mdAGENTS.md
- .agents/skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- .agents/skills/vercel-react-view-transitions/AGENTS.mdAGENTS.md
- client/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- todome-e2e-runnerSkill
- todome-frontend-implementationSkill
- todome-server-implementationSkill
- todome-server-navigatorSkill
- todome-type-lint-runnerSkill
- vercel-composition-patternsSkill
- vercel-react-best-practicesSkill
- vercel-react-view-transitionsSkill
- web-design-guidelinesSkill
The file
Files
Server Rules
server/ 配下を編集するときの追加ルール。
構造
新規コードは責務に合う場所へ入れる。
server/index.ts:Bun.serve/ Hono の組み立て、静的配信、/wsの upgradeserver/config.ts: 環境変数とパス定数server/db.ts: SQLite 初期化とスキーママイグレーションserver/state.ts:SessionStateと共有グローバルserver/storage/:bun:sqliteを直接使う I/Oserver/ai/: Claude Agent SDK ラッパーserver/github/: gh/git 連携server/ws/endpoint.ts:open/message/closeの dispatch ループserver/ws/handlers/: メッセージ種別ごとのハンドラserver/types.ts/server/utils/: 型とユーティリティ
ws/handlers から ai/*、storage/*、github/* を呼ぶ方向はよいが、逆方向の依存は作らない。
WebSocket メッセージ
- メッセージは
{"type":"xxx", ...}の JSON。新規typeを追加したらclient/src/types.tsのWSMessageunion にも追加する。 - サーバーからの送信は
broadcast()とsendTo()を使う。ws.send(JSON.stringify(...))を直接増やさない。 - 状態変更後は対応する
*_syncイベントをブロードキャストする。 - 新規
typeを追加したらserver/ws/handlers/index.tsの登録も更新する。
DB
- SQLite パスは
getDbPath()経由で取得する。 - スキーマ変更時は
initDb()のCREATE TABLE IF NOT EXISTSと必要な migration を更新する。 - 書き込み後は
scheduleAutosync()を呼び、GitHub 自動同期の流れを壊さない。 - GitHub pull 後の再ロード要件があるので、
wsNeedsReload周りの前提を崩さない。
Claude Agent SDK
@anthropic-ai/claude-agent-sdkのquery()を使う既存方針を保つ。- tool permission は既存実装どおり即時許可の流れを崩さない。
.ts編集でbun --watchが再起動する前提があるため、監視対象や配置を変えるときはstart.shへの影響も確認する。
テスト
- 単体テストは
bun:testを使い、server/**/*.test.tsに置く。 - データ処理、状態遷移、保存/ロード、マイグレーション、AI 応答の変換層を直したら、必ず回帰テストを足す。
- タスク、目標、プロフィール、振り返りなど複数データ型をまたぐ処理では、対象データだけでなく無関係な他データが変更されていないことも明示的に assert する。
- 入力オブジェクトや配列の非破壊性もテストする。
- 壊れた JSON、存在しないキー、空配列、非配列入力などの異常系で既存データが温存されることも確認する。
- テストデータは
makeTask、makeGoal、makeProfileのようなファクトリ関数で短く組み立てる。
チェック
変更後は必要に応じてこれを通す。
bunx tsc --noEmit
cd client && npx tsc -b && npm run lint
bun run testDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

