Agent Native

dart-use-doc-examples

This skill teaches an agent how to inject external Dart code examples into Dartdoc comments using the {@example} directive, and how to selectively filter code…

by GoogleOfficial publisherNot reviewed

Identity proven by GitHub's verified organisation badge (flutter, google)

Agents
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
License
BSD-3-Clause (permissive)
Pin
0ef3972pinned Oct 9, 2026
Context cost
about 1,300 tokenswhen the skill loads
GitHub stars
3,039on flutter/agent-plugins
Scripts
None found

What it does

“How to inject external code examples into Dartdoc using the {@example} directive, and how to filter those files using #hide, #region, and #endregion tags.”
The author's description, from SKILL.md

Generated summary from the skill's own text

This skill teaches an agent how to inject external Dart code examples into Dartdoc comments using the {@example} directive, and how to selectively filter code using region markers and hide tags. The agent learns path resolution rules, marker syntax, and verification steps to ensure examples are properly embedded and analyzed.

When to use it

  • Writing Dartdoc documentation with multi-line code examples
  • Organizing examples in separate files for linting and analysis
  • Hiding setup code or imports from documentation while keeping compiler-valid code
  • Managing complex examples across multiple Dart files with regions

When not to

  • Including examples from remote URLs or external network sources
  • Injecting examples into non-Dartdoc comment formats without using the directive
  • Writing single-line inline code snippets in documentation comments

Install

These commands install from the publisher's repository and need no account.

skills CLI

npx skills add flutter/agent-plugins --skill dart-use-doc-examples

Installs from the repository's default branch, which may have changed since the commit we checked.

GitHub CLI 2.90 or later

gh skill install flutter/agent-plugins dart-use-doc-examples@0ef3972f93e2baa4156ba1cbb1e515cd53079c68

Installs the commit we checked (0ef3972).

Copy by hand

Download the folder at 0ef3972 and put it in .claude/skills/dart-use-doc-examples for Claude Code and in .agents/skills/dart-use-doc-examples for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.

Skill folder on GitHub at 0ef3972

Claude Code plugin

/plugin install chrome-devtools-mcp@claude-plugins-official

The publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.

Claude Code plugin

/plugin install alloydb-omni@claude-plugins-official

The publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.

Claude Code plugin

/plugin install bigquery-data-analytics@claude-plugins-official

The publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.

Copy for your agent

A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.

Prompt

Install the agent skill "dart-use-doc-examples" by Google.

Source, pinned to commit 0ef3972f93e2baa4156ba1cbb1e515cd53079c68:
https://github.com/flutter/agent-plugins/tree/0ef3972f93e2baa4156ba1cbb1e515cd53079c68/skills/dart-use-doc-examples

1. Download that folder at exactly this commit. Do not use the default branch.
2. Copy every file unchanged, keeping the folder structure, into .claude/skills/dart-use-doc-examples/ for Claude Code and .agents/skills/dart-use-doc-examples/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist.
3. Do not edit the files, and do not run any script in the folder unless I ask you to.
4. When you are done, list the files you copied and where you put them.

Listing and checks: https://www.agentnative.dev/skills/google/dart-use-doc-examples

SKILL.md at the pin

---
name: dart-use-doc-examples
description: "How to inject external code examples into Dartdoc using the {@example} directive, and how to filter those files using #hide, #region, and #endregion tags."
---

# Using Examples in Dartdoc

