i18n-array-groq-query-migration
This skill detects and updates GROQ queries that read locale from the _key field when migrating sanity-plugin-internationalized-array from v4 to v5 or…
Identity proven by GitHub's verified organisation badge (sanity-io)
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
- License
- MIT (permissive)
- Pin
- a80a997pinned Oct 9, 2026
- Context cost
- about 720 tokenswhen the skill loads
- GitHub stars
- 20on sanity-io/plugins
- Scripts
- None found
What it does
“Detect and update legacy GROQ patterns where language is read from _key for sanity-plugin-internationalized-array when users mention v4 to v5 migration, or @sanity/document-internationalization from v5 to v6. GROQ query updates, localized arrays, or patterns like `_key == "en"` and `_key == $language`.”
Generated summary from the skill's own text
This skill detects and updates GROQ queries that read locale from the _key field when migrating sanity-plugin-internationalized-array from v4 to v5 or @sanity/document-internationalization from v5 to v6. It searches for legacy patterns like `_key == "en"` or `_key == $language` and rewrites them to use the language field instead, with backwards-compatible or final-form versions depending on migration stage.
When to use it
- Migrating sanity-plugin-internationalized-array v4 to v5
- Migrating @sanity/document-internationalization v5 to v6
- Finding GROQ queries that filter on _key for language
- Updating localized array field access patterns
When not to
- Using _key for non-language array item identity
- Projects not using sanity-plugin-internationalized-array
- When language field doesn't yet exist in schema
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add sanity-io/plugins --skill i18n-array-groq-query-migrationInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install sanity-io/plugins i18n-array-groq-query-migration@a80a997e3d11d188f9639ac3efab1d8f93a276efInstalls the commit we checked (a80a997).
Copy by hand
Download the folder at a80a997 and put it in .claude/skills/i18n-array-groq-query-migration for Claude Code and in .agents/skills/i18n-array-groq-query-migration for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Claude Code plugin
/plugin install sanity@claude-plugins-officialThe publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "i18n-array-groq-query-migration" by Sanity. Source, pinned to commit a80a997e3d11d188f9639ac3efab1d8f93a276ef: https://github.com/sanity-io/plugins/tree/a80a997e3d11d188f9639ac3efab1d8f93a276ef/plugins/sanity-plugin-internationalized-array/skills/i18n-array-groq-query-migration 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/i18n-array-groq-query-migration/ for Claude Code and .agents/skills/i18n-array-groq-query-migration/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/sanity/i18n-array-groq-query-migration
SKILL.md at the pin
---
name: i18n-array-groq-query-migration
description: Detect and update legacy GROQ patterns where language is read from _key for sanity-plugin-internationalized-array when users mention v4 to v5 migration, or @sanity/document-internationalization from v5 to v6. GROQ query updates, localized arrays, or patterns like `_key == "en"` and `_key == $language`.
---
# Internationalized Array GROQ Migration
## Goal
Help users find GROQ queries that still read locale from `_key` and rewrite them safely for v5.
## When To Use
Use this skill when a user asks to:
- migrate `sanity-plugin-internationalized-array` from v4 to v5
- migrate `@sanity/document-internationalization` from v5 to v6 alongside `sanity-plugin-internationalized-array` language field changes
- find queries that still use `_key` for language lookup
- update GROQ filters like `_key == "en"` or `_key == $language`
## Detection Workflow
Detection commands below use `grep`. If your environment differs, use your editor's global search with equivalent patterns.
1. Search for direct language comparisons on `_key`:
```bash
grep -REn --exclude-dir=node_modules "_key[[:space:]]*==[[:space:]]*(\"[^\"]+\"|'[^']+'|\\$[A-Za-z_][A-Za-z0-9_]*)" .
```
1. Search for any localized-array filters that mention `_key`:
```bash
grep -REn --exclude-dir=node_modules "\[[^]]*_key[^]]*\]" .
```
1. Prioritize matches that look like localized-value reads, for example:
- `field[_key == ...][0].value`
- `select(...)` branches that compare `_key` to a language value
1. Check for uses of `groq` and verify if they use `_key` as the language, if it is using it, update them.
1. Explicitly check for template-interpolated language expressions and keep the same operand, for example:
- `_key == "${language}"`
- `_key == "${locale}"`
1. Review each match to avoid false positives where `_key` is used for unrelated array item identity.
## Rewrite Rules
Use the same language operand from the original query. The language operand can be a string literal (for example `"en"`), a variable (for example `$language`), or a template-interpolated expression (for example `"${language}"`).
- **Before data migration is executed (backwards compatible):**
- `_key == <languageExpr>` -> `language == <languageExpr> || _key == <languageExpr>`
- **After migration is complete:**
- `language == <languageExpr> || _key == <languageExpr>` -> `language == <languageExpr>`
## Examples
Legacy:
```groq
*[_type == "person"]{
"greeting": greeting[_key == $language][0].value
}
```
Backwards compatible:
```groq
*[_type == "person"]{
"greeting": greeting[language == $language || _key == $language][0].value
}
```
Post-migration final form:
```groq
*[_type == "person"]{
"greeting": greeting[language == $language][0].value
}
```
## Response Template
When reporting findings to a user:
1. List each query location that still uses `_key` as language source.
2. Show the exact replacement using the same language expression.
3. Label each replacement as:
- `backwards-compatible` (pre-migration), or
- `final` (post-migration complete).
4. Label each match category as `runtime`, `docs/example`, or `ambiguous`.
5. Call out any ambiguous `_key` usage that needs manual review.
From sanity-io/plugins at a80a997, shown as plain text under its license: MIT (permissive). The license text is in plugins/sanity-plugin-internationalized-array/LICENSE.
View SKILL.md on GitHub at a80a997Files
- SKILL.md3.3 KB · 148bbfa457f3
1 file, 3.3 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at a80a997More from Sanity
sanity-live-cache-components
Integrates Sanity Live with Next.js Cache Components in next-sanity v13+ apps, setting up shared cached data fetching through sanityFetch, live content…
Claude Code, Codex, Cursor +4 · about 4K tokens · pinned 6 days ago
content-experimentation-best-practices
This skill provides guidance for designing and running content experiments using A/B and multivariate testing.
Claude Code, Codex, Cursor +4 · about 360 tokens · pinned 6 days ago
content-modeling-best-practices
Guides agents through structured content modeling principles for headless CMSes like Sanity, covering schema design, content reuse strategies, and field…
Claude Code, Codex, Cursor +4 · about 340 tokens · pinned 6 days ago
portable-text-conversion
Converts HTML and Markdown content into Portable Text blocks for Sanity using markdownToPortableText, htmlToBlocks, or manual construction.
Claude Code, Codex, Cursor +4 · about 510 tokens · pinned 6 days ago
portable-text-serialization
This skill enables rendering Portable Text content across multiple frameworks and output formats using the @portabletext library family.
Claude Code, Codex, Cursor +4 · about 940 tokens · pinned 6 days ago
sanity-best-practices
This skill provides best practices for Sanity headless CMS development across schema design, GROQ queries, framework integrations (Next.js, Nuxt, Astro…
Claude Code, Codex, Cursor +4 · about 1.1K tokens · pinned 6 days ago
Related in Coding workflow
planning
This skill orchestrates multi-workflow projects with dependencies and shared data tables by creating a task graph in the orchestrator via the create-tasks tool.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 2.4K tokens · pinned 6 days ago
progressive-building
This skill implements incremental workflow development for agents building or extending workflows.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 1.4K tokens · pinned 6 days ago
workflow-builder
Builds and edits n8n workflows using the TypeScript SDK.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 14.2K tokens · pinned 6 days ago
remotion-upgrade
This skill upgrades Remotion and its related packages to the latest stable version.
by RemotionOfficial publisher
Claude Code, Codex, Cursor +3 · about 460 tokens · pinned 6 days ago
remotion-upgrade
This skill upgrades Remotion and related packages across a project, automatically detecting the package manager and workspaces.
by RemotionOfficial publisher
Claude Code, Codex, Cursor +3 · about 460 tokens · pinned 6 days ago
final-release-review
Audits Python SDK release candidates or plans against the previous release, comparing diffs for regressions, API changes, and version compatibility.
by OpenAIOfficial publisher
Contains scripts
Claude Code, Codex, Cursor +3 · about 5.4K tokens · pinned 6 days ago