/gws:google-doc-to-md <doc-id-or-url> [output.md] [--title] [--list-tabs] [--tab <tab-title-or-id>]from gws
Downloads Google Docs (including tabs) as local markdown files via gws CLI, gcloud ADC, or the Drive MCP connector, with automatic fallback between authentication methods.
Ships in gws. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Download Google Docs as local markdown files. The Google Drive API natively
supports text/markdown as an export format, so no external conversion
tools are needed — the only variable is which account can authenticate to
reach the doc.
gws only authenticates your personal Google account. If the doc lives in
an account gws can't reach (e.g. a work account), route through the next
rung instead of giving up. Try rungs in order; only read/run the next rung
on fallthrough — don't front-load setup you may not need.
Use the existing workflow below. This is the primary path whenever gws
can authenticate to the doc's account.
Fall through to rung 2 if gws auth status fails, or the export/metadata
call 403s/404s for the doc (wrong account, not the auth-expired case —
that's a gws auth login fix, not a routing fallthrough).
Same clean native text/markdown export as rung 1 — same server-side
exporter — just authenticated via gcloud Application Default Credentials
instead of gws. Use this when the doc's account has ADC set up but not
gws (e.g. a work account you've done gcloud auth application-default login for).
# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
bash "$SKILL_DIR/scripts/adc-check.sh" # fast preflight; exit 0 = configured
bash "$SKILL_DIR/scripts/adc-export.sh" <doc-id-or-url> [output.md]
If adc-check.sh fails, it prints an actionable one-line reason. Only then
read references/adc-setup.md for the full gcloud
setup steps — don't load it up front. If ADC isn't configured and setting
it up isn't worth it right now, fall through to rung 3.
Escaping note (all rungs): Drive's native exporter also backslash-escapes markdown-significant punctuation that appears as literal text in the doc (
Catch up\!,\#123,(Q2 2026\)) — verified live 2026-07-16 on a real doc. It's valid CommonMark, but if the raw markdown is for human editing, the same de-escaper works on any rung. Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md inSKILL_DIR="${CLAUDE_SKILL_DIR}"; python3 "$SKILL_DIR/scripts/deescape.py" in.md out.md. Docs that round-tripped from markdown import export clean; docs with hand-typed punctuation don't. The connector rung always needs it.
Use when neither gws nor ADC can reach the doc's account, and the
mcp__claude_ai_Google_Drive__* tools are available in this session (e.g.
a work account added only via the Claude.ai connector). Verified live
(2026-07-14, see the smoke-test notes): the connector's markdown export is
backslash-escaped (\#, \[, \*, …) — there is no clean-export mode
to prefer, a de-escape pass is required.
/document/d/ up to the next /, ?, or #).mcp__claude_ai_Google_Drive__get_file_metadata with fileId to
confirm access and get the title.mcp__claude_ai_Google_Drive__download_file_content with
fileId and exportMimeType: "text/markdown". Base64-decode the
returned content (e.g.
python3 -c "import sys,base64; sys.stdout.write(base64.b64decode(sys.argv[1]).decode('utf-8'))" "$B64"
or write to a temp file and base64 -d).# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
python3 "$SKILL_DIR/scripts/deescape.py" TEMP_INPUT.md CLEANED.md
CLEANED.md's content to the output file (same filename-derivation
rules as rung 1).Known limitation: a literal backslash in the source prose immediately
followed by punctuation (e.g. C:\*.txt) is indistinguishable from a
connector-introduced escape and will also get unescaped. Low risk for prose
docs; call it out if the source doc is code-heavy or path-heavy.
If none of the three rungs can reach the doc, fail with a clear message naming which rungs were tried and why each failed — don't silently give up after rung 1.
# Codex: this path resolves under Claude Code; substitute the directory containing this plugin.
PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT}"
bash "$PLUGIN_ROOT/scripts/auth-preflight.sh"
Run the entrypoint script, passing all arguments through:
# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
bash "$SKILL_DIR/scripts/download.sh" $ARGUMENTS
If no arguments were provided, ask the user for the Google Doc URL or ID and optionally the output file path.
# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
bash "$SKILL_DIR/scripts/download.sh" DOC_ID_OR_URL
With a custom output path:
# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
bash "$SKILL_DIR/scripts/download.sh" DOC_ID_OR_URL ./output.md
With --title flag to use the doc's title as the filename:
# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
bash "$SKILL_DIR/scripts/download.sh" DOC_ID_OR_URL --title
gws drive files export with
mimeType: text/markdown (native Drive API support)The doc ID is the long string in a Google Docs URL:
https://docs.google.com/document/d/DOC_ID_HERE/edit
When no output path is given:
--title is set, derives the filename from the Google Doc title
(lowercased, spaces to hyphens, .md extension)<doc-id>.md in the current directoryGoogle limits exported content from files.export to 10 MB.
List a doc's tabs (id, index, title — indented by nesting):
# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
bash "$SKILL_DIR/scripts/download.sh" DOC_ID --list-tabs
Export a single tab as markdown (basic fidelity: headings, bold/italic, links, lists, tables):
# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
bash "$SKILL_DIR/scripts/download.sh" DOC_ID out.md --tab "Tab Title"
Note: the default (no --tab) Drive export flattens ALL tabs into one
markdown file with each tab's title as a heading — fine for single-tab docs,
confusing for multi-tab ones. Use --list-tabs first when unsure.
When downloading multiple docs, run in parallel:
# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
bash "$SKILL_DIR/scripts/download.sh" DOC_URL_1 ./doc1.md &
bash "$SKILL_DIR/scripts/download.sh" DOC_URL_2 ./doc2.md &
wait
If the bundled scripts are unavailable, see MANUAL.md for the step-by-step manual workflow.
Auth expired: Run gws auth login to re-authenticate.
Wrong account: Run gws auth status to check which account is active.
Account mismatch: If the doc belongs to a different Google account,
the script will tell you which account you're authenticated as and suggest
sharing or switching accounts. Run gws auth status to check.
Empty output: The doc may be empty or the export may have failed — check
stderr for error messages.
agents/openai.yaml (opens in a new tab)references/MANUAL.md (opens in a new tab)references/adc-setup.md (opens in a new tab)scripts/adc-check.sh (opens in a new tab)scripts/adc-export.sh (opens in a new tab)scripts/adc_export.py (opens in a new tab)scripts/deescape.py (opens in a new tab)scripts/docjson_to_md.py (opens in a new tab)scripts/download.sh (opens in a new tab)tests/test_adc_export.py (opens in a new tab)tests/test_deescape.py (opens in a new tab)tests/test_docjson_to_md.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub jtsternberg/claude-plugins --plugin gws7 skills in this plugin
/gws-accountCheck, add, list, or switch the active Google account. The only way to manage gws accounts — the CLI has no `account` subcommand./gws-calendarGoogle Calendar via the gws CLI — 'what's on my calendar', today's meetings, schedule, find an event, pull its Meet/Zoom link, create events, list calendars./gmail-draft-from-markdownTurn a local markdown file into a Gmail draft via gws — converts to HTML, attaches local files, threads onto an existing message as a reply, never sends, returns the Gmail drafts URL for review.Other plugins' skills for the same job