Agent skill

Doc Generate API Mindspore

by mindspore-ai in mindspore-ai/docs

Generate documentation for Python APIs, functions, classes, and modules — including English docstrings and Chinese RST docs.

Apache-2.0Auto-check passedDevelopment

Install Doc Generate API Mindspore

skills CLI
$ npx skills add mindspore-ai/docs --skill doc-generate-api-mindspore -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mindspore-ai/docs doc-generate-api-mindspore --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mindspore-ai/docs.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/doc-generate-api-mindspore .claude/skills/doc-generate-api-mindspore && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
doc-generate-api-mindspore
GitHub stars
167
Token cost
~2k tokens
SKILL.md length
928 words
Files
3
Skills in repo
3
Repo updated
First seen
Licence
Apache-2.0

At a glance

Generate documentation for Python APIs, functions, classes, and modules — including English docstrings and Chinese RST docs.

  • Works in 6 steps: Ask generation scope: Use the question… → Collect references: PR links, test… → Read the source code: Understand… → …
  • Adding docstrings to new functions
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Writing API reference docs

What it does

Doc Generate API Mindspore is an agent skill from mindspore-ai/docs. Generate documentation for Python APIs, functions, classes, and modules — including English docstrings and Chinese RST docs. Use when adding docstrings to new functions or classes, writing API reference docs, creating examples, documenting classes, or following Python doc conventions. Triggers on phrases like "API documentation", "API docs", "document API", "write API documentation", "generate API docs", "API reference".

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files (for example `rules/chinese-rst-guide.md` and `rules/python-docstring-guide.md`).

It sits in Development, covering Technical documentation. It works with Python. The licence is Apache-2.0.

When your agent uses it

  • Adding docstrings to new functions
  • Writing API reference docs
  • Creating examples
  • Documenting classes

Example prompts

  • “API documentation”
  • “API docs”
  • “document API”
  • “/doc-generate-api-mindspore”

Requirements

  • Python 3

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Ask generation scope: Use the question tool to ask the user (single choice, labels in Chinese)
  2. Collect references: PR links, test files, design docs, issue descriptions
  3. Read the source code: Understand function signatures, parameter types, return values
  4. Verify parameter types: Cross-reference type hints with references for untyped params
  5. Run or infer examples: Get actual output values from test files or references
  6. Identify naming + file paths (only when no existing file): Determine the .py source path. Determine the dotted path via Naming Convention…

What it can do on your machine

Read from SKILL.md and the folder at commit 33a632b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Doc Generate API Mindspore loads about 2k tokens when it runs. Until then it costs about 113 tokens; SKILL.md has 928 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~113
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mindspore-ai/docs at commit 33a632b, republished under its Apache-2.0 licence (© mindspore-ai). 928 words, ~2,012 tokens.

Download SKILL.mdSave it as .claude/skills/doc-generate-api-mindspore/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
doc-generate-api-mindspore
description
Generate documentation for Python APIs, functions, classes, and modules — including English docstrings and Chinese RST docs. Use when adding docstrings to new functions or classes, writing API reference docs, creating examples, documenting classes, or following Python doc conventions. Triggers on phrases like "API documentation", "API docs", "document API", "write API documentation", "generate API docs", "API reference".

API Documentation Guide (API文档生成指南)

This skill generates Python API documentation in English docstrings (.py) and/or Chinese RST docs (.rst).

Workflow (工作流程)

