google-docs-refine

Refines text in Google Docs using browser automation and human-assisted Gemini rewrite actions.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/toderian/project_template --skill google-docs-refine-toderian
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: google-docs-refine
Source: https://github.com/toderian/project_template/tree/main/plugins/agents-personal/skills/google-docs-refine
Command: npx skills add https://github.com/toderian/project_template --skill google-docs-refine-toderian

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires playwright, and includes scripts (resource) components.

What problem does it solve? Rewriting text with Google Docs' built-in Gemini tools (formalize, rephrase, shorten) cannot be triggered through the public Docs API, forcing users to manually copy text in and out of the browser. This Skill bridges that gap by staging text into a workbench Google Doc, driving the visible Gemini refine UI, and reading the final text back for the agent. ## Core Features & Use Cases - Connector-assisted staging: Uses a Google Drive/Docs connector when available to create workbench docs, replace document text, and read back final content reliably. - Visible browser automation: A Playwright-based script opens a persistent Chrome profile, stages text, and can automatically run Gemini refine modes such as more-formal, rephrase, shorten, elaborate, bulletize, and summarize. - Human-in-the-loop fallback: When automation cannot complete the rewrite, the script pauses so the user can run the Gemini UI manually, then extracts the result from the clipboard. - Use Case: You have a rough draft paragraph in a local file and need it formalized for an academic paper. The Skill stages it into a disposable Google Doc, runs the "More formal" Gemini action in the visible browser, and writes the refined text to an output file. ## Quick Start Ask the agent to refine the text in draft.txt using the Google Doc at your workbench URL with the instruction to make it more formal, and save the result to refined.txt.

Frequently Asked Questions about google-docs-refine

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate Google Docs Gemini rewrite actions?

Use the bundled script with the --auto-refine flag and a mode such as more-formal, rephrase, shorten, elaborate, bulletize, or summarize. It stages your text in a Google Doc, drives the visible Gemini refine UI with Playwright, accepts the suggestion, and writes the result to an output file.

Can the Google Docs API invoke Gemini rewrite features?

No. The public Docs API batchUpdate can insert, delete, and style content but cannot trigger built-in actions like Formalize or Rephrase. This Skill uses visible browser automation or human confirmation for the Gemini step instead.

Does the script store my Google credentials?

No. The script uses a persistent Chrome profile under ~/.cache/google-docs-refine-suite where you sign in once, or an already-authenticated connector. Credentials are never stored in repo files or requested by the Skill.

What happens if browser automation fails to extract the text?

The script falls back to a manual flow: it keeps the browser open, asks you to copy the final text with Ctrl+A and Ctrl+C, then reads the clipboard after you press Enter. It restores your original clipboard afterward unless --leave-clipboard is set.

Can I attach the script to an already-running Chrome window?

Yes. Start Chrome with a non-default user data directory and --remote-debugging-port=9222 bound to localhost, then pass --cdp-endpoint http://127.0.0.1:9222 to the script. Keep the debugging port local and never expose it on a network interface.