Token导航 LogoToken导航TokenDH.com
运维和基础设施external-servicegithub未标认证来源可访问许可证需确认审计通过

google-pubsubGoogle pubsub 命令行

Agent Skill

google-pubsub 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

630

周安装

26

GitHub Stars

12

下载量

206
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:google-pubsub(Google pubsub 命令行)
来源仓库:https://github.com/claude-dev-suite/claude-dev-suite
仓库路径:skills/google-pubsub
安装命令:
npx skills add https://github.com/claude-dev-suite/claude-dev-suite --skill google-pubsub
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/claude-dev-suite/claude-dev-suite --skill google-pubsub

简介

用于处理 Google Pub/Sub 消息队列协作信息,适合跟踪发布与订阅事件。

  • 适用于调试消息流、分析延迟或排查消费异常,需配置项目 ID 与凭证。
  • 使用时需确认消息格式与重试策略,避免重复处理或丢失数据;建议日志追踪。
  • 安装方式:github,命令:npx skills add https://github.com/claude-dev-suite/claude-dev-suite --skill google-pubsub。
  • 注意权限范围与维护状态,可能触发云服务调用与网络请求,建议先验证配额限制。

SKILL.md

Google Cloud Pub/Sub Core Knowledge

Full Reference: See advanced.md for Java/Python/Go producer patterns, Spring Cloud GCP consumer, push subscription handlers, and Terraform for DLT, IAM, VPC Service Controls, and monitoring alerts.
Deep Knowledge: Use mcp__documentation__fetch_docs with technology: google-pubsub for comprehensive documentation.

Quick Start (Emulator)

# docker-compose.yml
services:
  pubsub:
    image: gcr.io/google.com/cloudsdktool/google-cloud-cli:emulators
    command: gcloud beta emulators pubsub start --host-port=0.0.0.0:8085
    ports:
      - "8085:8085"
docker-compose up -d

# Set emulator env
export PUBSUB_EMULATOR_HOST=localhost:8085

# Create topic and subscription
gcloud pubsub topics create orders
gcloud pubsub subscriptions create order-processor --topic=orders

# Test
gcloud pubsub topics publish orders --message='{"id":"123"}'
gcloud pubsub subscriptions pull order-processor --auto-ack

Core Concepts

ConceptDescription
TopicNamed resource for publishing messages
SubscriptionNamed resource for receiving messages
PublisherSends messages to topic
SubscriberReceives messages from subscription
Ack DeadlineTime to acknowledge before redelivery
Message RetentionHow long unacked messages are kept

Delivery Types

TypeDescriptionUse Case
PullSubscriber requests messagesBatch processing, variable load
PushPub/Sub sends to endpointServerless, webhooks
BigQueryDirect export to BigQueryAnalytics pipelines
Cloud StorageDirect export to GCSData archival

Architecture

Publisher ──▶ Topic ──▶ Subscription 1 (Pull) ──▶ Subscriber
                   ──▶ Subscription 2 (Push) ──▶ Cloud Run
                   ──▶ Subscription 3 ──▶ BigQuery

Node.js Producer (@google-cloud/pubsub)

import { PubSub } from '@google-cloud/pubsub';

const pubsub = new PubSub({
  projectId: 'my-project',
});

const topic = pubsub.topic('orders');

// Publish single message
const messageId = await topic.publishMessage({
  data: Buffer.from(JSON.stringify(order)),
  attributes: {
    'correlation-id': correlationId,
    'order-type': order.type,
  },
  orderingKey: order.customerId, // For ordered delivery
});

// Batch publishing (automatic batching)
const publishOptions = {
  batching: {
    maxMessages: 100,
    maxMilliseconds: 10,
  },
};
const batchTopic = pubsub.topic('orders', publishOptions);

Node.js Consumer (Pull Subscription)

const subscription = pubsub.subscription('order-processor', {
  flowControl: {
    maxMessages: 100,
    maxExtensionMinutes: 10,
  },
  ackDeadline: 30,
});

const messageHandler = async (message) => {
  try {
    const order = JSON.parse(message.data.toString());
    const correlationId = message.attributes['correlation-id'];

    await processOrder(order);
    message.ack();
  } catch (error) {
    console.error('Processing failed:', error);
    message.nack(); // Will be redelivered
  }
};

subscription.on('message', messageHandler);
subscription.on('error', (error) => console.error('Subscription error:', error));

// Graceful shutdown
process.on('SIGTERM', async () => {
  await subscription.close();
});

Dead Letter Topics

# Create DLT
gcloud pubsub topics create orders-dlq
gcloud pubsub subscriptions create orders-dlq-sub --topic=orders-dlq

# Create subscription with DLT
gcloud pubsub subscriptions create order-processor \
  --topic=orders \
  --dead-letter-topic=orders-dlq \
  --max-delivery-attempts=5

When NOT to Use This Skill

Use alternative messaging solutions when:

  • AWS-native architecture - SQS has better AWS integration
  • Azure-native architecture - Use Azure Service Bus
  • Event streaming with replay - Use Dataflow or Kafka
  • On-premise deployment - Use RabbitMQ or ActiveMQ
  • Multi-cloud portability - Use Kafka or RabbitMQ
  • Complex routing patterns - RabbitMQ provides more flexibility
  • JMS compliance required - Use ActiveMQ

Anti-Patterns

Anti-PatternWhy It's BadSolution
No dead letter topicFailed messages lostConfigure DLT for all subscriptions
Short ack deadlineDuplicate processingSet deadline > max processing time
No retry policyImmediate redelivery on failureConfigure exponential backoff
Synchronous publishPoor throughputUse batching and async publish
Pull without flow controlConsumer overwhelmedSet max_messages limit
No message ordering when neededOut of order processingUse ordering keys
Large message payloadsHigher costs, poor performanceUse Cloud Storage with reference
No IAM least privilegeSecurity riskUse service accounts with minimal roles

Quick Troubleshooting

IssueLikely CauseFix
Messages not receivedNo subscription or wrong topicCreate subscription, verify topic
Duplicate messagesAck deadline expiredIncrease ack deadline or process faster
Messages in DLTMax delivery attempts exceededCheck processing logic, review DLT
Permission deniedMissing IAM rolesGrant Publisher/Subscriber roles
Ordering not workingNo ordering key or wrong subscriptionSet ordering key, enable message ordering
High latencyBatching delay or networkReduce batch delay, check network
Push subscription failingEndpoint down or auth failureCheck endpoint health, verify auth
Backlog growingSlow consumersAdd consumers or optimize processing

Production Readiness

Monitoring Metrics

MetricAlert Threshold
num_undelivered_messages> 10000
oldest_unacked_message_age> 3600s
num_outstanding_messages> 10000
dead_letter_message_count> 0
publish_latenciesp99 > 1s

Checklist

  • IAM roles with least privilege
  • Service account per component
  • Dead letter topic configured
  • Retry policy configured
  • Ack deadline appropriate
  • Message retention set
  • Monitoring alerts configured
  • Schema validation (if needed)
  • Message ordering (if needed)
  • VPC Service Controls (if needed)

Reference Documentation

Deep Knowledge: Use mcp__documentation__fetch_docs with technology: google-pubsub for comprehensive documentation.

Available topics: basics, producers, consumers, production

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

39.6%
按下载量换算82

Claude

29.9%
按下载量换算62

Cursor

18.34%
按下载量换算38

Gemini CLI

9.61%
按下载量换算20

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills