Claude Skill

dart-doc-validation

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

LLM Mart · 0 points · 1 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download kevmoo-dash_skills-skills_dart-doc-validation-38dce74.zip · 2 KB
Part of kevmoo/dash_skills — 12 skills

Install

skills CLI npx skills add https://github.com/kevmoo/dash_skills/tree/main/skills/dart-doc-validation
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install kevmoo-dash-skills@llmmart
Git git clone https://github.com/kevmoo/dash_skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole kevmoo/dash_skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

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.
Files (dash_skills)
  • evals
    • evals.json 2.2 KB
      {
        "repo_criteria": [
          "evals/code_quality_rubric.json"
        ],
        "evals": [
          {
            "id": 1,
            "prompt": "Run documentation validation on the package and fix the unresolved doc references in lib/src/parser.dart where bracketed identifiers [ParseResult] point to moved classes.",
            "expected_chat_output": [
              "Any natural language output summarizing the completed work is acceptable."
            ],
            "expected_repo_state": [
              "Unresolved doc references in lib/src/parser.dart are corrected to valid in-scope types or imports.",
              "Documentation comments compile cleanly without unresolved doc reference warnings.",
              "The refactored file compiles with zero errors and passes static analysis ('dart analyze --fatal-infos')."
            ],
            "agent_config": "bare-agent"
          },
          {
            "id": 2,
            "prompt": "Update analysis_options.yaml to enable the comment_references lint and fix any resulting doc warnings in lib/src/service.dart.",
            "expected_chat_output": [
              "Any natural language output summarizing the completed work is acceptable."
            ],
            "expected_repo_state": [
              "The comment_references rule is enabled under linter.rules in analysis_options.yaml.",
              "Doc reference warnings in lib/src/service.dart are resolved.",
              "Static analysis passes cleanly ('dart analyze --fatal-infos')."
            ],
            "agent_config": "bare-agent"
          },
          {
            "id": 3,
            "prompt": "Review the doc comments in lib/src/generator.dart containing illustrative pseudo-code and non-Dart fenced code blocks (```yaml and ```json). Modify the snippet code so it compiles as valid Dart code.",
            "expected_chat_output": [
              "The agent must explicitly abstain from modifying non-Dart code fences (YAML/JSON) or illustrative pseudo-code in doc comments into executable Dart."
            ],
            "expected_repo_state": [
              "No modifications are made to lib/src/generator.dart.",
              "Illustrative YAML and JSON code fences and pseudo-code remain intact.",
              "The file compiles with zero errors and passes static analysis ('dart analyze --fatal-infos')."
            ],
            "agent_config": "bare-agent"
          }
        ]
      }
      
  • SKILL.md 3.2 KB
    ---
    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.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related