implementing-openapi-in-dart

implementing-openapi-in-dart is a skill for Claude Code, Codex from Poorgramer-Zack/dart-expert-skills. It costs 134 tokens per session (2,138 once invoked), scanned A, original, MIT.

A guide for turning an OpenAPI 3.0 specification—an API description written in JSON or YAML—into a Dart API layer. It uses Dio for network requests and creates typed models, serialisation, repositories, and error handling.

In plain words
What is it for?
Use it to implement Dart and Flutter clients from Swagger or OpenAPI files, create models from schemas, map endpoints to Dio methods, and organise API errors.
Why use it?
It removes the need to manually design API calls and data models from an API document. The resulting layer gives the Flutter app a consistent way to communicate with the server.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to implement Dart and Flutter clients from Swagger or OpenAPI files, create models from schemas, map endpoints to Dio methods, and organise API errors.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/poorgramer-zack/dart-expert-skills/openapi-to-dart
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Poorgramer-Zack/dart-expert-skills --skill openapi-to-dart
Clone the repo
git clone --depth 1 https://github.com/Poorgramer-Zack/dart-expert-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for implementing-openapi-in-dart

README.md
[![agentmods](https://agentmods.dev/badge/skills/poorgramer-zack/dart-expert-skills/openapi-to-dart/github.svg)](https://agentmods.dev/skills/poorgramer-zack/dart-expert-skills/openapi-to-dart)
Your own site
<a href="https://agentmods.dev/skills/poorgramer-zack/dart-expert-skills/openapi-to-dart"><img src="https://agentmods.dev/badge/skills/poorgramer-zack/dart-expert-skills/openapi-to-dart/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for implementing-openapi-in-dart

Your own site · 80×15
<a href="https://agentmods.dev/skills/poorgramer-zack/dart-expert-skills/openapi-to-dart"><img src="https://agentmods.dev/badge/skills/poorgramer-zack/dart-expert-skills/openapi-to-dart.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 134 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,138 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00134 $0.02138
Opus 5 $0.00067 $0.01069
Sonnet 5 $0.00027 $0.00428
Haiku 4.5 $0.00013 $0.00214

Measured 12d ago against content hash 8f88a6de81a9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

implementing-openapi-in-dart scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/openapi-to-dart/SKILL.md · 305 lines

How it starts

The opening of the file, as written. The whole thing — 305 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Implementing OpenAPI 3.0 in Dart

Given an OpenAPI 3.0 spec, implement a type-safe Dart API layer with:

  • Freezed (or Equatable) for models
  • Dio for HTTP with interceptors and error handling
  • json_serializable for JSON serialisation

Process

  1. Read the OpenAPI spec — parse components/schemas for models, paths for endpoints.
  2. Map schemas → Dart models (Freezed or Equatable — see Model Strategy).
  3. Map paths → Dio service methods.
  4. Add a repository layer that wraps the service.
  5. Wire error handling via DioException → domain ApiError.

Dependencies

dependencies:
  dio: ^5.9.2
  freezed_annotation: ^3.1.0   # if using Freezed
  json_annotation: ^4.11.0
  equatable: ^2.0.5             # if using Equatable

dev_dependencies:
  build_runner: ^2.14.1
  freezed: ^3.2.5               # if using Freezed
  json_serializable: ^6.13.1

Directory Structure

lib/
└── data/
    ├── network/
    │   ├── dio_client.dart          # Dio instance + interceptors
    │   ├── api_error.dart           # global error model
    │   └── services/
    │       └── product_service.dart # one file per resource tag
    └── models/
        ├── product.dart
        └── ...

Dio Client Setup

import 'package:dio/dio.dart';

Dio createDioClient({required String baseUrl, String? accessToken}) {
  final dio = Dio(BaseOptions(
    baseUrl: baseUrl,
    connectTimeout: const Duration(seconds: 10),
    receiveTimeout: const Duration(seconds: 10),
    headers: {'Content-Type': 'application/json'},
  ));

  dio.interceptors.add(InterceptorsWrapper(
    onRequest: (options, handler) {
      if (accessToken != null) {
        options.headers['Authorization'] = 'Bearer $accessToken';
      }
      handler.next(options);
    },
    onError: (error, handler) {
      // Convert DioException to domain ApiError before propagating
      handler.next(error);
    },
  ));

  return dio;
}

Model Strategy

Read the full file on GitHub · 305 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 305 lines · 134 tokens per session scan A 8f88a6de81a9

Subscribe to this mod's changes

implementing-openapi-in-dart is a skill published in the GitHub repository Poorgramer-Zack/dart-expert-skills (7 stars, last pushed 1mo ago), licensed MIT. It adds 134 tokens to every session and 2,138 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.