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.
100
100%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
Generic Strapi CMS development methodology. For project-specific configuration, content types, and deployment details, see cms-config.md.
content-types directorysrc/api/<type>/controllers/<type>.js with wrapper logic that calls servicessrc/api/<type>/services/ and keep controllers thinbeforeCreate/afterUpdate handlers in src/api/<type>/lifecycles.js for side effectsconfig/env/<env>/populate to include relationsfilters with operators ($eq, $contains, $in, etc.)pagination[page] and pagination[pageSize]fields to select attributesGET with populate and filters (client-side fetch):
// 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):
// 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:
// 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);
},
};src/api/<type>/content-types/schema.json → commit schema.src/api/<type>/controllers/ and src/api/<type>/services/ with thin controller calling service functions.content-types/<type>/lifecycles.js for side effects.yarn develop) → check admin UI for new content type.
GET /api/<type>?pagination[page]=1 that fields exist.yarn build to surface schema errors, verify schema.json validity.fetch('/api/<type>?populate=*') in test suite to validate relations populate.For more reference patterns and larger examples, 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.