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.
In this repository11 other files it gives its agents.
- create-note-from-templateSkill
- create-noteSkill
- delete-noteSkill
- export-note-subtreeSkill
- find-template-instancesSkill
- journal-noteSkill
- manage-note-attributesSkill
- manage-trilium-instancesSkill
- move-noteSkill
- rename-noteSkill
- search-notesSkill
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
- Distinctive: line 10
If more than one Trilium instance is connected this session, resolve which one to use first — see Working with multiple instances.
≈ “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.
Files
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
- Resolve the target note (by title via
searchNotesor by noteId if given) and the template note (same resolution ascreate-note-from-templatestep 1: noteId if given, elsesearchNotes("#template")matched by title, asking if ambiguous). - Before writing anything, fetch both notes' current state (
getNoteById+getNoteContentfor 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. - Get explicit confirmation (e.g. via
AskUserQuestion) before proceeding. If the user declines, stop — do not attach the relation. - On confirmation,
postAttributewithtype: relation,name: template,value: <template noteId>,noteId: <target noteId>. - 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-templatesteps 5–7 (find the template's promoted attribute definitions surfaced on the target, ask for values, write them withpostAttribute). - Report back: confirm the relation is attached, how many child notes were added, and which promoted attributes were set.
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
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.

