Frb cargokit

From fzyzcjy/flutter_rust_bridge · View interactive version

Frb cargokit is an AI agent skill from the GitHub repository fzyzcjy/flutter_rust_bridge. Explain how cargokit is sourced, copied, and analyzed inside flutter_rust_bridge. Use when working on `integration_template/**/cargokit`, `frb_example/**/cargokit`, integrate/generate output drift, or any diff that mentions cargokit and you need to identify the true source of truth before judging th

How to use this skill

Skill file

FRB Cargokit

Overview

Use this skill to avoid mixing together three different things: the external cargokit repository, the template submodule pointers in FRB, and copied cargokit files inside generated examples.

The main job is to determine which layer a change belongs to before analyzing whether the change is correct.

Mental Model

There are two important cargokit forms inside FRB:

  1. External source

FRB depends on an external cargokit repository through git submodules under frb_codegen/assets/integration_template/**/cargokit.

  1. Copied outputs

FRB commands such as integrate/generate often copy concrete cargokit files into frb_example/**/cargokit or frb_example/**/rust_builder/cargokit.

This means a large cargokit diff in examples often does not mean FRB designed a large new cargokit behavior. It may only mean a template or submodule change propagated into copied outputs.

Source Of Truth

Treat these paths as the source of truth when deciding cargokit behavior:

Treat these paths as downstream copies unless the evidence shows otherwise:

Do not start by judging copied example files in isolation. First determine which source submodule pointer or template content produced them.

Synchronizing Copies

Use ./frb_internal sync-cargokit-copies to refresh checked-in Cargokit copies from the template submodules when those copies are not already regenerated by the integrate CI. The command mirrors the Rust integration template writer's Cargokit filtering and copied-file prelude.

Do not add flutter_via_create, flutter_via_integrate, or flutter_package to this sync map; the integrate generation CI already recreates those examples from templates. The CI Generate :: Internal job runs this as part of ./frb_internal generate-internal --set-exit-if-changed --coverage, so the normal generate-internal diff gate also catches Cargokit copy drift. If Cargokit copies drift, fix the source-of-truth template/submodule first when appropriate, run ./frb_internal sync-cargokit-copies, and commit the resulting copied-output refresh.

Diff Analysis Order

When a user asks "what happened to cargokit?" follow this order:

  1. Identify the layer.

Decide whether the diff is a submodule pointer update, a template file change, or copied output churn.

  1. If the change is a submodule pointer update, inspect the two external cargokit commits first.

Compare the old and new submodule SHAs inside the submodule repository before saying anything about the FRB-side diff.

  1. Only then inspect copied example files.

Ask whether they merely reflect the upstream change or whether FRB also introduced independent local edits.

  1. Separate semantic changes from churn.

Distinguish real logic changes from format-only refreshes, lockfile updates, scaffold refreshes, and regenerated outputs.

What To Say Explicitly

When answering, state which of these is true:

If discussing correctness, tie the judgment to the correct layer:

Common Mistakes

Avoid these mistakes:

Scope Boundary

This skill explains ownership, propagation, and diff interpretation.

Use frb-code-generation when you need to know which generation command to run.

Use frb-debugging when generation or cargokit-related behavior is failing and needs deeper investigation.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.