Before Generation (生成前)
  1. Ask generation scope: Use the question tool to ask the user (single choice, labels in Chinese):

    • 两者都生成(默认)— both English and Chinese
    • 仅英文 — English docstring only
    • 仅中文 — Chinese RST doc only
  2. Collect references: PR links, test files, design docs, issue descriptions

  3. Read the source code: Understand function signatures, parameter types, return values

  4. Verify parameter types: Cross-reference type hints with references for untyped params

  5. Run or infer examples: Get actual output values from test files or references

  6. Check existing files (if scope includes Chinese RST): Search the docs directory for existing .rst files.

    • Search method: (a) by dotted path pattern — use glob with *<api_name>.rst across docs/, or (b) by content — use grep for the API name within .rst files under docs/.
    • Current API found → Use its current filename; skip Naming Convention + Path Mapping + trimming prompt.
    • Current API not found, but sibling APIs (other functions/classes in the same .py file) have RST files → Derive the naming convention from the sibling's filename (e.g., if sibling uses pkg.module.API, trim the source filename segment); skip project-wide pattern alignment; proceed to step 6 Path Mapping only.
    • No RST found for current API or any sibling → Proceed to step 6 for full Naming Convention + Path Mapping.
  7. Identify naming + file paths (only when no existing file): Determine the .py source path. Determine the dotted path via Naming Convention (filename = title = directive), check the depth threshold and ask the user if trimming is needed. Then determine the output directory via Path Mapping.

Output Target (输出目标)
OutputFile TypeLocationTools
English docstring.pyDirectly into the Python source fileRead + Edit
Chinese RST doc.rstProject-specific (see Naming Convention + Path Mapping below)Read + Edit / Write
Naming Convention (命名规范)

RST filename = title (1st line) = .. py:: directive path. One file per API, all three always identical.

The full dotted path from the package root is the default. For deeply nested paths, the user may trim intermediate levels — all three use the shorter path together.

Rules:

  • Default: full path starting from the package root (e.g., mindspore.ops.affine_grid), always includes the package name. The package root is the top-level Python package directory in the repo (typically matches the repo name or main source dir), not inferred from internal import statements.
  • Trimming: when full path is overly deep, user trims middle segments. Package + API name always kept.
  • Depth threshold with project pattern alignment: Determine the dotted path as follows:
    1. Start from the full dotted path at the package root.
    2. Check existing .rst files in the project's docs directory. If the prevailing pattern consistently omits the source filename (e.g., pkg.module.API rather than pkg.module.filename.API), automatically trim accordingly to match.
    3. If the resulting path exceeds 4 levels (e.g., mindspore.a.b.c.ReLU is 5 levels), must ask the user whether to trim further. Provide concrete trimming suggestions — list options that keep package + API name and remove different combinations of middle segments. 4 levels or fewer use the current path directly without asking.
  • Exception: MindSpore ops func_ prefix in filename, removed in title/directive.

The dotted path determines the filename, title, and directive — all three must always be identical.

Examples:

FileTitleDirective
mindspore.nn.Tanh.rstmindspore.nn.Tanh.. py:class:: mindspore.nn.Tanh
mindspore.ops.AffineGrid.rstmindspore.ops.AffineGrid.. py:class:: mindspore.ops.AffineGrid
mindspore.ops.func_abs.rst(例外)mindspore.ops.abs.. py:function:: mindspore.ops.abs
mindspore.Tensor.abs.rstmindspore.Tensor.abs.. py:method:: mindspore.Tensor.abs

For the exception row (3rd), the func_ prefix is present in the filename but omitted from the title and directive.

Show full SKILL.md (349 more words)Show less
Path Mapping (路径映射)

Once the naming convention (dotted path) is determined, map it to the output directory (where the .rst file will be saved).

Examples (illustrative only, not an allowlist):

RepositorySourceDotted Path → FilenameOutput Directory
mindsporemindspore/python/mindspore/nn/tanh.pymindspore.nn.Tanhdocs/api/api_python/nn/
mindspore-litemindspore-lite/python/api/model.pymindspore_lite.modeldocs/api/lite_api_python/
lite_boostlite_boost/python/parallel/context_parallel.pylite_boost.parallel.context_parallellite_boost/docs/api/lite_boost_api_python/lite_boost/

The directory is derived by: (a) checking existing docs dirs, (b) matching module hierarchy, (c) confirming .rst format from neighbors. The table above is only illustrative — every repo follows this same process.

