Dify docs format check

From langgenius/dify-docs · View interactive version

Dify docs format check is an AI agent skill from the GitHub repository langgenius/dify-docs. Check formatting compliance in changed documentation against writing-guides/formatting-guide.md and tools/translate/formatting-{zh,ja}.md. Routes by path: en/ files get the English linter and rules; zh/ and ja/ files get the CJK linter and rules. Use after finalizing a draft or a translation batch,

How to use this skill

Skill file

Formatting Check (en / zh / ja)

Read-only audit of documentation formatting. Mechanical rules are enforced by two linter scripts in this skill directory; judgment-call rules are checked by reading each file. Route by path:

| Files under | Linter | Judgment digest |

|:------------|:-------|:----------------|

| en/ | check-format-en.py | Step 4 (English) |

| zh/ | check-format-cjk.py | Step 5 (CJK shared + Chinese) |

| ja/ | check-format-cjk.py | Step 5 (CJK shared + Japanese) |

Procedure

  1. Read the rule sources for the languages in scope. The digests in steps 4-5 are summaries of these files; wherever a digest and its source disagree, the source file wins.
  1. Detect the files to audit. Audit entire files, not just diffs. Default to the files currently under review:

```bash

git diff --name-only; git diff --cached --name-only; git status --porcelain | grep '^??'

```

Keep .mdx/.md files under en/, zh/, or ja/. If none are detected, ask the user which files to check. Translations ship as a zh/ja pair from one English source, so when both changed, audit both in the same session.

  1. Run the linter for each path group and paste its output verbatim into your report:

```bash

python3 .claude/skills/dify-docs-format-check/check-format-en.py <en files...>

python3 .claude/skills/dify-docs-format-check/check-format-cjk.py <zh and ja files...>

```

Success signal: each run prints one block per file and ends with Total violations: {n}; exit code is 0 when n = 0, 1 otherwise. A file passed to the wrong script is skipped with a stderr note (skip (non-en) / skip (non-zh/ja)); check-format-cjk.py selects the zh or ja rule set from the file path.

Then check that the three languages carry the same structure, passing every page in scope whatever its language (a zh or ja path is checked through its English twin):

```bash

python3 tools/check-parity.py --base origin/main <changed pages...>

```

Success signal: PARITY OK: {n} pages; otherwise one line per new mismatch and PARITY ISSUES: {n}, exit 1. The check compares each English page with its twins by path: heading count and level, then per section the paragraphs, list items, code blocks, table rows, the sequence of components, and anchor ids. Heading text is not compared, and the translation disclaimer is skipped. Mismatches already present at the base ref are listed under pre-existing and do not fail the run, because much of the corpus predates this check; report them to the owner with the other pre-existing findings. Skip this check on English still awaiting translation: every mismatch it would report there is one the translation clears.

The scripts are the authoritative deterministic rule list. Violation lines print as line [rule-id] message and the messages are self-describing, so do not re-summarize each rule. Rule-ID families: F- frontmatter, H- headings, B- bold/italic, L- lists, C- code, Li- links, I- images, M- Mintlify components, U- UI element references (en only), S- spacing, P- punctuation, CJK- both CJK languages, ZH- Chinese only, JA- Japanese only.

Five IDs need context the message alone does not give:

When changing the CJK checker, run python3 .claude/skills/dify-docs-format-check/test_check_format_cjk.py. The regression suite must end with OK and exit 0.

  1. Judgment review — en/ files. Digest of writing-guides/formatting-guide.md (section names in parentheses; the guide wins on conflict). Read each file and check:
  1. Judgment review — zh/ and ja/ files. Digest of tools/translate/formatting-zh.md and tools/translate/formatting-ja.md (those files win on conflict). The two findings the linter misses most often are translated anchor slugs and {{placeholder}} variables left unchanged in otherwise-translated prompts. Read each file and check:
  1. Report. A judgment finding cites a formatting-guide rule or a difference a reader of the rendered page would see; source-only variation that no rule covers is left out. Paste the raw linter output first, then append judgment findings per file:

```

[linter output, verbatim — per file: "### {path}" (the cjk script adds

" ({lang})"), then "line [rule-id] message" lines or "✅ no deterministic

issues found", each run ending with "Total violations: {n}"]

### Judgment findings

{path}

```

The scripts report only violations; do not invent per-rule "clean" lines they never printed. A file with no violations and no judgment findings needs nothing beyond its ✅ no deterministic issues found line.

Important

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.