gcp-development
Skill266 starsChanged 10 months agoApache-2.0View on GitHub
Google Cloud Platform (GCP) development best practices for Cloud Functions, Cloud Run, Firestore, BigQuery, and Infrastructure as Code.
In this repository264 other files it gives its agents.
- accessibility-a11ySkill
- alpine-jsSkill
- analytics-data-analysisSkill
- android-developmentSkill
- angular-developmentSkill
- angularSkill
- anime-jsSkill
- anthropic-claude-developmentSkill
- api-developmentSkill
- apollo-graphqlSkill
- aspnet-coreSkill
- astroSkill
- auth0-authenticationSkill
- autogen-developmentSkill
- automl-hyperparameter-optimizationSkill
- aws-developmentSkill
- azureSkill
- backend-developmentSkill
- bash-scriptingSkill
- beautifulsoup-parsingSkill
- bitbucket-workflowSkill
- blazorSkill
- blender-python-addonSkill
- blockchainSkill
- bootstrapSkill
- business-central-developmentSkill
- cheerio-parsingSkill
- chrome-extension-developmentSkill
- ci-cd-best-practicesSkill
- clean-architectureSkill
- clean-codeSkill
- clerk-authenticationSkill
- cloudflare-developmentSkill
- computer-vision-opencvSkill
- convexSkill
- cppSkill
- c-sharpSkill
- cssSkill
- cypressSkill
- data-analysis-jupyterSkill
- data-analystSkill
- data-jupyter-pythonSkill
- deep-learning-pythonSkill
- deep-learning-pytorchSkill
- deep-learningSkill
- deno-typescriptSkill
- design-systemsSkill
- devopsSkill
- django-pythonSkill
- django-rest-api-developmentSkill
- dockerSkill
- dotnetSkill
- drizzle-ormSkill
- drupal-developmentSkill
- elasticsearch-best-practicesSkill
- electron-developmentSkill
- elixirSkill
- embedded-stm32Skill
- esbuild-bundlerSkill
- ethereumSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
35 rules. About 0 are common, 35 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈35
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Write clean, well-structured code using GCP client libraries
- Distinctive: line 15
Use Infrastructure as Code (Terraform) for all infrastructure management
- Distinctive: line 16
Follow Google Cloud security best practices and compliance guidelines
- Distinctive: line 70
Use 2nd generation Cloud Functions for better performance
- Distinctive: line 72
Use environment variables for configuration
- Distinctive: line 74
Use connection pooling for database connections
- Distinctive: line 79
Use distroless or minimal base images
- Distinctive: line 82
Use Cloud Run services for HTTP workloads
- Distinctive: line 83
Use Cloud Run jobs for batch processing
- Distinctive: line 124
Use subcollections for hierarchical data
- Distinctive: line 126
Use batch writes for multiple document updates
- Distinctive: line 152
Use partitioned and clustered tables
- Distinctive: line 153
Avoid SELECT * in production queries
- Distinctive: line 154
Use parameterized queries to prevent SQL injection
- Distinctive: line 159
Use slot reservations for predictable workloads
- Distinctive: line 161
Use materialized views for repeated queries
- Distinctive: line 166
Use uniform bucket-level access
- Distinctive: line 169
Use signed URLs for temporary access
- Distinctive: line 214
Use versioned modules from Terraform Registry
- Distinctive: line 216
Use workspaces for environment separation
- Distinctive: line 222
Use service accounts with minimal permissions
- Distinctive: line 224
Use IAM Conditions for fine-grained access
- Distinctive: line 243
Use VPC Service Controls for sensitive data
- Distinctive: line 245
Use Private Google Access for internal services
- Distinctive: line 251
Use traffic splitting in Cloud Run
- Distinctive: line 254
Use Cloud Deploy for managed deployments
- Distinctive: line 287
Use structured logging in JSON format
- Distinctive: line 293
Create SLIs and SLOs for services
- Distinctive: line 295
Use custom metrics for business KPIs
- Distinctive: line 312
Use Cloud Debugger for production debugging
- Distinctive: line 314
Use Cloud Profiler for performance analysis
- Distinctive: line 315
Test locally with emulators before deployment
- Distinctive: line 327
Not using service accounts for workloads
- Distinctive: line 330
Not setting up proper IAM bindings
- Distinctive: line 333
Not using VPC for sensitive workloads
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 filesCloud Functions Guidelines
Function Configuration
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
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
# 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: productionFirestore 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
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
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
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
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
# 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
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
- Not using service accounts for workloads
- Hardcoding project IDs or credentials
- Ignoring cold start optimization for Cloud Functions
- Not setting up proper IAM bindings
- Missing Cloud Monitoring alerts
- Over-provisioning resources
- Not using VPC for sensitive workloads
- Ignoring cost optimization best practices
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

