skia-gn-workflow
Skill11k starsChanged 4 days agoBSD-3-ClauseView on GitHub
MANDATORY: Use this skill for ANY and ALL tasks involving building Skia with GN, Ninja, or compiling any Skia tool. It is the authoritative source for Skia's build workflows and MUST be used whenever compilation is required.
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 2 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Hermeticity: Always use ./bin/gn for configuration and ./bin/fetch-ninja to ensure the correct version of Ninja is available.
- Distinctive: line 15
Verification: Always build and run tests/benchmarks before documenting or finalizing changes.
- Very specific: line 16
Filtering: Use the --match flag (aliased as -m) to target specific tests and reduce execution time.
- Very specific: line 18
Toolchain Paths: When a build requires specific toolchain paths (e.g.
- Very specific: line 23
If you encounter compilation errors in third_party or missing headers, run:
- Very specific: line 29
If the ninja command is not found or you want to ensure a hermetic version:
- Distinctive: line 41
If the build system gets into a broken state, clean the directory:
- Very specific: line 53
If a build requires Rust dependencies (in third_party), use bazelisk to manage the toolchain:
- Very specific: line 75
Windows: Use clang_win="<path_to_llvm>" to build with clang-cl (highly recommended).
- Very specific: line 126
Unit Tests: Use DEF_TEST(Name, reporter) in tests/.
- Very specific: line 127
GMs: Use DEF_GM(return new MyGM;) in gm/.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
skia-gn-workflow
This skill provides expert guidance for building and testing Skia using the GN build system and Ninja. It covers common workflows for correctness testing (dm), performance benchmarking (nanobench), and interactive visualization (viewer).
Core Principles
- Hermeticity: Always use
./bin/gnfor configuration and./bin/fetch-ninjato ensure the correct version of Ninja is available. - Verification: Always build and run tests/benchmarks before documenting or finalizing changes.
- Filtering: Use the
--matchflag (aliased as-m) to target specific tests and reduce execution time. - Build Directories: NEVER override a user's existing build directory settings (e.g.
out/Debug). If you need a different configuration, create a new directory (e.g.out/Debug2,out/ASAN). Only modify settings in an existing directory if explicitly asked by the user. - Toolchain Paths: When a build requires specific toolchain paths (e.g.
cc,cxx, orclang_winfor Clang/LLVM), ALWAYS ask the user where these are extracted on their machine. Different developers have these in different locations.
Setup & Troubleshooting
1. Syncing Dependencies
If you encounter compilation errors in third_party or missing headers, run:
python3 tools/git-sync-deps2. Fetching Ninja
If the ninja command is not found or you want to ensure a hermetic version:
./bin/fetch-ninja3. Formatting Code
Near the end of your workflow, before uploading a CL or finalizing changes, format your code using:
git clang-format origin/main4. Cleaning Builds
If the build system gets into a broken state, clean the directory:
./bin/gn -q clean out/Dir5. Inspecting the Build
To understand how a target is being built or to find available targets:
- List all targets:
./bin/gn ls out/Dirorninja -C out/Dir -t targets - Inspect a target:
./bin/gn desc out/Dir //:dm(shows flags, defines, sources, etc.) - Check why a file is included:
./bin/gn path out/Dir //:dm //src/core/SkPath.cpp
6. Rust Dependencies (Bazel)
If a build requires Rust dependencies (in third_party), use bazelisk to manage the toolchain:
Build Workflows
1. Common Build Arguments
is_debug=false: Create an optimized Release build.is_official_build=true: Optimized build, links against system libraries. Suitable for shipping.is_component_build=true: Build Skia as a shared library.sanitize="ASAN"|"MSAN"|"TSAN"|"UBSAN": Enable memory, address, thread, or undefined behavior sanitizers.extra_cflags=["..."],extra_ldflags=["..."]: Add custom compiler/linker flags.cc="clang" cxx="clang++": Specify the compiler (highly recommended for performance).
2. Sanitizer Builds (xsan)
- ASAN:
./bin/gn gen -q out/ASAN --args='sanitize="ASAN" cc="<path_to_clang>" cxx="<path_to_clang++>"' - MSAN:
./bin/gn gen -q out/MSAN --args='sanitize="MSAN" cc="<path_to_clang>" cxx="<path_to_clang++>" skia_use_fontconfig=false'- Note: Run
dmwith--nogpuunder MSAN to avoid driver noise.
- Note: Run
- TSAN:
./bin/gn gen -q out/TSAN --args='sanitize="TSAN" is_debug=false cc="<path_to_clang>" cxx="<path_to_clang++>"'
3. Platform Specifics
- Android:
./bin/gn gen -q out/android --args='ndk="~/ndk" target_cpu="arm64"' - iOS:
./bin/gn gen -q out/ios --args='target_os="ios" target_cpu="arm64"' - Windows: Use
clang_win="<path_to_llvm>"to build with clang-cl (highly recommended).
4. Other Build Notes
- Unless otherwise instructed, build with:
ninja --quiet -C {OUT_DIR} {TARGET}. If given anninjacommand that is missing--quiet, you must add--quiet.
Tool Reference
dm (Correctness Testing)
dm runs GMs (graphics tests), unit tests, and compares images.
- Common Flags:
--src <types>: e.g.,--src tests gm skp image.--config <configs>: e.g.,--config 8888 gl.--match/-m: Case-sensitive substring filter. Supports~(exclude),^(start),$(end).--skip <config> <src> <srcOptions> <name>: Skip specific test cases. Use_for wildcards.--writePath/-w: Write result bitmaps as PNGs.--readPath/-r: Read reference bitmaps for comparison.--threads/-j: Number of threads (default: one per core).--verbose/-v: Detailed output.
- Extended Help: For detailed documentation on specific flags, use
--help <flag_name>.- Example:
out/Debug/dm --help config.
- Example:
nanobench (Performance Benchmarking)
Always use a Release build for benchmarking.
- Common Flags:
--samples <N>: Number of samples per benchmark (default 10).--ms <time>: Run each benchmark for at least<time>milliseconds.--cpuprofile <file>: Write pprof CPU profile (requiresskia_use_pprof=true).--match/-m: Filter benchmarks.
- Baseline Preservation: It is recommended to copy a stable baseline binary to
nanobench_control(outside theout/directory) to compare against a new build.
viewer (Interactive Visualization)
- Common Flags:
--backend/-b:sw,gl,vulkan,metal,d3d.--slide <name>: Jump to a specific GM or SKP.--match/-m: Filter slides.
- Hotkeys:
i(HUD),z(zoom),[/](navigation).
Advanced: "Via" Configs
dm supports "via" configs in the format [via-]*backend. These wrap a rendering sink to test additional logic.
- Examples:
serialize-8888: Serialize and then deserialize the canvas before drawing.srgb-8888: Run the 8888 sink in the sRGB color space.
- Common Vias:
serialize: Serializes/Deserializes drawing.pic: Records toSkPictureand plays back.rtblend: Uses a runtime blend mode.matrix: Applies a 2x2 matrix (requires--matrix "s0 s1 s2 s3").upright: Applies a matrix and then uprights it.
- Color Space Vias:
srgb,linear,p3,rec2020,narrow.
Writing Tests
- Unit Tests: Use
DEF_TEST(Name, reporter)intests/. - GMs: Use
DEF_GM(return new MyGM;)ingm/.
6. Debugging Fuzz Cases & Writing Reproduction Tests
To build and run a fuzzer (like Clusterfuzz or oss-fuzz) to reproduce a crash:
ninja --quiet -C out/Debug fuzz
out/Debug/fuzz --bytes <path_to_testcase>For the full workflow (including writing reproduction unit tests), see Fuzz Debugging.
Available Resources
- Build Arguments
- dm Usage
- nanobench Usage
- viewer Usage
- Testing
- GMs
- Fuzz Debugging
- Other Tools
Trending
Quiet since July.about the whole repository
Who's talking about google/skia
- flutter/flutter“Add ColorFilter.cube to apply 3D lookup table”GitHub · Apr 27, 2020 · 29 reactions
- flutter/flutter“[engine] Fix bold font fallback for non-Latin scripts on iOS”GitHub · Dec 2, 2025 · 24 reactions
- mono/SkiaSharp“[FEATURE] TIFF support”GitHub · Sep 11, 2024 · 12 reactions
- flutter/flutter“Fix RenderParagraph to use correct ideographic baseline”GitHub · Dec 25, 2025 · 8 reactions
- flutter/flutter“3.28 branch info”GitHub · Dec 5, 2024 · 8 reactions
The biggest 5 of 37 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 37
Talked about on GitHub, Stack Overflow and Hacker News (37 times).
On GitHub · 30
- Apr 27, 2020Add ColorFilter.cube to apply 3D lookup table — flutter/flutter29 reactions · 10 comments
- Dec 2, 2025[engine] Fix bold font fallback for non-Latin scripts on iOS — flutter/flutter24 reactions · 11 comments
- Sep 11, 2024[FEATURE] TIFF support — mono/SkiaSharp12 reactions · 2 comments
- Dec 25, 2025Fix RenderParagraph to use correct ideographic baseline — flutter/flutter8 reactions · 19 comments
- Dec 5, 20243.28 branch info — flutter/flutter8 reactions · 4 comments
25 more on GitHub
- Oct 14, 2020Add feature of ComposePathEffect and CornerPathEffect — flutter/flutter8 reactions · 6 comments
- Feb 2, 2018Porting SkTextBox to support draw text in wrap — mono/SkiaSharp.Extended7 reactions · 13 comments
- May 23, 20243.23 beta branch info — flutter/flutter6 reactions · 3 comments
- Jun 9, 2017Porting SkTextBox to support draw text in wrap — mono/SkiaSharp6 reactions · 4 comments
- Aug 11, 2024Skparagraph binding — skia-python/skia-python5 reactions · 19 comments
- Jun 12, 2024Add an API for Getting Glyph Outlines as Paths — flutter/flutter5 reactions · 2 comments
- Jan 17, 2024Wishlist for new benchmarks — dtcxzyw/llvm-opt-benchmarksays it tested it5 reactions · 15 comments
- Nov 4, 2022[FEATURE] D3D12 support — mono/SkiaSharp5 reactions · 2 comments
- Jun 24, 2019Add Serialize methods support for SKPicture — mono/SkiaSharp5 reactions · 16 comments
- Mar 9, 2025support for alternative svg renderers — hyprwm/hyprcursor4 reactions · 4 comments
- Nov 4, 2021Add SkText — HumbleUI/Skija4 reactions
- Sep 30, 2021`dart:ui.LineMetrics` should include the line boundaries — flutter/flutter4 reactions · 1 comment
- Apr 16, 2026Support soft hyphen (U+00AD) rendering with a Hyphens API — flutter/flutter3 reactions · 42 comments
- Jul 27, 2026Bump the cargo-major group across 1 directory with 5 updates — sunsided/miniscreenshot2 reactions · 2 comments
- Jul 20, 2026Bump the cargo-major group across 1 directory with 4 updates — sunsided/miniscreenshot2 reactions · 2 comments
- Jul 13, 2026Bump the cargo-major group across 1 directory with 3 updates — sunsided/miniscreenshot2 reactions · 2 comments
- Jul 6, 2026Bump the cargo-major group across 1 directory with 2 updates — sunsided/miniscreenshot2 reactions · 2 comments
- Jun 22, 2026Update skia-safe requirement from 0.97 to 0.99 in the cargo-major group — sunsided/miniscreenshot2 reactions · 3 comments
- Jun 17, 2025pixels: Multiply by alpha with less loss of precision — servo/servo2 reactions · 2 comments
- Apr 19, 2024Align Android HB formats handling — wcandillon/react-native-skia2 reactions · 1 comment
- Sep 28, 2019Updating to m80 — mono/skia2 reactions · 3 comments
- Mar 6, 2025[skia] Fix dependency skia — microsoft/vcpkg1 reaction
- Apr 12, 2024[Impeller] Use Wang's formula for quad/cubic subdivision. — flutter-team-archive/engine1 reaction · 5 comments
- Mar 22, 2022add metal-window example — rust-skia/rust-skia1 reaction · 2 comments
- Mar 20, 2020Revert "Enable unified OpenGL/Metal builds." — flutter-team-archive/engine0 reactions · 2 comments
On Stack Overflow · 6
- May 30, 2024How to embed skia python surface inside pysdl23 votes
- Dec 17, 2020Why does Android use pinImages to upload texutures of mutable bitmaps to GPU?1 vote
- Dec 1, 2017Skia buggy color blending1 vote · 1 answer
- May 21, 2024Qt/C++ Convert a quadrilateral (trapezoid) into a rectangle without additional libraries0 votes
- Mar 11, 2022Load images for canvaskit-wasm on node.js environment0 votes
1 more on Stack Overflow
- Feb 24, 2021Android 11,crash in skia/src/ops/GrorvalOpFactory.cpp, Help me see why-1 votes · 1 answer
On Hacker News · 1
- Oct 2, 2018HotSort GPU accelerated integer sorting library2 points
In this repository2 other files it gives its agents.
- skia-add-testSkill
- skia-style-checkSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

