Creates Contentful content types, queries entries via GraphQL/REST, runs CLI migrations, and manages assets and locales. Use when building or modifying Contentful content models, writing queries, or migrating content.
100
100%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
For project-specific configuration, content types, and API keys, see cms-config.md.
sys.publishedAt for cache invalidationinclude parameter to control link resolution depth// Example: Typed GraphQL query
const BLOG_POSTS_QUERY = `
query BlogPosts($limit: Int!, $locale: String!) {
blogPostCollection(limit: $limit, locale: $locale) {
items {
sys { id publishedAt }
title
slug
body { json }
featuredImage { url width height }
}
}
}
`;// Reference field with validation
blogPost.createField('author')
.type('Link').linkType('Entry')
.validations([{ linkContentType: ['person'] }]);Prefer typed content types over JSON fields; add validation rules to all required fields.
contentful space migration --space-id <SPACE_ID> --environment-id sandbox migration.jsmaster (safe rollback), or write a reverse migration and run it.master during a maintenance window.// Example: Migration script (migration.js)
module.exports = function (migration) {
const blogPost = migration.createContentType('blogPost')
.name('Blog Post')
.displayField('title');
blogPost.createField('title').type('Symbol').required(true);
blogPost.createField('slug').type('Symbol').required(true).validations([{ unique: true }]);
blogPost.createField('body').type('RichText');
};Validation script example (node):
// validate.js — exits non-zero on missing fields
const res = await fetch(`https://cdn.contentful.com/spaces/${SPACE}/environments/sandbox/entries?content_type=blogPost`, {
headers: { Authorization: `Bearer ${TOKEN}` },
});
const { items } = await res.json();
for (const item of items) {
if (!item.fields.slug) throw new Error(`Missing slug on ${item.sys.id}`);
}
console.log('OK —', items.length, 'entries validated');For longer migration patterns and rollback options see REFERENCE.md.
f5c8508
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.