Agent skill

Dart Seal Type Hierarchies

by kevmoo in kevmoo/dash_skills

Identify closed type hierarchies that are not declared sealed, and seal them so the compiler can enforce switch exhaustiveness.

Apache-2.0Auto-check passedMobile

Install Dart Seal Type Hierarchies

skills CLI
$ npx skills add kevmoo/dash_skills --skill dart-seal-type-hierarchies -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install kevmoo/dash_skills dart-seal-type-hierarchies --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/kevmoo/dash_skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/dart-seal-type-hierarchies .claude/skills/dart-seal-type-hierarchies && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
dart-seal-type-hierarchies
GitHub stars
147
Token cost
~1.4k tokens
SKILL.md length
653 words
Files
1
Skills in repo
12
Repo updated
First seen
Licence
Apache-2.0

At a glance

Identify closed type hierarchies that are not declared sealed, and seal them so the compiler can enforce switch exhaustiveness.

  • Works in 5 steps: When to use this skill → Why sealing is the correctness move → Detection → …
  • Tasks that involve Cross-platform mobile apps
  • SKILL.md covers 1. When to use this skill, 2. Why sealing is the…, 3. Detection and 4. Applying the change, plus 1 more section
  • Calls dart

What it does

Dart Seal Type Hierarchies is an agent skill from kevmoo/dash_skills. Identify closed type hierarchies that are not declared sealed, and seal them so the compiler can enforce switch exhaustiveness. Covers the same-library requirement, the public-API breaking-change tradeoff, and the migration from is cascades to exhaustive switches.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Mobile, covering Cross-platform mobile apps. It works with Dart. The repository describes itself as: Agent Skills for Dart and Flutter ecosytem. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Cross-platform mobile apps

Example prompts

  • “/dart-seal-type-hierarchies”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. When to use this skill
  2. Why sealing is the correctness move
  3. Detection
  4. Applying the change
  5. Interaction with other skills

What it can do on your machine

Read from SKILL.md and the folder at commit 397a703. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • dart

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Dart Seal Type Hierarchies loads about 1.4k tokens when it runs. Until then it costs about 74 tokens; SKILL.md has 653 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~74
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from kevmoo/dash_skills at commit 397a703, republished under its Apache-2.0 licence (© kevmoo). 653 words, ~1,401 tokens.

