
Dart Best Practices
Keep Dart and Flutter code idiomatic and lint-friendly when you write or review strings, line length, and style.
Overview
Dart Best Practices is an agent skill most often used in Build (also Ship) that guides idiomatic Dart string style and line-length discipline for readable, lint-friendly code.
Install
npx skills add https://github.com/kevmoo/dash_skills --skill dart-best-practicesWhat is this skill?
- Prefers triple-quoted multi-line strings over `+` and `\n` concatenation for PEM, SQL, and HTML blocks
- Enforces ~80-character line length in code, Markdown, and comments for split-screen readability
- Includes discovery regex patterns to find string-concat candidates and line-length issues
- Aligns with effective Dart and general code-style expectations for reviews
- 80-character line length target
- 2 discovery regex patterns for multiline string candidates
Adoption & trust: 648 installs on skills.sh; 137 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Dart files accumulate hard-to-read concatenated strings and overlong lines that fail lints and slow code review.
Who is it for?
Flutter or Dart solo devs who want fast, repeatable style guidance while writing or reviewing app and package code.
Skip if: Teams that only need automated fixes from dart analyze/format with no agent coaching, or projects that are not Dart/Flutter.
When should I use this skill?
Writing or reviewing Dart code, or when you need guidance on idiomatic Dart usage.
What do I get? / Deliverables
Agents apply consistent multi-line string and wrapping patterns so Dart reads cleanly and stays closer to effective Dart defaults.
- Concrete Dart refactors using `'''` multiline strings
- Review notes aligned to line-length and concatenation rules
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Canonical shelf is Build because the skill targets day-to-day Dart authoring; the same rules apply during Ship when you review diffs. Frontend subphase fits UI and app-layer Dart; backend Dart services still benefit but mobile/Flutter is the primary audience.
Where it fits
Refactor a PEM export block to triple-quoted literals before shipping a Flutter feature.
Scan a PR for `+` string joins with `\n` and flag them during code review.
Wrap a long SQL query in a multiline string in a Dart server package.
How it compares
Style-and-review coaching for Dart—not a linter config generator or a full testing skill.
Common Questions / FAQ
Who is dart-best-practices for?
Solo and indie builders using Claude Code, Cursor, or Codex on Dart and Flutter codebases who want idiomatic string and layout habits without digging through style guides each time.
When should I use dart-best-practices?
During Build while authoring Dart UI or services, and during Ship review when checking diffs for concatenated strings or lines_longer_than_80_chars violations before merge.
Is dart-best-practices safe to install?
The skill is documentation-only with no shell or network calls; review the Security Audits panel on this Prism page before adding any repo skill to your agent.
SKILL.md
READMESKILL.md - Dart Best Practices
# 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. ## 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:** ```dart final pem = '-----BEGIN RSA PRIVATE KEY-----\n' + base64Encode(fullBytes) + '\n-----END RSA PRIVATE KEY-----'; ``` **Prefer:** ```dart 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_chars` lint 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. [dart-modern-features]: https://github.com/kevmoo/dash_skills/blob/main/skills/dart-modern-features/SKILL.md