If the directory still cannot be determined after applying these rules, ask the user where to save the .rst file.

Generation (生成中)
  1. Load rules: Read the corresponding rules file(s):

    • 仅英文 → rules/python-docstring-guide.md
    • 仅中文 → rules/chinese-rst-guide.md
    • 两者都生成 → Both rules/python-docstring-guide.md and rules/chinese-rst-guide.md
  2. Generate: Apply the loaded rules to create or update the target file(s) at the mapped paths.

Cross-check (交叉验证)

Compare English docstring and Chinese RST for consistency on shared content: params, return type, exception types, math formulas, opening description.

Do NOT flag: Chinese RST omits Examples and Supported Platforms, uses different heading formats.

  • 两者都生成 → Fix inconsistencies directly
  • 仅英文/仅中文 → If the other-language file exists, report discrepancies without modifying it. Skip if it does not exist.
Quality Checklist (质量检查清单)

If any item is not satisfied, fix it directly.

English Docstring
  • Summary in third person, includes purpose
  • Args/Returns/Raises sections complete per signature
  • Example is runnable and shows expected output
  • Uses r"""...""" raw string prefix
Chinese RST
  • RST filename = title = .. py:: directive path, all three consistent (exception: func_ prefix kept in filename, omitted in title/directive)
  • Title followed by = underline before directive
  • Correct heading: 参数: / 返回: / 异常: / 输入: / 输出:
  • Parameter format: - **name** (Type) - Description.
  • No colons in description text
  • No Examples or Supported Platforms sections
  • Proper nouns kept in English (NumPy, MindSpore, etc.)
After Generation (生成后)
  • 仅英文 → Report the .py file path. If an existing Chinese RST was found with inconsistencies, list them.
  • 仅中文 → Report the .rst file path. If an existing English docstring was found with inconsistencies, list them.
  • 两者都生成 → Report both paths plus total APIs documented.

Tip: After generation, additional references (PR links, test files, etc.) can be provided to refine accuracy.

© mindspore-ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files in skills/doc-generate-api-mindspore of mindspore-ai/docs.

  • SKILL.md
  • rules/chinese-rst-guide.md
  • rules/python-docstring-guide.md

Open the folder on GitHubat commit 33a632b

Compare with similar skills

Doc Generate API Mindspore next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Doc Generate API Mindspore compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Doc Generate API Mindspore this skillmindspore-ai/docs167—~2kAutomated safety check: PassApache-2.0
Adk Sample Creatorgoogle/adk-python22k—~1.3kAutomated safety check: PassApache-2.0
Crafting Effective Readmescumbucadev/cinemaempoa1465 repos~669Automated safety check: PassGPL-3.0
Acquire Codebase Knowledgegithub/awesome-copilot40k1 repos~2.3kAutomated safety check: PassMIT
Docs Conventionsflet-dev/flet17k—~1.6kAutomated safety check: PassApache-2.0
DDNS Provider DevelopmentNewFuture/DDNS4.7k—~558Automated safety check: PassMIT

Similar skills

  • Adk Sample Creator

    google/adk-python

    Official

    Creates a new sample agent in the ADK Python repository — the sample directory, its agent.py, and its README.md — following the conventions the existing samples already use.

    22k GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Crafting Effective Readmes

    cumbucadev/cinemaempoa

    A skill your agent uses when writing or improving README files.

    146 GitHub starsUsed in 5 repos~669 tokens
    DevelopmentAuto-check passed
  • Acquire Codebase Knowledge

    github/awesome-copilot

    Official

    Maps an unfamiliar codebase into seven evidence-backed documents in docs/codebase/, using a scan script and templates, for onboarding or architecture write-ups.

    40k GitHub starsUsed in 1 repo~2.3k tokens
    DevelopmentAuto-check passed
  • Docs Conventions

    flet-dev/flet

    A skill your agent uses when writing or reviewing Flet documentation, including Python docstrings (Google style, reST roles, admonitions), Markdown docs (cross-references, images, code examples)…

    17k GitHub stars~1.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Adds or changes a DNS provider in the DDNS project while keeping its code, schemas, tests and Chinese and English docs consistent.

    4.7k GitHub stars~558 tokensUpdated today
    DevelopmentAuto-check passed
  • Mkdocs

    jeka-dev/jeka

    MkDocs documentation project reference covering CLI commands, mkdocs.yml configuration, Material theme setup, and plugin integration.

    176 GitHub stars~2k tokensUpdated 2 mo ago
    DevelopmentAuto-check passed

