evanca/flutter-ai-rules/effective-dart
Claude Code and agent skill by evanca/flutter-ai-rules
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Use when writing Dart code, reviewing for style, refactoring naming, adding doc comments, structuring imports, or enforcing type annotations.
Install
npx vskill@latest install evanca/flutter-ai-rules/effective-dartSKILL.md
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 and abbreviations longer than two letters like words:
HttpRequest, notHTTPRequest. - Avoid abbreviations unless the abbreviation is more common than the full term.
- Prefer putting the most descriptive noun last in names.
- Use terms consistently throughout your code.
- Follow mnemonic conventions for type parameters:
E(element),K/V(key/value),T/S/U(generic types). - Consider making code read like a sentence when designing APIs.
- Prefer a noun phrase for non-boolean properties or variables.
- Prefer a non-imperative verb phrase for boolean properties or variables; prefer the positive form.
- Consider omitting the verb for named boolean parameters.
- Avoid starting a function or method name with
get; prefer removinggetand using a getter when the API conceptually exposes a property.
2. Types and Functions
- Use class modifiers (
final,sealed,interface,base,mixin) to control whether a class can be extended or implemented. - 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.
- Write type arguments on generic invocations that aren't inferred.
- Annotate with
dynamicinstead of letting inference fail. - Use
Future<void>as the return type of async members that do not produce values. - Use getters for operations that conceptually access properties.
- Use setters for operations that conceptually change properties.
- Use a function declaration to bind a function to a name.
- Use inclusive start and exclusive end parameters to accept a range.
- Don't annotate a return type on a setter — including the
[]=operator, which behaves like a setter.
3. Style
- Format code with
dart format— don't manually format. - Use curly braces for all flow control statements.
- Prefer
finalovervarwhen variable values won't change. - Use
constfor compile-time constants. - Prefer lines 80 characters or fewer for readability.
4. Imports and Files
- Don't import libraries inside the
srcdirectory of another package. - Don't allow import paths to reach into or out of
lib. - Prefer relative import paths within a package.
- Don't use
/lib/or../in import paths. - Consider writing a library-level doc comment for library files.
5. Structure
- Keep files focused on a single responsibility.
- Limit file length to maintain readability.
- Group related functionality together.
- Prefer making fields and top-level variables
final. - Consider making constructors
constif the class supports it. - Prefer making declarations private — only expose what's necessary.
6. Usage Patterns
- Use
whereType<T>()to filter a collection by type. - Follow a consistent rule for
varandfinalon local variables. - Initialize fields at their declaration when possible.
- Override
hashCodeif you override==; ensure==obeys mathematical equality rules. - Prefer specific exception handling: use
on SomeException catch (e)instead of broadcatch (e)or.catchErrorhandlers.
7. Documentation
- Format comments like sentences (capitalize, end with period).
- Use
///doc comments — not/* */block comments — for types and members. - Prefer writing doc comments for public APIs; consider them for private APIs too.
- Start doc comments with a single-sentence summary, separated into its own paragraph.
- Avoid redundancy with the surrounding context.
- Start function/method comments with a third-person verb if the main purpose is a side effect.
- Start with a noun or non-imperative verb phrase if returning a value is the primary purpose.
- Start boolean variable/property comments with "Whether" followed by a noun or gerund phrase.
- Use
[identifier]in doc comments to refer to in-scope identifiers. - Use prose to explain parameters, return values, and exceptions (e.g., "The [param]", "Returns", "Throws" sections).
- Put doc comments before metadata annotations.
- Document why code exists or how it should be used, not just what it does.
8. Testing Patterns
- Write unit tests for business logic, using
groupand descriptivetestnames:
- Write widget tests using
testWidgetsandWidgetTester:
9. Code Review Workflow
When reviewing Dart code for Effective Dart compliance, the agent should check:
- Naming — verify all identifiers follow the conventions in Section 1.
- Type annotations — confirm public API parameters, return types, and uninitialized variables are annotated.
- Class modifiers — verify
final,sealed, orinterfaceis used where appropriate. - Documentation — confirm all public members have
///doc comments with a single-sentence summary. - Style — run
dart format --output=none --set-exit-if-changed .to verify formatting. - Analysis — run
dart analyzeand confirm zero issues.
References
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/effective-dart/SKILL.md
Popularity
- Repository stars
- 492
- Repository forks
- 50
- 7-day trend score
- 31
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 21 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/evanca/flutter-ai-rules/effective-dart)