bp-go
Go ベストプラクティス(moka-core 向け、Go 1.26+)。常駐エージェントループ・LLM クライアント・フィード取得を含む moka-core の実装規約。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Go ベストプラクティス(moka-core 向け、Go 1.26+)。常駐エージェントループ・LLM クライアント・フィード取得を含む moka-core の実装規約。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Rust ベストプラクティス(Plecto WASM フィルタ向け、Edition 2024)。plecto:filter WIT コントラクトを実装する WASM Component Model フィルタの規約とツールチェーン。
Grilling session that challenges your plan against moka-1's documented design decisions (tenets, ADRs) and domain model, sharpens terminology, and updates documentation (CONTEXT.md, ADRs) inline as decisions crystallise. Use when the user wants to stress-test a plan against the project's language and documented decisions, or says 「設計を詰めて」「用語を固めて」「ドキュメントと突き合わせて」.
クリーンアーキテクチャの依存ルールを moka-1 のミニマリズム制約下で適用する指針。レイヤ分割・interface 設計・依存方向の判断基準と、過剰抽象化を避けるガードレールを提供する。
Web調査の方法論。一次ソース(RFC・公式仕様・公式ドキュメント・原論文・ソースコード)を最優先し、検索クエリの多角化・横断的検証(lateral reading)・独立ソースでの三角測量を経て、出典付きで報告する手順。
moka-1 スタックの Docker Compose 操作と compose.yaml の書き方。ワンキック起動・開発ループ・ヘルスチェック・開発機(iGPU/Vulkan)固有設定・トラブルシュート。
Python ベストプラクティス(eval/ 専用、Python 3.14 + uv + Pyrefly + Ruff)。モデル A/B・プロンプト評価スクリプトの規約と再現性の作法。
| name | bp-go |
| description | Go ベストプラクティス(moka-core 向け、Go 1.26+)。常駐エージェントループ・LLM クライアント・フィード取得を含む moka-core の実装規約。 |
cpus: 制限と整合.golangci.yml 先頭に version: "2"。プリセット依存でなく明示的に有効化:
govet, errcheck, staticcheck, revive, testifylint, thelper, paralleltest, sloglint, bodyclose, noctx, errorlint, copyloopvargo fix ./...(1.26 で go vet と同じ解析基盤に刷新)を先に流すcore/
├── cmd/moka/main.go # 薄く: config → deps → 配線 → 起動 → signal 待機
└── internal/
├── feed/ # 取得・正規化・スケジューラ
├── enrich/ # 要約・タグ・埋め込みのキュー
├── rag/ # ハイブリッド検索・Q&A
├── highlight/ # MoA(提案3系統→集約)
├── llm/ # LLM クライアント(唯一の LLM 接点)
├── store/ # pgx + マイグレーション
└── httpapi/ # HTTP ハンドラ
enrich が LLM を使うなら enrich 側に必要最小の interface を書き、llm の具象を注入http.ServeMux(1.22+ のメソッド+パスパターン)。Echo/chi 等は入れない(ミニマリズム)fmt.Errorf("fetch feed %s: %w", url, err)。裸の return nil, err 禁止var ErrFeedGone = errors.New(...) で定義err == ErrX や err.(*T) は不可ctx context.Context。構造体フィールドに保持しないsignal.NotifyContext: main で ctx, stop := signal.NotifyContext(ctx, syscall.SIGINT, syscall.SIGTERM)。エージェントループ・HTTP サーバー・DB プールすべてこの ctx 系譜で graceful shutdowncontext.WithTimeout。フィード取得 30s、LLM は生成長依存なので長め(120s〜)+ キャンセル可能にsync.WaitGroup.Go(1.25+)を使う: wg.Add(1) + go func(){ defer wg.Done() }() の手書きは書かない
var wg sync.WaitGroup
wg.Go(func() { fetchLoop(ctx) })
wg.Go(func() { enrichLoop(ctx) })
wg.Wait()
errgroup.SetLimit: 濃縮ワーカーは LLM の -np スロット数に合わせて制限next_fetch_at は DB が真実、メモリ上のタイマーは再起動で消えてよい設計にgolang.org/x/time/rate の単一 *rate.Limiter(最小間隔 5s、tenets §8-5)をプロセス全体で共有。per-host にしないenrichment_status='failed' に記録して continue。panic・os.Exit に波及させない/v1/chat/completions。SDK・フレームワークは入れない。http.Client は使い回す(コネクションプール)response_format: {type: "json_schema", ...} で llama.cpp の文法制約付き生成を使う。クライアント側は encoding/json でパースするだけ</think> 除去はここで一元化: LFM2.5 系は reasoning-only(tenets §9)。呼び出し側に CoT を漏らさない:
if _, after, found := strings.Cut(raw, "</think>"); found { raw = after }
llm パッケージ内の定数表で管理log パッケージ禁止。JSON ハンドラ + slog.With("feed_id", id) でキー付き。エラーは slog.Any("err", err) でなく "err", err.Error() か slog.Stringdb/schema.sql 編集 → atlas migrate diff → atlas migrate lint。適用は compose の one-shot migrate ジョブ。Go 側に embed.FS マイグレーションや起動時スキーマ検査を書かないvector 型 + HNSW インデックス。ハイブリッド検索は FTS(tsvector)と pgvector の RRF 統合を SQL 側でt.Run + t.Parallel()。アサーションは testify/assert(require は前提条件のみ)t.Context()(1.24+)を使う: テスト内の ctx は context.Background() でなく t.Context()testing/synctest(1.25+ 安定): スケジューラ・backoff・レートリミッタのテストは synctest.Test で仮想時計。実時間 sleep するテストは書かない:
synctest.Test(t, func(t *testing.T) {
go scheduler.Run(t.Context())
time.Sleep(5 * time.Second) // 仮想時間で即時に進む
synctest.Wait()
// assert...
})
httptest.NewServer で json_schema 応答・<think> 付き応答・500・タイムアウトを返すフェイクを立てる。モデルの品質評価は eval/(bp-python)の仕事で、Go のユニットテストに混ぜないGOEXPERIMENT=goroutineleakprofile(1.26 実験)または uber-go/goleak を長期常駐部分のテストにdocs/tenets/moka-tenets.md — 本スキルの「tenets §N」参照はこの文書の節番号