Skip to content

Expand API design docs and rename add-api skill to api-add-review#3749

Merged
mattleibow merged 2 commits into
mainfrom
dev/improve-api-docs
Apr 27, 2026
Merged

Expand API design docs and rename add-api skill to api-add-review#3749
mattleibow merged 2 commits into
mainfrom
dev/improve-api-docs

Conversation

@mattleibow

@mattleibow mattleibow commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Captures patterns and learnings from the variable font PR (#3703) into the developer documentation, restructures the API skill, and renames it from add-api to api-add-review to reflect both modes (add + review) and broader applicability beyond P/Invoke bindings.

No code changes — documentation and skill files only.

documentation/dev/api-design.md

  • Span overload triple pattern (array property + Count property + Span method)
  • Properties vs methods decision rule
  • Type wrapping for uint32_t typedefs (SKFourByteTag pattern)
  • Ref struct parameter bags (SKFontArguments pattern)
  • Test patterns: exact values, span equivalence, interop round-trip, static font handling, negative index, type-specific test files
  • No XML doc comments rule (generated by separate localized repo process)
  • File-scoped namespace preference

documentation/dev/adding-apis.md

  • DEF_MAP macro variants with when-to-use guide
  • Layout-compatible vs manual struct conversion
  • Parameter bag helper functions
  • static_assert in sk_structs.cpp for ABI verification
  • New typedef pattern (sk_fourbytetag_tSKFourByteTag)
  • libSkiaSharp.json configuration: type aliases, member renames, function parameter overrides, struct options
  • GPU-specific patterns: GR* prefix, #if SK_GANESH/SK_VULKAN guards, internal native structs
  • Build commands updated with native rebuild requirement

Skill restructure: add-apiapi-add-review

  • Renamed skill and updated all 9 references across AGENTS.md, issue-pipeline, issue-fix, skia-feature-scout
  • Split monolithic checklists.md into add-workflow.md (9-phase) and review-workflow.md
  • Created shared api-design-rules.md quick-reference
  • SKILL.md now dispatches between add mode and review mode

@github-actions

github-actions Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 3749

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 3749"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-3749/packages --name skiasharp-pr-3749
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-3749

…arnings

Significantly expand documentation/dev/adding-apis.md with:
- C API struct conversion patterns (DEF_MAP macros, layout-compatible vs manual)
- Generator configuration (libSkiaSharp.json type aliases, struct options, param overrides)
- GPU-specific patterns (prefix conventions, C API guards, platform conditionals)
- Additional common mistakes (externals-download after C API changes, missing static_asserts)

Expand documentation/dev/api-design.md with:
- Span overloads pattern (array property + count + Span fill method)
- Properties vs methods decision guide
- Type wrapping for uint32_t typedefs (SKFourByteTag pattern)
- Ref struct parameter bags for complex APIs
- Test patterns (exact values, Span equivalence, round-trip, static font, negative index)
- XML documentation and file convention guidelines

Restructure add-api skill from monolithic SKILL.md into:
- SKILL.md: mode detection (add vs review), concise rules table
- references/add-workflow.md: step-by-step add phases with struct conversion examples
- references/api-design-rules.md: quick-reference checklist
- references/review-workflow.md: structured review with auto-fix capability
- Remove old references/checklists.md (superseded by above)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow
mattleibow force-pushed the dev/improve-api-docs branch from ac9aea5 to 4f209be Compare April 26, 2026 01:34
Rename reflects both modes (add new APIs + review existing PRs) and broader
applicability beyond just P/Invoke bindings to all C# library code in source/.

Updated all 9 references across 7 files:
- AGENTS.md (slash command + classification tables)
- documentation/dev/issue-pipeline.md (pipeline routing)
- .agents/skills/issue-fix/SKILL.md (cross-reference)
- .agents/skills/skia-feature-scout/SKILL.md (suggestion prompt)
- .agents/skills/skia-feature-scout/references/schema-cheatsheet.md (3x skillToUse)
- .agents/skills/api-add-review/SKILL.md (name field)
- Directory: .agents/skills/add-api/ → .agents/skills/api-add-review/

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow mattleibow changed the title Expand API design and adding-APIs documentation with variable font learnings Expand API design docs and rename add-api skill to api-add-review Apr 26, 2026
@mattleibow
mattleibow merged commit 01d1f2e into main Apr 27, 2026
2 of 3 checks passed
@mattleibow
mattleibow deleted the dev/improve-api-docs branch April 27, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant