agentleFS
MarceltovMarceltov/trilium-plugin/skills/apply-template-to-note/SKILL.md

apply-template-to-note

Skill0 starsChanged 2 months agoMITView on GitHub

Retroactively attach an existing Trilium note to a template via a ~template relation, which merges the template's child-note structure, content, and promoted attributes onto that note. Use when the user asks to convert, retrofit, or "make this note use" an existing template. This overwrites the target note's content and adds child notes to it — always confirm before writing.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If more than one Trilium instance is connected this session, resolve which one to use first — see Working with multiple instances.

    line 10

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Apply an Existing Template to an Existing Note

Same underlying mechanism as create-note-from-template (attaching a ~template relation), but applied to a note that may already have real content and children — which makes this the destructive one of the template skills. Verified against a live instance: once the ~template relation is attached, the target note's content is replaced with the template's content (they end up sharing a blob), and the template's child notes are cloned in as new children under the target. This is not reversible by simply deleting the relation.

If more than one Trilium instance is connected this session, resolve which one to use first — see Working with multiple instances.

Steps

  1. Resolve the target note (by title via searchNotes or by noteId if given) and the template note (same resolution as create-note-from-template step 1: noteId if given, else searchNotes("#template") matched by title, asking if ambiguous).
  2. Before writing anything, fetch both notes' current state (getNoteById + getNoteContent for each) and summarize for the user: the target's current content (non-empty? roughly how much?) and existing child-note count — call out specifically if either is non-trivial, since both are at risk — and the template's child-note count and title, so the user knows what's about to be merged in.
  3. Get explicit confirmation (e.g. via AskUserQuestion) before proceeding. If the user declines, stop — do not attach the relation.
  4. On confirmation, postAttribute with type: relation, name: template, value: <template noteId>, noteId: <target noteId>.
  5. Re-fetch the target note to confirm the relation applied, then walk the user through the promoted-attribute value prompts exactly as in create-note-from-template steps 5–7 (find the template's promoted attribute definitions surfaced on the target, ask for values, write them with postAttribute).
  6. Report back: confirm the relation is attached, how many child notes were added, and which promoted attributes were set.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.