documentation/dev/writing-docs.md
This guide covers generating and updating SkiaSharp API documentation.
SkiaSharp provides two types of documentation: concept docs and API docs.
The conceptual docs live on the main branch under documentation/conceptual/ and are published to:
See site.md for how to build, preview, and customize the docs site.
The API docs are XML reference documentation generated from SkiaSharp assemblies using mdoc. They are published to https://docs.microsoft.com/dotnet/api/skiasharp.
Because the docs are large and contain examples, images, and other assets, they are hosted in a separate repository:
This repository is pulled into the main SkiaSharp repo as a Git submodule at docs/. The XML files live under docs/SkiaSharpAPI/.
Two workflows in this repo automate the full docs lifecycle:
A single agentic workflow handles the entire pipeline — regenerating XML stubs from CI NuGet packages AND filling "To be added." placeholders with AI-written documentation:
auto-api-docs-writer.md (agentic, in this repo)dotnet cake --target=update-docs to regenerate XML stubsapi-docs skill, finds all "To be added." placeholders, reads C# source code, writes proper documentationmono/SkiaSharp-API-docsautomation/write-api-docs → main in mono/SkiaSharp-API-docsNote: There is also a standalone
update-docs.ymlworkflow in the docs repo that only regenerates stubs (no AI writing). The agentic workflow above supersedes it for the full pipeline.
After docs changes are merged to mono/SkiaSharp-API-docs main (whether from the AI pipeline, manual edits, or any other source), the submodule pointer in this repo needs to be updated:
auto-docs-submodule-sync.yml (in this repo)docs/ submodule SHA with the latest mono/SkiaSharp-API-docs main SHA. If behind, creates a PR to bump the submodule.automation/update-docs-submodule → main in mono/SkiaSharp| Time (UTC) | Workflow | Action |
|---|---|---|
| 8:00 AM | auto-api-docs-writer | Regenerates stubs + AI fills placeholders → PR to docs repo |
| 10:00 AM | auto-docs-submodule-sync | Bumps docs/ submodule → PR to SkiaSharp |
Each step produces a PR that requires human review before merging.
You can also update the submodule manually:
cd docs
git checkout main
git pull
cd ..
git add docs
git commit -m "Update docs submodule"
dotnet tool restore
cd docs
git checkout -b my-docs-update
cd ..
dotnet cake --target=docs-download-output
This downloads NuGet packages from the SkiaSharp-CI feed. By default it fetches from the main branch. To use a different branch:
dotnet cake --target=docs-download-output --gitBranch=my-feature-branch
dotnet cake --target=update-docs
This generates both the changelogs and the XML API docs in the docs/ directory.
After generating, you can open the XML files in any text editor and add or update documentation. Any members that do not have content will have the placeholder text "To be added."
You can also use the api-docs Copilot skill to write and review XML documentation. Ask Copilot to "fill in missing docs", "document SKCanvas", or "review documentation quality" and it will follow the .NET API documentation guidelines automatically.
As you edit, you can apply formatting and see what docs are still missing by running:
dotnet cake --target=docs-format-docs
This will report a summary of documentation coverage (types and members with missing docs).
Once you are happy with your changes, push them to your fork of mono/SkiaSharp-API-docs and open a PR.
For detailed XML documentation patterns and review criteria, see:
.claude/skills/api-docs/references/patterns.md — XML syntax and examples.claude/skills/api-docs/references/checklist.md — Review severity criteria| Target | Description |
|---|---|
docs-download-output | Downloads _nugets and _nugetspreview packages from the SkiaSharp-CI Azure Artifacts feed |
docs-api-diff | Compares current NuGets against latest published versions, generates markdown diffs and changelogs |
docs-api-diff-past | Generates historical API diffs across all published versions |
docs-update-frameworks | Extracts assemblies, builds frameworks.xml with monikers, runs mdoc update to generate XML API docs |
docs-format-docs | Cleans XML output, removes duplicates, syncs extension method docs, reports coverage |
update-docs | Runs docs-api-diff → docs-update-frameworks → docs-format-docs in sequence |