Download SKILL.mdSave it as .claude/skills/dart-seal-type-hierarchies/SKILL.md (or your agent's skills folder).
name
dart-seal-type-hierarchies
description
Identify closed type hierarchies that are not declared `sealed`, and seal them so the compiler can enforce switch exhaustiveness. Covers the same-library requirement, the public-API breaking-change tradeoff, and the migration from `is` cascades to exhaustive switches.
key_features
Closed hierarchy detection, Exhaustiveness enforcement, Public API breaking-change analysis

Seal Type Hierarchies

1. When to use this skill

Use this skill when:

  • A package declares an abstract base type whose subtypes are all defined in the same library, but the base type is not marked sealed.
  • Code branches over the members of such a hierarchy with is checks or a non-exhaustive switch, so adding a subtype later fails silently at runtime instead of loudly at compile time.
  • Reviewing a new type hierarchy and deciding whether it should be open to external subtyping.
When NOT to use (Abstention Guardrails)

Do NOT seal a type when:

  • Subtypes span multiple libraries: sealed requires every direct subtype to be declared in the same library as the base type. If subtypes live in other files (and are not part of the same library), the code will not compile. Either move them or leave the hierarchy open.
  • The type is public API and external extension is intended: Sealing a type exported from a published package is a breaking change for any downstream package that extends or implements it. Plugin interfaces, visitor bases, and extension points are meant to be open. Do not seal them to win exhaustiveness.
  • The base type is concrete and instantiated: sealed implies abstract. If callers construct the base type directly, sealing it breaks them, and the fix is a larger refactor than this skill covers.
  • Fewer than two subtypes: A single subtype is specialization, not an algebraic hierarchy. Exhaustiveness checking buys nothing.
  • SDK constraint below 3.0.0: Class modifiers do not exist before Dart 3. Check environment.sdk in pubspec.yaml first.

2. Why sealing is the correctness move

The value is not switch syntax. It is that the compiler starts rejecting incomplete branching:

seal the hierarchy -> exhaustiveness checking -> adding a subtype becomes
a compile error at every switch, instead of a silent fallthrough

An unsealed hierarchy with is cascades is not wrong today. It becomes wrong the moment someone adds a subtype, and nothing tells them which call sites they missed. Sealing is prophylactic: it converts a future runtime bug into a present-day compile error.

This is a different concern from preferring pattern matching for readability. Pattern matching over an unsealed hierarchy is a style choice. Sealing the hierarchy is a correctness guarantee, and the ergonomic payoff is a consequence, not the goal.

Show full SKILL.md (293 more words)Show less

3. Detection

A type is a candidate when all of the following hold:

  1. It is declared abstract and is not already sealed.
  2. It has two or more direct subtypes.
  3. Every direct subtype is declared in the same library as the base type.
  4. Sealing it is not a breaking change: it lives under lib/src/, or is already marked final, or the package is an application rather than a published library.

Conditions 1 through 3 are decidable from the syntax tree. Condition 4 requires knowing the author's intent about the public API and is the part a human or an LLM must confirm.

This detection is not expressible as a single-file regular expression. It is a question about the package-wide type graph: you must collect every type declaration and every extends/implements/with edge before you can tell whether a hierarchy is closed.

4. Applying the change

Before
dart
abstract class Shape {}

class Circle extends Shape {
  final double radius;
  Circle(this.radius);
}

class Square extends Shape {
  final double side;
  Square(this.side);
}

double area(Shape shape) {
  if (shape is Circle) {
    return 3.14159 * shape.radius * shape.radius;
  } else if (shape is Square) {
    return shape.side * shape.side;
  }
  // Silently reached when a new subtype is added.
  throw ArgumentError('Unknown shape: $shape');
}
After
dart
sealed class Shape {}

final class Circle extends Shape {
  final double radius;
  Circle(this.radius);
}

final class Square extends Shape {
  final double side;
  Square(this.side);
}

double area(Shape shape) => switch (shape) {
  Circle(:final radius) => 3.14159 * radius * radius,
  Square(:final side) => side * side,
};

Adding class Triangle extends Shape now produces a compile error at area, naming the missing case. The throw and its unreachable-by-construction error message are gone.

Migration steps
  1. Add sealed to the base type declaration.
  2. Run dart analyze. Every non-exhaustive switch over the hierarchy now reports an error; every subtype declared outside the library reports one too.
  3. Convert is cascades to switch expressions, removing the trailing throw/default that existed only to satisfy the return type.
  4. Consider marking leaf subtypes final to prevent further extension.

5. Interaction with other skills

  • dart-use-pattern-matching / dart-modern-features: apply after sealing. Rewriting an is cascade as a switch over an unsealed type is a readability change only; the same rewrite over a sealed type is checked by the compiler.
  • Do not treat this skill as a reason to seal a hierarchy you do not own the evolution of.

© kevmoo, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/dart-seal-type-hierarchies of kevmoo/dash_skills.

Open the folder on GitHubat commit 397a703

Compare with similar skills

Dart Seal Type Hierarchies next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Dart Seal Type Hierarchies compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Dart Seal Type Hierarchies this skillkevmoo/dash_skills147—~1.4kAutomated safety check: PassApache-2.0
Fjson Dart Bean GeneratorK3vinb5/unyo-app664—~2.2kAutomated safety check: PassBSD-3-Clause
Flutter Riverpod State Managementandrewyng/context-hub14k—~1.1kAutomated safety check: PassMIT
BlocVeryGoodOpenSource/vgv-ai-flutter-plugin170—~2kAutomated safety check: PassMIT
Flutter Dart Code Reviewaffaan-m/ECC277k2 repos~5.8kAutomated safety check: NotesMIT
Signals for Flutterrodydavis/signals.dart819—~1.9kAutomated safety check: PassApache-2.0

Similar skills

  • Generate Dart bean classes from JSON and regenerate serialization helpers using the fjson CLI.

    664 GitHub stars~2.2k tokensUpdated 4 mo ago
    MobileAuto-check passed
  • Guides Flutter state management with Riverpod: choosing provider types, wiring ConsumerWidgets, handling async state and lifecycle, and overriding providers in tests.

    14k GitHub stars~1.1k tokensUpdated 4 mo ago
    MobileAuto-check passed
  • Bloc

    VeryGoodOpenSource/vgv-ai-flutter-plugin

    Best practices for Bloc state management in Flutter/Dart, covering Cubit versus Bloc, event and state naming, sealed classes with Equatable, the Page/View split with BlocProvider, BlocBuilder…

    170 GitHub stars~2k tokensUpdated 5 days ago
    MobileAuto-check passed
  • Library-agnostic Flutter/Dart code review checklist covering widget best practices, state management patterns (BLoC, Riverpod, Provider, GetX, MobX, Signals), Dart idioms, performance…

    277k GitHub starsUsed in 2 repos~5.8k tokens
    MobileAuto-check: notes
  • Signals for Flutter

    rodydavis/signals.dart

    Reference for the signals_flutter package: reactive signals, computed values, effects, async signals and collection signals bound to Flutter widgets.

    819 GitHub stars~1.9k tokensUpdated 27 days ago
    MobileAuto-check passed
  • Taskflow

    MelbourneDeveloper/dart_node

    Build and run the full TaskFlow demo stack (Express backend + React frontend + mobile)

    113 GitHub stars~327 tokensUpdated 27 days ago
    MobileAuto-check: notes

More from kevmoo/dash_skills

All 12 skills in this repo
  • Dart Test Coverage

    kevmoo/dash_skills

    Understand and improve test coverage in a Dart package. An agent skill from kevmoo/dash_skills.

    147 GitHub stars~1.1k tokensUpdated 2 days ago
    Auto-check passed
  • Profile Dart Code

    kevmoo/dash_skills

    Profile Dart command-line applications using the VM Service protocol to capture CPU samples and identify performance bottlenecks.

    147 GitHub stars~1.1k tokensUpdated 2 days ago
    Auto-check passed
  • Dart Best Practices

    kevmoo/dash_skills

    General best practices for Dart development. An agent skill from kevmoo/dash_skills.

    147 GitHub stars~709 tokensUpdated 2 days ago
    Auto-check passed
  • Dart Doc Validation

    kevmoo/dash_skills

    Best practices for validating Dart documentation comments. An agent skill from kevmoo/dash_skills.

    147 GitHub stars~822 tokensUpdated 2 days ago
    Auto-check passed
  • Dart Long Lines

    kevmoo/dash_skills

    Guidelines for handling long lines in Dart code to adhere to the 80-column rule.

    147 GitHub stars~1k tokensUpdated 2 days ago
    Auto-check passed
  • Dart Matcher Best Practices

    kevmoo/dash_skills

    Best practices for using expect and package:matcher. An agent skill from kevmoo/dash_skills.

    147 GitHub stars~1.6k tokensUpdated 2 days ago
    Auto-check passed

Works with

Categories

Questions about Dart Seal Type Hierarchies

What does Dart Seal Type Hierarchies do?

Identify closed type hierarchies that are not declared sealed, and seal them so the compiler can enforce switch exhaustiveness. Dart Seal Type Hierarchies is an agent skill from kevmoo/dash_skills. Identify closed type hierarchies that are not declared sealed, and seal them so the compiler can enforce switch exhaustiveness.

When should I use Dart Seal Type Hierarchies?

Dart Seal Type Hierarchies fits situations like: tasks that involve Cross-platform mobile apps.

How do I install Dart Seal Type Hierarchies in Claude Code?

Run `npx skills add kevmoo/dash_skills --skill dart-seal-type-hierarchies -a claude-code`. Or copy the skill folder (skills/dart-seal-type-hierarchies in kevmoo/dash_skills) into .claude/skills/dart-seal-type-hierarchies in your project. Claude Code loads it when a task matches its description.

How do I install Dart Seal Type Hierarchies in Codex?

Run `npx skills add kevmoo/dash_skills --skill dart-seal-type-hierarchies -a codex`. Or copy the skill folder (skills/dart-seal-type-hierarchies in kevmoo/dash_skills) into .agents/skills/dart-seal-type-hierarchies in your project. Codex loads it when a task matches its description.

Can I use Dart Seal Type Hierarchies in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add kevmoo/dash_skills --skill dart-seal-type-hierarchies -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/dart-seal-type-hierarchies, .gemini/skills/dart-seal-type-hierarchies, .github/skills/dart-seal-type-hierarchies and .opencode/skills/dart-seal-type-hierarchies in your project.

What does Dart Seal Type Hierarchies need to run?

Going by SKILL.md and its folder, Dart Seal Type Hierarchies needs the command-line tools its instructions call (dart).

Does Dart Seal Type Hierarchies access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Dart Seal Type Hierarchies safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Dart Seal Type Hierarchies use?

Dart Seal Type Hierarchies is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Dart Seal Type Hierarchies use?

About 1.4k tokens (SKILL.md is roughly 5.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Dart Seal Type Hierarchies?

Skills that share tags, products or a category with Dart Seal Type Hierarchies: Fjson Dart Bean Generator (K3vinb5/unyo-app, 664 stars), Flutter Riverpod State Management (andrewyng/context-hub, 14k stars), Bloc (VeryGoodOpenSource/vgv-ai-flutter-plugin, 170 stars) and Flutter Dart Code Review (affaan-m/ECC, 277k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Dart Seal Type Hierarchies?

kevmoo (a GitHub user) maintains it in kevmoo/dash_skills, which has 147 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 8, 2026.

Source: kevmoo/dash_skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.