Run Goldens Rebaselineのロゴ

Run Goldens Rebaseline

コミュニティ
zakariaf
run-goldens-rebaseline

goldenの再ベースライン作成手順を実行します。コミット済みの参照画像を上書きする、唯一認められた方法です。順序を厳守します。まずgolden以外のジオメトリ、コントラスト、a11yのテストを追加して成功させます。次に、コミット済み画像を生成した固定の承認済み環境でのみ再ベースラインを作成します。何もAhemでレンダリングされないようloadAppFonts()を使い、`flutter test --update-goldens --tags golden`を実行します(CIでは実行せず、失敗したパイプラインを成功させるためにも使いません)。その後、変更されたPNGをすべて目視で確認し、テスト名変更や削除で残った孤立ファイルを削除します。画像は変更理由を示す独立したコミットとして登録し、フラグなしでテストスイートを再実行して検証します。これは手動で実行する副作用のあるワークフローです。意図的なビジュアル変更でmatchesGoldenFileが失敗したとき、goldenテストを追加・改名するとき、または誰かが--update-goldensを使おうとしているときに使用します。

Add to TypingMind

概要

公開者zakariaf
リポジトリFlutter-Skills
スキル名run-goldens-rebaseline
スター
64
フォーク
15
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    zakariafがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Run Goldens Rebaseline」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/zakariaf/Flutter-Skills/tree/main/skills/run-goldens-rebaseline
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zakariaf/Flutter-Skills.git /tmp/Flutter-Skills
mkdir -p .claude/skills
cp -r /tmp/Flutter-Skills/skills/run-goldens-rebaseline .claude/skills/run-goldens-rebaseline
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでRun Goldens Rebaselineを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にRun Goldens Rebaselineを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Run Goldens Rebaselineは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Run goldens rebaseline

Blessing a golden overwrites the only record of what the UI used to look like. It is the one operation in the test suite that destroys an assertion instead of running it, so it is a manual, low-freedom, human-run workflow: execute the steps in order, do not improvise, and never run it to make a failure go away.

The two-lane golden strategy, the harness, and why goldens are the weakest visual assertion belong to widget-golden-and-a11y-testing. This skill is only the ritual for changing the baselines.

Non-negotiable rules

  1. A golden failure is a question, not a chore. Before anything is regenerated, answer: did I intend this pixel change? If the answer is not an unambiguous yes for every changed image, the change is a regression and the code is what gets fixed.
  2. Green the real assertions first. Computed geometry, tap-target size, overflow, text-scale, and pure-Dart contrast tests must pass before re-baselining. WHY: a golden cannot assert anything — a blessed screenshot of clipped, unreadable text passes forever. The assertions are the gate; the images are only a diff.
  3. Re-baseline only in the pinned blessing environment. Same OS and same Flutter version that produced the committed images. WHY: font rasterization differs by host, so blessing elsewhere rewrites every image with host noise and permanently breaks the comparison for everyone else.
  4. loadAppFonts() must have run. Without it the real-font lane renders every glyph as an Ahem box and you bless a wall of rectangles that will "pass" forever.
  5. Never --update-goldens in CI, and never to fix a red pipeline. A gate that rewrites the thing it checks asserts nothing (ci-pipeline-and-gates). Blessing is a local, human-reviewed act.
  6. Never bless a flaky golden. A golden that changes without a code change is an environment or animation-settling defect — pump to a settled frame, remove the time-dependence, or delete the golden. Re-blessing hides it until the next run.
  7. Inspect every changed image by eye, individually. Not the count, not the diff stat — the images. WHY: this is the entire review; an unrelated screen that moved is exactly what the ritual exists to catch.
  8. Bless the whole affected set in one pass, never a subset. Blessing only the images you expected to change leaves the others failing and invites a second, unreviewed pass.
  9. Delete the orphans. A renamed or removed golden test leaves its PNG behind forever, and nothing fails. Removing stale files is part of the same change.
  10. The images land as their own commit, in the same PR as the change that moved them, with a message naming what changed and why. WHY: binary blobs mixed into a code commit make the code diff unreadable, and a reviewer cannot tell an intended re-baseline from a smuggled one.

