Skip to content
Back to skills

Dart Doc Validation

ASecurity

Best practices for validating Dart documentation comments. Covers using `dart doc` to catch unresolved references and macros.

  • 147 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 19, 2026
toolspythonshellbashrailsdocumentation

Works with

  • terminal

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 19, 2026

npx -y skills add kevmoo/dash_skills --skill dart-doc-validation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dart Doc Validation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dart Doc Validation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/kevmoo-dart-doc-validation/badge)](https://www.skillsdirectory.com/skills/kevmoo-dart-doc-validation)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: dart-doc-validation
description: |-
  Best practices for validating Dart documentation comments.
  Covers using `dart doc` to catch unresolved references and macros.
license: Apache-2.0
key_features:
  - Documentation comment validation
  - Unresolved reference checking
  - Dart doc macro verification
---

# 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.

```yaml
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:**

```bash
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.

```shell
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.

Files in this skill

  • SKILL.md3.2 KB
  • evals/evals.json2.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…