Use when a SPIP plugin or site uses N-Core (prefix ncore), the noisette engine behind noiZetier — declaring noisette types in YAML, writing the ncore/<prefixe>.php services, adding, moving or configuring noisettes through its API, displaying a container with conteneur_compiler or #NOISETTE_COMPILER, or debugging noisettes that render empty, ignore their children, keep stale output, or die with "Call to undefined function noisette_encapsuler()" or "conteneur_identifier()". Written for SPIP 4.x...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Plugin Ncore?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/epilibre-design-plugin-ncore)
---
name: plugin-ncore
description: Use when a SPIP plugin or site uses N-Core (prefix ncore), the noisette engine behind noiZetier — declaring noisette types in YAML, writing the ncore/<prefixe>.php services, adding, moving or configuring noisettes through its API, displaying a container with conteneur_compiler or #NOISETTE_COMPILER, or debugging noisettes that render empty, ignore their children, keep stale output, or die with "Call to undefined function noisette_encapsuler()" or "conteneur_identifier()". Written for SPIP 4.x; N-Core does not run on SPIP 5.0 (see the SPIP 5.0 section).
---
# N-Core (noisette engine)
## Overview
N-Core is an **API**, not an editor: a "plugin utilisateur" (noiZetier, or yours) passes its prefix as first argument
of every function, provides **services** that N-Core looks up by name, and stores noisettes (block instances) in
**containers**. Read here: **1.2.0** (`97d87b0`) plus the upstream fix `eb323fe` (2026-09-03), GPL 3, requires
`yaml`, `ezcache` (Cache Factory) and `saisies`. Facts marked *run* were executed on SPIP 4.4.28 (the skills
repository's `docs/tests/plugin-ncore-verifications.md` says on which N-Core); the others come from the source.
**The traps agents fall into** are defaults that contradict N-Core's own documentation, caches the API leaves stale,
and 1.2.0 defects that sit on the normal path — including the display of any container. Check the release at hand
(`paquet.xml`, upstream history) before relying on a defect.
## SPIP 5.0
`paquet.xml` declares `compatibilite="[4.1.0;4.*]"`: SPIP 5.0 never activates it. Do not force the compatibility;
say the plugin needs a release whose `compatibilite` reaches 5.x.
## Vocabulary traps — verify before answering
| Wrong | Correct |
|---|---|
| "A container type's squelette loops and renders its children per item" | For a container noisette, `#NOISETTE_COMPILER` renders the children **once**, with the page environment, through `conteneur_compiler`, then puts them in place of `<!--noisettes-->` in the type's squelette (`noisette_encapsuler()`). Nothing from a loop reaches the children. *run* |
| "Inclusion is static by default" (`type_noisette.schema.json` says so) | **Dynamic**: a type with `inclusion: 'defaut'` (or no key) follows `ncore_type_noisette_initialiser_inclusion()`, which returns `true` unless the plugin provides the service. |
| "Without `contexte`, the noisette gets nothing" | It gets the whole environment: `type_noisette_charger()` turns an empty `contexte` into `['env']` (`inc/ncore_type_noisette.php`) *run*. A **container** type is forced to `contexte: ['aucun']` and `ajax: 'non'` whatever its YAML says. A list such as `['id_article']` passes only those variables, which keeps the noisette's cache key small. |
| "Types are stored in the database" | Type descriptions and signatures are ezcache files under `tmp/cache/ncore/<prefixe>/` (`ezcache/ncore.php`). Noisettes are in the meta `<prefixe>_noisettes`, `[id_conteneur][rang] => description`. |
| "The service decides the capsule" | `_NCORE_ENCAPSULATION_AUTO` (`true` by default, `ncore_fonctions.php`) forces a capsule on every non-container noisette, whatever the service returns. It is a global constant: setting it affects every plugin using N-Core on the site. |
| `noisette_deplacer($plugin, $id, $rang)` | `noisette_deplacer($plugin, $noisette, $conteneur_destination, $rang_destination, $stockage = '')` |
| "The API refreshes the pages" | No API function calls `suivre_invalideur()` (only N-Core's own `editer_noisette` form does): the plugin must invalidate after each operation. *run* |
| "`id_conteneur=article` works with `conteneur_compiler`" | Not in 1.2.0: the string reaches `ncore_conteneur_verifier(…, array $conteneur)`; SPIP catches the `TypeError`, logs it in `spip.log` and serves the container **empty** with HTTP 200 (*run*). Override `conteneur_compiler.html` (Display). |
## Plugin services — `ncore/<prefixe>.php`
`ncore_chercher_service($plugin, $service, $stockage)` includes `ncore/<stockage>.php` (`<stockage>` defaults to the
plugin prefix) and calls `<stockage>_<service>` if it exists, else N-Core's default in `ncore/ncore.php`. To write:
- **Always**, for containers that are not noisettes (page regions…): `conteneur_verifier`, `conteneur_identifier`,
`conteneur_construire`.
- To change a default: `type_noisette_initialiser_dossier` (types folder), `type_noisette_initialiser_inclusion`,
`type_noisette_initialiser_ajax`, `noisette_initialiser_encapsulation` (plus `_NCORE_ENCAPSULATION_AUTO`).
- **Only for your own storage** (SQL table…): the storage services, chosen by the `$stockage` argument.
Signatures, defaults, the three container services as run, and the storage contract: `references/services.md`.
## Noisette type — `<dossier>/<type>.yaml` + `<type>.html`
```yaml
nom: 'Titre de l’article'
conteneur: 'non' # 'oui' only for a group rendered as-is (Vocabulary traps)
contexte: ['id_article'] # 'env' if absent; a list passes only these variables
ajax: 'non' # 'defaut' | 'oui' | 'non'
inclusion: 'statique' # 'defaut' | 'statique' | 'dynamique'
parametres: # Saisies
- saisie: 'input'
options: {nom: 'classes', label: 'Classes'}
```
The squelette receives the noisette's parameters and its context as `#ENV`. A container type's `.html` is a
**capsule**: its markup around a literal `<!--noisettes-->`.
Load or reload the types, then **empty the type caches**:
```php
include_spip('inc/ncore_type_noisette');
type_noisette_charger('monplug'); // second arg true: force, ignoring the md5 signatures
type_noisette_decacher('monplug'); // ajax, inclusions, contextes caches
```
`type_noisette_charger()` leaves those caches as they are: a type added after a page was rendered is missing from
them. On 1.2.0 its noisettes render nothing, HTTP 200, and `spip.log` records `array_flip(): Argument #1 ($array) must
be of type array, false given` (`noisette_contextualiser()`); with the fix proposed upstream (patch 0005), they
render with an empty context, silently — no `id_article` (*run* both). `type_noisette_decacher()` fixes both.
## API — `inc/ncore_noisette.php`, `inc/ncore_conteneur.php`
```php
include_spip('inc/ncore_noisette');
$id = noisette_ajouter('monplug', 'titre', ['squelette' => 'article'], $rang = 0); // array or string identifier
$actuels = unserialize(ncore_noisette_decrire('monplug', $id)['parametres']) ?: []; // include_spip('ncore/ncore')
noisette_parametrer('monplug', $id, ['parametres' => serialize(array_merge($actuels, $nouveaux))]);
noisette_deplacer('monplug', $id, ['squelette' => 'entete'], 1);
noisette_dupliquer('monplug', $id, $conteneur, $rang = 0, $parametrage = null);
noisette_supprimer('monplug', $id);
noisette_lire('monplug', $id, 'parametres'); // unserialized array, static cache: for display only
noisette_repertorier('monplug', ['squelette' => 'article']); // 1.2.0: array only, one container per hit
include_spip('inc/invalideur'); suivre_invalideur('monplug'); // after every write
```
- `noisette_parametrer()` stores only the editable fields (`parametres`, `css`, `css_saisies`, plus `encapsulation`
for a noisette that is not a container; pipeline `noisette_initialiser_parametrage`), each **as is**: merge the current parameters, `serialize()`. Any
other field is dropped and the call still returns `true`: `rang_noisette` changes with `noisette_deplacer()` (*run*).
- Read the current parameters with `ncore_noisette_decrire()`, not `noisette_lire()`: its static cache keeps the
first read of the hit, so a second merge in the same hit erases the first change (*run*).
- The children of a container noisette live in the container `<type>|noisette|<id_noisette>`
(`#CONTENEUR_IDENTIFIER{monplug, #ARRAY{type_noisette, <type>, id_noisette, <id>}}`).
- `noisette_dupliquer()` and `noisette_supprimer()` copy or delete children **only** if the type is `conteneur: 'oui'`.
## Display
```html
<INCLURE{fond=conteneur_compiler, plugin=monplug, id_conteneur=article, id_article, env} />
```
`conteneur_compiler` loops on the container's noisettes and calls `#NOISETTE_COMPILER` for each. **The 1.2.0 file
renders nothing** (three defects, `references/defauts-1.2.0.md`). Override it at the root of your plugin (it then
serves the whole site) with a version that reads the storage directly: `ncore_noisette_lister()` takes the string
identifier and has no static cache. With it, on 1.2.0, two containers on one page, a grid per article, paginated grids
and container noisettes all render (*run*):
```html
#SET{noisettes, #ENV{id_conteneur}|monplug_noisettes_conteneur{#ENV{plugin}, #ENV{stockage, ''}}}
<BOUCLE_noisettes_conteneur(DATA) {source table, #GET{noisettes}}{plugin}{par rang_noisette}>
[(#NOISETTE_COMPILER{#VALEUR{id_noisette}, #ENV{stockage, ''}})]
</BOUCLE_noisettes_conteneur>
```
```php
// monplug_fonctions.php
function monplug_noisettes_conteneur($id_conteneur, string $plugin, ?string $stockage = ''): array {
include_spip('ncore/ncore');
return ncore_noisette_lister($plugin, (string) $id_conteneur, '', 'rang_noisette', (string) $stockage);
}
```
Before the first display, also read `references/defauts-1.2.0.md`: on 1.2.0, container noisettes, the second
display of a page and the autorisation fail too.
## One sub-tree per item of a loop (query grid)
No N-Core option renders children per loop item (*run*). Workaround (*run*): a type declared `conteneur: 'non'` whose
squelette includes the container of its children for each item, through the overridden `conteneur_compiler`:
```html
#SET{conteneur, #CONTENEUR_IDENTIFIER{monplug, #ARRAY{type_noisette, grille, id_noisette, #ENV{id_noisette}}}}
<BOUCLE_g(ARTICLES){par date}{inverse}{0,4}>
<INCLURE{fond=conteneur_compiler, plugin=monplug, id_conteneur=#GET{conteneur}, id_article} />
</BOUCLE_g>
```
Add the children with `noisette_ajouter('monplug', 'titre', ['type_noisette' => 'grille', 'id_noisette' => $id])`;
they declare `contexte: ['id_article']`. Cost: duplicate and delete of the grid do not handle its children (copy with
none, children left orphan in the meta) — the editor must do it. Pagination per instance: name it after the noisette,
`#SET{nom, #VAL{_}|concat{#ENV{id_noisette}}}` then `{pagination 4, #GET{nom}}` gives the URL parameter
`debut_<id_noisette>`, stable when the noisette moves (*run*).
## Cost
Static inclusion puts the noisettes' HTML in the page cache: no cost on a cached page, recomputed with the page.
Each noisette is still its own `recuperer_fond()` with its own cache entry when the page is computed, whatever the
inclusion mode (*run*: 123 entries for a page with a header and two grids of 4 cards, against 3 for a single generated
squelette); dynamic inclusion adds one call per noisette on **every** display. On static vs dynamic in general, see
`spip-squelettes` (`references/inclure-ajax.md`).