skills/dart-best-practices/SKILL.md
General best practices for Dart development. Covers code style, effective Dart, and language features.
npx skillsauth add kevmoo/dash_skills dart-best-practicesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when:
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-----''';
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.
To find candidates for multi-line strings, search for string concatenation
with + involving newlines:
['"]\s*\+\s*['"]\+\s*['"].*\\nlines_longer_than_80_chars lint from the analyzer.testing
Core concepts and best practices for `package:test`. Covers `test`, `group`, lifecycle methods (`setUp`, `tearDown`), and configuration (`dart_test.yaml`).
testing
Understand and improve test coverage in a Dart package. Helps agents run coverage, interpret results, and identify missed lines.
documentation
Guidelines for maintaining external Dart packages, covering versioning, publishing workflows, and pull request management. Use when updating Dart packages, preparing for a release, or managing collaborative changes in a repository.
development
Guidelines and best practices for refactoring consecutive prints, single-line string concatenations, and complex output blocks into triple-quoted multi-line string literals (''' or """) in Dart.