dart-setup-ffi-assets skill: compile C code into Dart code assets with hooks
Makes your agent compile or bundle C and C++ code into Dart packages with build and link hooks.
- Installs
- 14.8K
- on skills.sh
- Stars
- 3.1K
- on GitHub
- Updated
- Nov 2026
- last repo commit
This skill makes your agent set up Dart's Native Assets: a hook/build.dart that compiles C sources with package:native_toolchain_c, and an optional hook/link.dart that tree-shakes unused symbols. It also covers a second route that downloads precompiled libraries and checks them against stored hashes.
It triggers on requests such as setting up native assets, compiling C code, bundling dynamic libraries, or writing build.dart and link.dart hooks. Local compilation needs a C compiler on your machine.
Good for
- Dart and Flutter package authors shipping C or C++ code
- Developers who want unused native symbols stripped from release builds
- Teams choosing between local compilation and precompiled downloads
Install dart-setup-ffi-assets
Claude Code
- 1
Copy this prompt.
Install the dart-setup-ffi-assets skill in Claude Code. Run this command: claude plugin marketplace add flutter/agent-plugins claude plugin install dart-flutter@dart-flutter Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Plugin route (Flutter docs): adds all 25 skills the repo has, not only this one, plus the Dart MCP server from the plugin manifest, which runs dart mcp-server. The docs say plugins do not load Flutter rules automatically. Single-skill route: the skills CLI command adds only this skill. Either way the project needs the Dart SDK.
From the vendor's docs. Source.
What's in the skill
When it loads
Guides agents in compiling and packaging C/C++ source code into dynamic or static libraries (Code Assets) using Dart's Native Assets hook system (via hook/build.dart and hook/link.dart utilizing package:hooks and package:native_toolchain_c). Use when a user asks to: 'setup native assets', 'compile C/C++ source code', 'bundle dynamic libraries', 'build native C code', 'link native assets', 'implement build.dart or link.dart hooks', or 'integrate C/C++ interop in Dart/Flutter'. Helps agents avoid manual toolchain orchestration and configures secure hash-validated binary downloads or advanced linker tree-shaking with package:record_use mapping.
Sections in SKILL.md
- Contents
- Introduction
- Constraints
- Native Interop Packages
- Step-by-Step Workflow
- Step 1: Add Dependencies
- Step 2: Define C Specifications
- Step 3: Implement Build and Link Hook Scripts
- Step 4: Run the Hook Cycle
- Choosing an Integration Approach
- Method 1: Local Compilation with Linker Tree-Shaking (Recommended)
- Prerequisite Host Compiler Toolchains
- C Source and Bindings Setup
- Defining the C Library Build Spec
- Implementing hook/build.dart
- Implementing hook/link.dart
Key facts
- Author
- Flutter team (flutter/agent-plugins; the README says the plugins are maintained by the Flutter team)
- Installs on skills.sh
- 14,781 as of 2 Nov 2026
- License
- BSD-3-Clause
- Last commit in the repo
- 2026-11-01
- What is inside
- 1 file (SKILL.md only)
- skills.sh audits
- Gen Agent Trust Hub pass, Socket pass, Snyk fail
What it includes
Runs dart pub add for code_assets, hooks, native_toolchain_c, record_use, ffigen
Adds the hook and toolchain packages from pub.dev, or you declare them in pubspec.yaml.
Runs code ·
Add dependenciesCreates lib/src/c_library.dart as one source of truth
A shared CLibrary spec with the name, asset name and C sources that both hooks read.
Write ·
Define the C libraryhook/build.dart compiles; hook/link.dart strips unused symbols
Recommended route. The build hook compiles with the host toolchain, and the link hook keeps only symbols the Dart code uses, mapped through the FFIgen record-use mapping.
Try: “Set up native assets so my package compiles third_party/foo.c and strips unused functions.”
Runs code ·
Method 1: local compile and tree-shakeDownloads a library and checks its hash before use
The build hook downloads a platform library from a release URL, compares its hash to a stored table, and falls back to local compilation when local_build is set.
Write ·
Method 2: precompiled downloadsdart test, dart build cli, symbol listing and an offline check
Runs dart test, builds a CLI bundle, lists exported symbols with nm or dumpbin to confirm stripping, and repeats the test offline with local_build: true.
Runs code ·
Verification checklist
From the official docs
Permissions
Medium risk
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
The download route bundles binaries from a URL
The build hook downloads a library and checks it against a hash table. The SKILL.md example uses MD5, although it allows MD5 or SHA-256. Prefer SHA-256 and a URL you control. github.com
Hooks run a C compiler during builds
Hooks run on dart run, dart test and builds. Read hook/build.dart before running it, since it executes on your machine. github.com
It suggests installing system tools
The skill lists xcode-select --install and sudo apt install build-essential as prerequisites. Run those yourself if you want them. github.com
The plugin route adds an MCP server and 25 skills
The dart-flutter Claude plugin manifest declares one MCP server, dart-mcp-server, started with `dart mcp-server`, and has no hooks field. The repo also has .agents/hooks.json with Stop hooks that call dart format and dart analyze scripts; the manifest does not reference it. github.com
Technical details
| Turning on read-only | The SKILL.md defines no read-only switch. |
|---|---|
| Talks to | pub.dev, for the dependencies. The release URL you configure, in the precompiled download route |
| Scopes |
|
Questions
What does the dart-setup-ffi-assets skill do?
It makes your agent set up Dart build and link hooks that compile C or C++ code, or download a precompiled library, and package it as a Code Asset with your Dart package.
How do I install it?
Use the install box on this page. It is a single SKILL.md, so adding the skill folder is the whole install. Your project then needs the Dart SDK, and a C compiler for local compilation.
Which route should I pick?
The SKILL.md recommends local compilation with tree-shaking when the C source is in the package. It suggests precompiled downloads when a compiler setup is slow or hard to guarantee. Downloads need network access and an offline fallback.
Do I also need dart-use-ffigen?
The SKILL.md does not name that skill. It uses package:ffigen itself, with a tool/ffigen.dart script and a record-use mapping file. The dart-use-ffigen skill in the same repo covers that generation step in more detail.
Is it safe to run?
It compiles C code on your machine and, in the download route, fetches and bundles binaries from a URL you choose. Check the URL and hashes, and review the diff. The Watch out list has more.
Information
updated Nov 2, 2026
- Repository
- flutter/agent-plugins
- Folder
skills/dart-setup-ffi-assets
Sources
Docs, issue trackers and discussions this page is built from.
Show all 5Hide
- Flutter docs: Get started developing with AI · docs.flutter.dev
- flutter/agent-plugins README · github.com
- dart-flutter Claude plugin manifest · github.com
- dart-setup-ffi-assets SKILL.md · github.com
- dart-use-ffigen SKILL.md · github.com