flutter-error-code-gen

Extract error codes from docs/api/*.md and generate a Dart enum class.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/dus2183-commits/flutter-skills --skill flutter-error-code-gen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flutter-error-code-gen
Source: https://github.com/dus2183-commits/flutter-skills/tree/main/flutter-error-code-gen
Command: npx skills add https://github.com/dus2183-commits/flutter-skills --skill flutter-error-code-gen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill automates turning error-code definitions written in docs/api/*.md into a reusable Dart enum class, preventing magic numbers and ensuring code stays in sync with API contracts.

Core Features & Use Cases

  • Extract error codes from docs/api/*.md and map them to descriptive enum members.
  • Generate Dart enum classes (e.g., {Module}ErrorCodes) under lib/features/{module}/data/error_codes.
  • Use Case: After flutter-api-design defines error codes, automatically produce consistent client-side constants for all modules.

Quick Start

Use this skill to generate a Dart error-code enum from the docs/api module docs.

Frequently Asked Questions about flutter-error-code-gen

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

FAQPage Schema
How do I generate Dart error-code enums from API documentation in a Flutter project?

To generate Dart error-code enums, extract error code tables from docs/api/*.md files and map them to descriptive enum members. This produces a reusable Dart enum class under lib/features/{module}/data/error_codes, replacing magic numbers in controllers and keeping code in sync with API contracts.

What is the best way to prevent magic numbers for API error codes in Flutter controllers?

The best way to prevent magic numbers is to generate a Dart enum class from your API error-code definitions. By extracting codes from docs/api/*.md and mapping them to descriptive enum names, you ensure consistent client-side constants across all Flutter modules.

Can I automatically sync Dart error code enums with API markdown documentation?

Yes, you can sync Dart error code enums by reading docs/api/*.md files to extract error code tables. This process maps the codes to descriptive enum members and outputs a {module}_error_codes.dart file, ensuring your client-side constants match the API contract.

Does generating Dart enums from markdown require any external dependencies or packages?

Generating Dart enums from markdown requires no external dependencies. It reads your existing docs/api/*.md files to extract error code tables and directly outputs the Dart enum class file into your Flutter project structure without needing additional packages.

How do I structure Flutter module files when generating error code enums from API docs?

When generating error code enums, the tool structures files by outputting to lib/features/{module}/data/error_codes/{module}_error_codes.dart. This creates a {Module}ErrorCodes enum class that organizes client-side constants cleanly within each specific feature module.