The ordered workflow

  1. Confirm the change is intentional and that the non-golden test suite (geometry, overflow, text-scale, contrast, a11y) is green.
  2. Run the failing goldens once, without the flag, and read the failure output. Flutter writes failures/*_testImage.png, *_masterImage.png, and *_isolatedDiff.png next to the goldens — open the diff before deciding anything.
  3. Confirm you are in the blessing environment (pinned OS + flutter --version matching the one that produced the committed baselines).
  4. Re-baseline, scoped to the golden tag:
    bash
    flutter test --update-goldens --tags golden
    # or a single file while iterating:
    flutter test --update-goldens test/golden/notes_screen_golden_test.dart
  5. List what actually changed and open every one:
    bash
    git status --porcelain -- '*.png'
    An image you did not expect is a regression. Stop, revert the images (git checkout -- <paths>), and fix the code.
  6. Remove orphans — golden files no longer referenced by any test:
    bash
    # Every committed golden whose filename appears in no test source.
    for f in $(git ls-files 'test/**/goldens/*.png'); do
      grep -rq "$(basename "$f")" test --include='*.dart' || echo "orphan: $f"
    done
  7. Delete the failures/ artifacts so they are never committed.
  8. Prove it: re-run the suite WITHOUT the flag.
    bash
    flutter test --tags golden
    Anything still failing means the baseline you just wrote does not reproduce — an unsettled animation, a time-dependent value, or a font that was not loaded.
  9. Commit the images alone, e.g. test(goldens): rebaseline notes screen — row height 40→48 (design review FIX-12).

Verification (blocking — must pass before the PR)

  • flutter test --tags golden is green without --update-goldens, run twice in a row to catch a golden that settles differently between runs.
  • Every changed PNG was opened and matches the intended change; nothing unrelated moved.
  • No failures/ directory, no orphan PNGs, and no --update-goldens anywhere in .github/workflows/.
  • The geometry/contrast/a11y assertions — the ones that can actually fail meaningfully — are still green.

Anti-patterns

  • --update-goldens as the reflex response to a red test — deletes the assertion instead of reading it.
  • Blessing on a different machine or Flutter version than the baselines — rewrites every image with host-specific rasterization; everyone else's suite goes red.
  • Blessing without loadAppFonts() — a wall of Ahem boxes, blessed as truth.
  • --update-goldens in a CI workflow — the gate now asserts nothing, permanently.
  • Committing images together with the code change — the reviewer cannot separate the intended re-baseline from an accidental one.
  • Blessing a subset of the failures — the rest fail on the next run and get blessed unreviewed.
  • Leaving orphan PNGs after renaming a test — dead weight nothing will ever fail on.
  • Re-blessing a golden that keeps drifting — that is a flake to fix, not a baseline to update.
  • Committing failures/*_testImage.png — noise, and it silently doubles as a second set of "reference" images nobody trusts.

Definition of done

  • The visual change was intentional and every changed image was inspected by eye.
  • Non-golden geometry, overflow, text-scale, contrast, and a11y tests were green before re-baselining, and still are.
  • Re-baselined in the pinned blessing environment, with loadAppFonts() in effect.
  • The whole affected set was blessed in one pass; nothing unexpected changed.
  • Orphan goldens deleted; failures/ artifacts removed.
  • flutter test --tags golden passes without the flag, twice in a row.
  • Images committed on their own, in the same PR, with a message naming the cause.
  • No --update-goldens anywhere in CI configuration.

Related skills

  • widget-golden-and-a11y-testing — the two golden lanes, the pumpApp harness, loadAppFonts(), and why goldens are the weakest assertion in the suite.
  • ci-pipeline-and-gates — gates verify and never bless; the pinned-runner rule.
  • design-review-workflow — the review pass that legitimately produces intentional visual changes.
  • design-system-structure — where a token change that moved every golden originated.
  • testing-strategy — the assertions that should be carrying the weight instead.

References

よくある質問

AIスキル「Run Goldens Rebaseline」では何ができますか?

goldenの再ベースライン作成手順を実行します。コミット済みの参照画像を上書きする、唯一認められた方法です。順序を厳守します。まずgolden以外のジオメトリ、コントラスト、a11yのテストを追加して成功させます。次に、コミット済み画像を生成した固定の承認済み環境でのみ再ベースラインを作成します。何もAhemでレンダリングされないようloadAppFonts()を使い、`flutter test --update-goldens --tags golden`を実行します(CIでは実行せず、失敗したパイプラインを成功させるためにも使いません)。その後、変更されたPNGをすべて目視で確認し、テスト名変更や削除で残った孤立ファイルを削除します。画像は変更理由を示す独立したコミットとして登録し、フラグなしでテストスイートを再実行して検証します。これは手動で実行する副作用のあるワークフローです。意図的なビジュアル変更でmatchesGoldenFileが失敗したとき、goldenテストを追加・改名するとき、または誰かが--update-goldensを使おうとしているときに使用します。

TypingMindでRun Goldens Rebaselineを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Run Goldens Rebaselineはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにRun Goldens Rebaselineをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/zakariaf/Flutter-Skills/tree/main/skills/run-goldens-rebaselineを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Run Goldens Rebaselineを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Run Goldens Rebaselineで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもRun Goldens Rebaselineを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Run Goldens Rebaseline」は無料ですか?

はい。zakariafがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