Skip to content

Build your personal knowledge base with Trilium Notes

chore(skills): make in-aggregator plugins the documented default

Elian Doran2cb5ae7918f8
diff --git a/.claude/skills/ckeditor5-plugin-development/SKILL.md b/.claude/skills/ckeditor5-plugin-development/SKILL.md
index a960bb6343..06c429c734 100644
--- a/.claude/skills/ckeditor5-plugin-development/SKILL.md
+++ b/.claude/skills/ckeditor5-plugin-development/SKILL.md
@@ -9,7 +9,8 @@ description: >-
the UI library (buttons, dropdowns, dialogs, balloons, toolbars), widgets
(block/inline, toWidget, nested editables), keystrokes, localization (t()/.po),
registering a plugin into plugins.ts / the editor classes / toolbar.ts, or
- scaffolding a new @triliumnext/ckeditor5-* package. Covers the architecture,
+ adding a plugin to the aggregator (or, for large features, a new
+ @triliumnext/ckeditor5-* package). Covers the architecture,
idiomatic patterns, Trilium packaging/registration, code-style conventions,
and a review checklist.
---
@@ -28,9 +29,10 @@ and review existing ones idiomatically.
## When to use this skill
-Use it whenever the task involves a Trilium CKEditor 5 plugin/feature: creating one (a new
-`@triliumnext/ckeditor5-<feature>` package or an in-repo plugin under
-`packages/ckeditor5/src/plugins/`), extending one, debugging editing behavior, registering a
+Use it whenever the task involves a Trilium CKEditor 5 plugin/feature: creating one (by default an
+in-aggregator plugin under `packages/ckeditor5/src/plugins/`; a separate
+`@triliumnext/ckeditor5-<feature>` package only for large self-contained features), extending one,
+debugging editing behavior, registering a
plugin so it reaches the editor, or reviewing plugin code for correctness and convention
compliance. Trigger concepts include: model/view/schema, conversion (upcast/downcast),
`Command`, `editor.model.change()`, `ButtonView`/`componentFactory`, widgets (`toWidget`),
@@ -211,10 +213,11 @@ converters instead of `attributeToElement`; see `references/widgets.md`.
## Development workflow
-1. **Write the plugin.** Either a new `packages/ckeditor5-<feature>` workspace package
- (`@triliumnext/ckeditor5-<feature>`, `main: "src/index.ts"`, ships TS source — no per-package
- `dist` for consumers) or an in-repo plugin file under `packages/ckeditor5/src/plugins/`. See
- `references/tooling-and-packaging.md` for the package layout and config files.
+1. **Write the plugin.** **Default: an in-aggregator plugin** — a file/folder under
+ `packages/ckeditor5/src/plugins/`. Create a separate `packages/ckeditor5-<feature>` workspace
+ package (`@triliumnext/ckeditor5-<feature>`, `main: "src/index.ts"`, ships TS source) **only for
+ a large, self-contained feature**. See `references/tooling-and-packaging.md` ("Where a new plugin
+ goes").
2. **Register it so it reaches the editor** (full flow in `references/tooling-and-packaging.md`):
- For a new workspace package, add `"@triliumnext/ckeditor5-<feature>": "workspace:*"` to
`packages/ckeditor5/package.json`.
diff --git a/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.md b/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.md
index 62a1f8b7c0..2ac9ee2ef3 100644
--- a/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.md
+++ b/.claude/skills/ckeditor5-plugin-development/references/tooling-and-packaging.md
@@ -4,8 +4,9 @@ How CKEditor 5 plugins are packaged, registered, built, and debugged in the **Tr
(TriliumNext Notes)** monorepo. This is a pnpm workspace (`[email protected]`, `nodeLinker: hoisted`,
no nx/turbo) with packages under `packages/*` and apps under `apps/*`, org scope `@triliumnext/`.
The CKEditor 5 **library** is an external dependency pinned to `48.2.0`; there is no package
-generator here — you add a workspace package (or an in-repo plugin) by hand following the layout
-and registration flow below.
+generator here — you add a plugin by hand. **By default a new plugin lives inside the aggregator**
+(a file/folder under `packages/ckeditor5/src/plugins/`); a separate workspace package is the
+exception, reserved for large self-contained features (see "Where a new plugin goes" below).
## Where the editor lives
@@ -19,7 +20,23 @@ and registration flow below.
The library's own packages (basic-styles, link, image, engine, ui, core, widget, typing, …) are
**upstream** and not present in this repo — they ship inside the `ckeditor5` npm aggregate.
-## Plugin package layout (`packages/ckeditor5-<feature>`)
+## Where a new plugin goes (default: in the aggregator)
+
+**Project direction: keep new plugins inside the aggregator.** The default home for a new feature
+is an **in-aggregator plugin** — a file or folder under `packages/ckeditor5/src/plugins/`, written
+as a normal `Plugin` class and registered in `TRILIUM_PLUGINS`. No new package, `package.json`,
+tsconfig, build, or workspace wiring; just the code and one line in `plugins.ts`. This is the right
+choice for the large majority of features.
+
+**Create a separate `@triliumnext/ckeditor5-<feature>` workspace package only for large,
+self-contained external plugins** — substantial code with their own theme/lang/tests that could
+plausibly stand alone (the existing ones: math, footnotes, mermaid, admonition, collapsible,
+keyboard-marker). When in doubt, start in-aggregator and promote to a package later if it grows.
+
+The package layout below applies **only to the separate-package case**. An in-aggregator plugin
+needs none of it.
+
+## Plugin package layout (`packages/ckeditor5-<feature>`, the separate-package exception)
`package.json`:
diff --git a/.claude/skills/ckeditor5-reviewing/references/defect-patterns.md b/.claude/skills/ckeditor5-reviewing/references/defect-patterns.md
index d9870c4541..49222617c9 100644
--- a/.claude/skills/ckeditor5-reviewing/references/defect-patterns.md
+++ b/.claude/skills/ckeditor5-reviewing/references/defect-patterns.md
@@ -191,6 +191,14 @@ nothing loads it, no button shows, or lint/license/localization is off.
`static get requires()`; check the chain before flagging.)
- Fix: export the plugin and add it to the appropriate array so it reaches `builtinPlugins`.
+**Unnecessary separate package.**
+- Spot: a small/simple feature shipped as a new `@triliumnext/ckeditor5-<feature>` workspace
+ package (its own `package.json`/tsconfig/build/`workspace:*` wiring).
+- Why: project direction is to keep new plugins **in the aggregator** (`packages/ckeditor5/src/plugins/`,
+ registered in `TRILIUM_PLUGINS`). A separate package is reserved for large, self-contained features
+ (math, footnotes, mermaid, …); a thin one is needless overhead.
+- Fix: move it into `packages/ckeditor5/src/plugins/` unless it's genuinely large/standalone. (Minor.)
+
**Toolbar component not wired up.**
- Spot: a plugin that registers a `componentFactory` button but no corresponding entry in
`apps/client/src/widgets/type_widgets/text/toolbar.ts`.