用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/RunnerQuan/SAFE-Agent --skill google-drive命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Find doctors with Healthgrades - search providers, read reviews, and check credentials
Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks.
基于RFM模型和回归算法的客户生命周期价值(LTV)预测分析工具,支持电商和零售业务的客户价值预测。使用时需要客户交易数据、订单历史或消费记录,自动进行RFM特征工程、回归建模和价值预测。
基于 SOC 职业分类
正在显示 SKILL.md
| name | google-drive |
| description | Search and read Google Drive files including Docs, Sheets, and other documents. |
This skill provides access to Google Drive and Google Docs/Sheets/Slides via the Drive API.
Uses OAuth with persistent refresh token (same setup for Calendar, Gmail, Drive).
One-time setup:
google-oauth-setup <path-to-client-secret.json>
See claude/skills/SETUP.md for detailed OAuth setup instructions.
Get Access Token (auto-refreshes):
ACCESS_TOKEN=$(google-oauth-token)
If you get invalid_grant or reauth related error, the OAuth token has expired. Re-authenticate using gcloud:
# Re-authenticate with required scopes
gcloud auth application-default login \
--scopes="https://www.googleapis.com/auth/calendar.readonly,https://www.googleapis.com/auth/gmail.readonly,https://www.googleapis.com/auth/drive.readonly,https://www.googleapis.com/auth/cloud-platform"
# Migrate the new credentials
google-oauth-setup --migrate-gcloud
This will open a browser for authentication, then migrate the credentials to the google-oauth config.
Required header for all requests:
-H "x-goog-user-project: ${GOOGLE_QUOTA_PROJECT}"
Use this skill when the user:
Base URL: https://www.googleapis.com/drive/v3
List Recent Files:
curl -s "https://www.googleapis.com/drive/v3/files?pageSize=20&orderBy=modifiedTime%20desc" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" | jq '.files[] | {name, id, mimeType}'
Search Files:
curl -s -G "https://www.googleapis.com/drive/v3/files" \
--data-urlencode "q=name contains 'meeting notes'" \
--data-urlencode "pageSize=20" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
Get File Metadata:
curl -s "https://www.googleapis.com/drive/v3/files/{FILE_ID}?fields=*" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
Export Google Doc as Text:
curl -s "https://www.googleapis.com/drive/v3/files/{FILE_ID}/export?mimeType=text/plain" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
Base URL: https://docs.googleapis.com/v1
Get Document Content:
curl -s "https://docs.googleapis.com/v1/documents/{DOCUMENT_ID}" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
Base URL: https://sheets.googleapis.com/v4
Get Spreadsheet Metadata:
curl -s "https://sheets.googleapis.com/v4/spreadsheets/{SPREADSHEET_ID}" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
Read Sheet Values:
curl -s "https://sheets.googleapis.com/v4/spreadsheets/{SPREADSHEET_ID}/values/{RANGE}" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
# Example RANGE: Sheet1!A1:D10, or just A1:D10 for first sheet
The q parameter uses Drive search syntax:
| Query | Description |
|---|---|
name contains 'report' | Name contains text |
name = 'Exact Name' | Exact name match |
fullText contains 'search term' | Content contains text |
mimeType = 'application/vnd.google-apps.document' | Google Docs |
mimeType = 'application/vnd.google-apps.spreadsheet' | Google Sheets |
mimeType = 'application/pdf' | PDF files |
modifiedTime > '2024-01-01' | Modified after date |
'folder_id' in parents | Files in specific folder |
starred = true | Starred files |
trashed = false | Not in trash |
Combine with and/or: name contains 'meeting' and mimeType = 'application/vnd.google-apps.document'
| Type | MIME Type |
|---|---|
| Google Doc | application/vnd.google-apps.document |
| Google Sheet | application/vnd.google-apps.spreadsheet |
| Google Slides | application/vnd.google-apps.presentation |
| Google Form | application/vnd.google-apps.form |
| Folder | application/vnd.google-apps.folder |
ACCESS_TOKEN=$(google-oauth-token)
curl -s -G "https://www.googleapis.com/drive/v3/files" \
--data-urlencode "q=name contains 'project plan' and mimeType = 'application/vnd.google-apps.document'" \
--data-urlencode "fields=files(id,name,modifiedTime,webViewLink)" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
# Export as plain text
DOC_ID="1abc123..."
curl -s "https://www.googleapis.com/drive/v3/files/${DOC_ID}/export?mimeType=text/plain" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
SHEET_ID="1abc123..."
# Get all values from first sheet
curl -s "https://sheets.googleapis.com/v4/spreadsheets/${SHEET_ID}/values/A:Z" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" | jq '.values'
curl -s -G "https://www.googleapis.com/drive/v3/files" \
--data-urlencode "q=mimeType = 'application/vnd.google-apps.document'" \
--data-urlencode "orderBy=modifiedTime desc" \
--data-urlencode "pageSize=10" \
--data-urlencode "fields=files(id,name,modifiedTime)" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
curl -s -G "https://www.googleapis.com/drive/v3/files" \
--data-urlencode "q=fullText contains 'quarterly review'" \
--data-urlencode "fields=files(id,name,mimeType,webViewLink)" \
-H "Authorization: Bearer ${ACCESS_TOKEN}"
Google Docs can be exported to various formats:
| Original | Export MIME Type |
|---|---|
| Document | text/plain, text/html, application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| Spreadsheet | text/csv, application/pdf, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
| Presentation | application/pdf, text/plain |
Google Drive URLs:
https://docs.google.com/document/d/{FILE_ID}/edithttps://docs.google.com/spreadsheets/d/{FILE_ID}/edithttps://drive.google.com/file/d/{FILE_ID}/viewThe FILE_ID is the long alphanumeric string between /d/ and the next /.
To access historical revisions of a Google Doc:
Get revision list:
curl -s "https://www.googleapis.com/drive/v3/files/${DOC_ID}/revisions?fields=revisions(id,modifiedTime,exportLinks,lastModifyingUser(displayName))" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "x-goog-user-project: ${GOOGLE_QUOTA_PROJECT}"
Export a specific revision (use exportLinks, NOT the export endpoint):
# IMPORTANT: The Drive export endpoint ignores the revision parameter for Google Docs!
# You MUST use the exportLinks from the revision metadata instead.
# Get the exportLink for a specific revision
EXPORT_URL=$(curl -s "https://www.googleapis.com/drive/v3/files/${DOC_ID}/revisions/${REV_ID}?fields=exportLinks" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" | jq -r '.exportLinks["text/plain"]')
# Download using that link
curl -sL "$EXPORT_URL" -H "Authorization: Bearer ${ACCESS_TOKEN}"
IMPORTANT CAVEATS:
revision parameter on /export is IGNORED for Google Docs - it always returns current contentexportLinks URLs from the revisions API to get historical contentfields parameter reduces response size (use for faster queries)