agentleFS
otncotnc/agent-skills/skills/fix-unnatural-line-breaks/SKILL.md

fix-unnatural-line-breaks

Skill2 starsChanged 49 days agoMITView on GitHub

Detects and fixes "unnatural line breaks" in prose (Markdown/README-style documentation, and code comments or docstrings) — newlines inserted mid-sentence just to keep lines under some fixed column width. Works on both English and Japanese text. Use for requests like "fix the line breaks," "this is hard-wrapped," "the text is cut off mid-sentence," "unnatural line wrapping," "改行がおかしい," "文の途中で改行が入っている," "一定の文字数で折り返されている," as well as when writing, reviewing, or rewriting documentation and comments. Does not cover restructuring bullet lists, rewording headings, or removing AI-sounding phrasing/redundancy (those belong to other skills).

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When writing new prose (documentation or comments) from scratch, write one paragraph per line (or one sentence per line) from the start, …

    line 25
  2. Very specific:

    When reviewing or fixing existing prose, use the criteria in references/detection.md to find breaks that cut a sentence in the middle, then …

    line 26
  3. Very specific:

    Don't restructure content: splitting into bullet lists, rewording headings, removing redundant phrasing, or scrubbing AI-sounding style are …

    line 33
  4. Very specific:

    Don't touch Markdown tables, code block contents, URLs, inline code spans, or intentional Markdown line breaks (two trailing spaces, a …

    line 34
  5. Distinctive:

    Don't touch commit messages or code formatting itself (that's Prettier/ESLint's job).

    line 35
  6. Very specific:

    Read references/detection.md and keep the relevant criteria in mind for the language(s) involved (English, Japanese, or both mixed in the …

    line 41
  7. Distinctive:

    Before calling it done, confirm:

    line 49

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

fix-unnatural-line-breaks

A skill for eliminating a specific bad habit: inserting a newline mid-sentence just to keep the line under some fixed column width. Line breaks should only appear at meaningful boundaries — paragraph breaks, list item boundaries, and around headings.

Core principle

Don't break a sentence or paragraph until it actually ends. Even when a line "feels" long, keep writing on the same line until the next meaningful boundary (end of paragraph, end of a list item, before/after a heading, before/after a code block). Let the editor, browser, or terminal handle visual wrapping (soft wrap) — the source itself should not contain a hard-coded newline chosen purely for line length.

This applies equally to English and Japanese, but the damage is arguably worse in Japanese. Japanese has no spaces between words, so an arbitrary line break doesn't look grammatically broken the way it might in English — yet breaking right after a comma, particle, or in the middle of a phrase still disrupts the reading rhythm and makes it easy to misread where a clause actually ends.

The target is both prose documentation (Markdown, README files) and code comments, docstrings, and JSDoc. For documentation, most Markdown renderers collapse a single newline inside a paragraph into a single space, so the rendered output often looks fine either way — but the raw source still suffers: it's harder to read as source, diffs get needlessly large when a whole paragraph reflows, and there are places where the raw newline is shown as-is (commit messages, terminals, an editor's hover tooltip for a code comment). For code comments there is no renderer to save you — the line break is shown exactly as written, so the harm is direct and immediate.

Do

  • When writing new prose (documentation or comments) from scratch, write one paragraph per line (or one sentence per line) from the start, and never wrap at an arbitrary column width.
  • When reviewing or fixing existing prose, use the criteria in references/detection.md to find breaks that cut a sentence in the middle, then fix them following references/rules.md.
  • To fix one, simply remove the line break and join the two lines: insert a single space for English, and nothing (no space) for Japanese. See references/examples.md for concrete cases where the right join is ambiguous.
  • It's fine — expected, even — for the fixed line to become very long. The only thing that should trigger a new line break is a structural boundary (paragraph, list item, heading, code block), never a character count.
  • In a comment block, if two paragraphs need a visible separator, use an unmarked blank line (no ///#/*) or no separator at all — never a bare comment marker with nothing after it. Nobody writes a lone // by hand; see references/rules.md.

Don't

  • Don't restructure content: splitting into bullet lists, rewording headings, removing redundant phrasing, or scrubbing AI-sounding style are out of scope (hand those off to a skill built for that, such as natural-japanese or stop-ai-slop-jp for Japanese text).
  • Don't touch Markdown tables, code block contents, URLs, inline code spans, or intentional Markdown line breaks (two trailing spaces, a trailing backslash, or an explicit <br>).
  • Don't touch commit messages or code formatting itself (that's Prettier/ESLint's job). The target here is prose meant for humans to read.
  • Don't run this against structured config formats such as CI workflow YAML, JSON, or embedded shell scripts. scripts/lint.mjs recognizes YAML frontmatter and simple key: value lines well enough to avoid the worst false positives, but it has no real YAML parser and cannot tell a wrapped prose sentence inside a block scalar (key: |) from wrapped shell script. Structured config is out of scope; only apply this skill to Markdown prose and code comments/docstrings.

Workflow

  1. Identify what kind of file you're looking at — Markdown documentation, or code comments.
  2. Read references/detection.md and keep the relevant criteria in mind for the language(s) involved (English, Japanese, or both mixed in the same file).
  3. If Node.js is available (most coding agents run on it or alongside it), run node <this skill's directory>/scripts/lint.mjs <file> from the project root to mechanically surface suspicious breaks (add --json for structured output). No install or dependency is needed — it's plain Node.js with no third-party packages. Without Node.js, do the same review by eye using references/detection.md.
  4. lint.mjs output is not the full list of what to fix. It's a small set of regex heuristics, so it both flags things that are fine (false positives) and misses real unnatural breaks it has no rule for (false negatives) — a break that doesn't end in a tracked particle/word but is still mid-sentence, for instance. Treat it as a starting hint, not a checklist to clear. Filter out its false positives (code blocks, tables, intentional breaks), then still read every paragraph and comment block in the file yourself against references/detection.md, including the parts the tool didn't flag at all.
  5. Apply the fixes following references/rules.md: merge broken sentences back into one line, and leave paragraph/list/heading/code-block boundaries untouched.
  6. Re-read the fixed paragraph to confirm the meaning and tone haven't shifted.

Quick self-check

Before calling it done, confirm:

  • No line break remains in the middle of a paragraph without a meaningful boundary justifying it
  • No single list item is still wrapped across multiple lines (unless the item is genuinely long and that's intentional)
  • No single sentence in a code comment or docstring still spans multiple comment lines
  • The fix didn't touch code blocks, tables, URLs, or intentional line breaks
  • No comment block uses a bare ///#/* marker as a paragraph separator
  • Every paragraph and comment block was actually read end to end — not just the lines lint.mjs happened to flag

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.