@mizchi/vibe-scratch-workflow
A`vibe new` から `vibe shell-stdin --restore` で scratch-db を積み上げ、`finalize`/`normalize`/`apply` まで安全に回すための実践手順。
Install
agr install @mizchi/vibe-scratch-workflow --target claudeWrites 12 files into .claude/skills/, pinned to git-a69b0d67.
- .claude/skills/vibe-scratch-workflow/.gitignore
- .claude/skills/vibe-scratch-workflow/.gitmodules
- .claude/skills/vibe-scratch-workflow/AGENTS.md
- .claude/skills/vibe-scratch-workflow/CLAUDE.md
- .claude/skills/vibe-scratch-workflow/CONTRIBUTION.md
- .claude/skills/vibe-scratch-workflow/LICENSE
- .claude/skills/vibe-scratch-workflow/README.md
- .claude/skills/vibe-scratch-workflow/SKILL.md
- .claude/skills/vibe-scratch-workflow/Taskfile.pkl
- .claude/skills/vibe-scratch-workflow/flake.lock
- .claude/skills/vibe-scratch-workflow/flake.nix
- .claude/skills/vibe-scratch-workflow/flaker.toml
Document
name: vibe-scratch-workflow
description: vibe new から vibe shell-stdin --restore で scratch-db を積み上げ、finalize/normalize/apply まで安全に回すための実践手順。
Vibe Scratch Workflow
使う場面
- 新しいライブラリを素早く試作したいとき
.vibeの scratch namespace で段階的に設計を詰めたいときtmp/tmp-hash-*配下で何度も同じ検証を回したいとき
標準フロー
- プロジェクト作成
vibe new tmp/tmp-hash-<id>/my_lib
cd tmp/tmp-hash-<id>/my_lib
- scratch-db を固定する
export VIBE_SCRATCH_DB_PATH="$PWD/.vibe/namespaces/my_lib.db"
shell-stdin --restoreで定義を積み上げる
printf '%s\n' \
'export enum MyType { A; B }' \
'export let f = (x: Int) -> Int { x + 1 }' \
'exit' | vibe shell-stdin --no-prompt --restore
- 追加の式や確認を同じ scratch-db で続ける
printf '%s\n' \
'f(1)' \
'exit' | vibe shell-stdin --no-prompt --restore
- 仕上げ
vibe finalize --db "$VIBE_SCRATCH_DB_PATH" --library --export my_lib.vibe
vibe normalize --write my_lib.vibe
vibe check my_lib.vibe
vibe test my_lib.vibe
vibe fetch my_lib.vibe
vibe apply my_lib.vibe
ベストプラクティス
shell-stdinは--restoreを付けないと空の scratch source から始まる。- 長い式や複数行入力は heredoc /
printf '%s\n' ...でまとめてshell-stdinに渡す。- 直接クオートを重ねるより parse 崩れを起こしにくい。
- scratch-db を明示的に分けたいときは
VIBE_SCRATCH_DB_PATHを固定する。 finalize --libraryは未使用定義と副作用文を落としてからエクスポートできるため、ライブラリ整形の基準にする。- scratch の破棄は
vibe history reset、または対象 DB ファイルの削除で行う。 - エクスポート後の確認は
vibe test my_lib.vibeとvibe symbols --json my_lib.vibeを基準にする。
Qualified Names(修飾名)
@ で始まるパッケージ参照では -(ハイフン)と /(スラッシュ)が識別子の一部として扱われる。
@ なしの場合、- は減算演算子、/ は除算演算子になる。
詳細は docs/language-tour/syntax-reference.vibe.md の "Qualified Names" セクションを参照。
反復デバッグ
- 同じワークフローの連続実行:
pkf run debug-scratch-workflow
- 便利な環境変数:
VIBE_SCRATCH_RUNS=50実行回数VIBE_SCRATCH_KEEP_SUCCESS=1成功ケースも保持VIBE_SCRATCH_CLI_BUILD=debug|release|skipCLI ビルドモード
scratch 反映後の検証
- exported module を lock/apply まで含めて確認する場合:
vibe finalize --db "$VIBE_SCRATCH_DB_PATH" --library --export my_lib.vibe
vibe fetch my_lib.vibe
vibe apply my_lib.vibe
vibe test my_lib.vibe
- scratch-db 自体は中間生成物なので、共有・レビュー対象は
finalize後の.vibeを優先する。
Trustgrade A
- passBody integrity
Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.
- passType matchnot applicable to this artifact type
Whether the artifact is really the kind of thing its metadata claims it is.
- passFreshness
How long since the source repository was last pushed to.
- passPrompt injection
Scans the artifact's own text for instructions aimed at your agent rather than at you.
- passLicense
Whether the source repository declares an SPDX license permissive enough to redistribute.
How the grade is calculated
Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:
- Aevery check passed
- Bone warning
- Ctwo warnings
- Dprompt injection or body integrity failed, or three warnings
- Fone of those failed, and something else is wrong
These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.
Versions
git-a69b0d6736fb2026-07-31