Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问许可证需确认审计提醒

schema-mapper模式映射器

Agent Skill

schema-mapper 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

558

周安装

23

GitHub Stars

公开资料未说明

下载量

182
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:schema-mapper(模式映射器)
来源仓库:https://github.com/palmerama/schema-mapper
仓库路径:skills/schema-mapper
安装命令:
npx skills add https://github.com/palmerama/schema-mapper --skill schema-mapper
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/palmerama/schema-mapper --skill schema-mapper

简介

schema-mapper 用于查找、检索和筛选相关信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词、任务场景或来源线索快速定位候选结果。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装使用。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Schema Mapper

Visual Sanity org/schema explorer. A Sanity App SDK app using React Flow. Shows projects, datasets, and document types as nodes, references as edges. Connects to the Sanity API, discovers all projects in an org, samples documents to infer schemas, and renders an interactive node graph.

Setup

Follow these steps when a user says "install schema mapper" or "set up schema mapper".

1. Detect project structure

Scan the user's project root to understand their setup. Check for these patterns and always tell the user what you found and what you recommend before making any changes:

Studio in root

Look for sanity.cli.ts and sanity.config.ts in the root directory.

If found:

⚠️ Schema Mapper is a separate Sanity App SDK app — it can't run inside a Studio project. The Sanity CLI can only detect one app per directory, so having both a Studio and an App SDK app in the same root won't work (the CLI will try to run the Studio instead of Schema Mapper). The fix is simple: move your Studio into a /studio subfolder and put Schema Mapper in /apps/schema-mapper alongside it. This makes zero difference to how your Studio works — you can still run it with cd studio && npx sanity dev and deploy with cd studio && npx sanity deploy. Everything stays exactly the same, it's just in a subfolder.

Ask the user if they'd like you to restructure:

  1. Create a studio/ folder
  2. Move all Studio files into it (sanity.cli.ts, sanity.config.ts, schemas/, src/, etc.)
  3. Create apps/schema-mapper for Schema Mapper
  4. If there's a pnpm-workspace.yaml or similar, leave it in the root — don't add packages: entries, each app runs independently

If the user declines, warn them that Schema Mapper probably won't work from the same root as the Studio.

Monorepo detection