## Contents
*   [1. The `{@example}` Directive](#1-the-example-directive)
*   [2. Using Regions](#2-using-regions)
*   [3. Hiding Setup Code](#3-hiding-setup-code)
*   [4. Marker Filtering Rules](#4-marker-filtering-rules)
*   [5. Placement and Path Resolution](#5-placement-and-path-resolution)
*   [6. Verification](#6-verification)

When writing documentation that requires multi-line code examples, you should generally extract those examples into standalone `.dart` files and inject them using the `{@example}` directive, rather than writing them inline inside `///` comments. This ensures the examples can be analyzed, linted, and executed.

## 1. The `{@example}` Directive
The `{@example}` directive parses an external file and resolves it into a fenced Markdown code block in the generated documentation.

**Syntax:** `{@example <path>[#<region>] [lang=LANGUAGE] [indent=keep|strip]}`

*   **`<path>`**: The path to the file. A leading `/` evaluates from the package root. Otherwise, it is relative to the current file.
*   **`lang`**: The language for the markdown fence. Auto-detected from the file extension (e.g., `dart`), but can be explicit (e.g., `lang=text`).
*   **`indent`**: `strip` (default) aggressively removes shared leading indentation from the code block.

*Bad (Inline Markdown):*
```dart
/// Makes a client service request to the backend.
///
/// ```dart
/// final client = Client();
/// client.send();
/// ```
```

*Good (External File Injection):*
```dart
/// Makes a client service request to the backend.
///
/// {@example /example/client_request.dart}
```

## 2. Using Regions
Often, an external example file contains imports, setup, or `void main()` wrappers that you don't want to show in the documentation. You can extract a specific block of code by appending `#<region>` to the `{@example}` directive path, and wrapping that code with `#region` and `#endregion` comments in the target file.

**Dart Code (e.g., `/example/client.dart`):**
```dart
import 'package:http/http.dart';

void main() {
  // #region request_snippet
  final client = Client();
  client.send();
  // #endregion request_snippet
}
```

**Dartdoc Usage:**
```dart
/// Connects the client to the server and sends a request.
///
/// {@example /example/client.dart#request_snippet}
```

## 3. Hiding Setup Code
If there is a specific line of code within your extracted region that is necessary for the compiler/analyzer to pass but irrelevant (or distracting) for the documentation reader, append `#hide` to that line.

**Dart Code:**
```dart
final mockServer = startServer(); // #hide
final data = await fetch(mockServer.url);
```
In the generated documentation, only `final data = await fetch(mockServer.url);` will be visible. The line with `#hide` is completely dropped.

## 4. Marker Filtering Rules
When working with `#hide`, `#region`, and `#endregion` markers, you must follow these two technical constraints:

*   **Region Required:** The markers are only processed and stripped when you target a specific region suffix (e.g., `{@example file.dart#region_name}`). If you inject an entire file without a region suffix, the file is embedded exactly as it appears in the source, including any marker text like `// #hide`.
*   **Format Agnosticism:** The marker system is completely format-agnostic. Dartdoc simply runs a regex to strip lines containing the marker strings, meaning it works identically in non-Dart files (e.g., inside YAML comments `# #region` or HTML comments `<!-- #region -->`).

## 5. Placement and Path Resolution
The `{@example}` directive is a block-level directive. It must appear on its own line prefixed with `///`. Its internal `<path>` parser follows strict URI reference rules:

*   **Package-Root Paths (`/`)**: Paths starting with a leading slash automatically resolve directly to the root of the Dart package. Use this when the destination file is deep.
    *   *Example:* `{@example /test/data/sample.txt}` exactly maps to `<package_root>/test/data/sample.txt`.
*   **Relative Paths**: Paths without a leading slash resolve relative to the directory of the file containing the doc comment.
    *   *Example:* `{@example ../utils/demo.dart}`
*   **Boundary Enforcement:** Using `..` segments to traverse upward is perfectly acceptable, but dartdoc natively stops directory traversal at the package root (it will never escape the package).
*   **No Network URLs:** Absolute URIs (e.g., starting with `https://`) are strictly not supported. The example file *must* sit natively somewhere in the local filesystem.
*   **Separators & Encoding:** Because dartdoc resolves the path as a URI, you must always use forward slashes (`/`) as folder separators (even on Windows). You can natively include URI-encoded characters (like `%20` for spaces) as permitted by URI reference rules.

## 6. Verification
After injecting examples:
1.  Run `dart analyze` on the example files to ensure the hidden setup code compiles.
2.  (Optional) Run `dart doc` to verify that dartdoc successfully parsed the directive without throwing a "Failed to read file" or "missing region" warning.

From flutter/agent-plugins at 0ef3972, shown as plain text under its license: BSD-3-Clause (permissive). The license text is in LICENSE.

View SKILL.md on GitHub at 0ef3972

Files

1 file, 5.3 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.

Skill folder on GitHub at 0ef3972
All 50 skills from Google

More from Google

  • skill-creator

    This skill guides agents through creating new skills that extend Gemini CLI with specialized knowledge, workflows, and tool integrations.

    Contains scripts

    Gemini CLI · about 5K tokens · pinned 6 days ago

  • chrome-devtools-cli

    This skill enables agents to automate browser interactions and inspect web pages using Chrome DevTools via command-line interface.

    Claude Code, Codex, Cursor +4 · about 2.9K tokens · pinned 6 days ago

  • cloud-run-basics

    Deploys and manages Google Cloud Run services, jobs, and worker pools for running containerized applications or source code.

    Claude Code, Codex, Cursor +4 · about 3.9K tokens · pinned 6 days ago

  • retail-virtual-tryon

    Creates virtual try-on agents on Google Cloud using Gemini image models and Veo video generation, supporting static image try-ons and catwalk animations.

    Contains scripts

    Claude Code, Codex, Cursor +3 · about 3.3K tokens · pinned 6 days ago

  • site-md

    This skill analyzes project briefs and generates a .stitch/SITE.md constitution file that documents the project's identity, visual direction, architecture…

    Claude Code, Codex, Cursor +4 · about 730 tokens · pinned 6 days ago

  • stitch::code-to-design

    This skill converts existing frontend code (React, Vue, Angular, etc.) into a Stitch Design by extracting HTML, analyzing design systems, and uploading both…

    Claude Code, Codex, Cursor +4 · about 760 tokens · pinned 6 days ago

All Docs and writing skills
  • n8n-docs-assistant

    This skill answers questions about n8n configuration, setup, credentials, nodes, and troubleshooting by retrieving information from current n8n documentation.

    by n8nOfficial publisher

    Claude Code, Codex, Cursor +3 · about 450 tokens · pinned 6 days ago

  • algodocs-automation

    This skill automates Algodocs document processing tasks through Composio's toolkit via the Rube MCP server.

    by ComposioOfficial publisher

    Claude Code, Codex, Cursor +3 · about 690 tokens · pinned 6 days ago

  • remotion-docs

    This skill enables agents to search and retrieve Remotion documentation via the Algolia API and fetch pages as Markdown.

    by RemotionOfficial publisher

    Claude Code, Codex, Cursor +3 · about 320 tokens · pinned 6 days ago

  • remotion-docs

    This skill searches the Remotion documentation using the Algolia API and retrieves documentation pages as Markdown.

    by RemotionOfficial publisher

    Claude Code, Codex, Cursor +3 · about 320 tokens · pinned 6 days ago

  • receipts

    This skill generates a personal Claude Code usage report from local session transcripts stored in ~/.claude/projects, mining activity across projects without…

    by AnthropicOfficial publisher

    Contains scripts

    Claude Code · about 4.1K tokens · pinned 6 days ago

  • solo

    This skill enables an agent to work through a single difficult mathematics problem independently within one session.

    by AnthropicOfficial publisher

    Claude Code · about 1.4K tokens · pinned 6 days ago

Open roles at Google

No open roles at Google on the Agent Native jobs board right now.

Browse the jobs board

The skills listed here are third-party software, collected from public GitHub repositories as a catalog of recent skills and provided as is. Agent Native does not write or control them and is not responsible for any harm, loss or damage caused by installing or using them. Labels and checks describe what we saw at one commit and are not a guarantee. Read a skill's files before you run it. Terms of use