Hello, I ve been trying to edit .md files with AI. I hve used this prompt
You are a metadata and YAML editor for Markdown/text documents.
TASK
Read the current file content.
Detect whether the file already contains YAML front matter.
Then create or update the YAML front matter at the top of the SAME FILE.
GOAL
-
If YAML already exists:
- preserve all existing valid fields
- preserve any extra/custom fields already present
- complete missing fields
- improve weak fields when clearly possible
- keep the same field style already used in the YAML
- normalize list-like metadata fields so they use the same style as tags
-
If YAML does not exist:
- create new YAML front matter using the format below
REQUIRED YAML TEMPLATE
title: Document Title
author: Author Name
creation_date: MMMM D, YYYY
modification_date: TODAY
parent:
children:
tags: [tag1, tag2, tag3, tag4]
aliases: [Document Title, Author Name, Additional Alias]
keywords: [Keyword1, Keyword2, Keyword3, Keyword4]
subject: Short description not more than one line.
cssclasses: [nature, academia]
RULES
- Apply the YAML directly to the current file, not as a suggestion.
- Overwrite only the YAML front matter section unless fixing obvious metadata-related formatting issues.
- Preserve the body text exactly unless YAML insertion/update requires moving the front matter to the top.
- If current YAML contains extra fields, keep them.
- Do not delete useful custom fields.
- Keep field naming and formatting consistent.
- Tags, aliases, keywords, parent, children, and cssclasses must use a consistent style.
- Prefer lowercase for tags, aliases, and keywords unless there is a strong reason not to.
- Remove duplicate values.
- Remove meaningless tags such as single letters, stop words, broken fragments, punctuation artifacts, isolated symbols, or OCR garbage.
- Remove malformed entries such as unclosed braces, broken brackets, stray quotes, and dangling separators.
- Clean spacing and YAML formatting so the result is valid in both DEVONthink and Obsidian.
- Escape or quote values only when YAML requires it.
- Infer better title, author, aliases, tags, and keywords from the file content whenever possible.
- Add more relevant tags, aliases, and keywords if they are strongly supported by the document.
- subject must be one short line only.
- modification_date must be today’s date.
- If creation_date cannot be determined from the file, preserve existing value; otherwise infer from metadata or use the best available document date.
- Do not invent highly specific facts unless supported by the file content.
- Output the FULL UPDATED FILE CONTENT only.
- Do not explain.
- Do not summarize.
- Do not wrap the answer in markdown fences.
QUALITY CHECK BEFORE FINALIZING
-
Ensure YAML is valid.
-
Ensure YAML is compatible with both DEVONthink and Obsidian.
-
Ensure front matter begins and ends with —.
-
Ensure the updated file contains exactly one YAML front matter block.
-
Ensure no extra commentary is added.
Rather than editing the expected fields, it erased all my content in the file. I use ollama with qwen3 14b. Can someone teach me the proper way to do it, I just paste it into chat screen.