# JSON canonicalization

> JSON canonicalization is an open-source agent skill for security. Canonicalizes JSON per RFC 8785 so signed and hashed data stays repeatable. 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/ScaleDockHQ/better-supabase/tree/main/.agents/skills/json-canonicalization
- **Repository:** https://github.com/scaledockhq/better-supabase
- **GitHub stars:** 5
- **License:** MIT
- **Skill name:** json-canonicalization
- **Collection:** https://github.com/ScaleDockHQ/better-supabase
- **Categories:** [security](https://ai-powered.com/categories/security)
- **Listing updated:** 2026-12-02

## About

This skill guides an agent through producing a canonical form of JSON using the JSON Canonicalization Scheme defined in RFC 8785, so that hashing and signing produce consistent results across producers and consumers. It walks through the requirements of the RFC one by one: I-JSON compatibility, rejection of duplicate property names, no whitespace between tokens, specific escaping rules for control characters, sorting of object properties recursively while leaving array order intact, and UTF-8 encoding of the result.

The workflow asks the agent to first settle whether it is acting as producer or consumer, then to apply each applicable requirement, and to make implementations fail with an error on lone surrogates, NaN or Infinity instead of emitting broken output. A references folder holds the pinned requirement quotes and version notes, and the skill tracks the RFC revision it was written from.

The skill contains no scripts. It expects the agent to write the canonicalization logic itself in whatever language the project uses, and it is meant for cases where JSON is canonicalized before signing.

## When your agent uses it

> JSON Canonicalization Scheme (JCS): Cryptographic operations like hashing and signing need the data to be expressed in an invariant format so that the operations are reliably repeatable. Covers RFC 8785 JSON Canonicalization Scheme (JCS). Use when canonicalizing JSON for signing. Triggers: RFC 8785, JCS.

## What it can access

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

- [Instructions only, no scripts](https://github.com/ScaleDockHQ/better-supabase/tree/HEAD/.agents/skills/json-canonicalization)
- [License: MIT](https://github.com/ScaleDockHQ/better-supabase/tree/HEAD/.agents/skills/json-canonicalization)

## Features

- **RFC 8785 requirements:** Walks the agent through the canonicalization rules of RFC 8785 section by section.
- **Property sorting:** Recursively sorts object properties while keeping array element order unchanged.
- **String escaping rules:** Covers which control characters use short escapes and which use lowercase hex notation.
- **Invalid input errors:** Requires implementations to fail on lone surrogates, NaN and Infinity rather than output them.
- **Pinned source tracking:** Records the RFC revision it follows and includes steps for checking for updates.

## Good for

- Canonicalize a JSON payload before computing its hash
- Prepare JSON for a digital signature so verification stays repeatable
- Check that a JSON serializer meets RFC 8785 rules
- Review existing JSON signing code for duplicate keys or whitespace issues

## Install

### Claude Code

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

```sh
/plugin marketplace add ScaleDockHQ/better-supabase
/plugin install better-supabase@better-supabase
```

Or copy only this skill to `~/.claude/skills/json-canonicalization`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/json-canonicalization &&
cp -R "$tmp/.agents/skills/json-canonicalization" ~/.claude/skills/json-canonicalization &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/json-canonicalization` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/json-canonicalization` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/json-canonicalization &&
cp -R "$tmp/.agents/skills/json-canonicalization" ~/.agents/skills/json-canonicalization &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/json-canonicalization` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/json-canonicalization` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/json-canonicalization &&
cp -R "$tmp/.agents/skills/json-canonicalization" ~/.cursor/skills/json-canonicalization &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/json-canonicalization` 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/ScaleDockHQ/better-supabase.git --path .agents/skills/json-canonicalization
```

Or copy the folder to `~/.gemini/skills/json-canonicalization` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/json-canonicalization`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/json-canonicalization &&
cp -R "$tmp/.agents/skills/json-canonicalization" ~/.copilot/skills/json-canonicalization &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/json-canonicalization` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git
```

Then copy `better-supabase/.agents/skills/json-canonicalization` into your agent's skills folder as `json-canonicalization`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does the skill trigger?

It is meant for canonicalizing JSON for signing and is triggered by mentions of RFC 8785 or JCS.

### Does JSON canonicalization run any scripts?

No. The skill contains no scripts and relies on the agent to write the canonicalization logic.

### Which RFC does JSON canonicalization follow?

It follows RFC 8785, the JSON Canonicalization Scheme, published in June 2020 as informational.

### How is JSON canonicalization installed?

The README gives the command npx skills add ScaleDockHQ/scaledock-skills --skill json-canonicalization.

### How do I install JSON canonicalization in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/json-canonicalization to use it in all your projects, or to .claude/skills/json-canonicalization in one project. Or install the better-supabase plugin, which includes it: /plugin marketplace add ScaleDockHQ/better-supabase, then /plugin install better-supabase@better-supabase.

### Does JSON canonicalization run scripts?

No. It is instructions only, with no 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 JSON canonicalization?

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 JSON canonicalization?

The closest alternatives to JSON canonicalization are JWT, HTTP cookies, Gnap, Sh kb auth and Axiom security.

## Where this comes from

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

## Alternatives

- [JWT](https://ai-powered.com/skills/jwt-scaledockhq): JWT is an open-source agent skill for security.
- [HTTP cookies](https://ai-powered.com/skills/http-cookies): HTTP cookies is an open-source agent skill for security.
- [Gnap](https://ai-powered.com/skills/gnap): Gnap is an open-source agent skill for security.
- [Sh kb auth](https://ai-powered.com/skills/sh-kb-auth): Sh kb auth is an open-source agent skill for security.
- [Axiom security](https://ai-powered.com/skills/axiom-security-charleswiltgen-2): Axiom security is an open-source agent skill for security.
- [Cedar](https://ai-powered.com/skills/cedar): Cedar is an open-source agent skill for security.
- [Sarif parsing](https://ai-powered.com/skills/sarif-parsing): Sarif parsing is an open-source agent skill for security.
- [Security](https://ai-powered.com/skills/security-sorah): Security is an open-source agent skill for security.

---
Source: https://ai-powered.com/skills/json-canonicalization
