# Golden and snapshot tests

> Golden and snapshot tests is an open-source agent skill for developer tools. Lets an agent write and review frozen data and pixel golden tests for React Native apps. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/zakariaf/ReactNative-Skills/tree/main/skills/golden-and-snapshot-tests
- **Repository:** https://github.com/zakariaf/reactnative-skills
- **GitHub stars:** 16
- **License:** MIT
- **Skill name:** golden-and-snapshot-tests
- **Collection:** https://github.com/zakariaf/ReactNative-Skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill sets up and polices golden tests in a Jest golden project: readable text snapshots of pure logic, append-only contract entries for outputs that installed versions and saved files must reproduce, and pixel goldens for Skia drawing. It spells out when a golden may be rewritten, which is only by running jest -u on one named file after reading the diff, and forbids any script, hook or CI job from writing goldens automatically.

The workflow picks the right kind of golden, scaffolds missing helpers from bundled templates, and walks through creating goldens with --listTests before accepting them. Two bundled checker scripts inspect the working tree and the commit history, verifying that golden changes carry a Gate-Change trailer, that contract entries are never edited or deleted, and that pixel tolerances are never raised without approval.

It expects a Jest setup with a golden project, jest-expo for iOS snapshots, and Node for the checker scripts. Pixel goldens additionally need jest-image-snapshot pinned to a specific version and a CanvasKit-based Skia test environment.

## When your agent uses it

> Guards data and pixel goldens - *.golden.test.ts snapshots, append-only [contract] entries, Skia tolerance, jest -u rules. Use when adding a golden or snapshot test or a .snap diff appears. Not for device screenshots (e2e-maestro).

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Runs JavaScript and TypeScript scripts](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/golden-and-snapshot-tests)
- [No network calls found in its scripts](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/golden-and-snapshot-tests)
- [License: MIT](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/golden-and-snapshot-tests)

## Features

- **Data golden pattern:** Readable text snapshots of pure units with fixed inputs and reviewable diffs.
- **Append-only contract entries:** Protects outputs such as backup formats and derived identifiers from silent change across versions.
- **Pixel golden matcher:** Renders Skia drawings at several canvas sizes and compares them with a fixed 0.1% tolerance.
- **Snapshot update rules:** Forbids automated snapshot updates in scripts, hooks and CI and limits jest -u to one file by hand.
- **Tree and history checkers:** Scripts that verify snapshot hygiene and Gate-Change trailers on commits.
- **Commit trailer workflow:** Steps for recording why each golden changed in the commit message.

## Good for

- Add a readable golden test for a pure scheduling or formatting function
- Pin a backup or export format so future versions keep producing the same output
- Create pixel goldens for a Skia chart at narrow, phone and tablet sizes
- Investigate a failing snapshot and decide whether it is a bug or an intended change
- Check that a branch's golden changes carry the required Gate-Change trailers

## Install

### Claude Code

This skill ships in the `react-native` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add zakariaf/ReactNative-Skills
/plugin install react-native@react-native-skills
```

Or copy only this skill to `~/.claude/skills/golden-and-snapshot-tests`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/golden-and-snapshot-tests &&
cp -R "$tmp/skills/golden-and-snapshot-tests" ~/.claude/skills/golden-and-snapshot-tests &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/golden-and-snapshot-tests` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/golden-and-snapshot-tests` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/golden-and-snapshot-tests &&
cp -R "$tmp/skills/golden-and-snapshot-tests" ~/.agents/skills/golden-and-snapshot-tests &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/golden-and-snapshot-tests` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/golden-and-snapshot-tests` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/golden-and-snapshot-tests &&
cp -R "$tmp/skills/golden-and-snapshot-tests" ~/.cursor/skills/golden-and-snapshot-tests &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/golden-and-snapshot-tests` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/zakariaf/ReactNative-Skills.git --path skills/golden-and-snapshot-tests
```

Or copy the folder to `~/.gemini/skills/golden-and-snapshot-tests` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/golden-and-snapshot-tests`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/golden-and-snapshot-tests &&
cp -R "$tmp/skills/golden-and-snapshot-tests" ~/.copilot/skills/golden-and-snapshot-tests &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/golden-and-snapshot-tests` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git
```

Then copy `ReactNative-Skills/skills/golden-and-snapshot-tests` into your agent's skills folder as `golden-and-snapshot-tests`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need to be installed?

It expects a Jest golden project, and pixel goldens also need jest-image-snapshot pinned at 6.5.2 with its types at 6.4.2. The checker scripts run with Node.

### Can the agent update snapshots automatically?

Not in scripts, hooks or CI. Goldens change only by running jest -u on one named file by hand after reading its diff.

### What is a contract entry?

A describe titled [contract] that pins output every installed version or saved file must reproduce. Existing entries are never edited, deleted or renamed.

### Does Golden and snapshot tests handle device screenshots?

No. Device screenshots are covered by a separate e2e-maestro skill that uses a 0.2% tolerance.

### How do I install Golden and snapshot tests in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/golden-and-snapshot-tests to use it in all your projects, or to .claude/skills/golden-and-snapshot-tests in one project. Or install the react-native plugin, which includes it: /plugin marketplace add zakariaf/ReactNative-Skills, then /plugin install react-native@react-native-skills.

### Does Golden and snapshot tests run scripts?

Yes. It runs JavaScript and TypeScript scripts. No network calls were found in its scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Golden and snapshot tests?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Golden and snapshot tests?

The closest alternatives to Golden and snapshot tests are Vibe golden file testing, Design visual parity, Git commits and reporting, Jest skill and macOS golden gate design.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Vibe golden file testing](https://ai-powered.com/skills/vibe-golden-file-testing): Vibe golden file testing is an open-source agent skill for developer tools.
- [Design visual parity](https://ai-powered.com/skills/design-visual-parity): Design visual parity is an open-source agent skill for developer tools.
- [Git commits and reporting](https://ai-powered.com/skills/git-commits-and-reporting): Git commits and reporting is an open-source agent skill for developer tools.
- [Jest skill](https://ai-powered.com/skills/jest-skill): Jest skill is an open-source agent skill for developer tools.
- [macOS golden gate design](https://ai-powered.com/skills/macos-golden-gate-design): macOS golden gate design is an open-source agent skill for design and media.
- [Game rules engine](https://ai-powered.com/skills/game-rules-engine): Game rules engine is an open-source agent skill for developer tools.
- [Expo prebuild and config plugins](https://ai-powered.com/skills/expo-prebuild-and-config-plugins): Expo prebuild and config plugins is an open-source agent skill for developer tools.
- [Flutter testing skill](https://ai-powered.com/skills/flutter-testing-skill): Flutter testing skill is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/golden-and-snapshot-tests
