Skills for Claude Code CLI such as full stack dev Cloudflare, React, Tailwind v4, and AI integrations.
Python aianthropicautomationclaude-codeclaude-skillscloudflaredevtoolsproductivityreactskillstailwindvite
feat(skills): Add google-app-engine skill for GCP deployment (#16)
Jeremy Dawesaaf658b6023b
diff --git a/skills/google-app-engine/README.md b/skills/google-app-engine/README.mdnew file mode 100644index 00000000..86b402ff--- /dev/null+++ b/skills/google-app-engine/README.md@@ -0,0 +1,65 @@+# Google App Engine Skill++Deploy Python applications to Google App Engine Standard and Flexible environments.++## Auto-Trigger Keywords++This skill activates when discussing:++### Platform & Services+- Google App Engine, GAE, App Engine Standard, App Engine Flexible+- app.yaml, dispatch.yaml, cron.yaml, queue.yaml+- gcloud app deploy, gcloud app logs+- appspot.com, App Engine service++### Configuration+- instance_class, F1, F2, F4, F4_1G+- automatic_scaling, basic_scaling, manual_scaling+- min_instances, max_instances+- beta_settings, cloud_sql_instances+- handlers, static_dir, script: auto++### Cloud SQL Integration+- Cloud SQL socket, /cloudsql/, Unix socket connection+- Cloud SQL Proxy, cloud-sql-proxy+- GAE_APPLICATION environment variable++### Static Files & Storage+- Cloud Storage static files, GS_BUCKET_NAME+- django-storages google, GoogleCloudStorage+- collectstatic App Engine++### Environment & Secrets+- Secret Manager App Engine, get_secret+- env_variables app.yaml+- GOOGLE_CLOUD_PROJECT++### Common Errors+- 502 Bad Gateway App Engine+- cold start timeout+- Exceeded soft memory limit+- DeadlineExceededError+- Connection refused Cloud SQL+- request timeout 60 seconds++### Deployment+- gcloud app deploy+- --no-promote, --version+- traffic splitting, versions migrate+- warmup requests, /_ah/warmup+- health check, /_ah/health++## Composable With++- **django**: Framework patterns, ORM, admin+- **flask**: Lightweight Python framework+- **fastapi**: Modern async API framework++## Use Cases++1. Deploy Django/Flask/FastAPI to App Engine+2. Configure Cloud SQL connections+3. Set up static file serving with Cloud Storage+4. Configure scaling for traffic patterns+5. Manage secrets securely+6. Set up multi-service architecturediff --git a/skills/google-app-engine/SKILL.md b/skills/google-app-engine/SKILL.mdnew file mode 100644index 00000000..7623cef9--- /dev/null+++ b/skills/google-app-engine/SKILL.md@@ -0,0 +1,637 @@+---+name: google-app-engine+description: |+ Deploy Python applications to Google App Engine Standard/Flexible. Covers app.yaml configuration, Cloud SQL socket connections, Cloud Storage for static files, scaling settings, and environment variables.++ Use when: deploying to App Engine, configuring app.yaml, connecting Cloud SQL, setting up static file serving, or troubleshooting 502 errors, cold starts, or memory limits.+---++# Google App Engine++**Status**: Production Ready+**Last Updated**: 2026-01-24+**Dependencies**: Google Cloud SDK (gcloud CLI)+**Skill Version**: 1.0.0++---++## Quick Start (10 Minutes)++### 1. Prerequisites++```bash+# Install Google Cloud SDK+# macOS+brew install google-cloud-sdk++# Or download from https://cloud.google.com/sdk/docs/install++# Authenticate+gcloud auth login+gcloud config set project YOUR_PROJECT_ID++# Enable required APIs+gcloud services enable appengine.googleapis.com+gcloud services enable sqladmin.googleapis.com+gcloud services enable secretmanager.googleapis.com+```++### 2. Create app.yaml++```yaml+# app.yaml - Standard Environment (Python 3.12)+runtime: python312+instance_class: F2++env_variables:+ DJANGO_SETTINGS_MODULE: "myproject.settings.production"++handlers:+ # Static files (served directly by App Engine)+ - url: /static+ static_dir: staticfiles/+ secure: always++ # All other requests go to the app+ - url: /.*+ script: auto+ secure: always++automatic_scaling:+ min_instances: 0+ max_instances: 10+ target_cpu_utilization: 0.65+```++### 3. Deploy++```bash+# Deploy to App Engine+gcloud app deploy++# Deploy with specific version+gcloud app deploy --version=v1 --no-promote++# View logs+gcloud app logs tail -s default+```++---++## Standard vs Flexible Environment++### Standard Environment (Recommended for Most Apps)++**Use when**: Building typical web apps, APIs, or services that fit within runtime constraints.++| Aspect | Standard |+|--------|----------|+| **Startup** | Fast (milliseconds) |+| **Scaling** | Scale to zero |+| **Pricing** | Pay per request |+| **Runtimes** | Python 3.8-3.12 |+| **Instance Classes** | F1, F2, F4, F4_1G |+| **Max Request** | 60 seconds |+| **Background** | Cloud Tasks only |++```yaml+# app.yaml - Standard+runtime: python312+instance_class: F2+```++### Flexible Environment++**Use when**: Need custom runtimes, Docker, longer request timeouts, or background threads.++| Aspect | Flexible |+|--------|----------|+| **Startup** | Slower (minutes) |+| **Scaling** | Min 1 instance |+| **Pricing** | Per-hour VM |+| **Runtimes** | Any (Docker) |+| **Max Request** | 60 minutes |+| **Background** | Native threads |++```yaml+# app.yaml - Flexible+runtime: python+env: flex++runtime_config:+ runtime_version: "3.12"++resources:+ cpu: 1+ memory_gb: 0.5+ disk_size_gb: 10++automatic_scaling:+ min_num_instances: 1+ max_num_instances: 5+```++**Cost Warning**: Flexible always runs at least 1 instance (~$30-40/month minimum).++---++## Cloud SQL Connection++### Standard Environment (Unix Socket)++App Engine Standard connects to Cloud SQL via Unix sockets, not TCP/IP.++```python+# settings.py+import os++if os.getenv('GAE_APPLICATION'):+ # Production: Cloud SQL via Unix socket+ DATABASES = {+ 'default': {+ 'ENGINE': 'django.db.backends.postgresql',+ 'NAME': os.environ['DB_NAME'],+ 'USER': os.environ['DB_USER'],+ 'PASSWORD': os.environ['DB_PASSWORD'],+ 'HOST': f"/cloudsql/{os.environ['CLOUD_SQL_CONNECTION_NAME']}",+ 'PORT': '', # Empty for Unix socket+ }+ }+else:+ # Local development: Cloud SQL Proxy or local DB+ DATABASES = {+ 'default': {+ 'ENGINE': 'django.db.backends.postgresql',+ 'NAME': os.environ.get('DB_NAME', 'localdb'),+ 'USER': os.environ.get('DB_USER', 'postgres'),+ 'PASSWORD': os.environ.get('DB_PASSWORD', ''),+ 'HOST': '127.0.0.1',+ 'PORT': '5432',+ }+ }+```++```yaml+# app.yaml+env_variables:+ DB_NAME: "mydb"+ DB_USER: "myuser"+ CLOUD_SQL_CONNECTION_NAME: "project:region:instance"++# CRITICAL: Beta settings for Cloud SQL socket+beta_settings:+ cloud_sql_instances: "project:region:instance"+```++**CRITICAL**: The `beta_settings.cloud_sql_instances` enables the Unix socket. Without it, connection fails.++### Local Development with Cloud SQL Proxy++```bash+# Download and run Cloud SQL Proxy+cloud-sql-proxy PROJECT:REGION:INSTANCE --port=5432++# Or use Docker+docker run -p 5432:5432 \+ gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.8.0 \+ PROJECT:REGION:INSTANCE+```++---++## Static Files with Cloud Storage++### Option 1: App Engine Static Handlers (Simple)++```yaml+# app.yaml+handlers:+ - url: /static+ static_dir: staticfiles/+ secure: always+ expiration: "1d"+```++```bash+# Collect static files before deploy+python manage.py collectstatic --noinput+gcloud app deploy+```++**Limitation**: Files bundled with deploy, limited to 32MB per file.++### Option 2: Cloud Storage (Recommended for Production)++```python+# settings.py+from google.cloud import storage++GS_BUCKET_NAME = os.environ.get('GS_BUCKET_NAME')+STATICFILES_STORAGE = 'storages.backends.gcloud.GoogleCloudStorage'+DEFAULT_FILE_STORAGE = 'storages.backends.gcloud.GoogleCloudStorage'++# Or with django-storages+STORAGES = {+ "default": {+ "BACKEND": "storages.backends.gcloud.GoogleCloudStorage",+ "OPTIONS": {+ "bucket_name": GS_BUCKET_NAME,+ "location": "media",+ },+ },+ "staticfiles": {+ "BACKEND": "storages.backends.gcloud.GoogleCloudStorage",+ "OPTIONS": {+ "bucket_name": GS_BUCKET_NAME,+ "location": "static",+ },+ },+}+```++```bash+# Install django-storages+pip install django-storages[google]++# Create bucket with public access for static files+gsutil mb -l us-central1 gs://YOUR_BUCKET_NAME+gsutil iam ch allUsers:objectViewer gs://YOUR_BUCKET_NAME+```++---++## Environment Variables and Secrets++### Simple: app.yaml env_variables++```yaml+# app.yaml - NOT for secrets!+env_variables:+ DJANGO_SETTINGS_MODULE: "myproject.settings.production"+ DEBUG: "False"+```++**Warning**: `app.yaml` is committed to source control. Never put secrets here.++### Production: Secret Manager++```python+# settings.py+from google.cloud import secretmanager++def get_secret(secret_id, version="latest"):+ """Fetch secret from Google Secret Manager."""+ client = secretmanager.SecretManagerServiceClient()+ project_id = os.environ.get('GOOGLE_CLOUD_PROJECT')+ name = f"projects/{project_id}/secrets/{secret_id}/versions/{version}"+ response = client.access_secret_version(request={"name": name})+ return response.payload.data.decode("UTF-8")++# Usage+if os.getenv('GAE_APPLICATION'):+ SECRET_KEY = get_secret('django-secret-key')+ DB_PASSWORD = get_secret('db-password')+```++```bash+# Create secrets+echo -n "your-secret-key" | gcloud secrets create django-secret-key --data-file=-+echo -n "db-password" | gcloud secrets create db-password --data-file=-++# Grant App Engine access+gcloud secrets add-iam-policy-binding django-secret-key \+ --member="serviceAccount:[email protected]" \+ --role="roles/secretmanager.secretAccessor"+```++---++## Scaling Configuration++### Automatic Scaling (Default)++```yaml+automatic_scaling:+ min_instances: 0 # Scale to zero when idle+ max_instances: 10 # Cap maximum instances+ target_cpu_utilization: 0.65+ target_throughput_utilization: 0.6+ max_concurrent_requests: 80+ min_pending_latency: 30ms+ max_pending_latency: automatic+```++### Basic Scaling (Background Tasks)++```yaml+basic_scaling:+ max_instances: 5+ idle_timeout: 5m+```++**Use for**: Services that need to run background work without scaling to zero immediately.++### Manual Scaling (Fixed Instances)++```yaml+manual_scaling:+ instances: 3+```++**Use for**: Predictable workloads, WebSocket connections, or when you need guaranteed capacity.++---++## Instance Classes++| Class | Memory | CPU | Cost/hour |+|-------|--------|-----|-----------|+| F1 | 256 MB | 600 MHz | $0.05 |+| F2 | 512 MB | 1.2 GHz | $0.10 |+| F4 | 1 GB | 2.4 GHz | $0.20 |+| F4_1G | 2 GB | 2.4 GHz | $0.30 |++```yaml+# Recommended for Django+instance_class: F2 # 512MB usually sufficient+```++**Upgrade to F4** if you see memory errors or slow response times.++---++## Known Issues Prevention++This skill prevents **6 documented issues**:++### Issue #1: Cloud SQL Connection Refused+**Error**: `could not connect to server: Connection refused`+**Why It Happens**: Missing `beta_settings.cloud_sql_instances` in app.yaml+**Prevention**: Always include:+```yaml+beta_settings:+ cloud_sql_instances: "project:region:instance"+```++### Issue #2: Static Files 404+**Error**: Static files return 404 after deploy+**Why It Happens**: `collectstatic` not run, or handler order wrong+**Prevention**:+```bash+python manage.py collectstatic --noinput+```+And ensure static handler comes before catch-all:+```yaml+handlers:+ - url: /static+ static_dir: staticfiles/+ - url: /.*+ script: auto+```++### Issue #3: 502 Bad Gateway+**Error**: 502 errors on first request or under load+**Why It Happens**: Cold start timeout, app takes too long to initialize+**Prevention**:+- Optimize app startup (lazy imports, connection pooling)+- Use `min_instances: 1` to avoid cold starts+- Increase `instance_class` for more CPU/memory++### Issue #4: Memory Limit Exceeded+**Error**: `Exceeded soft memory limit` in logs+**Why It Happens**: F1 class (256MB) too small for Django + dependencies+**Prevention**: Use `instance_class: F2` minimum for Django apps++### Issue #5: Request Timeout+**Error**: `DeadlineExceededError` after 60 seconds+**Why It Happens**: Standard environment has 60s request limit+**Prevention**:+- Move long tasks to Cloud Tasks+- Use Flexible environment for longer timeouts+- Optimize database queries++### Issue #6: Secret Key in Source Control+**Error**: Django `SECRET_KEY` exposed in git history+**Why It Happens**: Putting secrets in `app.yaml` env_variables+**Prevention**: Use Secret Manager (see Environment Variables section)++---++## Deployment Commands++```bash+# Deploy default service+gcloud app deploy++# Deploy specific service+gcloud app deploy app.yaml --service=api++# Deploy without promoting (for testing)+gcloud app deploy --version=v2 --no-promote++# Split traffic between versions+gcloud app services set-traffic default --splits=v1=0.5,v2=0.5++# Promote version+gcloud app versions migrate v2++# View logs+gcloud app logs tail -s default++# Open app in browser+gcloud app browse++# List versions+gcloud app versions list++# Delete old versions+gcloud app versions delete v1 v2 --quiet+```++---++## Multi-Service Architecture++```+myproject/+├── app.yaml # Default service+├── api/+│ └── app.yaml # API service+├── worker/+│ └── app.yaml # Background worker+└── dispatch.yaml # URL routing+```++```yaml+# dispatch.yaml+dispatch:+ - url: "*/api/*"+ service: api+ - url: "*/tasks/*"+ service: worker+```++```bash+# Deploy all services+gcloud app deploy app.yaml api/app.yaml worker/app.yaml dispatch.yaml+```++---++## Common Patterns++### Health Check Endpoint++```python+# urls.py+urlpatterns = [+ path('_ah/health', lambda r: HttpResponse('ok')),+ # ... other urls+]+```++```yaml+# app.yaml+liveness_check:+ path: "/_ah/health"+ check_interval_sec: 30+ timeout_sec: 4+ failure_threshold: 2+ success_threshold: 2++readiness_check:+ path: "/_ah/health"+ check_interval_sec: 5+ timeout_sec: 4+ failure_threshold: 2+ success_threshold: 2+```++### Warmup Requests++```yaml+# app.yaml+inbound_services:+ - warmup+```++```python+# urls.py+urlpatterns = [+ path('_ah/warmup', warmup_view),+]++# views.py+def warmup_view(request):+ """Pre-warm caches and connections."""+ from django.db import connection+ connection.ensure_connection()+ return HttpResponse('ok')+```++### HTTPS Redirect++```yaml+# app.yaml+handlers:+ - url: /.*+ script: auto+ secure: always # Redirects HTTP to HTTPS+```++---++## Local Development++### Using Cloud SQL Proxy++```bash+# Terminal 1: Run Cloud SQL Proxy+cloud-sql-proxy PROJECT:REGION:INSTANCE --port=5432++# Terminal 2: Run Django+export DB_HOST=127.0.0.1+export DB_PORT=5432+python manage.py runserver+```++### Using dev_appserver (Legacy)++```bash+# Not recommended - use Django's runserver instead+dev_appserver.py app.yaml+```++### Environment Detection++```python+# settings.py+import os++# Detect App Engine environment+IS_GAE = os.getenv('GAE_APPLICATION') is not None+IS_GAE_LOCAL = os.getenv('GAE_ENV') == 'localdev'++if IS_GAE:+ DEBUG = False+ ALLOWED_HOSTS = ['.appspot.com', '.your-domain.com']+else:+ DEBUG = True+ ALLOWED_HOSTS = ['localhost', '127.0.0.1']+```++---++## Bundled Resources++### Templates (templates/)++- `app.yaml` - Standard environment configuration+- `app-flex.yaml` - Flexible environment configuration+- `requirements.txt` - Common dependencies for App Engine++### References (references/)++- `instance-classes.md` - Detailed instance class comparison+- `common-errors.md` - Error messages and solutions++---++## Official Documentation++- **App Engine Python**: https://cloud.google.com/appengine/docs/standard/python3+- **app.yaml Reference**: https://cloud.google.com/appengine/docs/standard/reference/app-yaml+- **Cloud SQL**: https://cloud.google.com/sql/docs/postgres/connect-app-engine-standard+- **Secret Manager**: https://cloud.google.com/secret-manager/docs+- **Scaling**: https://cloud.google.com/appengine/docs/standard/how-instances-are-managed++---++## Dependencies++```+# requirements.txt+gunicorn>=21.0.0+google-cloud-secret-manager>=2.16.0+google-cloud-storage>=2.10.0+django-storages[google]>=1.14.0+psycopg2-binary>=2.9.9 # For PostgreSQL+```++---++## Production Checklist++- [ ] `SECRET_KEY` in Secret Manager (not app.yaml)+- [ ] `DEBUG = False` in production settings+- [ ] `ALLOWED_HOSTS` configured for your domain+- [ ] `collectstatic` runs before deploy+- [ ] `beta_settings.cloud_sql_instances` set+- [ ] Instance class appropriate (F2+ for Django)+- [ ] HTTPS enforced (`secure: always`)+- [ ] Health check endpoint configured+- [ ] Error monitoring set up (Cloud Error Reporting)++---++**Last verified**: 2026-01-24 | **Skill version**: 1.0.0diff --git a/skills/google-app-engine/references/common-errors.md b/skills/google-app-engine/references/common-errors.mdnew file mode 100644index 00000000..197776a9--- /dev/null+++ b/skills/google-app-engine/references/common-errors.md@@ -0,0 +1,187 @@+# Google App Engine Common Errors++## Connection Errors++### `could not connect to server: Connection refused`++**Cause**: Missing Cloud SQL socket configuration++**Solution**: Add to app.yaml:+```yaml+beta_settings:+ cloud_sql_instances: "project:region:instance"+```++And use Unix socket in settings.py:+```python+'HOST': f"/cloudsql/{os.environ['CLOUD_SQL_CONNECTION_NAME']}"+```++---++### `OperationalError: FATAL: password authentication failed`++**Cause**: Wrong Cloud SQL credentials++**Solution**:+1. Verify user exists: `gcloud sql users list --instance=INSTANCE`+2. Reset password: `gcloud sql users set-password USER --instance=INSTANCE --password=NEW_PASSWORD`+3. Update Secret Manager or env_variables++---++## Memory Errors++### `Exceeded soft memory limit of X MB`++**Cause**: Instance class too small++**Solution**: Upgrade instance class in app.yaml:+```yaml+instance_class: F2 # 512MB (usually sufficient)+instance_class: F4 # 1GB (for heavy apps)+instance_class: F4_1G # 2GB (maximum)+```++**Tips**:+- Profile memory with `tracemalloc`+- Use streaming for large responses+- Lazy load heavy modules++---++### `Process terminated because the request deadline was exceeded`++**Cause**: Request took longer than 60 seconds (Standard) or 60 minutes (Flexible)++**Solution**:+- Move long tasks to Cloud Tasks+- Optimize slow database queries+- Use Flexible environment for longer timeouts+- Add indexes to database++---++## Deployment Errors++### `ERROR: (gcloud.app.deploy) PERMISSION_DENIED`++**Cause**: Service account lacks permissions++**Solution**:+```bash+# Grant App Engine deployer role+gcloud projects add-iam-policy-binding PROJECT_ID \+ --member="user:YOUR_EMAIL" \+ --role="roles/appengine.appAdmin"++# For CI/CD service accounts+gcloud projects add-iam-policy-binding PROJECT_ID \+ --member="serviceAccount:SA_EMAIL" \+ --role="roles/appengine.deployer"+```++---++### `Unable to fetch P4SA`++**Cause**: App Engine not initialized in project++**Solution**:+```bash+gcloud app create --region=us-central1+```++---++## Static File Errors++### Static files return 404++**Cause**: Files not collected or wrong handler path++**Solution**:+1. Run collectstatic:+```bash+python manage.py collectstatic --noinput+```++2. Verify handler order (static before catch-all):+```yaml+handlers:+ - url: /static+ static_dir: staticfiles/+ - url: /.*+ script: auto+```++3. Check STATIC_ROOT matches static_dir:+```python+STATIC_ROOT = 'staticfiles' # Matches static_dir: staticfiles/+```++---++### `The file size exceeds the maximum allowed size of 32MB`++**Cause**: Static file too large for App Engine bundling++**Solution**: Use Cloud Storage instead:+```python+STATICFILES_STORAGE = 'storages.backends.gcloud.GoogleCloudStorage'+```++---++## 502 Bad Gateway++### Intermittent 502 errors++**Causes**:+1. Cold start timeout+2. App crashes during request+3. Health check failing++**Solutions**:++1. **Reduce cold start time**:+ - Enable warmup requests+ - Use min_instances: 1 (costs more)+ - Optimize imports (lazy loading)++2. **Check logs**:+```bash+gcloud app logs tail -s default+```++3. **Fix health checks**:+```python+# urls.py+path('/_ah/health', lambda r: HttpResponse('ok'))+```++---++## Secret Manager Errors++### `PermissionDenied: Permission denied on resource`++**Cause**: Service account lacks Secret Manager access++**Solution**:+```bash+gcloud secrets add-iam-policy-binding SECRET_NAME \+ --member="serviceAccount:[email protected]" \+ --role="roles/secretmanager.secretAccessor"+```++---++### `NotFound: Secret not found`++**Cause**: Secret doesn't exist or wrong project++**Solution**:+1. List secrets: `gcloud secrets list`+2. Create if missing: `gcloud secrets create SECRET_NAME --data-file=-`+3. Check project: `gcloud config get project`diff --git a/skills/google-app-engine/rules/google-app-engine.md b/skills/google-app-engine/rules/google-app-engine.mdnew file mode 100644index 00000000..7c27beed--- /dev/null+++ b/skills/google-app-engine/rules/google-app-engine.md@@ -0,0 +1,192 @@+# Google App Engine Correction Rules++Copy this file to `.claude/rules/google-app-engine.md` in your project.++## Cloud SQL Connection++**WRONG** - TCP connection (won't work in Standard):+```python+DATABASES = {+ 'default': {+ 'HOST': '10.0.0.1', # Private IP won't work+ 'PORT': '5432',+ }+}+```++**CORRECT** - Unix socket:+```python+DATABASES = {+ 'default': {+ 'HOST': f"/cloudsql/{os.environ['CLOUD_SQL_CONNECTION_NAME']}",+ 'PORT': '', # Empty for Unix socket+ }+}+```++**CRITICAL**: Also requires in app.yaml:+```yaml+beta_settings:+ cloud_sql_instances: "project:region:instance"+```++---++## app.yaml Handler Order++**WRONG** - Catch-all before static:+```yaml+handlers:+ - url: /.*+ script: auto+ - url: /static+ static_dir: staticfiles/+```++**CORRECT** - Static before catch-all:+```yaml+handlers:+ - url: /static+ static_dir: staticfiles/+ - url: /.*+ script: auto+```++---++## Environment Detection++**WRONG** - Checking DEBUG or other settings:+```python+if DEBUG:+ # local+else:+ # production+```++**CORRECT** - Use GAE_APPLICATION:+```python+if os.getenv('GAE_APPLICATION'):+ # Running on App Engine+else:+ # Local development+```++---++## Secrets in app.yaml++**WRONG** - Secrets in env_variables:+```yaml+env_variables:+ SECRET_KEY: "actual-secret-key-here"+ DB_PASSWORD: "database-password"+```++**CORRECT** - Use Secret Manager:+```python+from google.cloud import secretmanager++def get_secret(secret_id):+ client = secretmanager.SecretManagerServiceClient()+ name = f"projects/{os.environ['GOOGLE_CLOUD_PROJECT']}/secrets/{secret_id}/versions/latest"+ return client.access_secret_version(name=name).payload.data.decode("UTF-8")++SECRET_KEY = get_secret('django-secret-key')+```++---++## Instance Class for Django++**WRONG** - F1 (256MB) for Django:+```yaml+instance_class: F1 # Will cause memory errors+```++**CORRECT** - F2 minimum:+```yaml+instance_class: F2 # 512MB - sufficient for most Django apps+```++---++## Service Worker Syntax (Legacy)++**WRONG** - Old service worker format:+```yaml+handlers:+ - url: /.*+ script: main.app # Legacy format+```++**CORRECT** - Modern entrypoint:+```yaml+entrypoint: gunicorn -b :$PORT myproject.wsgi:application++handlers:+ - url: /.*+ script: auto+```++---++## Python Runtime++**WRONG** - Deprecated runtimes:+```yaml+runtime: python27 # End of life+runtime: python37 # Deprecated+```++**CORRECT** - Current runtimes:+```yaml+runtime: python312 # Recommended+# Also supported: python311, python310, python39, python38+```++---++## HTTPS Enforcement++**WRONG** - Missing secure setting:+```yaml+handlers:+ - url: /.*+ script: auto+ # No secure setting - allows HTTP+```++**CORRECT** - Always enforce HTTPS:+```yaml+handlers:+ - url: /.*+ script: auto+ secure: always # Redirects HTTP to HTTPS+```++---++## Warmup Requests++**WRONG** - No warmup handling:+```yaml+# Missing warmup configuration+```++**CORRECT** - Enable warmup to reduce cold starts:+```yaml+inbound_services:+ - warmup+```++```python+# urls.py+path('_ah/warmup', warmup_view),++# views.py+def warmup_view(request):+ from django.db import connection+ connection.ensure_connection()+ return HttpResponse('ok')+```diff --git a/skills/google-app-engine/templates/app-flex.yaml b/skills/google-app-engine/templates/app-flex.yamlnew file mode 100644index 00000000..bee67754--- /dev/null+++ b/skills/google-app-engine/templates/app-flex.yaml@@ -0,0 +1,54 @@+# Google App Engine - Flexible Environment+# Use when you need: custom Docker, longer timeouts, or background threads++runtime: python+env: flex++runtime_config:+ runtime_version: "3.12"++# Application entrypoint+entrypoint: gunicorn -b :$PORT myproject.wsgi:application++# Environment variables (NOT for secrets - use Secret Manager)+env_variables:+ DJANGO_SETTINGS_MODULE: "myproject.settings.production"+ GOOGLE_CLOUD_PROJECT: "your-project-id"++# Cloud SQL connection+beta_settings:+ cloud_sql_instances: "your-project:your-region:your-instance"++# Resource allocation+resources:+ cpu: 1+ memory_gb: 0.5+ disk_size_gb: 10++# Scaling (min 1 instance in Flexible - always costs money)+automatic_scaling:+ min_num_instances: 1+ max_num_instances: 5+ cool_down_period_sec: 120+ cpu_utilization:+ target_utilization: 0.65++# Health checks+liveness_check:+ path: "/_ah/health"+ check_interval_sec: 30+ timeout_sec: 4+ failure_threshold: 3+ success_threshold: 2++readiness_check:+ path: "/_ah/health"+ check_interval_sec: 5+ timeout_sec: 4+ failure_threshold: 2+ success_threshold: 2++# Network configuration (optional)+# network:+# name: default+# subnetwork_name: defaultdiff --git a/skills/google-app-engine/templates/app.yaml b/skills/google-app-engine/templates/app.yamlnew file mode 100644index 00000000..d678f9a1--- /dev/null+++ b/skills/google-app-engine/templates/app.yaml@@ -0,0 +1,56 @@+# Google App Engine - Standard Environment+# Copy to your project root and customize++runtime: python312+instance_class: F2++# Application entrypoint+entrypoint: gunicorn -b :$PORT myproject.wsgi:application++# Environment variables (NOT for secrets - use Secret Manager)+env_variables:+ DJANGO_SETTINGS_MODULE: "myproject.settings.production"+ GOOGLE_CLOUD_PROJECT: "your-project-id"++# Cloud SQL connection (REQUIRED for database)+beta_settings:+ cloud_sql_instances: "your-project:your-region:your-instance"++# Request handlers+handlers:+ # Static files - served directly by App Engine+ - url: /static+ static_dir: staticfiles/+ secure: always+ expiration: "1d"++ # All other requests go to the application+ - url: /.*+ script: auto+ secure: always++# Scaling configuration+automatic_scaling:+ min_instances: 0 # Scale to zero when idle (cost savings)+ max_instances: 10 # Cap maximum instances+ target_cpu_utilization: 0.65+ max_concurrent_requests: 80++# Health checks+liveness_check:+ path: "/_ah/health"+ check_interval_sec: 30+ timeout_sec: 4+ failure_threshold: 2+ success_threshold: 2++readiness_check:+ path: "/_ah/health"+ check_interval_sec: 5+ timeout_sec: 4+ failure_threshold: 2+ success_threshold: 2++# Enable warmup requests to reduce cold starts+inbound_services:+ - warmupdiff --git a/skills/google-app-engine/templates/requirements-gae.txt b/skills/google-app-engine/templates/requirements-gae.txtnew file mode 100644index 00000000..3a2d7e3d--- /dev/null+++ b/skills/google-app-engine/templates/requirements-gae.txt@@ -0,0 +1,19 @@+# Google App Engine Dependencies+# Add these to your requirements.txt++# WSGI server (required for App Engine)+gunicorn>=22.0.0++# Google Cloud services+google-cloud-secret-manager>=2.20.0+google-cloud-storage>=2.14.0++# Django storage backend (for Cloud Storage static/media files)+django-storages[google]>=1.14.0++# Database drivers (choose one)+psycopg2-binary>=2.9.9 # PostgreSQL+# mysqlclient>=2.2.0 # MySQL++# Optional: Cloud Logging integration+# google-cloud-logging>=3.10.0