contentful-cms
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.
git clone --depth 1 https://github.com/monkilabs/opencastle /tmp/contentful-cms && cp -r /tmp/contentful-cms/src/orchestrator/plugins/contentful ~/.claude/skills/contentful-cmsSKILL.md
# Contentful CMS
For project-specific configuration, content types, and API keys, see [cms-config.md](../../.opencastle/stack/cms-config.md).
## Query Patterns
### GraphQL Content API
- Leverage `sys.publishedAt` for cache invalidation
- Use `include` parameter to control link resolution depth
```typescript
// 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 }
}
}
}
`;
```
## Content Modeling
```javascript
// 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.
## Migration Workflow
1. Create a sandbox environment using the Contentful web UI or API.
2. Write a migration script using the Contentful migration library (example below).
3. Run the migration against the sandbox:
```bash
contentful space migration --space-id <SPACE_ID> --environment-id sandbox migration.js
```
4. Validate changes:
- Run a small validation script that queries a sample of affected entries and ensures required fields exist.
- If validation fails: roll back by deleting the sandbox and recreate from `master` (safe rollback), or write a reverse migration and run it.
5. When sandbox validation passes, promote the environment or run the migration against `master` during a maintenance window.
```javascript
// 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):
```js
// 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](REFERENCE.md).Creates pages/layouts, defines content collections, configures hydration directives, and wires integrations. Use when adding or modifying Astro pages, layouts, components, or content collections. Trigger terms: Astro, content collection, client:load, client:visible, astro:content
Drive real browsers via Chrome DevTools MCP: navigate pages, capture snapshots, run responsive checks, and collect console/perf traces. Use when the user mentions: 'validate UI change in Chrome', 'capture a screenshot', 'run responsive checks', or 'collect console logs'. Trigger terms: browser testing, DevTools, console logs, screenshot, responsive testing
Creates and deploys Cloudflare Workers, configures wrangler.toml bindings, sets up KV/D1/R2 storage and Durable Objects, manages Pages deployments, and implements edge function patterns. Use when building or deploying Cloudflare Workers, setting up Pages, working with KV/D1/R2 storage, configuring wrangler.toml, or deploying edge applications.
Convex reactive database patterns, schema design, real-time queries, mutations, actions, authentication, migrations, performance optimization, and component creation. Use when designing Convex schemas, writing queries/mutations, managing the Convex backend, setting up auth, migrating data, optimizing performance, or building Convex components.
Deploys applications, databases, and services on self-hosted Coolify instances, manages environments and env vars, runs infrastructure diagnostics, and performs batch operations. Use when deploying apps to Coolify, managing Coolify servers, debugging deployment issues, setting up databases, or managing Coolify infrastructure.
Writes Cypress E2E/component tests, configures `cy.intercept()` and `cy.session()`, authors custom commands, and wires CI artifacts. Use when creating E2E specs, component tests, or CI test pipelines. Trigger terms: cypress, e2e, component test, cy.intercept, cy.session
Drizzle ORM schema definition, type-safe queries, relational queries, CRUD operations, transactions, migrations with drizzle-kit, and database setup for PostgreSQL, MySQL, and SQLite. Use when defining database schemas, writing queries or joins, managing migrations, setting up a new Drizzle project, or working with drizzle-kit.
Scaffolds Expo/React Native apps, configures EAS Build profiles, manages native modules via CNG, sets up Expo Router navigation, and uses EAS Update for OTA deployments. Use when creating React Native apps with Expo, configuring EAS builds, setting up Expo Router, managing native modules, or deploying OTA updates.