sd0x-dev-flow

May 14, 2026 · View on GitHub

sd0x-dev-flow banner

言語: English | 繁體中文 | 简体中文 | 日本語 | 한국어 | Español

Claude Code のための harness レイヤー。

AI がスキップできない品質ゲート。 Claude Code のための AI Agent Harness Engineering の reference implementation — Hook 強制のデュアルレビュー、context compaction を乗り越える state machine ゲート、そして本当に必要な箇所での fail-closed な安全性。

96 bundled · 96 public skills · 15 agents — Claude の context window のわずか ~4%

License: MIT npm

この harness は何をするのか

Harness engineering とは、モデル自体を学習させるのではなく、LLM の周辺にあるすべて(tool loop、context management、hooks、state machine、safety layer)を工学的に構築する分野です。Mitchell Hashimoto が 2026 年 2 月にこの用語を提唱し、Anthropic engineeringMartin Fowler が論考を発表、arXiv 2603.05344 が形式化しています。

sd0x-dev-flow は reference implementation です。以下の各行は、harness の典型的なサブ問題を実際に読める具体的なコードに対応づけています:

#Harness のサブ問題sd0x-dev-flow の実装コード証拠
1Tool loop control/codex-review-fast/precommit の auto-loop、sentinel 駆動で状態遷移rules/auto-loop.md + hooks/post-tool-review-state.sh
2Sentinel-driven state machine✅ Ready / ⛔ Blocked / ✅ All Pass のゲートマーカーを永続状態へパースscripts/emit-review-gate.sh (producer) + hooks/post-tool-review-state.sh (parser)
3Context recovery across compactionSessionStart(compact) 後に [AUTO_LOOP_RESUME] を stdout へ注入hooks/post-compact-auto-loop.sh
4Lifecycle interceptors5 種類の hook event を 8 本のスクリプトへディスパッチ: PreToolUse / PostToolUse / Stop / SessionStart / UserPromptSubmithooks/ (8 scripts) + .claude/settings.json
5Capability-based tool gatingSkill frontmatter の allowed-tools — 例: /ask には Edit/Write が無い95 個の公開 skill のうち 86 個が allowed-tools を宣言
6Defense-in-depth safety5 層構成: pre-edit-guard → commit-msg-guard → pre-push-gate → stop-guard → sidecar fail-closed markerscripts/pre-push-gate.sh + scripts/commit-msg-guard.sh + hooks/stop-guard.sh
7Generator-evaluator splitデュアルレビュー: Codex (primary) + Claude (secondary) を各レビューサイクルで並列ディスパッチrules/codex-invocation.md + rules/auto-loop.md (Dual Review Mode)
8Incremental progress trackingiteration_history.current_round + max_rounds + 収束プラトー検出rules/auto-loop.md (exit conditions + strategic reset)
9Human-in-the-loop safety gates破壊的操作に対する /dev/tty 確認 + AskUserQuestionscripts/pre-push-gate.sh + skills/push-ci/SKILL.md
10Self-improvement loop是正 → lesson として記録 → 3 回以上の再発で rule に昇格rules/self-improvement.md

多くの harness プロジェクトはこれらのうち 2〜4 個しかカバーしません。sd0x-dev-flow は 10 個すべてをカバーしており、単なるツールではなく学習対象として読めるコードになっています。

なぜ sd0x-dev-flow?

ガードレールなしsd0x-dev-flow あり
コンテキストが長いと AI がレビューをスキップHook 強制: stop-guard が未完了レビューをブロック
単一レビューアーが問題を見落とすデュアルディスパッチ: Codex + セカンダリが並列実行
「修正済み」なのに再検証なしAuto-loop: 修正 → 再レビュー → パス → 続行
compact 後にレビュー状態が消失状態追跡: SessionStart hook が再注入

クイックスタート

# プラグインをインストール
/plugin marketplace add sd0xdev/sd0x-dev-flow
/plugin install sd0x-dev-flow@sd0xdev-marketplace

# プロジェクトを設定
/project-setup

1つのコマンドでフレームワーク、パッケージマネージャー、データベース、エントリポイント、スクリプトを自動検出します。ルールとフックのサブセットをインストールします。完全なプラグインには14ルール + 9フックが含まれます。

--lite で CLAUDE.md のみ設定(ルール/フックをスキップ)。

仕組み

