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.
npx skills add https://github.com/google/skia --skill 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).
./bin/gn for configuration and ./bin/fetch-ninja to ensure the correct version of Ninja is available.--match flag (aliased as -m) to target specific tests and reduce execution time.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.cc, cxx, or clang_win for Clang/LLVM), ALWAYS ask the user where these are extracted on their machine. Different developers have these in different locations.If you encounter compilation errors in third_party or missing headers, run:
python3 tools/git-sync-deps
If the ninja command is not found or you want to ensure a hermetic version:
./bin/fetch-ninja
Near the end of your workflow, before uploading a CL or finalizing changes, format your code using:
git clang-format origin/main
If the build system gets into a broken state, clean the directory:
./bin/gn -q clean out/Dir
To understand how a target is being built or to find available targets:
./bin/gn ls out/Dir or ninja -C out/Dir -t targets./bin/gn desc out/Dir //:dm (shows flags, defines, sources, etc.)./bin/gn path out/Dir //:dm //src/core/SkPath.cppIf a build requires Rust dependencies (in third_party), use bazelisk to manage the toolchain:
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).xsan)./bin/gn gen -q out/ASAN --args='sanitize="ASAN" cc="<path_to_clang>" cxx="<path_to_clang++>"'./bin/gn gen -q out/MSAN --args='sanitize="MSAN" cc="<path_to_clang>" cxx="<path_to_clang++>" skia_use_fontconfig=false'dm with --nogpu under MSAN to avoid driver noise../bin/gn gen -q out/TSAN --args='sanitize="TSAN" is_debug=false cc="<path_to_clang>" cxx="<path_to_clang++>"'./bin/gn gen -q out/android --args='ndk="~/ndk" target_cpu="arm64"'./bin/gn gen -q out/ios --args='target_os="ios" target_cpu="arm64"'clang_win="<path_to_llvm>" to build with clang-cl (highly recommended).ninja --quiet -C {OUT_DIR} {TARGET}. If given an ninja command that is missing --quiet, you *must* add --quiet.dm (Correctness Testing)dm runs GMs (graphics tests), unit tests, and compares images.
--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.--help <flag_name>.out/Debug/dm --help config.nanobench (Performance Benchmarking)Always use a Release build for benchmarking.
--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 (requires skia_use_pprof=true).--match / -m: Filter benchmarks.nanobench_control (outside the out/ directory) to compare against a new build.viewer (Interactive Visualization)--backend / -b: sw, gl, vulkan, metal, d3d.--slide <name>: Jump to a specific GM or SKP.--match / -m: Filter slides.i (HUD), z (zoom), [/] (navigation).dm supports "via" configs in the format [via-]*backend. These wrap a rendering sink to test additional logic.
serialize-8888: Serialize and then deserialize the canvas before drawing.srgb-8888: Run the 8888 sink in the sRGB color space.serialize: Serializes/Deserializes drawing.pic: Records to SkPicture and 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.srgb, linear, p3, rec2020, narrow.DEF_TEST(Name, reporter) in tests/.DEF_GM(return new MyGM;) in gm/.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.
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.
Intelligently organizes your files and folders across your computer by understanding context, finding duplicates, suggesting better structures, and automating cleanup tasks. Reduces cognitive load and keeps your digital workspace tidy without manual effort.
Generates creative domain name ideas for your project and checks availability across multiple TLDs (.com, .io, .dev, .ai, etc.). Saves hours of brainstorming and manual checking.
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
Implements Manus-style file-based planning for complex tasks. Creates task_plan.md, findings.md, and progress.md. Use when starting complex multi-step tasks, research projects, or any task requiring >5 tool calls.
Creative research ideation and exploration. Use for open-ended brainstorming sessions, exploring interdisciplinary connections, challenging assumptions, or identifying research gaps. Best for early-stage research planning when you do not have specific observations yet. For formulating testable hypotheses from data use hypothesis-generation.
Comprehensive GitHub project management with swarm-coordinated issue tracking, project board automation, and sprint planning
Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".
Take google/skia-gn-workflow from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.