sanity-pkg-utils
Skill by sanity-io
Builds, watches, and validates Sanity npm libraries with the pkg CLI and @sanity/pkg-utils. Intended for packages that use Sanity-style package.json exports and package.config.ts.
Install sanity-pkg-utils
Built from the published package, never by AI.
git clone --depth 1 https://github.com/sanity-io/pkg-utils /tmp/pkg-utils && mkdir -p ~/.claude/skills && cp -r /tmp/pkg-utils/skills/sanity-pkg-utils ~/.claude/skills/sanity-pkg-utilsRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/sanity-io/pkg-utils /tmp/pkg-utils && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/pkg-utils/skills/sanity-pkg-utils ~/.gemini/antigravity-cli/skills/sanity-pkg-utilsAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This agent skill guides an assistant through using the pkg CLI and @sanity/pkg-utils to build, watch, and validate Sanity npm library packages. It explains that pkg-utils composes tsdown with @sanity/tsdown-config and derives entries, formats, and browser or node builds from the hand-written package.json exports map. It covers commands such as pkg build, pkg watch, and pkg check, along with package.config.ts options, dependency controls, React and CSS handling, and common pitfalls.
The skill is aimed at developers maintaining Sanity-style library packages. It also helps them decide whether to stay with pkg-utils or use @sanity/tsdown-config directly, for example when they need multiple tsdown configs or the reactCompiler.reactServer dual build.
Written from the project's SKILL.md and checked against it.
What it can do
- pkg buildBuilds the package once, with options for strict checks, running checks after the build, and keeping dist.
- pkg watchRebuilds the package when source or config files change.
- pkg checkValidates the package without building it, including publint checks.
- Exports-driven buildsDerives entries, formats, and platform builds from the package.json exports map.
- package.config.ts setupConfigures tsconfig, output directory, minification, dependency bundling, and CSS options.
- Dependency controlsUses deps.neverBundle and deps.alwaysBundle to decide which dependencies are bundled.
- React and CSS optionsCovers opt-in React Compiler, styled-components, vanilla-extract, and plain CSS export handling.
What you need
- Node.js ^22.18.0, ^24.11.0, or >=26.0.0 for @sanity/pkg-utils 13.x
- pnpm to add the package as a dev dependency
Try asking
- Set up pkg build and pkg watch scripts for my Sanity library package.
- Check why my package.json exports are not reconciled after a pkg build.
- Help me decide whether to use pkg-utils or @sanity/tsdown-config directly.
Good to know
- pkg init is interactive and should not be automated through piped input.
- pkg-utils does not support reactCompiler.reactServer; use tsdown with @sanity/tsdown-config directly for that build.
- The external option is deprecated but still supported with a warning.
- pkg build never loads tsdown.config.* files.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/sanity-pkg-utils/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to sanity-pkg-utils
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
sanity-pkg-utils: common questions
Does pkg build read tsdown.config.ts?
No. pkg build never loads tsdown.config.*, and its only config file is package.config.ts (also .mts, .js, or .mjs). A tsdown.config.ts file is ignored by pkg.
Where does pkg-utils find the entry points to build?
Public entries come from package.json#exports, not a src config option. The bundles option can be used for non-exported artifacts such as workers or CLIs.
Should I use pkg watch to validate my package before publishing?
No. The source says to run pkg build --strict --check so exports are reconciled and TSDoc and publint checks execute, since pkg watch is not the final validation.
How do I install sanity-pkg-utils?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is sanity-pkg-utils free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is sanity-pkg-utils safe to use?
It scores 58 of 100. Grades: maintenance A, licence A, quality C. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to sanity-pkg-utils?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
