dart-long-lines
Skill148 starsChanged 13 days agoApache-2.0View on GitHub
Guidelines for handling long lines in Dart code to adhere to the 80-column rule. The `lines_longer_than_80_chars` lint.
In this repository11 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Use this skill when:
- Distinctive: line 25
Do NOT break lines or alter code when:
- Very specific: line 35
Prior to Automated Formatting: Do NOT manually break code lines before running dart format.
- Very specific: line 61
Always run dart format before manually breaking long lines.
- Very specific: line 74
Avoid breaking markdown link blocks like [name] or text across lines.
- Distinctive: line 77
Start doc comments with a single summary sentence, followed by a blank line before the rest of the comment.
- Distinctive: line 80
Avoid unresolved references or dangling sentences.
- Very specific: line 84
Use adjacent string literals (e.g., 'part 1 ' 'part 2') to break long strings.
- Very specific: line 86
If a single-line string contains newline characters (\n) or if there are consecutive print statements, consider migrating to a multi-line …
- Very specific: line 92
Run dart format and dart analyze after making changes.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Dart Long Lines
1. When to use this skill
Use this skill when:
- Writing Dart code that might exceed the 80-column limit.
- Refactoring code to comply with the
lines_longer_than_80_charslint. Reference: https://dart.dev/tools/linter-rules/lines_longer_than_80_chars
When NOT to use (Abstention Guardrails)
Do NOT break lines or alter code when:
- Unbreakable URLs & URIs: Lines contain long HTTP/HTTPS URLs, import URIs, or file paths where breaking them across lines would invalidate the link.
- Complex Regular Expression Literals: Long RegExp patterns
(
RegExp(r'...')) where inserting whitespace or line breaks changes the matching semantics. - ASCII Art, Tables, or Preformatted Diagrams: Preformatted text blocks, table rows, or ASCII diagrams inside comments or strings where wrapping lines destroys visual alignment.
- Prior to Automated Formatting: Do NOT manually break code lines before
running
dart format. Letdart formathandle code wrapping automatically; only manually wrap comments, docs, and multi-line strings that the formatter does not re-wrap.
Discovery
To find lines that exceed the limit:
Automated Analysis
The most reliable way to find long lines is to use the Dart analyzer:
- Command:
dart analyze - Lint:
lines_longer_than_80_chars
Manual Search
To search for long lines using regex:
- Regex:
^.{81,}$(Matches any line with 81 or more characters).
2. Guidelines
Format First
Always run dart format before manually breaking long lines. The formatter
often automatically fixes long lines, especially in generated code, and applies
standard Dart styling rules.
Code Comments
Break long code comments (//) cleanly at word boundaries to ensure lines do
not exceed 80 characters. Maintain tight formatting and avoid unnecessary
vertical space.
Documentation Comments (///)
- Apply the same line-breaking rules as for code comments.
- Avoid breaking markdown link blocks like
[name]or[text](http://example.com)across lines. Place them on their own line if they exceed the limit. - Start doc comments with a single summary sentence, followed by a blank line before the rest of the comment. It is okay to break this first sentence across multiple lines to fit the 80-column limit.
- Avoid unresolved references or dangling sentences.
Long Strings
- Use adjacent string literals (e.g.,
'part 1 ' 'part 2') to break long strings. Break at word boundaries. - If a single-line string contains newline characters (
\n) or if there are consecutiveprintstatements, consider migrating to a multi-line string literal (''').
Format and Analyze After Changes
- Run
dart formatanddart analyzeafter making changes. - Be aware that splitting strings may trigger new lints (e.g.,
prefer_single_quotesif a double-quoted string is split into parts that no longer contain single quotes).
3. Examples
Documentation Comment Link
Avoid:
/// This is a long doc comment that contains a link to [a very long
/// URL](http://example.com/very/long/url/that/exceeds/eighty/chars).Prefer:
/// This is a long doc comment that contains a link to [a very long URL][ref].
///
/// [ref]: http://example.com/very/long/url/that/exceeds/eighty/charsAdjacent String Literals
Prefer:
final longString = 'This is a very long string that needs to be broken '
'across multiple lines to stay under the limit.';Multi-line String Migration
Avoid:
print('This is line 1\nThis is line 2 that is also quite long\nThis is line 3 which makes the whole thing exceed eighty characters');Prefer:
print('''This is line 1
This is line 2 that is also quite long
This is line 3 which makes the whole thing exceed eighty characters''');Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