Check for these workspace patterns:

  • packages/ directory — common monorepo convention. Suggest installing at packages/schema-mapper or apps/schema-mapper (create apps/ if it doesn't exist). Tell the user: "I see you have a packages/ directory — looks like a monorepo. I'd suggest putting Schema Mapper in apps/schema-mapper to keep it separate from your packages. OK?"
  • Turborepo (turbo.json in root) — suggest apps/schema-mapper. Tell the user: "This looks like a Turborepo project. I'll put Schema Mapper in apps/schema-mapper which is the standard Turborepo convention for applications."
  • Nx (nx.json in root) — suggest apps/schema-mapper. Tell the user: "This looks like an Nx workspace. I'll put Schema Mapper in apps/schema-mapper which follows Nx conventions."
  • pnpm workspaces (pnpm-workspace.yaml with packages: entries) — check what directories are listed and suggest a location that fits. Don't add Schema Mapper to the workspace packages list — it runs independently.

Existing apps/ directory

If apps/ exists, suggest apps/schema-mapper. Tell the user: "You already have an apps/ directory — I'll install Schema Mapper at apps/schema-mapper."

Flat project (no monorepo signals)

If none of the above patterns are found (just src/, package.json, etc.), suggest ./schema-mapper as a sibling directory or ask the user where they'd like it. Tell the user: "I don't see a monorepo setup here. Where would you like me to install Schema Mapper? I can put it in ./schema-mapper next to your project, or somewhere else."

Multiple Sanity projects

If you find multiple sanity.cli.ts files in subdirectories, note this to the user: "I see multiple Sanity projects in your repo. Schema Mapper will map your entire org regardless of which project it's configured with — you just need to pick one project for the SDK auth context."

Always confirm the chosen path with the user before proceeding.

2. Check Studio version

Check the user's installed Sanity version:

npx sanity --version

Or check package.json for the sanity dependency version.

Flag any issues:

  • Below v4.9.0: Deployed schema is not available (live manifests require v4.9.0+). Schema Mapper will still work but will use inferred schema (sampling documents to guess the schema). Recommend upgrading to get accurate deployed schema support. The user can deploy their schema without redeploying their Studio by running npx sanity schema deploy.
  • v4.9.0+: Full support — deployed schema via live manifests and Dashboard both work. Recommend @latest for best experience.

3. Confirm install location

By this point you should have a suggested path from step 1. If not (e.g. the user skipped detection), ask them directly. Always confirm before proceeding:

"I'll install Schema Mapper at <path>. Sound good?"

4. Clone the repository

git clone --depth 1 https://github.com/sanity-labs/schema-mapper.git <chosen-path>
rm -rf <chosen-path>/.git
rm -rf <chosen-path>/scripts

5. Choose Sanity project

npx sanity projects list
  • Present the list to the user with project names and IDs
  • Ask the user to choose which project to use
  • If the Sanity CLI isn't available or the command fails, ask the user for their project ID manually

6. Get organization ID

npx sanity projects get <projectId>
  • Look for the org ID in the output
  • If that fails, ask the user for their organization ID
  • Org IDs look like oXxXxXxXx (starts with o, alphanumeric)

7. Configure the app

In <path>/sanity.cli.ts: replace YOUR_PROJECT_ID with the chosen project ID, replace YOUR_ORG_ID with the org ID.

In <path>/src/App.tsx: replace YOUR_PROJECT_ID with the chosen project ID, and replace YOUR_ORG_ID with the org ID.

8. Install dependencies

  • Check for pnpm-lock.yaml → use pnpm install
  • Check for yarn.lock → use yarn install
  • Otherwise → use npm install

Run the install command inside the app directory.

9. Done

Tell the user: "Schema Mapper is installed. Run npx sanity dev from <path> to start. Then open your Sanity dashboard in the browser — the app runs inside the dashboard as a local app, not directly at localhost."

Update

Follow these steps when a user says "update schema mapper".

1. Find the installation

Look for the schema-mapper directory. Check apps/schema-mapper first, then ask the user.

2. Backup config lines

These two files contain the user's project and org IDs (often with commented-out alternatives). Read and save the exact lines containing these IDs:

  • <path>/sanity.cli.ts — find the organizationId: line (e.g. organizationId: 'abc123', // my org)
  • <path>/src/App.tsx — find the organizationId line AND the projectId: line in the config array

Save the complete lines including any inline comments — the user may have other IDs commented alongside. You will reinstate these exact lines after the update.

3. Download latest

cd <path> && curl -sL https://github.com/sanity-labs/schema-mapper/archive/main.tar.gz | tar xz

4. Overwrite ALL source files

Copy everything from the extracted schema-mapper-main/ directory into <path>, including any new files that didn't exist before. The only exceptions are sanity.cli.ts and src/App.tsx — these contain the user's project and org IDs and MUST NOT be overwritten. Use rsync or cp -r to ensure new files are added and deleted files are removed:

rsync -a --exclude='sanity.cli.ts' --exclude='src/App.tsx' <path>/schema-mapper-main/ <path>/

5. Restore config lines

In the updated sanity.cli.ts and src/App.tsx, find the placeholder lines (YOUR_ORG_ID, YOUR_PROJECT_ID) and replace them with the exact lines you saved in step 2. This preserves the user's IDs and any commented-out alternatives on the same lines.

6. Clean up

rm -rf <path>/schema-mapper-main

7. Install dependencies

Run install in case package.json changed (use the same package manager detection as setup).

8. Done

Tell the user the update is complete.

Architecture

App SDK App (not a Studio plugin)

Schema Mapper is a standalone Sanity App SDK app. It uses:

  • sanity.cli.ts with app: {organizationId, entry} config
  • SanityApp provider from @sanity/sdk-react with explicit config prop
  • useProjects(), useDatasets(), useClient() hooks for data fetching
  • ResourceProvider to scope hooks to specific project/dataset contexts

Data Flow

  1. LiveOrgOverviewuseProjects() gets all org projects
  2. Per project: ProjectDatasetsWrapperuseDatasets() inside ResourceProvider
  3. Per dataset: DatasetDiscoveryWrapperuseSchemaDiscovery() samples documents
  4. Results flow up via callbacks → assembled into ProjectInfo[]
  5. OrgOverview renders navigation and graph as data arrives progressively

Key Files

FilePurpose
sanity.cli.tsCLI config — org ID, Vite config, CORS headers
src/App.tsxRoot — SanityApp provider, theme, routing
src/components/LiveOrgOverview.tsxData orchestrator — progressive loading
src/components/OrgOverview.tsxUI shell — tabs, graph container, export
src/components/SchemaGraph.tsxReact Flow graph — 4 layout algorithms, edge styles
src/components/SchemaNode.tsxCustom node — field list with type badges and handles
src/hooks/useSchemaDiscovery.tsSchema inference from document sampling

Known Gotchas

  1. Sanity CLI detection in monorepos — CLI needs both sanity.cli.ts in the project root AND sanity in devDependencies of package.json. Missing either = CLI won't find the app.
  2. Chrome LNA headers — Chrome requires Access-Control-Allow-Private-Network: true for localhost. Without it, Sanity auth flow fails. Configured in sanity.cli.ts under vite.server.headers.
  3. useDatasets() per-project error handlinguseDatasets() throws for projects where the user isn't a member. Each call is wrapped in an ErrorBoundary that falls back to assuming a production dataset.
  4. SanityApp needs explicit config propSanityApp from @sanity/sdk-react requires config with at least one {projectId, dataset} entry. Without it, hooks like useProjects() won't work.
  5. ResourceProvider needs fallback={null} — Without fallback={null}, ResourceProvider shows a loading flash. Always pass it for background data fetching.
  6. Hook ordering in React FlowuseCallback functions referencing setEdges (from useEdgesState) must be defined AFTER the useEdgesState call. JavaScript's temporal dead zone causes "Cannot access before initialization" errors otherwise.
  7. Edge/node types must be module-levelnodeTypes and edgeTypes objects must be defined outside the component. If defined inside, React Flow recreates them every render causing infinite loops.

Customization

Layout Algorithms

  • dagre — Directed graph (LR)
  • layered — ELK layered with crossing minimization
  • force — ELK force-directed
  • stress — ELK stress with manual component separation

Edge Styles

  • bezier — Custom gentle bezier with adjustable curvature
  • smoothstep — Right-angle stepped edges
  • straight — Direct lines

Adding a New Layout

Add the layout function in SchemaGraph.tsx, add it to the layout selector dropdown, and define default spacing in the spacing map.

Changing Node Appearance

Edit SchemaNode.tsx. The node renders field names, type badges, and source/target handles for references.

Export Formats

ExportDropdown.tsx supports PNG, SVG, and PDF with smart cropping. Add new formats there.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.29%
按下载量换算70

Claude

29.82%
按下载量换算54

Cursor

20.06%
按下载量换算37

Gemini CLI

9.06%
按下载量换算16

安全审计

Gen Agent Trust Hub

可疑

Socket

可疑

Snyk

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills