api-add-review

Add and review C# APIs in SkiaSharp by wrapping Skia C++ functionality.

5.6k|645|Updated Feb 22, 2016
One-click install
npx skills add https://github.com/mono/SkiaSharp --skill api-add-review
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-add-review
Source: https://github.com/mono/SkiaSharp/tree/main/.agents/skills/api-add-review
Command: npx skills add https://github.com/mono/SkiaSharp --skill api-add-review

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Adding new APIs to SkiaSharp requires coordinating C++ analysis, C API bindings, generated interop code, C# wrappers, native rebuilds, tests, and gallery samples across a repository with a git submodule, and mistakes like skipping the native build or editing generated files cause runtime failures.

Core Features & Use Cases

  • Add Mode: A 10-phase workflow covering C++ API analysis, C API creation in the skia submodule, binding generation, C# wrapper design, native rebuild, tests, and gallery samples.
  • Review Mode: A structured checklist that audits naming, Span overloads, properties vs methods, interop safety, test coverage, and sample quality, with an auto-fix mode for high-confidence issues.
  • Use Case: When asked to expose SkFontArguments variation APIs, the skill walks through writing the C API in externals/skia, regenerating SkiaApi.generated.cs, adding Span-based C# wrappers, rebuilding natives, and verifying tests pass.

Quick Start

Ask the assistant to add a new SkiaSharp API wrapping a specific Skia C++ method, or to review an existing API pull request for design correctness.

Frequently Asked Questions about api-add-review

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new C# API to SkiaSharp?

Follow the add workflow: analyze the C++ API in Skia headers, add a C API in externals/skia, commit the submodule, run pwsh ./utils/generate.ps1 to regenerate bindings, write the C# wrapper, rebuild natives, and add tests plus a gallery sample.

How do I review a SkiaSharp API pull request?

Use the review workflow to check naming against upstream Skia, verify Span overloads and Count properties exist, confirm no default parameters or XML doc comments, audit test coverage for exact values and interop round-trips, and produce a structured report.

Why do I get EntryPointNotFoundException after adding a C API function?

The native library was not rebuilt after adding the C API function, so the pre-built binaries lack the new entry point. Run dotnet cake --target=externals-{platform} --arch={arch} and re-run the tests.

Can I edit SkiaApi.generated.cs manually to add a binding?

No, generated files are overwritten on regeneration. Add the C API in externals/skia, map new types in libSkiaSharp.json, then run pwsh ./utils/generate.ps1 to produce the binding.

What branch should I use when adding SkiaSharp APIs?

Never commit directly to main or the skiasharp submodule branch. Create a feature branch in both the parent repository and the externals/skia submodule, commit in the submodule first, then stage it in the parent.