Notion Write Math Encoding Guard logo

Notion Write Math Encoding Guard

Community
Rainy-W-cy
notion-write-math-encoding-guard

Prevent mojibake and formula corruption when creating or updating Notion pages that contain Markdown, LaTeX formulas, vectors/matrices, and mixed Chinese-English text. Use when Notion content includes non-ASCII symbols, math delimiters, previously corrupted escapes, or unstable Notion formula rendering.

Overview

PublisherRainy-W-cy
Repositorypractical-agent-skills
Skill namenotion-write-math-encoding-guard
Stars
29
Forks
2
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Rainy-W-cy on GitHub. Read the source before you install it.

Installation

Install the Notion Write Math Encoding Guard AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Rainy-W-cy/practical-agent-skills/tree/main/skills/notion-write-math-encoding-guard
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Rainy-W-cy/practical-agent-skills.git /tmp/practical-agent-skills
mkdir -p .claude/skills
cp -r /tmp/practical-agent-skills/skills/notion-write-math-encoding-guard .claude/skills/notion-write-math-encoding-guard
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Notion Write Math Encoding Guard in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Notion Write Math Encoding Guard on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Notion Write Math Encoding Guard is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Notion Write Math Encoding Guard

Overview

Use this skill when Notion page content must stay readable after upload, especially for formula-heavy technical notes. The goal is not only to prevent mojibake, but also to keep formula presentation stable in Notion preview, fetch output, and later edits.

Workflow

  1. Determine language, math density, and whether the user wants full rewrite or local edits.
  2. Determine content ownership before drafting:
    • user-provided text that must be preserved
    • assistant-authored explanation that may be reformatted
  3. Classify formulas before drafting:
    • plain-text-safe
    • inline-math-needed
    • block-math-needed
  4. Build content in Notion-friendly Markdown with LaTeX-safe formulas and preview-stable layout.
  5. For existing pages, fetch first and decide replace_content vs update_content.
  6. Write to Notion.
  7. Fetch again and validate encoding, delimiters, wording fidelity, and rendering stability.

Authoring Rules

  • If the user gives text to write into Notion, preserve the user's wording and intent by default.
  • Do not autonomously rewrite, polish, summarize, or strengthen the user's wording unless the user explicitly asks for that.
  • You may only normalize formatting, formula delimiters, headings, spacing, list structure, and obvious encoding issues when writing the user's content into Notion.
  • When user wording and Notion preview stability conflict, keep the wording and change only the presentation layer.
  • Prefer block formulas ($$...$$) for complex expressions.
  • Use inline formulas ($...$) only for short symbols that truly need math rendering.
  • Prefer LaTeX commands over decorative Unicode math glyphs.
  • Use canonical forms: \\vec{x}, \\mathbf{x}, \\begin{bmatrix}...\\end{bmatrix}.
  • Keep punctuation in formulas ASCII-only.
  • Keep mixed-language prose outside formula delimiters where possible.
  • Prefer plain text for simple function names and short variables in prose.
  • Do not wrap every symbol in inline math by default.
  • Avoid mixing backticks and math delimiters around the same token.
  • For long-term notes, prefer "few block formulas + mostly plain text" over dense inline math.

Preview-Stable Notion Layout Rules

  • Write for Notion page preview first, not for raw Markdown aesthetics.
  • Avoid layouts that commonly render badly in Notion preview:
    • dense inline formulas inside long Chinese sentences
    • mixed backticks and math delimiters on the same token
    • deeply nested lists containing formulas
    • long multi-clause paragraphs that alternate prose and symbols repeatedly
  • Prefer short paragraphs, flat lists, and separated block formulas.
  • Keep headings concise and aligned with the user's original structure.
  • If the user provides an existing section order, preserve that order unless the user explicitly requests restructuring.
  • Do not add explanatory sections, transition sentences, or editorial comments unless the user asked for them.
  • If a table is likely to misalign or degrade in Notion preview, rewrite it into a flat bullet list only if this does not change the user-requested content structure.
  • When formatting user-provided content, optimize spacing and alignment only to improve Notion readability, never to change meaning.

Formula Style Guide

Use plain text when:

  • Mentioning a function name in prose
  • Describing thresholds or parameter ranges
  • Referring to simple scalars or settings
  • Explaining hardware control flow, FSM names, or module names

Examples:

  • Softmax
  • LayerNorm
  • exp(x)
  • sqrt(a)
  • h <= 4
  • N >= 3
  • a in [0, 2]

Use inline math when:

  • A short symbol would be ambiguous in plain text
  • A sentence needs one compact mathematical token