flowchart LR
    P["🎯 Plan"] --> B["🔨 Build"]
    B --> G["🛡️ Gate"]
    G --> S["🚀 Ship"]

    P -.- P1["/codex-brainstorm<br/>/feasibility-study<br/>/tech-spec"]
    B -.- B1["/feature-dev<br/>/bug-fix<br/>/codex-implement"]
    G -.- G1["/codex-review-fast<br/>/precommit<br/>/codex-test-review"]
    S -.- S1["/smart-commit<br/>/push-ci<br/>/create-pr<br/>/pr-review"]

Auto-Loop エンジンが品質ゲートを自動的に実行します。コード編集後、レビューコマンドがデュアルレビュー(Codex MCP + セカンダリレビューアーを並列実行)をディスパッチします。Findings は重複排除・重要度正規化後、単一ゲートに集約されます。strict モードでは、Hooks が fail-closed を強制:集約ゲートが未完了なら stop-guard がブロックします。詳細は docs/hooks.md を参照。

詳細:デュアルレビュー シーケンス図
sequenceDiagram
    participant D as Developer
    participant C as Claude
    participant X as Codex MCP
    participant T as Secondary Reviewer
    participant H as Hooks

    D->>C: Edit code
    H->>H: Track file change
    C->>H: emit-review-gate PENDING
    par Dual Review
        C->>X: Codex review (sandbox)
    and
        C->>T: Task(code-reviewer)
    end
    X-->>C: Findings (primary)
    T-->>C: Findings (secondary)
    C->>C: Aggregate + dedup + gate
    C->>H: emit-review-gate READY/BLOCKED

    alt Issues found
        C->>C: Fix all issues
        C->>X: --continue threadId
        X-->>C: Re-verify
    end

    C->>C: /precommit (auto)
    C-->>D: ✅ All gates passed

    Note over H: Strict mode: incomplete gate → blocked

機能スポットライト:デュアルレビューアーキテクチャ

v2.0 では2つの独立したレビューアーを並列でディスパッチします — 単一障害点ゼロ:

レビューアー役割フォールバック
Codex MCPデフォルトでデュアルレビュー、フォールバックモードをサポート利用不可時はシングルレビューモードにフォールバック
セカンダリ(pr-review-toolkit)信頼度スコアリングレビューstrict-reviewer → シングルモード

Findings は重要度正規化(P0-Nit)、重複排除(ファイル + issue キー、±5 行許容)、ソース帰属codex | toolkit | both)されます。

ゲート:✅ Ready または ⛔ Blocked — strict モードでは、未完了ゲート = ブロック。

比較表

機能sd0x-dev-flowgstack汎用プロンプト
強制レビューゲートHook + 動作レイヤー提案のみなし
デュアルレビューアーCodex + セカンダリ(並列)単一 /reviewなし
自動修正ループ修正 → 再レビュー → パス手動なし
マルチエージェントリサーチ/deep-research(3 エージェント)なしなし
敵対的検証ナッシュ均衡ディベートなしなし
自己改善教訓ログ + ルール昇格/retro 統計のみなし
クロスツールサポートCodex/Cursor/WindsurfClaude/Codex/Gemini/CursorN/A

使用に適したケース

適している不向き
Claude Code を使う個人・小規模チームのプロジェクトClaude Code を全く使わないチーム
自動レビューゲートが必要なプロジェクトCI のないワンオフスクリプト
Codex CLI / Cursor / Windsurf ユーザー(skills サブセット)カスタム LLM プロバイダーが必要なプロジェクト
品質ゲートでリグレッションを防ぐリポジトリテストインフラがないリポジトリ

インストール

Codex CLI / その他の AI エージェント

# Agent Skills 標準で個別スキルをインストール
npx skills add sd0xdev/sd0x-dev-flow

# AGENTS.md を生成 + フックをインストール(Claude Code 内で実行)
/codex-setup init
方法対応ツールカバー範囲
プラグインインストールClaude Codeフル(96 bundled skills、フック、ルール、auto-loop)
npx skills addCodex CLI、Cursor、Windsurf、Aiderスキルのみ(96 public skills)
/codex-setup initCodex CLIAGENTS.md カーネル + git フック

必要環境: Claude Code 2.1+ | Codex MCP(オプション — /codex-* スキルに必要;未インストール時はシングルレビューモードにフォールバック)

ワークフロートラック

