Skip to main content
ClaudeWave
Skill58 estrellas del repoactualizado 2mo ago

strapi-cms

Builds Strapi content types, extends controllers and services, implements lifecycle hooks, and configures REST/GraphQL APIs. Use when creating content types, writing custom controllers, developing Strapi plugins, or querying the API.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/monkilabs/opencastle /tmp/strapi-cms && cp -r /tmp/strapi-cms/src/orchestrator/plugins/strapi ~/.claude/skills/strapi-cms
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->

# Strapi CMS

Generic Strapi CMS development methodology. For project-specific configuration, content types, and deployment details, see [cms-config.md](../../.opencastle/stack/cms-config.md).

## Critical Development Rules

1. **Use Content-Type Builder** — define content types through the admin panel or `content-types` directory
2. **REST API by default** — Strapi exposes REST endpoints automatically; enable GraphQL plugin if needed
3. **Extend controllers** — implement `src/api/<type>/controllers/<type>.js` with wrapper logic that calls services
4. **Implement services** — place business logic in `src/api/<type>/services/` and keep controllers thin
5. **Use lifecycle hooks** — add `beforeCreate`/`afterUpdate` handlers in `src/api/<type>/lifecycles.js` for side effects
6. **Configure permissions per role** — set public/authenticated access in Users & Permissions; keep environment configs under `config/env/<env>/`

## API Patterns

### REST API (Strapi-specific)
- Use `populate` to include relations
- Use `filters` with operators (`$eq`, `$contains`, `$in`, etc.)
- Pagination via `pagination[page]` and `pagination[pageSize]`
- Use `fields` to select attributes

### Quick REST examples

GET with populate and filters (client-side fetch):

```js
// GET /api/articles?populate=author,categories&filters[status][$eq]=published&pagination[page]=1&pagination[pageSize]=10
const res = await fetch('https://cms.example.com/api/articles?populate=author,categories&filters[status][$eq]=published');
const json = await res.json();
console.log(json.data[0].attributes.title);
```

Custom controller extension (server):

```js
// src/api/article/controllers/article.js
const { createCoreController } = require('@strapi/strapi').factories;

module.exports = createCoreController('api::article.article', ({ strapi }) => ({
	async find(ctx) {
		// call default then modify response
		const res = await super.find(ctx);
		// add extra field
		res.meta.custom = { processedAt: new Date().toISOString() };
		return res;
	},
}));
```

Lifecycle hook example:

```js
// src/api/article/content-types/article/lifecycles.js
module.exports = {
	async beforeCreate(event) {
		const { data } = event.params;
		if (data.title) data.slug = slugify(data.title);
	},
};
```


## Quick workflow: create content type + custom controller + service

1. Create content type using Content-Type Builder or `src/api/<type>/content-types/schema.json` → commit schema.
2. Scaffold controller and service files under `src/api/<type>/controllers/` and `src/api/<type>/services/` with thin controller calling service functions.
3. Add lifecycle hooks (optional) in `content-types/<type>/lifecycles.js` for side effects.
4. Run local Strapi (`yarn develop`) → check admin UI for new content type.
	- Validation: create a test entry in admin UI and confirm via `GET /api/<type>?pagination[page]=1` that fields exist.
	- If fail: check server logs, run `yarn build` to surface schema errors, verify `schema.json` validity.
5. Add permissions (Users & Permissions) for public/authenticated roles if API access required.
6. Add automated API test: `fetch('/api/<type>?populate=*')` in test suite to validate relations populate.

For more reference patterns and larger examples, see [REFERENCE.md](REFERENCE.md).
astro-frameworkSkill

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

browser-testingSkill

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

cloudflare-platformSkill

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.

contentful-cmsSkill

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.

convex-databaseSkill

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.

coolify-deploymentSkill

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.

cypress-testingSkill

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-ormSkill

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.