@marcfargas/skills 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,119 @@
1
+ # Data: Cloud SQL, BigQuery, Pub/Sub
2
+
3
+ ## Cloud SQL
4
+
5
+ ```bash
6
+ # ⚠️ EXPENSIVE — always-on, ~$8-400+/mo depending on tier
7
+ gcloud sql instances create my-db \
8
+ --database-version=POSTGRES_15 \
9
+ --tier=db-f1-micro \
10
+ --region=europe-west1
11
+
12
+ # Create database
13
+ gcloud sql databases create mydb --instance=my-db
14
+ gcloud sql databases list --instance=my-db --format=json
15
+
16
+ # Create user — NEVER put password in CLI args
17
+ # Use --prompt-for-password or pull from Secret Manager
18
+ gcloud sql users create myuser --instance=my-db --prompt-for-password
19
+
20
+ # Or from Secret Manager
21
+ gcloud sql users set-password myuser --instance=my-db \
22
+ --password="$(gcloud secrets versions access latest --secret=db-password)"
23
+
24
+ # Connect directly
25
+ gcloud sql connect my-db --user=myuser
26
+
27
+ # Cloud SQL Auth Proxy (for local dev — preferred)
28
+ cloud-sql-proxy PROJECT_ID:europe-west1:my-db
29
+
30
+ # Export/Import
31
+ gcloud sql export sql my-db gs://my-bucket/backup.sql --database=mydb
32
+ gcloud sql import sql my-db gs://my-bucket/backup.sql --database=mydb # ⚠️ overwrites
33
+
34
+ # READ
35
+ gcloud sql instances list --format=json
36
+ gcloud sql instances describe my-db --format=json
37
+
38
+ # ⚠️ DESTRUCTIVE
39
+ gcloud sql instances delete my-db
40
+ ```
41
+
42
+ ---
43
+
44
+ ## BigQuery (bq)
45
+
46
+ ### Datasets & Tables
47
+
48
+ ```bash
49
+ # Create dataset
50
+ bq mk my_dataset
51
+ bq ls --format=json
52
+
53
+ # Create table with schema
54
+ bq mk --table my_dataset.my_table schema.json
55
+
56
+ # READ
57
+ bq show --format=json my_dataset.my_table
58
+ bq head my_dataset.my_table
59
+ ```
60
+
61
+ ### Queries
62
+
63
+ ```bash
64
+ # Query (always use Standard SQL)
65
+ bq query --use_legacy_sql=false --format=json \
66
+ 'SELECT * FROM `project.dataset.table` LIMIT 10'
67
+
68
+ # Dry run (estimate bytes scanned — cost check)
69
+ bq query --use_legacy_sql=false --dry_run \
70
+ 'SELECT * FROM `project.dataset.table`'
71
+ ```
72
+
73
+ ### Load & Export
74
+
75
+ ```bash
76
+ # Load from GCS
77
+ bq load --source_format=CSV my_dataset.my_table gs://bucket/data.csv schema.json
78
+ bq load --autodetect --source_format=NEWLINE_DELIMITED_JSON \
79
+ my_dataset.my_table gs://bucket/data.jsonl
80
+
81
+ # Export to GCS
82
+ bq extract --destination_format=CSV my_dataset.my_table gs://bucket/export.csv
83
+ ```
84
+
85
+ ### Delete
86
+
87
+ ```bash
88
+ # ⚠️ DESTRUCTIVE — drops table
89
+ bq rm my_dataset.my_table
90
+
91
+ # ⚠️ DESTRUCTIVE — drops dataset and ALL tables
92
+ bq rm -r my_dataset
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Pub/Sub
98
+
99
+ ```bash
100
+ # Topics
101
+ gcloud pubsub topics create my-topic
102
+ gcloud pubsub topics list --format=json
103
+
104
+ # Subscriptions
105
+ gcloud pubsub subscriptions create my-sub --topic=my-topic
106
+ gcloud pubsub subscriptions list --format=json
107
+
108
+ # Publish
109
+ gcloud pubsub topics publish my-topic --message="Hello"
110
+ gcloud pubsub topics publish my-topic --message='{"key":"value"}' \
111
+ --attribute="type=event"
112
+
113
+ # Pull
114
+ gcloud pubsub subscriptions pull my-sub --auto-ack --limit=10 --format=json
115
+
116
+ # ⚠️ DESTRUCTIVE
117
+ gcloud pubsub topics delete my-topic
118
+ gcloud pubsub subscriptions delete my-sub
119
+ ```
@@ -0,0 +1,137 @@
1
+ # IAM, Projects & Secrets
2
+
3
+ ## Projects
4
+
5
+ ```bash
6
+ gcloud projects list --format=json
7
+ gcloud projects create PROJECT_ID --name="Display Name"
8
+ gcloud config set project PROJECT_ID
9
+ gcloud config get-value project
10
+ gcloud projects describe PROJECT_ID --format=json
11
+
12
+ # Link billing (required for resource creation)
13
+ gcloud billing accounts list
14
+ gcloud billing projects link PROJECT_ID --billing-account=ACCOUNT_ID
15
+ ```
16
+
17
+ ## APIs
18
+
19
+ Most APIs are disabled by default. Enable before first use:
20
+
21
+ ```bash
22
+ # Enable single API
23
+ gcloud services enable compute.googleapis.com
24
+
25
+ # Enable multiple at once
26
+ gcloud services enable \
27
+ compute.googleapis.com \
28
+ container.googleapis.com \
29
+ run.googleapis.com \
30
+ cloudsql.googleapis.com \
31
+ secretmanager.googleapis.com \
32
+ cloudbuild.googleapis.com \
33
+ artifactregistry.googleapis.com
34
+
35
+ # List enabled APIs
36
+ gcloud services list --format=json
37
+
38
+ # Check if specific API is enabled
39
+ gcloud services list --filter="name:run.googleapis.com" --format="value(name)"
40
+ ```
41
+
42
+ ## IAM Roles
43
+
44
+ ```bash
45
+ # View project IAM policy
46
+ gcloud projects get-iam-policy PROJECT_ID --format=json
47
+
48
+ # Grant role (WRITE — confirm with user)
49
+ gcloud projects add-iam-policy-binding PROJECT_ID \
50
+ --member="user:user@example.com" \
51
+ --role="roles/compute.instanceAdmin.v1"
52
+
53
+ # Check what roles a user has
54
+ gcloud projects get-iam-policy PROJECT_ID \
55
+ --flatten="bindings[].members" \
56
+ --filter="bindings.members:user@example.com" \
57
+ --format="table(bindings.role)"
58
+
59
+ # ⚠️ DESTRUCTIVE — remove role
60
+ gcloud projects remove-iam-policy-binding PROJECT_ID \
61
+ --member="user:user@example.com" \
62
+ --role="roles/compute.instanceAdmin.v1"
63
+ ```
64
+
65
+ > **Least privilege**: Use specific roles (`roles/compute.instanceAdmin.v1`),
66
+ > never `roles/owner` or `roles/editor` for automation.
67
+
68
+ ## Service Accounts
69
+
70
+ ```bash
71
+ # Create
72
+ gcloud iam service-accounts create SA_NAME --display-name="Description"
73
+
74
+ # List
75
+ gcloud iam service-accounts list --format=json
76
+
77
+ # Grant role to service account
78
+ gcloud projects add-iam-policy-binding PROJECT_ID \
79
+ --member="serviceAccount:SA_EMAIL" \
80
+ --role="roles/run.admin"
81
+
82
+ # Check service account permissions
83
+ gcloud iam service-accounts get-iam-policy SA_EMAIL --format=json
84
+ ```
85
+
86
+ > ⚠️ **FORBIDDEN**: Do not use `gcloud iam service-accounts keys create`.
87
+ > Use impersonation instead (see [auth.md](auth.md)).
88
+ > If keys are absolutely required (user explicitly confirmed), they must be
89
+ > stored in Secret Manager, rotated within 90 days, and deleted when unused.
90
+
91
+ ## Secret Manager
92
+
93
+ ```bash
94
+ # Create secret (pipe from stdin — no plaintext in CLI args)
95
+ echo -n "s3cr3t" | gcloud secrets create my-secret --data-file=-
96
+
97
+ # Access latest version
98
+ gcloud secrets versions access latest --secret=my-secret
99
+
100
+ # Add new version
101
+ echo -n "new-value" | gcloud secrets versions add my-secret --data-file=-
102
+
103
+ # List & describe
104
+ gcloud secrets list --format=json
105
+ gcloud secrets describe my-secret --format=json
106
+
107
+ # Grant access to service account
108
+ gcloud secrets add-iam-policy-binding my-secret \
109
+ --member="serviceAccount:SA_EMAIL" \
110
+ --role="roles/secretmanager.secretAccessor"
111
+
112
+ # ⚠️ DESTRUCTIVE — delete secret
113
+ gcloud secrets delete my-secret
114
+ ```
115
+
116
+ ## Workload Identity Federation
117
+
118
+ Keyless auth for external systems (GitHub Actions, AWS, Azure):
119
+
120
+ ```bash
121
+ # Create workload identity pool
122
+ gcloud iam workload-identity-pools create github-pool \
123
+ --location=global \
124
+ --display-name="GitHub Actions Pool"
125
+
126
+ # Create provider (GitHub example)
127
+ gcloud iam workload-identity-pools providers create-oidc github-provider \
128
+ --location=global \
129
+ --workload-identity-pool=github-pool \
130
+ --issuer-uri="https://token.actions.githubusercontent.com" \
131
+ --attribute-mapping="google.subject=assertion.sub,attribute.repository=assertion.repository"
132
+
133
+ # Allow SA impersonation from GitHub
134
+ gcloud iam service-accounts add-iam-policy-binding SA_EMAIL \
135
+ --role="roles/iam.workloadIdentityUser" \
136
+ --member="principalSet://iam.googleapis.com/projects/PROJECT_NUM/locations/global/workloadIdentityPools/github-pool/attribute.repository/ORG/REPO"
137
+ ```
@@ -0,0 +1,169 @@
1
+ # Serverless: Cloud Run, Functions, App Engine, Scheduler, Tasks
2
+
3
+ ## Cloud Run (Services)
4
+
5
+ ```bash
6
+ # WRITE — deploy from container image
7
+ gcloud run deploy my-service \
8
+ --image=europe-west1-docker.pkg.dev/PROJECT_ID/my-repo/my-image:tag \
9
+ --region=europe-west1 \
10
+ --set-env-vars="KEY=value"
11
+
12
+ # Deploy from source (buildpacks — no Dockerfile needed)
13
+ gcloud run deploy my-service --source=. --region=europe-west1
14
+
15
+ # READ
16
+ gcloud run services list --format=json
17
+ gcloud run services describe my-service --region=europe-west1 --format=json
18
+ gcloud run services logs read my-service --region=europe-west1
19
+
20
+ # WRITE — update
21
+ gcloud run services update my-service --region=europe-west1 --memory=512Mi --cpu=1
22
+
23
+ # Traffic splitting
24
+ gcloud run services update-traffic my-service \
25
+ --to-revisions=my-service-v1=50,my-service-v2=50
26
+
27
+ # ⚠️ SECURITY — exposes to public internet
28
+ gcloud run deploy my-service --allow-unauthenticated ...
29
+
30
+ # ⚠️ DESTRUCTIVE
31
+ gcloud run services delete my-service --region=europe-west1
32
+ ```
33
+
34
+ ## Cloud Run (Jobs — batch workloads)
35
+
36
+ ```bash
37
+ # WRITE — create job
38
+ gcloud run jobs create my-job \
39
+ --image=europe-west1-docker.pkg.dev/PROJECT_ID/my-repo/my-image:tag \
40
+ --region=europe-west1 \
41
+ --tasks=10 --max-retries=3
42
+
43
+ # Execute
44
+ gcloud run jobs execute my-job --region=europe-west1
45
+
46
+ # READ
47
+ gcloud run jobs list --format=json
48
+ gcloud run jobs describe my-job --region=europe-west1 --format=json
49
+
50
+ # ⚠️ DESTRUCTIVE
51
+ gcloud run jobs delete my-job --region=europe-west1
52
+ ```
53
+
54
+ ## Cloud Functions (Gen 2)
55
+
56
+ ```bash
57
+ # WRITE — deploy HTTP function
58
+ gcloud functions deploy my-func \
59
+ --gen2 \
60
+ --runtime=nodejs20 \
61
+ --region=europe-west1 \
62
+ --trigger-http \
63
+ --entry-point=handler \
64
+ --source=.
65
+
66
+ # Event-triggered (Pub/Sub)
67
+ gcloud functions deploy my-func \
68
+ --gen2 \
69
+ --runtime=python312 \
70
+ --region=europe-west1 \
71
+ --trigger-topic=my-topic
72
+
73
+ # ⚠️ SECURITY — exposes to public internet
74
+ gcloud functions deploy my-func --allow-unauthenticated ...
75
+
76
+ # READ
77
+ gcloud functions list --format=json
78
+ gcloud functions describe my-func --region=europe-west1 --format=json
79
+ gcloud functions logs read my-func --region=europe-west1
80
+
81
+ # ⚠️ DESTRUCTIVE
82
+ gcloud functions delete my-func --region=europe-west1
83
+ ```
84
+
85
+ ## App Engine
86
+
87
+ ```bash
88
+ gcloud app deploy app.yaml
89
+ gcloud app browse
90
+ gcloud app logs tail
91
+ gcloud app versions list --format=json
92
+
93
+ # ⚠️ DESTRUCTIVE
94
+ gcloud app versions delete VERSION_ID
95
+
96
+ # Traffic splitting
97
+ gcloud app services set-traffic SERVICE --splits v1=50,v2=50
98
+ ```
99
+
100
+ ## Cloud Scheduler
101
+
102
+ ```bash
103
+ # WRITE — create cron job
104
+ gcloud scheduler jobs create http my-job \
105
+ --schedule="0 9 * * 1" \
106
+ --uri="https://my-service.run.app/task" \
107
+ --http-method=POST \
108
+ --location=europe-west1 \
109
+ --oidc-service-account-email=SA_EMAIL
110
+
111
+ # Pub/Sub trigger
112
+ gcloud scheduler jobs create pubsub my-job \
113
+ --schedule="*/5 * * * *" \
114
+ --topic=my-topic \
115
+ --message-body='{"action":"process"}' \
116
+ --location=europe-west1
117
+
118
+ # READ
119
+ gcloud scheduler jobs list --location=europe-west1 --format=json
120
+
121
+ # Manual trigger
122
+ gcloud scheduler jobs run my-job --location=europe-west1
123
+
124
+ # ⚠️ DESTRUCTIVE
125
+ gcloud scheduler jobs delete my-job --location=europe-west1
126
+ ```
127
+
128
+ ## Cloud Tasks
129
+
130
+ ```bash
131
+ # WRITE — create queue
132
+ gcloud tasks queues create my-queue --location=europe-west1
133
+
134
+ # Create HTTP task
135
+ gcloud tasks create-http-task \
136
+ --queue=my-queue \
137
+ --url="https://my-service.run.app/process" \
138
+ --http-method=POST \
139
+ --location=europe-west1
140
+
141
+ # READ
142
+ gcloud tasks queues list --location=europe-west1 --format=json
143
+
144
+ # ⚠️ DESTRUCTIVE
145
+ gcloud tasks queues delete my-queue --location=europe-west1
146
+ ```
147
+
148
+ ## GKE (Kubernetes Engine)
149
+
150
+ ```bash
151
+ # ⚠️ EXPENSIVE — ~$70+/month for 3-node e2-medium cluster
152
+ gcloud container clusters create my-cluster \
153
+ --zone=europe-west1-b \
154
+ --num-nodes=3 \
155
+ --machine-type=e2-medium \
156
+ --enable-autoscaling --min-nodes=1 --max-nodes=5
157
+
158
+ # Get kubectl credentials
159
+ gcloud container clusters get-credentials my-cluster --zone=europe-west1-b
160
+
161
+ # READ
162
+ gcloud container clusters list --format=json
163
+
164
+ # WRITE — resize
165
+ gcloud container clusters resize my-cluster --num-nodes=5 --zone=europe-west1-b
166
+
167
+ # ⚠️ DESTRUCTIVE
168
+ gcloud container clusters delete my-cluster --zone=europe-west1-b
169
+ ```
@@ -0,0 +1,122 @@
1
+ # Cloud Storage & Artifact Registry
2
+
3
+ ## Cloud Storage
4
+
5
+ > **Note**: `gsutil` is being replaced by `gcloud storage`. Both work today.
6
+ > New scripts should prefer `gcloud storage`. Examples show both where relevant.
7
+
8
+ ### Buckets
9
+
10
+ ```bash
11
+ # Create
12
+ gcloud storage buckets create gs://my-bucket --location=europe-west1
13
+
14
+ # List
15
+ gcloud storage ls
16
+ gcloud storage buckets list --format=json
17
+
18
+ # ⚠️ DESTRUCTIVE — remove bucket (must be empty, or use --recursive)
19
+ gcloud storage rm --recursive gs://my-bucket/
20
+ ```
21
+
22
+ ### Upload & Download
23
+
24
+ ```bash
25
+ # Upload
26
+ gcloud storage cp local.txt gs://my-bucket/
27
+ gcloud storage cp -r ./dir gs://my-bucket/dir/ # recursive
28
+
29
+ # Download
30
+ gcloud storage cp gs://my-bucket/file.txt ./
31
+ gcloud storage cp -r gs://my-bucket/dir/ ./local/ # recursive
32
+
33
+ # Move/rename
34
+ gcloud storage mv gs://my-bucket/old.txt gs://my-bucket/new.txt
35
+ ```
36
+
37
+ ### Sync
38
+
39
+ ```bash
40
+ # Sync local → GCS
41
+ gcloud storage rsync ./local-dir gs://my-bucket/remote-dir --recursive
42
+
43
+ # Sync GCS → local
44
+ gcloud storage rsync gs://my-bucket/dir ./local --recursive
45
+
46
+ # ⚠️ DESTRUCTIVE: --delete-unmatched-destination-objects removes files at
47
+ # destination not present in source. Always confirm with user.
48
+ gcloud storage rsync ./local gs://my-bucket/dir --recursive --delete-unmatched-destination-objects
49
+ ```
50
+
51
+ ### List & Info
52
+
53
+ ```bash
54
+ gcloud storage ls gs://my-bucket/
55
+ gcloud storage ls -l gs://my-bucket/ # sizes
56
+ gcloud storage du -s gs://my-bucket # total size
57
+ gcloud storage cat gs://my-bucket/file.txt # print contents
58
+ ```
59
+
60
+ ### Permissions
61
+
62
+ ```bash
63
+ # Grant read access
64
+ gcloud storage buckets add-iam-policy-binding gs://my-bucket \
65
+ --member="user:user@example.com" \
66
+ --role="roles/storage.objectViewer"
67
+
68
+ # ⚠️ SECURITY — make public
69
+ gcloud storage buckets add-iam-policy-binding gs://my-bucket \
70
+ --member="allUsers" \
71
+ --role="roles/storage.objectViewer"
72
+ ```
73
+
74
+ ### Delete
75
+
76
+ ```bash
77
+ # ⚠️ DESTRUCTIVE — delete objects
78
+ gcloud storage rm gs://my-bucket/file.txt
79
+ gcloud storage rm -r gs://my-bucket/dir/ # recursive
80
+ gcloud storage rm -r gs://my-bucket/ # entire bucket contents + bucket
81
+ ```
82
+
83
+ ### gsutil equivalents (legacy)
84
+
85
+ | `gcloud storage` | `gsutil` (legacy) |
86
+ |-------------------|-------------------|
87
+ | `gcloud storage cp` | `gsutil cp` |
88
+ | `gcloud storage ls` | `gsutil ls` |
89
+ | `gcloud storage rm` | `gsutil rm` |
90
+ | `gcloud storage rsync` | `gsutil rsync` |
91
+ | `gcloud storage mv` | `gsutil mv` |
92
+ | `gcloud storage cat` | `gsutil cat` |
93
+ | `gcloud storage buckets create` | `gsutil mb` |
94
+
95
+ ---
96
+
97
+ ## Artifact Registry
98
+
99
+ Preferred over Container Registry for Docker images, npm packages, Python packages, etc.
100
+
101
+ ```bash
102
+ # Create Docker repository
103
+ gcloud artifacts repositories create my-repo \
104
+ --repository-format=docker \
105
+ --location=europe-west1 \
106
+ --description="Docker images"
107
+
108
+ # Configure Docker auth
109
+ gcloud auth configure-docker europe-west1-docker.pkg.dev
110
+
111
+ # Tag and push
112
+ docker tag my-image europe-west1-docker.pkg.dev/PROJECT_ID/my-repo/my-image:tag
113
+ docker push europe-west1-docker.pkg.dev/PROJECT_ID/my-repo/my-image:tag
114
+
115
+ # READ
116
+ gcloud artifacts repositories list --format=json
117
+ gcloud artifacts docker images list europe-west1-docker.pkg.dev/PROJECT_ID/my-repo --format=json
118
+
119
+ # ⚠️ DESTRUCTIVE
120
+ gcloud artifacts docker images delete europe-west1-docker.pkg.dev/PROJECT_ID/my-repo/my-image:tag
121
+ gcloud artifacts repositories delete my-repo --location=europe-west1
122
+ ```
package/package.json CHANGED
@@ -1,13 +1,46 @@
1
1
  {
2
2
  "name": "@marcfargas/skills",
3
- "version": "0.1.0",
4
- "description": "Pi agent skills by marcfargas",
3
+ "version": "0.2.1",
4
+ "description": "Reusable AI agent skills for pi, Claude Code, Cursor, and any Agent Skills compatible agent",
5
5
  "license": "MIT",
6
- "main": "index.js",
7
- "keywords": ["pi", "agent", "skills"],
6
+ "author": "Marc Fargas <marc@marcfargas.com>",
8
7
  "repository": {
9
8
  "type": "git",
10
9
  "url": "https://github.com/marcfargas/skills"
11
10
  },
12
- "author": "Marc Fargas <marc@marcfargas.com>"
11
+ "keywords": [
12
+ "pi-package",
13
+ "agent-skills",
14
+ "ai-agent",
15
+ "skills",
16
+ "gcloud",
17
+ "pre-release",
18
+ "vhs",
19
+ "web-search"
20
+ ],
21
+ "pi": {
22
+ "skills": [
23
+ "google-cloud",
24
+ "release",
25
+ "search",
26
+ "terminal"
27
+ ]
28
+ },
29
+ "scripts": {
30
+ "changeset": "changeset",
31
+ "version-packages": "changeset version",
32
+ "release": "changeset publish"
33
+ },
34
+ "devDependencies": {
35
+ "@changesets/changelog-github": "^0.5.2",
36
+ "@changesets/cli": "^2.29.8"
37
+ },
38
+ "files": [
39
+ "google-cloud/",
40
+ "release/",
41
+ "search/",
42
+ "terminal/",
43
+ "README.md",
44
+ "LICENSE"
45
+ ]
13
46
  }