mcpbeat

Dart Best Practices

hoangnguyen0403/dart-best-practices

Dart code quality conventions: naming, const/final/var hierarchy, single quotes, trailing commas, collection idioms, tear-offs, and import organization. Use only for Dart style-focused changes or reviews; never activate for configuration-only lint setup, unrelated feature work, or widget tests.

1k tokens
context cost
the whole folder, loaded on every use
2
files
instructions only
0
copies elsewhere
how many repositories repackaged it
536
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/HoangNguyen0403/agent-skills-standard --skill dart-best-practices

What comes with it

3 264 bytes besides the instruction
evals/evals.json

The instruction itself

3 sections, as written by the author

Dart Best Practices

Priority: P1 (HIGH)

  • Scoping:
  • No global variables.
  • Private globals (if required) must start with _.
  • Immutability: Use const > final > var.
  • Config: Use --dart-define for secrets. Never hardcode API keys.
  • Naming: Follow effective-dart (PascalCase classes, camelCase members).
  • Strings: Prefer single quotes; use double quotes only for interpolation needs.
  • Trailing Commas: Always use trailing commas for multi-line literals/params.
  • Expression Bodies: Prefer => for single-expression functions/getters.
  • Collections:
  • Use .map, .where, .fold, .any over manual loops when clarity improves.
  • Type empty collections (<String>[], <String, User>{}) to avoid dynamic.
  • Use collection if/for and spread operators for composable lists/maps.
  • Async: Always await futures unless intentionally fire-and-forget.
import 'models/user.dart'; // Good
import 'package:app/models/user.dart'; // Avoid local absolute

Anti-Patterns

  • No var for non-obvious types: Use final or explicit type; var only for locally-obvious short scopes.
  • No package imports within same package: Use relative imports for intra-package files.
  • No top-level mutable state: Encapsulate in class or inject via DI.
  • No anonymous lambdas for tear-offs: Prefer list.forEach(doSomething) over anonymous form.

How to use it

Copy the folder

Take hoangnguyen0403/dart-best-practices from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.