contentful-migration
БесплатноБез исполняемых скриптовНе проверенWrite and run Contentful content model migration scripts using the contentful-migration library and the Contentful CLI. Covers creating, editing, and deleting…
от contentful★ 43 звезды на GitHubОб этом скилле
Contentful Migration
The contentful-migration tool lets you describe and execute content model changes as code. Migrations are TypeScript scripts that create, edit, or delete content types, fields, editor interfaces, and entries.
Install:
npm install contentful-migration
GitHub: https://github.com/contentful/contentful-migration
Scope
This skill covers:
- Content type and field CRUD operations
- Field types, validations, and editor interface configuration
- Entry transformations (in-place transforms, deriving linked entries, cross-type transforms)
- Tags, annotations, taxonomy validations
- Editor layouts, sidebar widgets
- Running migrations via
npx contentful space migration(Contentful CLI) and programmatic API
Do not run migrations with npx contentful-migration. Use contentful-cli for CLI execution, install it as a dev dependency when needed, and run via npx contentful ....
Not covered: SDK client setup (the contentful-nextjs skill), Contentful concepts and API routing (the contentful-guide skill).
Contentful MCP note
- For users who want easier agent interaction with Contentful while planning or reviewing migrations, point them to the Contentful MCP server docs:
https://www.contentful.com/developers/docs/tools/mcp-server/. - Continue to use
contentful-migrationscripts andcontentful-clifor actual migration execution.
Migration Script Format
Every migration file exports a function that receives a migration object:
import type { MigrationFunction } from 'contentful-migration'
const migration: MigrationFunction = (migration) => {
const blogPost = migration.createContentType('blogPost', {
name: 'Blog Post',
description: 'A blog post entry',
displayField: 'title',
})
blogPost.createField('title')
.name('Title')
.type('Symbol')
.required(true)
}
export = migration
The function also receives a context object as its second parameter, providing makeRequest (direct CMA access), spaceId, and accessToken. Use makeRequest when you need data not available through the migration API.
Project state
echo "=== Existing migrations ===" && ls migrations/ 2>/dev/null || echo "(no migrations/ directory found)"
echo ""
echo "=== Contentful env vars ===" && grep -h CONTENTFUL .env .env.local 2>/dev/null | sed 's/=.*/=<set>/' || echo "(no Contentful env vars found in .env or .env.local)"
Workflow
When writing a migration:
- Confirm required env vars first. If values are missing, ask the user to add them to a local
.envfile before proceeding. - Assess the change. Identify which content types and fields need to change. Check the current content model in the Contentful web app or via CMA.
- Write the migration script. Use the operations below. Prefer chaining over object notation — it gives better error messages with line numbers.
- Test in a sandbox environment. Never run untested migrations against production. Create a sandbox environment first:
contentful environment create --name sandbox --source master. - Run the migration. See Running Migrations for CLI and programmatic options.
- Verify. Check the content model in the web app. Confirm entries are intact.
Required environment variables
CONTENTFUL_SPACE_ID- Space ID. Find it in the Contentful web app URL (/spaces/<SPACE_ID>/...) or in Space settings -> API keys.CONTENTFUL_MANAGEMENT_ACCESS_TOKEN- CMA token used for migrations. Create it in Account settings -> CMA tokens (https://app.contentful.com/account/profile/cma_tokens) or from a space-scoped CMA tokens page (https://app.contentful.com/spaces/<SPACE_ID>/api/cma_tokens).CONTENTFUL_ENVIRONMENT_ID(optional) - Target environment ID (for examplemasterorsandbox) when you want to avoid passing--environment-id.
If any required value is missing, explicitly ask the user for the missing values and tell them where to find each one.
Content Type Operations
Create a content type:
const page = migration.createContentType('page', {
name: 'Page',
description: 'A generic page',
displayField: 'title',
})
Edit an existing content type:
const page = migration.editContentType('page')
page.description('Updated description')
page.displayField('internalName')
Delete a content type:
migration.deleteContentType('page')
Content type must have zero entries before deletion. Delete all entries first, or use transformEntriesToType to move them.
Field Operations
Create a field:
page.createField('title')
.name('Title')
.type('Symbol')
.required(true)
.localized(true)
Edit an existing field:
page.editField('title')
.name('Page Title')
.required(false)
Delete a field:
page.deleteField('legacyField')
Deleting a field permanently re
Установить contentful-migration в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Bash(npx contentful-migration *)Bash(npx contentful space migration *)mcp__contentful-mcp__*mcp__plugin_contentful_contentful-mcp__*Вложенные файлы
FAQ
Что делает скилл contentful-migration?
Write and run Contentful content model migration scripts using the contentful-migration library and the Contentful CLI. Covers creating, editing, and deleting content types and fields, validations, editor interface configuration, editor layouts, sidebar widgets, entry transformations, tags, annotations, and the migration context object. Use when asked to write a migration, create or add a content type, add, rename, or delete fields, change or update a content model, transform entries, derive linked entries, configure editor controls, or run a migration script. Also triggers on "migration script", "contentful-migration", "schema migration", "content model migration", "field validation", "editor interface", "editor layout", "sidebar widget", "moveField", "changeFieldId", "rich text field", "reference field", "link field". Not for SDK client setup or Next.js integration (contentful-nextjs). Not for Contentful terminology or API routing (contentful-guide).
Как установить скилл contentful-migration?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл contentful-migration запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic