create-flet-example-projects

Converts flat Flet example files into standalone projects with main.py and pyproject.toml metadata.

16.6k|685|Updated Mar 24, 2022
One-click install
npx skills add https://github.com/flet-dev/flet --skill create-flet-example-projects
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-flet-example-projects
Source: https://github.com/flet-dev/flet/tree/main/.agents/skills/create-flet-example-projects
Command: npx skills add https://github.com/flet-dev/flet --skill create-flet-example-projects

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Flet example code often lives as loose flat .py files that cannot be indexed by the Gallery or MCP tooling. This Skill standardizes those examples into runnable, self-contained projects with consistent metadata, mobile-safe layouts, and updated documentation references.

Core Features & Use Cases

  • Project-per-example conversion: Moves flat foo.py files into foo/main.py folders and generates pyproject.toml with Gallery/MCP metadata including categories, controls, layout patterns, and complexity.
  • Code modernization: Wraps content in ft.SafeArea for mobile safety, migrates custom controls to @ft.control style, removes deprecated use_material3 usage, and enforces the ft.run(main) entrypoint.
  • Reference and validation updates: Rewrites docs includes and test imports to the new main.py paths, then validates with compileall and ruff.
  • Use Case: You have an examples/controls/chip folder mixing flat files and partial conversions. Ask the Skill to normalize it, and every example becomes a runnable project with correct metadata, updated docs, and passing lint checks.

Quick Start

Convert the examples in examples/controls/chip to the project-per-example format with pyproject.toml metadata and update all doc references.

Frequently Asked Questions about create-flet-example-projects

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert flat Flet example files into runnable projects?

Move each flat foo.py file into a foo/main.py folder and add a pyproject.toml with [project], [tool.flet.gallery], and [tool.flet.metadata] sections. The Skill automates this conversion, infers metadata from the code, and updates docs references.

What metadata does a Flet example pyproject.toml need for Gallery indexing?

Required fields include [project] name, version, description, requires-python, keywords, authors, and dependencies, plus [tool.flet.gallery].categories and [tool.flet.metadata] with title, controls, layout_pattern, complexity, and features. Add [tool.flet].platforms only when the example is platform-limited.

How do I make Flet examples safe to run on mobile?

Wrap rendered content in a top-level ft.SafeArea, adding expand=True only when needed for correct sizing. Avoid unnecessary page.update() calls when auto-update is active, and end each main.py with if __name__ == "__main__": ft.run(main).

Should Flet examples still use use_material3?

No. The use_material3 flag is deprecated and should be removed from example code along with any toggle UI that only exists to switch it. Update the example pyproject.toml metadata to remove stale Material 3 references as well.

How are Flet examples validated after migration?

Run python -m compileall on changed main.py files and uv run ruff check on changed example files until lint passes. Also search for stale flat-file paths in docs and tests, and confirm SafeArea wrapping and the ft.run entrypoint exist in every example.