portable-text-conversion

portable-text-conversion is a skill for Claude Code from sanity-io/agent-toolkit. It costs 94 tokens per session (689 once invoked), scanned A, original, MIT.

A converter that turns HTML or Markdown into Portable Text, Sanity's structured format for rich content such as paragraphs, headings, links, and images.

In plain words
What is it for?
Use it to migrate HTML or Markdown, build content-import pipelines, or create Portable Text documents programmatically.
Why use it?
It avoids manually rebuilding imported content when moving material from an older CMS, files, APIs, or databases into Sanity.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the sanity plugin — 10 skills, 4 commands, 1 MCP server shipped together

not rated 194repo +3 2d ago A scan Socket: passSnyk: passSkillSpector: pass 94 tokens original MIT

Good fit Use it to migrate HTML or Markdown, build content-import pipelines, or create Portable Text documents programmatically.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sanity-io/agent-toolkit/portable-text-conversion
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add sanity-io/agent-toolkit --skill portable-text-conversion
Clone the repo
git clone --depth 1 https://github.com/sanity-io/agent-toolkit

Made for: Claude Code.

Or install sanity, the plugin that ships this one along with the rest of its 10 skills, 4 commands, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for portable-text-conversion

README.md
[![agentmods](https://agentmods.dev/badge/skills/sanity-io/agent-toolkit/portable-text-conversion/github.svg)](https://agentmods.dev/skills/sanity-io/agent-toolkit/portable-text-conversion)
Your own site
<a href="https://agentmods.dev/skills/sanity-io/agent-toolkit/portable-text-conversion"><img src="https://agentmods.dev/badge/skills/sanity-io/agent-toolkit/portable-text-conversion/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for portable-text-conversion

Your own site · 80×15
<a href="https://agentmods.dev/skills/sanity-io/agent-toolkit/portable-text-conversion"><img src="https://agentmods.dev/badge/skills/sanity-io/agent-toolkit/portable-text-conversion.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 94 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 689 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 15 Sept 2026
  • Snyk pass 15 Sept 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00094 $0.00689
Opus 5.5 $0.00038 $0.00276
Sonnet 5.5 $0.00019 $0.00138
Haiku 4.5 $0.00009 $0.00069

Measured 1mo ago against content hash 6dc622dff286, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

portable-text-conversion scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

3 near-identical copies found in the catalogue:

skills/portable-text-conversion/SKILL.md · 66 lines

How it starts

The opening of the file, as written. The whole thing — 66 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Portable Text Conversion

Convert external content (HTML, Markdown) into Portable Text for Sanity. Three main approaches:

  1. markdownToPortableText — Convert Markdown directly using @portabletext/markdown (recommended for Markdown)
  2. htmlToBlocks — Parse HTML into PT blocks using @portabletext/block-tools (for HTML migration)
  3. Manual construction — Build PT blocks directly from any source (APIs, databases, etc.)

Portable Text Specification

Understand the target format before converting. PT is an array of blocks:

[
  {
    "_type": "block",
    "_key": "abc123",
    "style": "normal",
    "children": [
      {"_type": "span", "_key": "def456", "text": "Hello ", "marks": []},
      {"_type": "span", "_key": "ghi789", "text": "world", "marks": ["strong"]}
    ],
    "markDefs": []
  },
  {
    "_type": "block",
    "_key": "jkl012",
    "style": "h2",
    "children": [
      {"_type": "span", "_key": "mno345", "text": "A heading", "marks": []}
    ],
    "markDefs": []
  },
  {
    "_type": "image",
    "_key": "pqr678",
    "asset": {"_type": "reference", "_ref": "image-abc-200x200-png"}
  }
]

Key rules:

  • Every block and span needs _key (unique within the array)
  • _type: "block" is for text blocks; custom types use their own _type
  • markDefs holds annotation data; marks on spans reference markDefs[*]._key or are decorator strings
  • Lists use listItem ("bullet" | "number") and level (1, 2, 3...) on regular blocks

Conversion Rules

Read the rule file matching your source format:

  • Markdown → Portable Text: rules/markdown-to-pt.md — @portabletext/markdown with markdownToPortableText (recommended)
  • HTML → Portable Text: rules/html-to-pt.md — @portabletext/block-tools with htmlToBlocks
  • Manual PT Construction: rules/manual-construction.md — build blocks programmatically from any source

Note: @sanity/block-tools is the legacy package name. Always use @portabletext/block-tools for new projects. The API is the same.

Read the full file on GitHub · 66 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 66 lines · 94 tokens per session scan A 6dc622dff286

Subscribe to this mod's changes

portable-text-conversion is a skill published in the GitHub repository sanity-io/agent-toolkit (194 stars, last pushed 2d ago), licensed MIT. It adds 94 tokens to every session and 689 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

fetch-firecrawl

Use to scrape a URL into clean Markdown when the page is JS-rendered, behind anti-bot, or a PDF — and FIRECRAWLAPIKEY is available. Degrades gracefully to warn when key is missing.

0xmariowu/Autosearch · 49 tokens

kolmopdf

A workflow for using KolmoPDF, a paid cloud service, to process PDFs or Markdown files. It supports PDF parsing, translation, export to common document formats, and reading aids such as outlines and summaries.

komoai2026/claude-plugin · 107 tokens

dokmatiq-docgen

Dokmatiq DocGen skill for Codex, Claude Code, and MCP-enabled AI assistants. Use this skill when the user wants to generate, transform, or analyze documents — including PDF, DOCX, ODT, or Excel/XLSX files — with optional stationery overlay (Briefpapier/letterhead/company letterhead branding applied to generated PDFs).…

dokmatiq/docgen-sdks · 308 tokens

document

Builds technical A4 PDF documents with D2 diagrams (architecture, sequence, mapping, ERD, flowchart and state) from one HTML source, checks every diagram against the page and previews every page. Use it when the user asks for a PDF, a document, a spec with flowcharts or sequence diagrams, or an ERD of a database or an…

supostat/mneme-plugin · 78 tokens

doc-management

Provides document management guidance for creating, updating, and maintaining project documentation. Use when writing or editing docs, structuring markdown files, managing document lifecycle, or applying formatting standards. Triggers on creating docs, updating docs, writing documentation, markdown formatting…

doancan/mags · 66 tokens

mags-docs-create

Create a new document from template.

doancan/mags · 12 tokens