dart-use-ffigen skill: generate Dart FFI bindings with package:ffigen
Makes your agent generate Dart bindings for C code with package:ffigen instead of writing them by hand.
- Installs
- 14.8K
- on skills.sh
- Stars
- 3.1K
- on GitHub
- Updated
- Nov 2026
- last repo commit
This skill tells your agent never to hand-write FFI bindings when C headers exist. It adds ffigen as a dev dependency, writes a generator script at tool/ffigen.dart, runs it, and checks the result with dart analyze.
It triggers on writing new FFI bindings, extending C, Objective-C or Swift integrations, or replacing hand-crafted dart:ffi code. It sets rules for where headers and output go, adds a license preamble to generated files, and turns on usage recording so unused native code can be stripped.
Good for
- Dart and Flutter developers wrapping a C library
- Package authors replacing hand-written dart:ffi lookups
- Teams that want generated bindings licensed and placed consistently
Install dart-use-ffigen
Claude Code
- 1
Copy this prompt.
Install the dart-use-ffigen 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
Guide agents to use `package:ffigen` to automatically generate FFI bindings instead of writing them manually. Use this skill when a task involves writing new FFI bindings, extending C/Objective-C/Swift integrations, or replacing hand-crafted `dart:ffi` setups.
Sections in SKILL.md
- Contents
- Introduction
- Constraints
- FFIgen Overview
- 1. FfiGenerator
- 2. Headers
- 3. Functions
- 4. Output
- Step-by-Step Workflow
- Step 1: Check/Add Dependencies
- Step 2: Formulate Paths Dynamically
- Step 3: Write the Script (tool/ffigen.dart)
- Step 4: Run Code Generation
- Step 5: Static Analysis
- Concrete Example: Binding a C Library
- The C Header File (third_party/sqlite/sqlite3.h)
Key facts
- Author
- Flutter team (flutter/agent-plugins; the README says the plugins are maintained by the Flutter team)
- Installs on skills.sh
- 14,842 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 pass
What it includes
Rules for where headers, the generator and output files live
No hand-written bindings when headers exist. Generator at tool/ffigen.dart, third-party headers in third_party/, output under lib/src/third_party/ with a .g.dart extension, and only the symbols you need.
Read ·
ConstraintsRuns dart pub add dev:ffigen
Checks pubspec.yaml for ffigen in dev_dependencies and adds it with the Dart CLI if it is missing.
Runs code ·
Add the dependencyCreates the generator script with FfiGenerator
Resolves paths from Platform.script so it runs from any folder, sets the entry header, an include filter, a license preamble, and recordUse so unused functions can be tree-shaken.
Write ·
Write tool/ffigen.dartRuns dart run tool/ffigen.dart
Generates the .g.dart bindings file, and a record-use mapping file when the package builds native assets.
Try: “Replace the hand-written dart:ffi bindings for sqlite3.h with generated ones.”
Runs code ·
Run the generatorRuns dart analyze and checks the checklist
Lint warnings in generated code are silenced through the preamble. Real compile errors are reported to you to file with dart-lang/native, not fixed by editing the generated file.
Runs code ·
Analyze and verify
From the official docs
Permissions
Low risk
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
It runs a generator script in your package
dart run tool/ffigen.dart executes Dart code the agent wrote and parses your C headers. Read the script before the first run. github.com
It adds a dev dependency
dart pub add dev:ffigen changes pubspec.yaml and fetches from pub.dev. Check the diff before committing. 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, when dart pub add fetches ffigen |
| Scopes |
|
Questions
What does the dart-use-ffigen skill do?
It makes your agent generate Dart FFI bindings with package:ffigen instead of writing dart:ffi lookups by hand. It sets up a generator script, runs it, and verifies the output with dart analyze.
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.
How is it different from dart-setup-ffi-assets?
This skill generates the Dart bindings from C headers. The sibling dart-setup-ffi-assets skill in the same repo compiles or bundles the C code itself with build and link hooks, and its SKILL.md uses FFIgen for the symbol mapping.
Will it edit the generated bindings by hand?
No. If dart analyze shows real errors in the generated file, the SKILL.md says not to edit it. The agent reports the details so you can file an issue at dart-lang/native.
Is it safe to run?
It adds a dev dependency, writes a generator script and generated files in your package, and runs dart commands. Review the diff before you commit. The Watch out list has the details.
Information
updated Nov 2, 2026
- Repository
- flutter/agent-plugins
- Folder
skills/dart-use-ffigen
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-use-ffigen SKILL.md · github.com
- dart-setup-ffi-assets SKILL.md · github.com