mcpField
G
google-slides

google-slides

github.com/odyssey4me文档处理13195 次安装1 天前更新
代码仓库

关于 google-slides

用于通过 Markdown 创建和编辑演示文稿的 skill,适合处理幻灯片的用户。它可在本地生成 PPTX,也支持选择上传到 Google Slides。

主要功能

  1. 01从 Markdown 构建 PPTX
  2. 02通过 YAML frontmatter 配置
  3. 03上传到 Google Slides
  4. 04下载并重新构建演示文稿
  5. 05以图像或文本预览幻灯片

适用场景

  1. 01从 Markdown 文件创建幻灯片
  2. 02编辑下载的 Google Slides 演示文稿并重新构建
  3. 03分享前预览 PPTX

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/odyssey4me/agent-skills --skill google-slides

安装后在 Claude Code 中输入/google-slides确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
command-reference.md
permissions.md
presentations-guide.md
scripts/
google-slides.py
templates/
default.pptx
generate_template.py

详细介绍

Google Slides

使用带 YAML frontmatter 的 Markdown 文件制作演示文稿。此技能使用 python-pptx 在本地生成 .pptx 文件,也可选择通过 Drive API 上传到 Google Slides。往返工作流支持将现有演示文稿下载为 Markdown,编辑后重新构建并上传。

安装

必需的 Python 包:

pip install --user google-auth google-auth-oauthlib google-api-python-client keyring pyyaml

用于在本地构建 .pptx:

pip install --user python-pptx cairosvg

可选的系统依赖项: LibreOffice(用于 preview 命令)。此技能会自动检测 libreoffice、soffice、Flatpak,或 LIBREOFFICE_PATH 环境变量中设置的路径。

验证设置

安装后,验证技能是否已正确配置:

$SKILL_DIR/scripts/google-slides.py check

此命令会检查:

  • Python 依赖项(google-auth、google-auth-oauthlib、google-api-python-client、keyring、pyyaml、python-pptx、cairosvg)
  • 身份验证配置
  • 与 Google API 的连通性
  • LibreOffice 是否可用(可选)

如果缺少任何内容,检查命令会提供设置说明。

身份验证

Google Slides 使用 OAuth 2.0 进行身份验证。如需完整的设置说明,请参阅:

  1. GCP 项目设置指南 - 创建项目并启用 Drive API
  2. Google OAuth 设置指南 - 配置凭据
快速开始
  1. 创建 ~/.config/agent-skills/google.yaml:

    oauth_client:
      client_id: your-client-id.apps.googleusercontent.com
      client_secret: your-client-secret
    
  2. 运行 $SKILL_DIR/scripts/google-slides.py check,触发 OAuth 流程并验证设置。

如果出现作用域或身份验证错误,请参阅 OAuth 故障排除指南。

脚本用法

请参阅 permissions.md,了解各命令的读写权限分类。

# Setup and auth
$SKILL_DIR/scripts/google-slides.py check
$SKILL_DIR/scripts/google-slides.py auth setup --client-id ID --client-secret SECRET
$SKILL_DIR/scripts/google-slides.py auth reset
$SKILL_DIR/scripts/google-slides.py auth status

# Build a presentation from Markdown
$SKILL_DIR/scripts/google-slides.py create --file deck.md
$SKILL_DIR/scripts/google-slides.py create --file deck.md --output deck.pptx --palette redhat-brand
$SKILL_DIR/scripts/google-slides.py create --file deck.md --title "My Deck"  # build and upload

# Download a presentation as Markdown
$SKILL_DIR/scripts/google-slides.py get PRESENTATION_ID
$SKILL_DIR/scripts/google-slides.py get PRESENTATION_ID -o deck.md

# Upload or replace slides in an existing presentation
$SKILL_DIR/scripts/google-slides.py update PRESENTATION_ID --file deck.pptx
$SKILL_DIR/scripts/google-slides.py update PRESENTATION_ID --file deck.pptx --mode append

# Preview and verify
$SKILL_DIR/scripts/google-slides.py preview --file deck.pptx
$SKILL_DIR/scripts/google-slides.py preview --file deck.pptx --format summary
$SKILL_DIR/scripts/google-slides.py verify --file deck.pptx

# List available color palettes
$SKILL_DIR/scripts/google-slides.py palettes

如需查看完整的参数详情和示例,请参阅 command-reference.md。