ワークフローコマンドゲート実行レイヤー
機能開発/feature-dev/verify/codex-review-fast/precommit✅/⛔Hook + 動作レイヤー
バグ修正/issue-analyze/bug-fix/verify/precommit✅/⛔Hook + 動作レイヤー
Auto-Loopコード編集 → /codex-review-fast/precommit✅/⛔Hook
ドキュメントレビュー.md 編集 → /codex-review-doc✅/⛔Hook
プランニング/codex-brainstorm/feasibility-study/tech-spec
オンボーディング/project-setup/repo-intake
ビジュアル:ワークフロー フローチャート
flowchart TD
    subgraph feat ["🔨 Feature Development"]
        F1["/feature-dev"] --> F2["Code + Tests"]
        F2 --> F3["/verify"]
        F3 --> F4["/codex-review-fast"]
        F4 --> F5["/precommit"]
        F5 --> F6["/update-docs"]
    end

    subgraph fix ["🐛 Bug Fix"]
        B1["/issue-analyze"] --> B2["/bug-fix"]
        B2 --> B3["Fix + Regression test"]
        B3 --> B4["/verify"]
        B4 --> B5["/codex-review-fast"]
        B5 --> B6["/precommit"]
    end

    subgraph docs ["📝 Docs Only"]
        D1["Edit .md"] --> D2["/codex-review-doc"]
        D2 --> D3["Done"]
    end

    subgraph plan ["🎯 Planning"]
        P1["/codex-brainstorm"] --> P2["/feasibility-study"]
        P2 --> P3["/tech-spec"]
        P3 --> P4["/codex-architect"]
        P4 --> P5["Implementation ready"]
    end

    subgraph ops ["⚙️ Operations"]
        O1["/project-setup"] --> O2["/repo-intake"]
        O2 --> O3["Develop"]
        O3 --> O4["/project-audit"]
        O3 --> O7["/best-practices"]
        O3 --> O5["/risk-assess"]
        O4 --> O6["/next-step --go"]
        O5 --> O6
        O7 --> O6
    end

クックブック

どのスキルをどの順番で組み合わせるかを示す、実践的なシナリオ集です。

シナリオフロードキュメント
リポジトリ初日/project-setup/repo-intake/next-step
新機能の実装/feature-dev/verify/codex-test-review/codex-review-fast/precommit
PR レビューコメントの対応/load-pr-review → 修正 → /codex-review-fast/push-ci
マージ前のセキュリティチェック/codex-security/dep-audit/risk-assess/pre-pr-audit
注目コンボ: 方向性の検証/deep-research/best-practices/feasibility-study/codex-brainstorm
注目コンボ: 敵対的設計/codex-brainstorm(ナッシュ均衡ディベート)→ /codex-architect

全 10 シナリオを見る →

同梱内容

カテゴリ
スキル96 public (96 bundled)/project-setup, /codex-review-fast, /verify, /smart-commit, /deep-research
エージェント15strict-reviewer, verify-app, coverage-analyst, architecture-designer
フック9pre-edit-guard, auto-format, review state tracking, stop guard, namespace hint, post-compact-auto-loop, post-skill-auto-loop, user-prompt-review-guard, session-init
ルール14auto-loop, auto-loop-project, codex-invocation, security, testing, git-workflow, self-improvement, context-management
スクリプト13precommit runner, verify runner, dep audit, namespace hint, skill runner, commit-msg guard, pre-push gate, utils (shared lib), emit-review-gate, build-codex-artifacts, resolve-feature (CLI + shell), feature-resolver, readme-catalog

極小の Context 使用量

Claude の 200k context window のわずか ~4% — 96% はコードに使えます。

コンポーネントトークン数200k に対する割合
ルール(常時読み込み)5.1k2.6%
スキル(オンデマンド)1.9k1.0%
エージェント7910.4%
合計~8k~4%

スキルはオンデマンドで読み込まれます。未使用のスキルはトークンを消費しません。

スキルリファレンス

Skill使用場面
/project-setupプロジェクトの初回設定
/bug-fixバグ修正・Issue 解決
/feature-dev機能のエンドツーエンド実装
/smart-commitスマートグループ化でコミット
/push-ciプッシュ + CI モニタリング
/create-prGitHub PR を作成
/codex-review-fastクイックコードレビュー(diff のみ)
/codex-review-docドキュメント変更のレビュー
/codex-securityOWASP Top 10 セキュリティ監査
/verifyフル検証チェーンの実行
/precommitprecommit 品質ゲート(lint + build + test)
/precommit-fast高速 precommit(lint + test、build なし)
/codex-brainstorm対立型ブレスト(ナッシュ均衡)
/tech-spec技術仕様書の作成
/pr-reviewマージ前の PR セルフレビュー
全 96 public skills

開発 (33)

