
dart-best-practices
General best practices for Dart development. Covers code style, effective Dart, and language features.
- Installs
- 832
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/kevmoo/dash_skills --skill dart-best-practices- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads dart-best-practices automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Dart Best Practices
1. When to use this skill
Use this skill when:
- Writing or reviewing Dart code.
- Looking for guidance on idiomatic Dart usage.
When NOT to use (Abstention Guardrails)
Do NOT apply this skill or refactor code when:
- Public API Breaking Changes: Refactoring would alter public API contracts, return types, or parameter signatures in published packages without a coordinated major SemVer bump.
- Dogmatic Micro-Optimizations: Rewriting clear, readable code for negligible theoretical gains (e.g. replacing clear string concatenation in a simple one-line log message with multiline quotes).
- Domain-Specific or Code-Generated Files: Generated files (
*.g.dart,*.freezed.dart, protobufs) or files where line lengths and string layouts are managed by code generators. - Explicit Type Annotations in Public Interfaces: Replacing explicit type
annotations with
varorfinalwhere explicit types document the public API surface or disambiguate complex generics.
2. Best Practices
Multi-line Strings
Prefer using multi-line strings (''') over concatenating strings with + and
\n, especially for large blocks of text like SQL queries, HTML, or PEM-encoded
keys. This improves readability and avoids lines_longer_than_80_chars lint
errors by allowing natural line breaks.
Avoid:
final pem = '-----BEGIN RSA PRIVATE KEY-----\n' +
base64Encode(fullBytes) +
'\n-----END RSA PRIVATE KEY-----';
Prefer:
final pem = '''
-----BEGIN RSA PRIVATE KEY-----
${base64Encode(fullBytes)}
-----END RSA PRIVATE KEY-----''';
Line Length
Avoid lines longer than 80 characters, even in Markdown files and comments. This ensures code is readable in split-screen views and on smaller screens without horizontal scrolling.
Prefer: Target 80 characters for wrapping text. Exceptions are allowed for long URLs or identifiers that cannot be broken.
Discovery
Multi-line Strings
To find candidates for multi-line strings, search for string concatenation with
+ involving newlines:
- Regex:
['"]\s*\+\s*['"] - Regex:
\+\s*['"].*\\n
Line Length
- Rely on the
lines_longer_than_80_charslint from the analyzer.
Related Skills
- dart-modern-features: For idiomatic usage of modern Dart features like Pattern Matching (useful for deep JSON extraction), Records, and Switch Expressions.
FAQ
What does the dart-best-practices skill do?
General best practices for Dart development. Covers code style, effective Dart, and language features.
How do I install dart-best-practices?
Run npx skills add https://github.com/kevmoo/dash_skills --skill dart-best-practices in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/dart-best-practices/ (personal) or .claude/skills/dart-best-practices/ (project).
Which AI agents can use dart-best-practices?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is dart-best-practices safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains dart-best-practices?
It is published by kevmoo in kevmoo/dash_skills. It has 832 recorded installs.
More from kevmoo/dash_skills
dart-test-fundamentals
kevmoo/dash_skills
Open the skill to read its SKILL.md instructions.
dart-package-maintenance
kevmoo/dash_skills
Open the skill to read its SKILL.md instructions.
dart-matcher-best-practices
kevmoo/dash_skills
Open the skill to read its SKILL.md instructions.
dart-cli-app-best-practices
kevmoo/dash_skills
Open the skill to read its SKILL.md instructions.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.