effective-dart
Linter and style guide tool for idiomatic Dart and Flutter code.
Install
mkdir -p .claude/skills/effective-dart && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18624" && unzip -o skill.zip -d .claude/skills/effective-dart && rm skill.zipInstalls to .claude/skills/effective-dart
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Apply Effective Dart guidelines to write idiomatic, high-quality Dart and Flutter code. Use when writing new Dart code, reviewing pull requests for style compliance, refactoring naming conventions, enforcing type annotations, or running code review checks against Effective Dart standards.Key capabilities
- →Apply Effective Dart guidelines to Dart and Flutter code
- →Refactor naming conventions according to guidelines
- →Enforce type annotations in Dart code
- →Run code review checks against Effective Dart standards
How it works
The skill defines and applies rules for naming, types, style, comments, imports, and usage patterns to Dart and Flutter code.
Inputs & outputs
When to use effective-dart
- →Format Dart code
- →Check naming conventions
- →Refactor for effective dart
- →Review flutter code style
About this skill
Effective Dart Skill
This skill defines how to write idiomatic, high-quality Dart and Flutter code following Effective Dart guidelines.
1. Naming Conventions
| Kind | Convention | Example |
|---|---|---|
| Classes, enums, typedefs, type parameters, extensions | UpperCamelCase | MyWidget, UserState |
| Packages, directories, source files | lowercase_with_underscores | user_profile.dart |
| Import prefixes | lowercase_with_underscores | import '...' as my_prefix; |
| Variables, parameters, named parameters, functions | lowerCamelCase | userName, fetchData() |
- Capitalize acronyms longer than two letters like words:
HttpRequest, notHTTPRequest. - Avoid abbreviations unless the abbreviation is more common than the full term.
- Put the most descriptive noun last in names.
- Use terms consistently throughout the codebase.
2. Types and Functions
- Type annotate variables without initializers.
- Type annotate fields and top-level variables if the type isn't obvious.
- Annotate return types on function declarations.
- Annotate parameter types on function declarations.
- Use
Future<void>as the return type of async members that produce no value. - Use class modifiers (
final,sealed,interface) to control inheritance.
// Prefer sealed for exhaustive pattern matching in state classes
sealed class LeagueState extends Equatable {}
final class LeagueLoading extends LeagueState {}
final class LeagueLoaded extends LeagueState {
const LeagueLoaded(this.leagues);
final List<League> leagues;
@override List<Object?> get props => [leagues];
}
3. Style
dart format .
dart analyze
- Format with
dart format— do not manually format. - Use curly braces for all flow control statements.
- Prefer
finalovervarwhen the value won't change. - Use
constfor compile-time constants. - Lines 80 characters or fewer as a guideline.
4. Comments
Default to writing no comments. Add a comment only when the WHY is non-obvious: a hidden constraint, a subtle invariant, a workaround for a specific bug, or behavior that would surprise a reader.
// BAD — comment describes what the code does (already obvious)
// Check if user is premium
if (user.isPremium) { ... }
// GOOD — explains a non-obvious constraint
// Positions 1 and 4 are always unlocked; others depend on premium status.
final isUnlocked = position == 1 || position == 4 || isPremium;
When a comment is warranted, use /// for public API doc comments:
/// Returns the leagues for the current user, checking local cache first.
Future<Either<Failure, List<League>>> getUserLeagues();
- Start doc comments with a single-sentence summary.
- Avoid redundancy with surrounding context.
- Do not write multi-paragraph docstrings or multi-line comment blocks.
- Do not reference the current task, fix, or PR in comments — those belong in the PR description.
5. Imports and Files
- Prefer relative import paths within the same package.
- Do not import from inside another package's
src/directory. - Keep files focused on a single responsibility.
- Prefer making declarations private — only expose what's necessary.
6. Usage Patterns
// Use collection literals
final list = [1, 2, 3];
final map = {'key': 'value'};
// Initializing formals
class Point {
final double x, y;
Point(this.x, this.y);
}
// rethrow to preserve stack trace
try {
doSomething();
} catch (e) {
log(e);
rethrow;
}
- Use
whereType<T>()to filter a collection by type. - Initialize fields at their declaration when possible.
- Use
on SomeException catch (e)— avoid broadcatch (e). - Override
hashCodewhenever you override==.
7. Project-Specific Rules
- User-facing strings and error messages are in Italian. Never add English strings to the UI.
- Do not add error handling for scenarios that cannot happen. Trust framework guarantees.
- Do not add features, refactors, or abstractions beyond what the task requires.
- Three similar lines is better than a premature abstraction.
8. Code Review Checks
- Identifiers follow naming conventions in Section 1.
- Public API parameters, return types, and uninitialized variables are type-annotated.
dart format --output=none --set-exit-if-changed .passes.dart analyzereports zero issues.- Comments explain WHY, not WHAT.
- User-facing strings are in Italian.
References
When not to use it
- →When the goal is to add English strings to the UI
- →When adding error handling for scenarios that cannot happen
- →When adding features or abstractions beyond task requirements
Limitations
- →User-facing strings and error messages must be in Italian
- →Does not add error handling for impossible scenarios
- →Does not add features or abstractions beyond task requirements
How it compares
This skill provides explicit guidelines and checks for idiomatic Dart and Flutter code, ensuring adherence to a specific style guide, unlike general code formatting.
Compared to similar skills
effective-dart side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| effective-dart (this skill) | 0 | 1mo | Review | Intermediate |
| webf-api-compatibility | 1 | 5mo | Review | Intermediate |
| flutter-riverpod-change | 0 | 2mo | No flags | Intermediate |
| effective-go | 323 | 9mo | No flags | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
webf-api-compatibility
openwebf
Check Web API and CSS feature compatibility in WebF - determine what JavaScript APIs, DOM methods, CSS properties, and layout modes are supported. Use when planning features, debugging why APIs don't work, or finding alternatives for unsupported features like IndexedDB, WebGL, float layout, or CSS Grid.
flutter-riverpod-change
xelis-project
Guide Dart, Flutter, Riverpod, Forui, routing, model, serializer, and UI-state changes in Genesix. Use when touching lib/features, lib/shared, providers, widgets, routes, generated Dart annotations, or Flutter package APIs.
effective-go
openshift
Apply Go best practices, idioms, and conventions from golang.org/doc/effective_go. Use when writing, reviewing, or refactoring Go code to ensure idiomatic, clean, and efficient implementations.
solid-principles
SmidigStorm
Enforce SOLID principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) in object-oriented design. Use when writing or reviewing classes and modules.
typescript-review
metabase
Review TypeScript and JavaScript code changes for compliance with Metabase coding standards, style violations, and code quality issues. Use when reviewing pull requests or diffs containing TypeScript/JavaScript code.
ast-grep
ast-grep
Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for code patterns, find specific language constructs, or locate code with particular structural characteristics.