mcpField
D
dart-doc-validation

dart-doc-validation

github.com/kevmooTesting & quality148286 installsUpdated 2w ago
Repository

About dart-doc-validation

A skill for validating documentation comments in Dart code, aimed at developers maintaining docs or preparing packages for pub.dev. It covers lint setup, local generation checks, and common unresolved references or macro warnings, with guardrails for content that should not be changed.

Key features

  1. 01Check Dart documentation references
  2. 02Enable the comment_references lint
  3. 03Run dart doc validation
  4. 04Identify undefined macros
  5. 05Avoid altering excluded comments

Use cases

  1. 01Checking Dart doc comments before release
  2. 02Finding broken references in package docs
  3. 03Preparing a package for pub.dev

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/kevmoo/dash_skills --skill dart-doc-validation

After installing, type/dart-doc-validationin Claude Code to confirm it loaded.

Bundled filesevals/evals.json

Details

From the project README

Dart Doc Validation

1. When to use this skill

Use this skill when:

  • Writing or updating documentation comments (///) in Dart code.
  • Checking for broken documentation links, references, or macros.
  • Preparing a package for publishing to pub.dev.
When NOT to use (Abstention Guardrails)

Do NOT apply this skill or refactor doc comments when:

  • Illustrative Pseudo-Code & Non-Dart Code Fences: Comments contain pseudo-code, non-Dart language identifiers (e.g. yaml`, json, ````bash, ````text`), or abstract conceptual fragments intentionally not designed to compile as valid Dart.
  • Generated Code: Files generated by tools (e.g. *.g.dart, *.mocks.dart, *.freezed.dart) where comments are synthesized.
  • External Markdown Hyperlinks: Text in square brackets followed by a link target (e.g. [External Guide](https://...)), which is standard Markdown hyperlink syntax rather than an unresolved Dart doc reference.

Discovery

To find documentation issues:

Missing Lint

Verify if the comment_references lint is enabled:

  • Target: analysis_options.yaml
  • Search Query: comment_references
Automated Validation

Run the documentation generator to surface warnings:

  • Command: dart doc -o $(mktemp -d)
  • Keywords to look for: warning:, unresolved doc reference, undefined macro

2. Best Practices

Enable the doc validation lint

In your analysis_options.yaml, enable the comment_references lint.

linter:
  rules:
    - comment_references
Validating Documentation Locally

Use the dart doc command with a temporary output directory to validate documentation comments without polluting the local project workspace.

This command parses all documentation comments and reports warnings such as:

  • warning: unresolved doc reference
  • warning: undefined macro

Command to run:

dart doc -o $(mktemp -d)

This will work on Mac and Linux.

This ensures that the generated HTML files are stored in a temporary location and don't clutter the package directory, while still surfacing all validation warnings in the terminal output.

Browsing the docs:

Our docs use features designed to be run on a web server. If you want to browse the generated docs locally, install the dhttpd package.

dart install dhttpd
TMP_DIR=$(mktemp -d) && dart doc -o "$TMP_DIR" &&  dhttpd --path "$TMP_DIR"

(Or use another HTTP server, such as python3 -m http.server.)

Fixing Common Warnings
  • Unresolved doc reference: Ensure that any identifier wrapped in square brackets ([Identifier]) correctly points to an existing class, method, property, or parameter in the current scope or imported libraries.
  • Undefined macro: If using {@macro macro_name}, ensure that the template {@template macro_name} is defined in the same file or a file that is imported and visible to the documentation generator.

Comments

Markdown supported