More from mindspore-ai/docs

  • 检查文档质量的工具。当用户提到检查文档质量、审查文档、文档检查、文档审查、lint文档, 或者提供文档URL/PR链接/本地文件路径要求检查时触发。支持通用性检查、教程检查和API文档检查。

    167 GitHub stars~2.1k tokensUpdated 10 days ago
    Auto-check passed
  • Doc Release

    mindspore-ai/docs

    MindSpore 文档发布新分支时,链接更替与组件清洗技能,用于清理组件和替换链接. An agent skill from mindspore-ai/docs.

    167 GitHub stars~4.8k tokensUpdated 10 days ago
    Auto-check passed

Works with

Categories

Questions about Doc Generate API Mindspore

What does Doc Generate API Mindspore do?

Generate documentation for Python APIs, functions, classes, and modules — including English docstrings and Chinese RST docs. Doc Generate API Mindspore is an agent skill from mindspore-ai/docs. Generate documentation for Python APIs, functions, classes, and modules — including English docstrings and Chinese RST docs.

When should I use Doc Generate API Mindspore?

Doc Generate API Mindspore fits situations like: adding docstrings to new functions; writing API reference docs; creating examples; documenting classes.

How do I install Doc Generate API Mindspore in Claude Code?

Run `npx skills add mindspore-ai/docs --skill doc-generate-api-mindspore -a claude-code`. Or copy the skill folder (skills/doc-generate-api-mindspore in mindspore-ai/docs) into .claude/skills/doc-generate-api-mindspore in your project. Claude Code loads it when a task matches its description.

How do I install Doc Generate API Mindspore in Codex?

Run `npx skills add mindspore-ai/docs --skill doc-generate-api-mindspore -a codex`. Or copy the skill folder (skills/doc-generate-api-mindspore in mindspore-ai/docs) into .agents/skills/doc-generate-api-mindspore in your project. Codex loads it when a task matches its description.

Can I use Doc Generate API Mindspore in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mindspore-ai/docs --skill doc-generate-api-mindspore -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/doc-generate-api-mindspore, .gemini/skills/doc-generate-api-mindspore, .github/skills/doc-generate-api-mindspore and .opencode/skills/doc-generate-api-mindspore in your project.

What does Doc Generate API Mindspore need to run?

SKILL.md names no scripts, command-line tools or credentials: Doc Generate API Mindspore is instructions for the agent only. Our summary lists: Python 3.

Does Doc Generate API Mindspore access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Doc Generate API Mindspore safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Doc Generate API Mindspore use?

Doc Generate API Mindspore is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Doc Generate API Mindspore use?

About 2k tokens (SKILL.md is roughly 8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Doc Generate API Mindspore?

Skills that share tags, products or a category with Doc Generate API Mindspore: Adk Sample Creator (google/adk-python, 22k stars), Crafting Effective Readmes (cumbucadev/cinemaempoa, 146 stars), Acquire Codebase Knowledge (github/awesome-copilot, 40k stars) and Docs Conventions (flet-dev/flet, 17k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Doc Generate API Mindspore?

mindspore-ai (a GitHub organization) maintains it in mindspore-ai/docs, which has 167 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on September 29, 2026.

Source: mindspore-ai/docs on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.