gdoc-math
Convert Markdown with LaTeX math into a native Google Doc whose equations are real, editable equation objects (not images, not literal $$ text). Use when: "/gdoc-math", "turn this markdown into a Google Doc with editable equations", "convert this LaTeX/formulas to a Google Doc", "make a gdoc from this .md with math", or converting an LLM/Gemini answer full of $...$ formulas into a proper editable Doc. NOT for: plain Markdown with no math (use /copy:gdocs), clipboard copy, Sheets/Slides, or editing an existing Doc's body.
What this skill does
# gdoc-math — Markdown + LaTeX → Google Doc with editable equations
Google Docs' **Paste from Markdown** ignores math: `$...$` and `$$...$$` land as literal text. There is also no Google Docs API to insert native equation objects. This skill takes the only route that yields **editable** equations:
```
markdown+LaTeX →[pandoc]→ .docx (OMML) →[gws drive upload]→ →[gws drive convert --to docs]→ Google Doc
└─ intermediate .docx is auto-trashed
```
pandoc renders LaTeX into Office MathML (OMML); Google Drive imports OMML as native, clickable, editable Google Docs equations. The script `scripts/md2gdoc.sh` runs the whole pipeline and prints the Doc link.
## Prerequisites
Three hard dependencies — the skill cannot work without them, so verify them before doing anything else (Step 0 below):
- **pandoc** — `brew install pandoc`. Renders LaTeX into the OMML equations Google imports.
- **python3** — used to parse `gws` JSON output (present by default on macOS).
- **gws** (the Google Workspace CLI), **authenticated for Drive** — the pipeline uploads + converts a file in the user's Drive.
- Install: `go install github.com/omriariav/workspace-cli/cmd/gws@latest` (repo: https://github.com/omriariav/workspace-cli)
- Authenticate: `gws auth login` (or the `/gws:auth` skill). Verify with `gws auth status`.
## Workflow
0. **Preflight — verify dependencies.** Before anything else, run:
```bash
bash "${CLAUDE_PLUGIN_ROOT}/skills/gdoc-math/scripts/verify-setup.sh"
```
It checks pandoc, the `gws` binary, and live Drive auth, printing exactly what's missing and how to fix it. **On failure** (non-zero exit), stop and report the remediation to the user — don't attempt the pipeline against a missing dependency, or the math conversion or Drive write will throw a confusing error downstream. `md2gdoc.sh` repeats these checks as a safety net, but Step 0 gives the user one clear, upfront fix-list.
1. **Resolve the input into a single `.md` file path:**
- **Path given** in `$ARGUMENTS` (ends in `.md`/`.markdown` and exists) → use it directly.
- **Inline content** in `$ARGUMENTS` (a blob of markdown, not a path) → `Write` it to a temp file, e.g. `/tmp/gdoc-math-<timestamp>.md`, and use that path.
- **Nothing usable** → fall back to the most recent substantial Markdown content in the conversation (the last assistant answer or code block containing `$`/`$$` math). `Write` it to a temp `.md` and use that path. If the conversation has no clear candidate, ask the user what to convert with `AskUserQuestion`.
2. **Pick a title (optional):** If the user named the doc, pass `--name "<title>"`. Otherwise let the script derive it from the first `#` heading or the filename.
3. **Run the pipeline** from the skill directory:
```bash
bash "${CLAUDE_PLUGIN_ROOT}/skills/gdoc-math/scripts/md2gdoc.sh" "<path.md>" [--name "<title>"] [--folder <DRIVE_FOLDER_ID>]
```
The script writes `DOC_NAME=`, `DOC_ID=`, and `DOC_URL=` lines to stdout.
4. **Present the result:** Give the user the **`DOC_URL`** as a clickable link and the doc title. Note that the equations are now native and editable. Briefly flag that very complex LaTeX (stacked fractions, matrices, large operators) can lose some fidelity on Google's import and may need a touch-up.
## Flags & config
- `--name "Title"` — Google Doc name (default: first `#` heading, else the filename).
- `--folder ID` — create the Doc inside a specific Drive folder (default: My Drive root). Overrides config.
- `--keep-docx` — keep the intermediate `.docx` in Drive instead of trashing it (debugging only).
`config.json` holds one optional setting, `default_folder_id` — if set, Docs land in that Drive folder when `--folder` isn't passed. It's empty by default (My Drive root); the skill works fine without touching it.
## Output format
`md2gdoc.sh` prints exactly this three-line structure to stdout (parse `DOC_URL` for the link):
```
DOC_NAME=<the document title>
DOC_ID=<the Google Doc file id>
DOC_URL=<https://docs.google.com/document/d/.../edit>
```
Present `DOC_URL` to the user as a clickable link with the title. Any other stdout is a diagnostic from a failed step — surface it, don't paper over it.
## Example
A ready-to-run sample ships at `examples/math-demo.md` (inline + display math, fractions, roots, summations, integrals, limits, Greek). A typical run:
```
User: /gdoc-math examples/math-demo.md
→ bash .../md2gdoc.sh examples/math-demo.md
→ DOC_URL=https://docs.google.com/document/d/1t_.../edit
Claude: Done — "Math, rendered properly" is in your Drive with native,
editable equations: <link>. Fractions and integrals came through clean.
```
## Common mistakes
These are real failure modes — knowing *why* each happens prevents the wrong fix.
- **LaTeX comes out as literal `$...$` text.** Almost always the wrong pandoc reader. `gfm` (GitHub-flavored) does **not** parse `$`-delimited math, so it passes through verbatim — exactly the failure `/copy:gdocs` has. The script pins `-f markdown+tex_math_dollars+tex_math_single_backslash` for this reason; don't "simplify" it to `gfm`. Supported delimiters: `$…$`, `$$…$$`, `\(…\)`, `\[…\]`. Other delimiters won't convert.
- **`gws is not authenticated for Drive`.** The pipeline writes to Google Drive over the network, so `gws` must be authed. The script probes this up front and fails fast — hand the user to `/gws:auth`, don't retry.
- **A stray `.docx` shows up in Drive.** `gws drive upload` + `gws drive convert` is a two-step flow: convert creates a *new* Google Doc and leaves the uploaded `.docx` behind. The script trashes that intermediate automatically on exit; only `--keep-docx` (debugging) leaves it.
- **Equation fidelity on complex LaTeX.** Simple fractions/subscripts/Greek round-trip cleanly, but Google's OMML import can mangle stacked fractions, matrices, and large operators. Tell the user to spot-check those rather than promising pixel-perfect output.
## Notes
- **Editable, verified:** equations round-trip as OMML (`m:oMath`) with no embedded images — genuine editable equation objects, not pictures.
- **Side effect:** this creates a file in the user's Google Drive (intermediate `.docx` auto-trashed).
- **Not the clipboard:** for plain prose/tables with no math, `/copy:gdocs` (Paste from Markdown) is simpler and stays local.
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.