Examples:

  • $x_i$
  • $\\mu$
  • $\\sigma^2$

Use block math when:

  • The expression contains fractions, roots, summations, matrices, or updates
  • The formula is central to the explanation
  • The same formula may be referenced later

Examples:

$$ \mathrm{Softmax}(x_i) = \frac{e^{x_i}}{\sum_{j=1}^{N} e^{x_j}} $$

$$ x_{n+1} = \frac{1}{2}\left(x_n + \frac{a}{x_n}\right) $$

Notion Write Rules

  • For new pages, create with title in properties and body in content.
  • For existing pages, always fetch before editing.
  • Prefer full replace_content when corruption is widespread.
  • Prefer update_content for small, exact-match edits.
  • Avoid blind global replacements on formula-heavy content.
  • When a page has repeated formula corruption, prefer rebuilding the affected section from clean source text rather than patching escaped fragments in place.
  • If both encoding cleanup and formula-style cleanup are needed, prefer one controlled full rewrite over many small edits.
  • If the user asks to "write this content into Notion", treat the provided content as source-of-truth text.
  • In that case, editing scope is limited to:
    • encoding repair
    • math delimiter stabilization
    • line break and heading normalization
    • preview-safe list and paragraph formatting
  • In that case, do not:
    • rewrite the tone
    • add missing analysis on your own
    • compress or expand the substance
    • silently convert the content into a different style

Wording Fidelity Rules

  • Preserve terminology exactly when it appears intentional, including mixed Chinese-English technical phrases.
  • Preserve emphasis markers, section names, and user-specified ordering unless they directly cause rendering failure.
  • If a phrase is awkward but readable, keep it.
  • If a phrase is unreadable because of corruption, reconstruct the smallest necessary fragment only.
  • When you must repair a corrupted expression, keep the nearest recoverable wording rather than producing a cleaner paraphrase.

Validation Checklist

After writing to Notion, verify all checks:

  • Page fetch returns readable text in the requested language.
  • User-provided wording has not been unintentionally rewritten.
  • No mojibake markers such as ???, replacement bursts, or obviously garbled character runs.
  • Formula delimiters remain balanced.
  • Backslashes in LaTeX commands are preserved.
  • Critical formulas and vector/matrix snippets render in Notion UI.
  • Plain-text function names do not appear wrapped in accidental math delimiters.
  • API fetch noise is distinguished from true corruption:
    • escaped backslashes alone do not prove the page is broken
    • repeated $...$-style fragments or mixed backticks/math usually indicate unstable authoring
  • If API text shows escaped backslashes, verify UI rendering before concluding corruption.
  • Headings, bullets, spacing, and formula blocks remain visually aligned in Notion preview.

Failure Handling

If validation fails:

  1. Rebuild the affected section from clean source text.
  2. Reduce inline formulas; convert complex inline math to block formulas.
  3. Convert non-essential inline math to plain text function or variable notation.
  4. Revert any unnecessary wording changes and keep only formatting repairs.
  5. Re-apply update with exact snippet boundaries.
  6. Fetch again and re-check delimiters, backslashes, wording fidelity, and UI rendering.

Decision Heuristics

  • If the page is mostly readable but a few formulas are ugly, use update_content.
  • If formulas are broadly inconsistent, mixed with escaped fragments, or preview is unstable, use replace_content.
  • If the user wants a long-term notes page, optimize for stability, not for maximal LaTeX density.
  • If a formula-heavy page keeps regressing after edits, simplify the notation style rather than adding more escapes.
  • If the user provides final text for direct write-in, prefer preserving wording over stylistic optimization.
  • If preview stability can be fixed by layout changes alone, do not touch the wording.

Quick Snippets

See references/math-and-vector-snippets.md for safe equation, vector, and matrix templates.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Notion Write Math Encoding Guard AI skill do?

Prevent mojibake and formula corruption when creating or updating Notion pages that contain Markdown, LaTeX formulas, vectors/matrices, and mixed Chinese-English text. Use when Notion content includes non-ASCII symbols, math delimiters, previously corrupted escapes, or unstable Notion formula rendering.

Why use Notion Write Math Encoding Guard on TypingMind?

Because you install it once and use it with any model. Notion Write Math Encoding Guard is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Notion Write Math Encoding Guard in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Rainy-W-cy/practical-agent-skills/tree/main/skills/notion-write-math-encoding-guard. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Notion Write Math Encoding Guard?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Notion Write Math Encoding Guard?

As many as you like. As long as a model supports skills, you can use Notion Write Math Encoding Guard with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Notion Write Math Encoding Guard AI skill free?

Yes. It is published on GitHub by Rainy-W-cy under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