Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

edit-gdoc

БесплатноБез исполняемых скриптовНе проверен

Edit or create an unpublished OWID gdoc, or check or read any registered one (article, data insight, any gdoc type), as ArchieML text through the local or…

owidот owid★ 1 574 звезды на GitHub

Об этом скилле

Edit, create and check gdocs as ArchieML

Three admin routes read and write a gdoc's ArchieML text. Writes need unpublished docs the service account can edit (Google permissions decide which); GET reads any registered doc. A write replaces the whole doc: Google comments and any styling the parser ignores are lost. The old version stays in the doc's revision history (File → Version history).

The doc id is the part of the URL after /document/d/.

Host

  • Default: the local admin of the checkout you are in. Worktrees use their own port, so run this from the checkout root to take it from .env. Don't Read the .env itself, because it holds secrets.

    jq -Rr 'select(startswith("ADMIN_SERVER_PORT=")) | ltrimstr("ADMIN_SERVER_PORT=") | sub("\\s*(#.*)?$"; "")' .env
    

    It prints the port without any inline comment, or nothing when .env doesn't set it (the port is then 3030). HOST=http://localhost:<port>.

  • When the user names a branch: HOST=http://staging-site-<branch>, with slashes in the branch name turned into hyphens and the branch part truncated to 28 characters.

  • No auth headers. Localhost logs you in automatically; staging knows you through Tailscale.

$HOST, $ID, $REVISION_ID and $EMAIL in the commands below are placeholders. Shell variables don't persist between Bash calls, so write the literal values into every command.

Keep local files in your session scratchpad directory, and use their absolute paths in commands.

The routes are under $HOST/admin/api. Errors come back as { "error": { "message", "status" } }; the first line of message says what went wrong.

Read a doc

Works on any registered doc, published or not.

  1. Get the doc and check the response for .error (see Refusals):

    curl -s "$HOST/admin/api/gdocs/$ID/archieml" > doc.json
    jq '.error' doc.json
    
  2. Only when that prints null, save its text, exactly, to a local file:

    jq -j .text doc.json > doc.archieml
    jq -r .revisionId doc.json
    

    jq -j keeps the text byte-exact (no added trailing newline). revisionId is null when the service account can only view the doc (e.g. most published docs): it can be read, not written.

Edit a doc

Change a local copy of the text with Edit, then send that file. Never retype the doc into a request — that is where content gets lost.

  1. Read the doc (see "Read a doc") and keep its revisionId. If jq .published doc.json prints true, or jq .revisionId doc.json prints null, stop: tell the user the doc can only be read (published, or the service account can only view it).

  2. Read doc.archieml, then make the change with Edit. Touch only the lines that need to change.

  3. Send the file:

    curl -s -X PUT "$HOST/admin/api/gdocs/$ID/archieml?revisionId=$REVISION_ID" \
        -H "Content-Type: text/plain; charset=utf-8" \
        --data-binary @doc.archieml | jq
    

    --data-binary sends the file as-is (-d would strip newlines).

  4. Read the response (below). For another edit, use the new revisionId it returns, or GET again.

  5. If this is the first write to this doc in the session, give the user both links (see "Links").

Create a doc

Mirror a real doc of the same type. Field lists alone miss the structure (e.g. a data insight's text goes inside [+body] … []).

  1. Find an exemplar of the type ($TYPE, e.g. data-insight):

    curl -s "$HOST/admin/api/gdocs-reference/templates/$TYPE/exemplars.json" | jq -r '.exemplars[0].gdocId'
    

    If that prints null or an error, take any doc of the type, published first:

    curl -s "$HOST/admin/api/gdocs" | jq -r --arg t "$TYPE" '[.[] | select(.type == $t)] | (map(select(.published)) + .)[0].id'
    

    If that prints null too, there is no doc of the type: build from the fields in $HOST/admin/api/gdocs-reference/templates.json, and tell the user the structure is unverified.

  2. Read the exemplar as in "Read a doc" (exemplar.json → exemplar.archieml), then Read the local file. It is usually published and always read-only: a PUT on it returns 403. Never send it.

  3. Write the new doc to a local file, e.g. new.archieml. Mirror the exemplar's front matter and block layout; replace its content with yours. Prefix the front-matter title with [TEST] (e.g. title: [TEST] Life expectancy): the Drive name is taken from it, so test docs stand out in Drive and in the admin. For block syntax, see $HOST/admin/api/gdocs-reference/components.json.

  4. Share with the Claude session's account email (the user's email from your session context). If you don't know it, ask. Never guess.

  5. Pick the Drive folder. If the user names one, add &folderId=$FOLDER_ID to the URL in step 6, where $FOLDER_ID is the part of the folder's URL after /folders/. Otherwise leave folderId out, and the server uses the folder set in its GDOCS_EDIT_GDOC_FOLDER_ID.

    If the

Полный SKILL.md на GitHub

Установить edit-gdoc в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Edit
Write
Bash(curl:*)
Bash(jq:*)

FAQ

Что делает скилл edit-gdoc?

Edit or create an unpublished OWID gdoc, or check or read any registered one (article, data insight, any gdoc type), as ArchieML text through the local or staging admin API. Use when an engineer asks to change a test gdoc's content, create a new gdoc draft from ArchieML, or check a gdoc's errors and warnings — given a doc id or docs.google.com URL, on localhost or on staging-site-<branch>.

Как установить скилл edit-gdoc?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл edit-gdoc запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить edit-gdoc с