agentleFS
deretamederetame/Breeze/.agents/skills/dart-use-pattern-matching/SKILL.md

dart-use-pattern-matching

Skill3.1k starsChanged 5 days agoMPL-2.0View on GitHub

Applies Dart 3 pattern matching, switch expressions, and destructuring idiomatically to validate data schemas, handle algebraic data types, and decompose control flow. Use when refactoring complex if-else chains, parsing polymorphic JSON or API responses, destructuring Lists, URI/path segments, String.split() tokens, Records, or Maps, or enforcing exhaustiveness on sealed classes. Don't use for simple boolean conditions, single-variable type promotion (use `is`), or basic collection filtering.

6 other projects use a version of this, 4 of them edited; 4 of 4 edited versions we compared changed its rules; 1 new project in the last 4 weeks, against 1 the 4 before.

How people change it

4 of 4 edited versions changed its rules, and some changes recur.

Of the 4 edited versions we compared: 4 made changes of their own.

Rules people drop

  1. If handling polymorphic payloads or responses: Use switch expressions over map discriminant keys to deserialize into sealed class hierarchies.dropped by 4 of 4
  2. If unpacking multiple fields from an object or MapEntry: Use Object patterns (final Spec(:field1, :field2!) = spec;, for (final MapEntry(:key, :value) in map.entries)) when promoting nullable properties or unpacking 3+ fields used across multiple …dropped by 4 of 4
  3. When checking or promoting a single variable, use standard is checks instead of if-case patterns that introduce shadow aliases.dropped by 4 of 4
  4. When mapping or returning values where both null and a type T are valid and handled identically, match the nullable type T? directly rather than creating redundant null arms.dropped by 4 of 4
  5. Do not use if-case in loops or deserialization to filter elements if malformed data should trigger an error or diagnostic warning.dropped by 4 of 4
  6. Use if (x is T) instead of a switch statement with only 1 case and default: break;.dropped by 4 of 4
  7. Use standard conditional ternary operators (condition ? a : b) instead of switch (condition) { true => a, false => b }.dropped by 4 of 4
  8. Use object or record destructuring when extracting 3+ fields used across multiple statements, iterating MapEntry(:key, :value) in map.entries loops, eliminating a single-use intermediate variable, or promoting nullable fields to local variables (:field! …dropped by 4 of 4

Rules people add

  1. A rule we can't quote: its licence doesn't allow itadded by 4 of 4

We split this file and each edited version into the rules they give an agent and match them by wording. A version that adds no rule of its own and has not changed since this file last did reads as an older text, so what it lacks is not counted as dropped. We keep no past texts of a file, so that is inferred, and an edited version that started from an older text still counts its gaps as drops.

Adopted by

Steady: 1 new project took it in the last 4 weeks, 1× the 4 weeks before.thin data

Week of Sep 20: 0 new projectsWeek of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 1 new projectWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projectsWeek of Nov 8: 1 new project
Sep 2026Oct 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 2 in all, so this is a hint, not a trend.

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

26 rules. 6 are common, 0 are distinctive, and 20 are very specific to this project.

  • 6

    Common

    Most of the 4 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 20

    Very specific

    Tied to their project's names, files or tools. Probably skip.

Licensed with conditions — read it at the source. We count its rules but don't quote them. Read them on GitHub.

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.