SkillDescription
/askコンテキスト認識型 Q&A。自動的にコンテキスト情報を収集します。
/bug-fixBug fix workflow.
/bump-versionBump package and plugin version in sync.
/code-explorePure Claude code investigation.
/code-investigateDual-perspective code investigation.
/codex-architectCodex architecture consulting.
/codex-implementImplement features via Codex MCP.
/codex-setupInitialize sd0x-dev-flow infrastructure for Codex CLI and other non-Claude agents.
/create-prCreate or update GitHub PR with gh CLI.
/debugInteractive debugging workflow with hypothesis-driven probe loop.
/deep-exploreMulti-wave parallel code exploration orchestrator.
/epic-mergeスタックされた PR チェーンをエピックブランチへ順次スカッシュマージします。
/feature-devFeature development workflow.
/feature-verifyFeature verification (READ-ONLY, P0-P5).
/git-investigateGit history investigation.
/git-profileGit identity and GPG signing profile manager.
/install-hooksInstall plugin hooks into project .claude/ for persistent use without plugin loaded
/install-rulesInstall plugin rules into project .claude/rules/ for persistent use without plugin loaded
/install-scriptsInstall plugin runner scripts into project .claude/scripts/ for persistent use without plugin loaded
/issue-analyzeGitHub Issue and PR review thread deep analysis with Codex blind verdict.
/jiraJira integration — view issues, generate branches, create tickets, transition status.
/load-pr-reviewLoad GitHub PR review comments into AI session — analyze, triage, plan.
/merge-prepPre-merge analysis and preparation.
/next-stepChange-aware next step advisor.
/post-dev-testPost-development test completion.
/pr-commentPost friendly review comments to a GitHub PR — prepare locally, preview, then submit as atomic review.
/project-setupProject configuration initialization.
/push-ciPush to remote and monitor CI.
/remindLightweight model correction with context-aware rule loading.
/repo-intakeProject initialization inventory (one-time).
/smart-commitSmart batch commit.
/smart-rebaseSmart partial rebase for squash-merge repositories.
/watch-ciMonitor GitHub Actions CI runs until completion.

レビュー (Codex MCP) (14)

SkillDescriptionループサポート
/codex-cli-reviewCode review via Codex CLI with full disk access.-
/codex-code-reviewCode review using Codex MCP.-
/codex-explainExplain complex code via Codex MCP.-
/codex-reviewFull second-opinion using Codex MCP (with lint:fix + build).--continue <threadId>
/codex-review-branchFully automated review of an entire feature branch using Codex MCP-
/codex-review-docReview documents using Codex MCP.--continue <threadId>
/codex-review-fastQuick second-opinion using Codex MCP (diff only, no tests).--continue <threadId>
/codex-securityOWASP Top 10 security review using Codex MCP.--continue <threadId>
/codex-test-genGenerate unit tests for specified functions using Codex MCP-
/codex-test-reviewReview test case sufficiency using Codex MCP, suggest additional edge cases.--continue <threadId>
/doc-reviewDocument review via Codex MCP.-
/security-reviewSecurity review via Codex MCP.-
/seek-verdictIndependent second-opinion verification for any finding.-
/test-reviewTest coverage review via Codex MCP.-

検証 (13)

SkillDescription
/best-practicesIndustry best practices conformance audit with mandatory adversarial debate.
/check-coverageComprehensive assessment of Unit / Integration / E2E three-layer test coverage, identify gaps and provide actionable ...
/dep-auditAudit dependency security risks
/dev-security-auditComprehensive developer workstation security audit — scans for exposed credentials, compromised application data, per...
/necessity-auditNecessity audit for over-designed spec elements.
/pre-pr-auditPre-PR confidence audit with 5-dimension scoring.
/precommitPre-commit checks — lint:fix -> build -> test
/precommit-fastQuick pre-commit checks — lint:fix -> test
/project-auditProject health audit with deterministic scoring.
/risk-assessUncommitted code risk assessment with breaking change detection, blast radius analysis, and scope metrics.
/test-deepContext-aware test orchestration.
/test-healthHolistic test coverage measurement.
/verifyVerification loop — lint -> typecheck -> unit -> integration -> e2e

計画 (16)

SkillDescription
/architectureArchitecture design and documentation.
/codex-brainstormAdversarial brainstorming via Claude+Codex debate.
/deep-analyzeDeep-dive analysis of an initial proposal — research code implementation, produce an actionable roadmap and alternatives
/deep-researchUniversal multi-source research orchestration.
/feasibility-studyFeasibility analysis from first principles.
/fp-briefFirst-principles briefing from technical documents.
/post-dev-recapGuided post-dev recap wrapper — scope detection + doc generation + Q&A.
/project-briefConvert a technical spec into a PM/CTO-readable executive summary.
/recap-askRecap-bounded Q&A follow-up over an existing briefing-recap.
/recap-docPost-development recap document generator with blind-spot detection.
/req-analyzeRequirements analysis — problem decomposition, stakeholder scan, requirement structuring.
/request-trackingRequest tracking knowledge base.
/review-specReview technical spec documents from completeness, feasibility, risk, and code consistency perspectives.
/tech-briefTechnical briefing for developer sharing.
/tech-specTech spec generation and review.
/ui-first-principlesFirst-principles UI/IA reasoning: turns a <scenario> + API field set into JTBD analysis, principle-anchored field-p...

