Skill站外收录 @skilllib/skill-2117939930272417195
gmail-skill
提供对 Gmail 账户的全流程管理能力,包括多账户支持下的邮件收发、按条件检索、消息详情读取、标签增删及草稿创建与发送,所有操作通过轻量级 CLI 脚本实现,输出结构化 JSON 便于解析和组合使用。
效率工具 AI 技能
Skills.MD
# Gmail Manager Skill
This skill provides comprehensive Gmail integration through lightweight CLI scripts. All operations are token-efficient and composable.
## First-Time Setup
Before using this skill, you must set up OAuth authentication:
1. **Install dependencies:**
```bash
cd ~/.claude/skills/gmail-skill && npm install
```
2. **Set up Google Cloud credentials:**
- Follow the guide in `docs/google-cloud-setup.md`
- Download `credentials.json` and save to `scripts/auth/credentials.json`
3. **Authenticate:**
```bash
cd ~/.claude/skills/gmail-skill && npm run setup
```
This will open a browser for Google OAuth and save your token locally.
## Multi-Account Support
The Gmail skill supports multiple accounts (e.g., personal and work email):
### Add Additional Accounts
```bash
# Add a second account (from skill directory)
npm run setup -- --account work
# Add a third account
npm run setup -- --account personal
```
Each account needs separate OAuth authentication.
### Manage Accounts
```bash
# List all configured accounts
node scripts/manage-accounts.js --list
# Set default account (used when --account is not specified)
node scripts/manage-accounts.js --set-default work
# Remove an account
node scripts/manage-accounts.js --remove old-account
```
### Using Specific Accounts
All Gmail operations support the `--account` parameter:
```bash
# Send email from work account
node gmail-send.js --account work --to "user@example.com" --subject "..." --body "..."
# Send from personal (or omit --account to use default)
node gmail-send.js --account personal --to "friend@example.com" --subject "..." --body "..."
# Search work emails
node gmail-search.js --account work --query "is:unread"
```
If `--account` is not specified, the default account is used.
## Usage Guidelines
### 1. Read Documentation On-Demand
When first using Gmail operations, read the comprehensive README:
```bash
cat ~/.claude/skills/gmail-skill/README.md
```
This provides detailed usage examples for all operations.
### 2. Execute Scripts via Bash
All scripts are in the `scripts/` directory and output JSON for easy parsing:
```bash
cd ~/.claude/skills/gmail-skill/scripts
```
### 3. Parse JSON Output
All scripts return JSON. Parse the output and present relevant information to the user in a friendly format.
### 4. Chain Operations
Save intermediate results to files when chaining operations:
```bash
# Search for emails
node gmail-search.js --query "from:user@example.com" > /tmp/search-results.json
# Read first message from results
MESSAGE_ID=$(cat /tmp/search-results.json | jq -r '.messages[0].id')
node gmail-read.js --id "$MESSAGE_ID"
```
## Available Operations
### Send Email
```bash
node gmail-send.js --to "user@example.com" --subject "Subject" --body "Body text"
```
### Search Emails
```bash
node gmail-search.js --query "is:unread" --limit 10
```
### Read Message
```bash
node gmail-read.js --id "MESSAGE_ID"
```
### Manage Labels
```bash
# List all labels
node gmail-labels.js --action list
# Add label to message
node gmail-labels.js --action add --id "MESSAGE_ID" --label "Important"
```
### Manage Drafts
```bash
# Create draft
node gmail-drafts.js --action create --to "user@example.com" --subject "Subject" --body "Draft body"
# Send draft
node gmail-drafts.js --action send --id "DRAFT_ID"
```
## Error Handling
If scripts fail:
- Check that `token.json` exists in `scripts/auth/`
- If token is expired, run `npm run setup` again
- Verify the user granted all required Gmail API permissions
## Best Practices
1. **Always change to the scripts directory first** to ensure relative paths work
2. **Parse JSON output** and present user-friendly summaries
3. **Validate user input** before passing to scripts
4. **Handle errors gracefully** and provide helpful error messages
5. **Use search operators** for precise email filtering (see README.md)
## Token Efficiency
This skill is designed for minimal token usage:
- Documentation loaded only when needed
- Scripts are small and focused
- JSON output is compact and parseable
- No persistent server overhead
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「gmail-skill」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次