Markdown 格式

演示文稿使用带 YAML frontmatter 的 Markdown 文件编写。幻灯片之间以独占一行的 --- 分隔。幻灯片类型通过 HTML 注释指令设置。

---
title: Team Update
subtitle: Q2 2026
author: Jane Smith
date: 2026-06-23
palette: redhat-brand
---

# Team Update

## Q2 2026

> Speaker notes go in blockquotes.

---



# Progress Review

---

## Key Metrics

- Revenue: $1.2M (up 15%)
- Active users: 50,000
- NPS: 72

::icon:trending-up::

> Mention the NPS improvement from last quarter.

---



## Comparison



### Before

- Manual process
- 3-day turnaround
- Error-prone



### After

- Fully automated
- 15-minute turnaround
- 99.9% accuracy

---



# Architecture

![System architecture diagram](images/architecture.png)

---



# Thank You

## Questions?
幻灯片类型
类型指令描述
标题(自动检测首张幻灯片)演示文稿标题和副标题
章节``带有大标题的章节分隔页
内容(默认)包含标题和项目符号的标准幻灯片
双栏``使用 / 标记并排展示内容
图片``全屏图片,可选标题
结束页``结束页(例如“谢谢”)
格式
  • # H1 -- 幻灯片标题
  • ## H2 -- 幻灯片副标题
  • - bullets -- 项目符号(支持嵌套)
  • > blockquote -- 演讲者备注(不会显示在幻灯片上)
  • ![alt](path) -- 图片
  • ::icon:name:: -- 来自 Red Hat 图标仓库的图标

有关完整的 Markdown 格式规范、图标类别和调色板,请参阅 presentations-guide.md。

调色板

提供七种内置调色板:四种 Red Hat 品牌调色板和三种通用调色板。使用 palettes 列出调色板。

在 frontmatter 中设置调色板(palette: name),或在命令行中设置(--palette name)。命令行标志会覆盖 frontmatter 中的设置。

示例

构建并预览演示文稿
# Create .pptx from Markdown
$SKILL_DIR/scripts/google-slides.py create --file deck.md --output deck.pptx

# Preview as images (requires LibreOffice)
$SKILL_DIR/scripts/google-slides.py preview --file deck.pptx --format images

# Get a text summary instead
$SKILL_DIR/scripts/google-slides.py preview --file deck.pptx --format summary
一步完成构建和上传
$SKILL_DIR/scripts/google-slides.py create --file deck.md --title "Q2 Team Update"
# Builds .pptx, uploads to Google Drive, returns the presentation URL
往返工作流
# Download existing presentation as Markdown
$SKILL_DIR/scripts/google-slides.py get 1abc...xyz -o deck.md

# Edit deck.md in your editor...

# Rebuild
$SKILL_DIR/scripts/google-slides.py create --file deck.md --output deck.pptx

# Verify quality and accessibility
$SKILL_DIR/scripts/google-slides.py verify --file deck.pptx

# Replace slides in the original presentation
$SKILL_DIR/scripts/google-slides.py update 1abc...xyz --file deck.pptx --mode replace
对照云端版本进行验证
$SKILL_DIR/scripts/google-slides.py verify --file deck.pptx --presentation-id 1abc...xyz

错误处理

身份验证错误和权限范围错误不可重试。 如果命令因身份验证错误、权限范围不足错误或权限被拒绝错误(退出代码 1)而失败,请停止并告知用户。不要重试或尝试自主解决问题——这些错误需要用户交互(基于浏览器的 OAuth 授权)。请引导用户查看 OAuth 故障排除指南。

可重试的错误:速率限制(HTTP 429)和临时服务器错误(HTTP 5xx)在短暂等待后重试可能成功。其他所有错误都应报告给用户。

模型指南

此技能会进行需要结构化输入/输出的 API 调用。建议使用标准能力的模型。

故障排除

找不到演示文稿

请确保使用 URL 中正确的演示文稿 ID:

  • URL:https://docs.google.com/presentation/d/1abc...xyz/edit
  • 演示文稿 ID:1abc...xyz
找不到 LibreOffice

preview 命令需要 LibreOffice。请通过软件包管理器安装,或将 LIBREOFFICE_PATH 设置为二进制文件所在位置。此技能会自动检查 libreoffice、soffice 和 Flatpak 安装。

参考

评论

支持 Markdown