ドキュメント&ツール (20)

SkillDescription
/claude-healthClaude Code config health check + plugin sync.
/contract-decodeEVM contract error and calldata decoder.
/create-requestCreate, update, or scan per-task request tickets for progress tracking.
/de-ai-flavorRemove AI artifacts from documents.
/doc-refactorRefactor documents — simplify without losing information, visualize flows with sequenceDiagram.
/generate-runnerGenerate a customized precommit runner for any ecosystem.
/obsidian-cliObsidian vault integration via official CLI.
/op-sessionInitialize 1Password CLI session for Claude Code.
/portfolioPortfolio system knowledge base.
/pr-reviewPR self-review — review changes, produce checklist, update rules
/pr-summaryList open PRs, filter automation PRs, group by ticket ID, format as Markdown.
/refactorMulti-target refactoring orchestrator.
/runbookGenerate/update feature release runbook
/safe-removeSafely remove plugin assets (skill/agent/rule/script/hook) with dependency detection and reference cleanup.
/sharinganReplicate knowledge from any source as sd0x-dev-flow skill definition.
/simplifyWrap-up refactoring — simplify code, eliminate duplication, preserve behavior
/skill-health-checkValidate skill quality against routing, progressive loading, and verification criteria.
/statusline-configCustomize Claude Code statusline.
/update-docsResearch current code state then update corresponding docs, ensuring docs stay in sync with code.
/zh-twRewrite the previous reply in Traditional Chinese

ルール & フック

14 ルール(常時読み込みの規約)+ 9 フック(自動ガードレール)。

カスタマイズauto-loop-project.md を編集してプロジェクトの auto-loop 動作をオーバーライドできます。プラグイン更新と競合しません — Rule Override Pattern 参照。

ルール、フック、環境変数の完全なリファレンスは docs/rules.mddocs/hooks.md をご覧ください。

カスタマイズ

/project-setup ですべてのプレースホルダーを自動検出・設定するか、.claude/CLAUDE.md を直接編集してください:

プレースホルダー説明
{PROJECT_NAME}プロジェクト名my-app
{FRAMEWORK}フレームワークMidwayJS 3.x, NestJS, Express
{CONFIG_FILE}メイン設定ファイルsrc/configuration.ts
{BOOTSTRAP_FILE}ブートストラップエントリbootstrap.js, main.ts
{DATABASE}データベースMongoDB, PostgreSQL
{TEST_COMMAND}テストコマンドyarn test:unit
{LINT_FIX_COMMAND}Lint 自動修正yarn lint:fix
{BUILD_COMMAND}ビルドコマンドyarn build
{TYPECHECK_COMMAND}型チェックyarn typecheck

ショーケース:マルチエージェントリサーチ

/deep-research を実行すると、2-3 の並列リサーチエージェントが Web ソース、コードベース、コミュニティ知識を横断して調査します — claim registry による統合と条件付き敵対的ディベートを備えています。

特徴内容
エージェント2-3 並列(web + code + community)
統合Claim registry による合意検出
検証条件付き /codex-brainstorm ディベート
スコアリング4 シグナル完全性モデル

詳細ドキュメント

アーキテクチャ

Command (entry) → Skill (capability) → Agent (environment)
  • コマンド:ユーザーが /... で起動
  • スキル:オンデマンドで読み込まれるナレッジベース
  • エージェント:専用ツールを持つ隔離されたサブエージェント
  • フック:自動ガードレール(フォーマット、レビュー状態、ストップガード)
  • ルール:常時有効な規約(自動読み込み)

高度なアーキテクチャの詳細(agentic control stack、制御ループ理論、サンドボックスルール)については docs/architecture.md を参照してください。

コントリビュート

PR を歓迎します。お願い事項:

  1. 既存の命名規約に従う(kebab-case)
  2. スキルに When to Use / When NOT to Use を含める
  3. 危険な操作には disable-model-invocation: true を付与
  4. 提出前に Claude Code でテスト

ライセンス

MIT

Star History

Star History Chart