Agent skill

Dart Best Practices

General purity standards for Dart development.

Stars 163
Forks 31

Install this agent skill to your Project

npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/best-practices-hoangnguyen0403-agent-skills-standar-3

Metadata

Additional technical details for this skill

labels
dart clean-code
triggers
{
    "files": [
        "**/*.dart"
    ],
    "keywords": [
        "import",
        "final",
        "const",
        "var",
        "global"
    ]
}

SKILL.md

Dart Best Practices

Priority: P1 (OPERATIONAL)

Best practices for writing clean, maintainable Dart code.

  • 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.
dart
import 'models/user.dart'; // Good
import 'package:app/models/user.dart'; // Avoid local absolute

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results