Skip to main content
skill CX Codex

gcp-development — Claude Code skill: GCP development rules

A rule set for building on Google Cloud: Cloud Functions, Cloud Run, Firestore, BigQuery and Terraform. Useful when your agent writes GCP code or infrastructure.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill gcp-development -a claude-code
Open on GitHub

What gcp-development does

The skill gives your agent a frame for Google Cloud work. It covers Cloud Functions (2nd generation, memory and timeout limits, error handling), Cloud Run (minimal base images, health checks, graceful SIGTERM shutdown), Firestore (collections shaped around query patterns, transactions, composite indexes), BigQuery (partitioning, clustering, parameterized queries) and Cloud Storage.

A separate section handles Terraform: the infrastructure/ layout with main.tf, variables.tf, outputs.tf, versions.tf and modules, the hashicorp/google provider pinned at ~> 5.0, and state stored in GCS. Code samples are TypeScript for Cloud Functions, Firestore and Secret Manager, plus a distroless Dockerfile and a cloudbuild.yaml pipeline.

Security guidance is IAM with minimal permissions, Workload Identity and VPC Service Controls. One thing to know: the skill hands you recommendations, not working infrastructure — you still create the Terraform state bucket, service accounts and buckets yourself. Several samples assume Node.js 20 and the Google client libraries.

What it helps with

  • write a Cloud Function with request validation and error handling
  • build a distroless Dockerfile for Cloud Run
  • design Firestore collections around actual query patterns
  • split Terraform into modules with state in GCS
  • set up Cloud Build to build and push an image

Example prompts for the agent

  • Write a TypeScript Cloud Function that validates the method and logs errors
  • Split my project infrastructure into Terraform modules with a GCS backend
  • Check my BigQuery query for partitioning and parameterization

How to install gcp-development

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill gcp-development -a claude-code

2Manually: put the files in place

~/.claude/skills/gcp-development/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/gcp-development/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about gcp-development

How do I install gcp-development in Claude?

Run npx skills add Mindrally/skills --skill gcp-development -a claude-code. The skill file lands at ~/.claude/skills/gcp-development/SKILL.md.

What does gcp-development do?

It spells out Google Cloud development practices: Cloud Functions and Cloud Run configuration, Firestore, BigQuery and Cloud Storage usage, Terraform infrastructure and IAM setup.

Which platforms can use this skill?

Besides Claude, there are install paths for Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode, each with its own flag or installer.

Source text

SKILL.md · Apache-2.0
---
name: gcp-development
description: Google Cloud Platform (GCP) development best practices for Cloud Functions, Cloud Run, Firestore, BigQuery, and Infrastructure as Code.
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# GCP Development Best Practices

## Overview

This skill provides comprehensive guidelines for developing applications on Google Cloud Platform (GCP), covering serverless computing, data services, Infrastructure as Code with Terraform, and security best practices.

## Core Principles

- Write clean, well-structured code using GCP client libraries
- Use Infrastructure as Code (Terraform) for all infrastructure management
- Follow Google Cloud security best practices and compliance guidelines
- Implement comprehensive logging with Cloud Logging and monitoring with Cloud Monitoring

## Code Organization and Structure

### Terraform Module Structure
```
infrastructure/
├── main.tf           # Primary resources
├── variables.tf      # Input variables
├── outputs.tf        # Output values
├── versions.tf       # Provider versions
├── terraform.tfvars  # Variable values
└── modules/
    ├── compute/
    ├── storage/
    └── networking/
```

### Application Structure
```
src/
├── functions/        # Cloud Functions
├── services/         # Cloud Run services
├── shared/           # Shared utilities
└── tests/            # Test files
```

## Cloud Functions Guidelines

### Function Configuration
```typescript
import { HttpFunction } from '@google-cloud/functions-framework';

export const helloWorld: HttpFunction = async (req, res) => {
  try {
    // Validate request
    if (req.method !== 'POST') {
      res.status(405).send('Method Not Allowed');
      return;
    }

    // Business logic
    const result = await processRequest(req.body);

    res.status(200).json(result);
  } catch (error) {
    console.error('Function error:', error);
    res.status(500).json({ error: 'Internal Server Error' });
  }
};
```

