contentful
БесплатноБез исполняемых скриптовНе проверенContentful is an API-first headless CMS: content lives in typed content models and is served through the Content Delivery API (published, CDN), the Content…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Contentful
Overview
Contentful stores structured content in a space. You define content types (a blog post, an author), editors create entries, and your code reads them over REST (or GraphQL). Reads of published content use the Delivery API on cdn.contentful.com; unpublished drafts use the Preview API on preview.contentful.com with a separate token; writes use the Management API with a personal access token or an app token. The contentful package (v11) is the read client, contentful-management (v12) the write client, and @contentful/rich-text-react-renderer turns rich text fields into React.
Instructions
Install and configure
npm install contentful @contentful/rich-text-react-renderer @contentful/rich-text-types
npm install contentful-management # only for scripts that create or publish entries
Keep the space ID and tokens in environment variables: CONTENTFUL_SPACE_ID, CONTENTFUL_DELIVERY_TOKEN, CONTENTFUL_PREVIEW_TOKEN (server-side only), CONTENTFUL_MANAGEMENT_TOKEN (scripts only, never in browser code).
Typed Delivery API client
Since v10 the client is typed through entry skeletons: describe each content type once with contentTypeId and fields, then pass the skeleton to getEntries<...>. The content_type query parameter is required when you filter on fields.*.
// src/lib/contentful.ts: Contentful client and typed queries
import * as contentful from "contentful";
export type AuthorSkeleton = {
contentTypeId: "author";
fields: {
name: contentful.EntryFieldTypes.Text;
};
};
export type BlogPostSkeleton = {
contentTypeId: "blogPost";
fields: {
title: contentful.EntryFieldTypes.Text;
slug: contentful.EntryFieldTypes.Symbol;
excerpt: contentful.EntryFieldTypes.Text;
body: contentful.EntryFieldTypes.RichText;
featuredImage: contentful.EntryFieldTypes.AssetLink;
author: contentful.EntryFieldTypes.EntryLink<AuthorSkeleton>;
tags: contentful.EntryFieldTypes.Array<contentful.EntryFieldTypes.Symbol>;
publishDate: contentful.EntryFieldTypes.Date;
};
};
const preview = process.env.CONTENTFUL_PREVIEW === "true";
export const client = contentful.createClient({
space: process.env.CONTENTFUL_SPACE_ID!,
environment: process.env.CONTENTFUL_ENVIRONMENT ?? "master",
accessToken: preview
? process.env.CONTENTFUL_PREVIEW_TOKEN!
: process.env.CONTENTFUL_DELIVERY_TOKEN!,
host: preview ? "preview.contentful.com" : "cdn.contentful.com",
});
export async function getBlogPosts(limit = 10) {
const response = await client.withoutUnresolvableLinks.getEntries<BlogPostSkeleton>({
content_type: "blogPost",
order: ["-fields.publishDate"],
limit,
include: 2,
"fields.slug[exists]": true,
});
return response.items;
}
export async function getBlogPostBySlug(slug: string) {
const response = await client.withoutUnresolvableLinks.getEntries<BlogPostSkeleton>({
content_type: "blogPost",
"fields.slug": slug,
include: 3,
limit: 1,
});
return response.items[0] ?? null;
}
Notes on the queries: include sets how many levels of linked entries and assets are resolved. withoutUnresolvableLinks removes links to entries that are unpublished or deleted instead of leaving raw link objects, so post.fields.author is either a resolved entry or absent. In v11 asset files are optional (asset.fields.file?.url) because an asset may have no file in the requested locale.
You can generate the skeletons from your content model instead of writing them: npx cf-content-types-generator -s $CONTENTFUL_SPACE_ID -t $CONTENTFUL_MANAGEMENT_TOKEN -e master -o src/@types/generated (a community tool that targets contentful.js 10 and later).
Rich text rendering
// src/components/RichText.tsx: render Contentful rich text
import { documentToReactComponents, type Options } from "@contentful/rich-text-react-renderer";
import { BLOCKS, INLINES, type Document } from "@contentful/rich-text-types";
const renderOptions: Options = {
renderNode: {
[BLOCKS.EMBEDDED_ASSET]: (node) => {
const file = node.data.target.fields?.file;
if (!file?.url) return null;
const width = file.details?.image?.width; // absent for non-image files
const height = file.details?.image?.height;
return (
<img
src={`https:${file.url}?w=800&fm=webp&q=80`}
alt={node.data.target.fields.title ?? ""}
width={width}
height={height}
loading="lazy"
/>
);
},
[BLOCKS.EMBEDDED_ENTRY]: (node) => {
const entry = node.data.target;
if (entry.sys.contentType?.sys.id === "codeBlock") {
return (
<pre>
<code className={`language-${entry.fields.language}`}>{entry.fields.code}</code>
</pre>
);
}
return null;
},
[INLINES.HYPERLINK]: (node, children) => (
<a href={node.data.uri} target="_blank" rel="noopener noreferre
Установить contentful в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл contentful?
Contentful is an API-first headless CMS: content lives in typed content models and is served through the Content Delivery API (published, CDN), the Content Preview API (drafts) and the Content Management API (writes). Use when a user wants to fetch Contentful entries in a website or app, type them in TypeScript, render rich text, resolve linked entries and assets, preview drafts, write or publish entries from a script, or trigger rebuilds with webhooks.
Как установить скилл contentful?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл contentful запускает скрипты?
Нет, скилл состоит только из инструкций (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