Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

strapi

/strapi

Wspiera pracę ze Strapi, headless CMS: typy treści, wtyczki, API REST i GraphQL oraz własne kontrolery w samodzielnie hostowanych backendach Node.js.

Repozytorium
Agent-Skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
01.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 01.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Wspiera pracę ze Strapi, headless CMS: typy treści, wtyczki, API REST i GraphQL oraz własne kontrolery w samodzielnie hostowanych backendach Node.js.

Oryginalny opis (EN)

Expert Strapi headless CMS assistance covering content types, plugins, REST/GraphQL APIs, and custom controllers. Use when building self-hosted, customizable Node.js headless CMS backends.

Jak działa

  1. When to Use
  2. Quick Start
  3. Core Concepts
  4. Common Patterns
  5. Best Practices
  6. Troubleshooting
  7. References
Sekcje z nagłówków SKILL.md, w oryginale · 175 linii, 597 słów
Podgląd SKILL.md
---
name: strapi
description: Expert Strapi headless CMS assistance covering content types, plugins, REST/GraphQL APIs, and custom controllers. Use when building self-hosted, customizable Node.js headless CMS backends.
---

# Strapi

Strapi is an open-source, customizable headless CMS providing a powerful Document Service API, role-based access control, and customizable REST/GraphQL endpoints.

## When to Use

- **Self-Hosted Open Source Headless CMS**: Complete ownership of content data, database schemas, and hosting infrastructure.
- **Customizable Admin Dashboard**: Building content management workflows for editorial and marketing teams.
- **Automated REST & GraphQL Endpoints**: Instantly exposing type-safe APIs for frontends (Next.js, Nuxt, mobile).
- **Role-Based Content Governance**: Granular permissions, internationalization (i18n), and draft/publish workflows.

## Quick Start

```bash
# Create a new Strapi project with quickstart SQLite
npx create-strapi-app@latest my-cms --quickstart
```

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

module.exports = createCoreController("api::article.article", ({ strapi }) => ({
  async findCustom(ctx) {
    const entries = await strapi.entityService.findMany(
      "api::article.article",
      {
        populate: ["author", "coverImage"],
      },
    );
    return ctx.send(entries);
  },
}));
```

## Core Concepts

### Content-Type Schema Definition

Declaring entities, attributes, and relationships via JSON schema:

```json
{
  "kind": "collectionType",
  "collectionName": "articles",
  "info": {
    "singularName": "article",
    "pluralName": "articles",
    "displayName": "Article",
    "description": "Editorial blog articles"
  },
  "options": {
    "draftAndPublish": true
  },
  "attributes": {
    "title": {
      "type": "string",
      "required": true,
      "minLength": 5
    },
    "slug": {
      "type": "uid",
      "targetField": "title",
      "required": true
    },
    "content": {
      "type": "richtext"
    },
    "author": {
      "type": "relation",
      "relation": "manyToOne",
      "target": "plugin::users-permissions.user"
    }
  }
}
```

### Custom Controllers & Lifecycle Hooks

Extending core business logic with automated side-effects:

```typescript
// src/api/article/content-types/article/lifecycles.ts
export default {
  async beforeCreate(event) {
    const { data } = event.params;
    if (data.title) {
      data.slug = data.title.toLowerCase().replace(/[^a-z0-9]+/g, "-");
    }
  },

  async afterCreate(event) {
    const { result } = event;
    strapi.log.info(
      `New article published: ${result.title} (ID: ${result.id})`,
    );
    // Trigger external notification or webhook
  },
};
```

### Custom Service & Query API

Querying database using the Strapi Document Service:

```typescript
// src/api/article/services/article.ts
import { factories } from "@strapi/strapi";

export default factories.createCoreService(
  "api::article.article",
  ({ strapi }) => ({
    async findFeaturedArticles() {
      return await strapi.documents("api::article.article").findMany({
        filters: { featured: true },
        populate: ["author", "coverImage"],
        sort: { publishedAt: "desc" },
        limit: 5,
      });
    },
  }),
);
```

## Common Patterns

### Custom Lifecycle Hooks for Document Processing

**Problem**: Automatically generating slugs or sending notification emails on content creation.

**Solution**:
Use Strapi content type lifecycles:

```javascript
// src/api/article/content-types/article/lifecycles.js
const slugify = require("slugify");

module.exports = {
  beforeCreate(event) {
    const { data } = event.params;
    if (data.title && !data.slug) {
      data.slug = slugify(data.title, { lower: true, strict: true });
    }
  },
};
```

## Best Practices

**Do**:

- Target Strapi v5 with the modern Document Service API and enhanced content versioning.
- Configure API tokens with minimum necessary permissions for frontend consumer applications.
- Use `populate` parameters selectively to prevent over-fetching relational data.
- Store uploaded media in external object storage (AWS S3, Cloudinary) rather than the local filesystem.

**Don't**:

- Expose admin panel routes (`/admin`) publicly without VPN or strict IP whitelisting in production.
- Edit generated content-type schema files manually while the Strapi development server is running.
- Query private fields (like user password hashes) in public controller responses.

## Troubleshooting

| Error                                         | Cause                                                            | Solution                                                                            |
| :-------------------------------------------- | :--------------------------------------------------------------- | :---------------------------------------------------------------------------------- |
| `ForbiddenError: 403 Forbidden`               | API role permissions not enabled for public/authenticated users. | Enable permissions in Strapi Admin > Settings > Users & Permissions Plugin > Roles. |
| `Relations not returned in REST API response` | Strapi v4+ does not populate relations by default.               | Append query param: `?populate=*` or specify specific relation names.               |
| `Database migration error on server start`    | Schema changes in development conflicting with DB columns.       | Delete conflicting column or review schema in `content-types/schema.json`.          |

## References

- [Strapi Documentation](https://strapi.io/)

Wersje

RepozytoriumWynikLicencja
Ta strona · G1Joshi/Agent-Skills100MIT
TerminalSkills/skills100Apache-2.0

Migawka bazy z 13.11.2026 · wersja paczki 04f13c12d097 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100strapi-plugin-dev
    Pomaga tworzyć, refaktoryzować i naprawiać wtyczki Strapi v5: własne API, rozszerzenia panelu admina i typy treści.
  • 95cms
    Wspiera integrację headless CMS (Sanity, Strapi, Contentful): zapytania GROQ, Portable Text, draft mode, kolekcje treści i podgląd z rewalidacją.
  • 100add-cms
    Dodaje headless CMS, np. Sanity, Payload lub Strapi, z modelem treści, podglądem i odświeżaniem po webhooku.
  • 100wordpress
    Wspiera tworzenie motywów, wtyczek, REST API, bloków Gutenberga i zapytań WP_Query, także własnych wtyczek i headless CMS na WordPressie.
  • 100orchard-cms
    Pomaga budować modułowe aplikacje webowe z zarządzaniem treścią w Orchard Core na ASP.NET Core: typy treści, moduły, workflow, motywy i headless API.
  • 100directus
    Buduje backendy i API w headless CMS Directus: modelowanie danych, automatycznie generowane REST i GraphQL, role i uprawnienia oraz automatyzacje we flows.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.