### Best Practices
- Use 2nd generation Cloud Functions for better performance
- Set appropriate memory and timeout limits
- Use environment variables for configuration
- Implement proper error handling and logging
- Use connection pooling for database connections

## Cloud Run Guidelines

### Container Best Practices
- Use distroless or minimal base images
- Implement health check endpoints
- Handle SIGTERM for graceful shutdown
- Use Cloud Run services for HTTP workloads
- Use Cloud Run jobs for batch processing

### Dockerfile Example
```dockerfile
FROM node:20-slim AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production

FROM gcr.io/distroless/nodejs20-debian12
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY . .
CMD ["dist/index.js"]
```

### Service Configuration
```yaml
# service.yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: my-service
spec:
  template:
    spec:
      containers:
        - image: gcr.io/PROJECT_ID/my-service
          resources:
            limits:
              memory: 512Mi
              cpu: '1'
          env:
            - name: NODE_ENV
              value: production
```

## Firestore Guidelines

### Data Modeling
- Design collections around query patterns
- Use subcollections for hierarchical data
- Implement composite indexes for complex queries
- Use batch writes for multiple document updates

### Best Practices
```typescript
import { Firestore } from '@google-cloud/firestore';

const db = new Firestore();

// Use transactions for atomic operations
await db.runTransaction(async (transaction) => {
  const docRef = db.collection('users').doc(userId);
  const doc = await transaction.get(docRef);

  if (!doc.exists) {
    throw new Error('User not found');
  }

  transaction.update(docRef, {
    lastLogin: Firestore.FieldValue.serverTimestamp()
  });
});
```

## BigQuery Guidelines

### Query Best Practices
- Use partitioned and clustered tables
- Avoid SELECT * in production queries
- Use parameterized queries to prevent SQL injection
- Implement query caching where appropriate

### Cost Optimization
- Set up budget alerts
- Use slot reservations for predictable workloads
- Archive old data to Cloud Storage
- Use materialized views for repeated queries

## Cloud Storage Guidelines

### Bucket Configuration
- Use uniform bucket-level access
- Enable versioning for important data
- Set lifecycle rules for automatic cleanup
- Use signed URLs for temporary access

### Best Practices
```typescript
import { Storage } from '@google-cloud/storage';

const storage = new Storage();
const bucket = storage.bucket('my-bucket');

// Generate signed URL for upload
const [url] = await bucket.file('uploads/file.pdf').getSignedUrl({
  version: 'v4',
  action: 'write',
  expires: Date.now() + 15 * 60 * 1000, // 15 minutes
  contentType: 'application/pdf',
});
```

## Terraform Best Practices

### Provider Configuration
```hcl
terraform {
  required_version = ">= 1.0"

  required_providers {
    google = {
      source  = "hashicorp/google"
      version = "~> 5.0"
    }
  }

  backend "gcs" {
    bucket = "my-terraform-state"
    prefix = "terraform/state"
  }
}

provider "google" {
  project = var.project_id
  region  = var.region
}
```

### Module Best Practices
- Use versioned modules from Terraform Registry
- Lock provider versions for consistency
- Use workspaces for environment separation
- Store state in Cloud Storage with encryption

## Security Best Practices

### IAM Configuration
- Use service accounts with minimal permissions
- Implement Workload Identity for GKE
- Use IAM Conditions for fine-grained access
- Regular audit with Policy Analyzer

### Secret Management
```typescript
import { SecretManagerServiceClient } from '@google-cloud/secret-manager';

const client = new SecretManagerServiceClient();

async function getSecret(secretName: string): Promise<string> {
  const [version] = await client.accessSecretVersion({
    name: `projects/PROJECT_ID/secrets/${secretName}/versions/latest`,
  });

  return version.payload?.data?.toString() || '';
}
```

### Network Security
- Use VPC Service Controls for sensitive data
- Implement Cloud Armor for DDoS protection
- Use Private Google Access for internal services
- Configure firewall rules with least privilege

## Deployment Best Practices

### Blue/Green Deployments
- Use traffic splitting in Cloud Run
- Implement health checks before traffic shift
- Have rollback strategy ready
- Use Cloud Deploy for managed deployments

### CI/CD with Cloud Build
```yaml
# cloudbuild.yaml
steps:
  - name: 'node:20'
    entrypoint: npm
    args: ['ci']

  - name: 'node:20'
    entrypoint: npm
    args: ['test']

  - name: 'gcr.io/cloud-builders/docker'
    args: ['build', '-t', 'gcr.io/$PROJECT_ID/my-service', '.']

  - name: 'gcr.io/cloud-builders/docker'
    args: ['push', 'gcr.io/$PROJECT_ID/my-service']

  - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
    entrypoint: gcloud
    args:
      - 'run'
      - 'deploy'
      - 'my-service'
      - '--image=gcr.io/$PROJECT_ID/my-service'
      - '--region=us-central1'
```

## Observability

### Cloud Logging
- Use structured logging in JSON format
- Include trace IDs for distributed tracing
- Set up log-based metrics for monitoring
- Configure log sinks for long-term storage

### Cloud Monitoring
- Create SLIs and SLOs for services
- Set up alerting policies for critical metrics
- Use custom metrics for business KPIs
- Implement uptime checks for endpoints

### Cloud Trace
```typescript
import { TraceExporter } from '@google-cloud/opentelemetry-cloud-trace-exporter';
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';

const provider = new NodeTracerProvider();
provider.addSpanProcessor(
  new BatchSpanProcessor(new TraceExporter())
);
provider.register();
```

## Debugging Strategies

- Use Cloud Debugger for production debugging
- Implement error reporting with Error Reporting
- Use Cloud Profiler for performance analysis
- Test locally with emulators before deployment

## Recommended Tools

- **gcloud CLI**: Command-line interaction with GCP
- **Terraform**: Infrastructure as Code
- **Cloud Code VS Code Extension**: IDE integration
- **Docker**: Local containerization
- **Emulator Suite**: Local testing for Firestore, Pub/Sub, etc.

## Common Pitfalls to Avoid

1. Not using service accounts for workloads
2. Hardcoding project IDs or credentials
3. Ignoring cold start optimization for Cloud Functions
4. Not setting up proper IAM bindings
5. Missing Cloud Monitoring alerts
6. Over-provisioning resources
7. Not using VPC for sensitive workloads
8. Ignoring cost optimization best practices

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

Everything for Cloud: AWS, Azure, GCP →

From the same set168

deep-learning Gives your agent a rulebook for neural network work: layer design, optimizers, mixed precision, memory. Useful when you write or refactor model code. CX Codex +1 946installs react This skill gives your agent a fixed React style: hooks, Server Components, Tailwind, TypeScript. Useful when several people or agents touch the same codebase. CX Codex +1 944installs sequelize A skill that gives your agent rules for writing Sequelize code: models, associations, migrations and queries. Useful for Node.js projects on a relational database. CX Codex +1 942installs nestjs-clean-typescript Guides Claude Code to write clean NestJS APIs using TypeScript, MikroORM, class-validator, and Jest testing conventions. CX Codex +1 940installs django-python A skill that steers your agent through Django work: MVT structure, ORM over raw SQL, class-based views and view-level error handling. CX Codex +1 933installs security-best-practices A skill providing security principles for backend and microservice development. It helps agents enforce strict input validation, protect APIs, and prevent sensitive data leaks. CX Codex +1 930installs flutter Enforces Flutter and Dart standards: feature-first clean architecture, state management with Riverpod or BLoC, and strict limits on widget tree depth. CX Codex +1 925installs laravel-development A skill that keeps your agent inside Laravel conventions: SOLID, PSR-12, Eloquent over raw SQL. Useful whenever the AI writes PHP in a Laravel app. CX Codex +1 909installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor