@sylix/coworker 2.0.10 → 2.0.12

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.
Files changed (178) hide show
  1. package/dist/commands/slash/config.d.ts.map +1 -1
  2. package/dist/commands/slash/config.js +23 -5
  3. package/dist/commands/slash/config.js.map +1 -1
  4. package/dist/commands/slash/todo.js +1 -1
  5. package/dist/commands/slash/todo.js.map +1 -1
  6. package/dist/core/CoWorkerAgent.d.ts.map +1 -1
  7. package/dist/core/CoWorkerAgent.js +6 -3
  8. package/dist/core/CoWorkerAgent.js.map +1 -1
  9. package/dist/permissions/PermissionInterceptor.js +1 -1
  10. package/dist/permissions/PermissionInterceptor.js.map +1 -1
  11. package/dist/skills/defaults/accessibility/screen-reader-testing.md +545 -0
  12. package/dist/skills/defaults/accessibility/wcag-audit-patterns.md +555 -0
  13. package/dist/skills/defaults/ai-ml/rag.md +276 -0
  14. package/dist/skills/defaults/backend-development/api-design-principles.md +528 -0
  15. package/dist/skills/defaults/backend-development/api-design.md +285 -0
  16. package/dist/skills/defaults/backend-development/architecture-patterns.md +494 -0
  17. package/dist/skills/defaults/backend-development/async-python.md +237 -0
  18. package/dist/skills/defaults/backend-development/auth-implementation-patterns.md +638 -0
  19. package/dist/skills/defaults/backend-development/bazel-build-optimization.md +387 -0
  20. package/dist/skills/defaults/backend-development/billing-automation/SKILL.md +566 -0
  21. package/dist/skills/defaults/backend-development/code-review-excellence.md +538 -0
  22. package/dist/skills/defaults/backend-development/cqrs-implementation.md +554 -0
  23. package/dist/skills/defaults/backend-development/database-design.md +305 -0
  24. package/dist/skills/defaults/backend-development/debugging-strategies.md +536 -0
  25. package/dist/skills/defaults/backend-development/e2e-testing-patterns.md +544 -0
  26. package/dist/skills/defaults/backend-development/error-handling-patterns.md +641 -0
  27. package/dist/skills/defaults/backend-development/fastapi-templates.md +559 -0
  28. package/dist/skills/defaults/backend-development/fastapi.md +309 -0
  29. package/dist/skills/defaults/backend-development/git-advanced-workflows.md +405 -0
  30. package/dist/skills/defaults/backend-development/microservices-patterns.md +595 -0
  31. package/dist/skills/defaults/backend-development/microservices.md +284 -0
  32. package/dist/skills/defaults/backend-development/monorepo-management.md +623 -0
  33. package/dist/skills/defaults/backend-development/nodejs-backend-patterns.md +1048 -0
  34. package/dist/skills/defaults/backend-development/nx-workspace-patterns.md +457 -0
  35. package/dist/skills/defaults/backend-development/paypal-integration/SKILL.md +478 -0
  36. package/dist/skills/defaults/backend-development/pci-compliance/SKILL.md +480 -0
  37. package/dist/skills/defaults/backend-development/python-anti-patterns.md +349 -0
  38. package/dist/skills/defaults/backend-development/python-background-jobs.md +364 -0
  39. package/dist/skills/defaults/backend-development/python-code-style.md +360 -0
  40. package/dist/skills/defaults/backend-development/python-configuration.md +368 -0
  41. package/dist/skills/defaults/backend-development/python-design-patterns.md +296 -0
  42. package/dist/skills/defaults/backend-development/python-error-handling.md +323 -0
  43. package/dist/skills/defaults/backend-development/python-packaging.md +887 -0
  44. package/dist/skills/defaults/backend-development/python-performance-optimization.md +874 -0
  45. package/dist/skills/defaults/backend-development/python-project-structure.md +252 -0
  46. package/dist/skills/defaults/backend-development/python-resilience.md +376 -0
  47. package/dist/skills/defaults/backend-development/python-resource-management.md +421 -0
  48. package/dist/skills/defaults/backend-development/python-type-safety.md +428 -0
  49. package/dist/skills/defaults/backend-development/sql-optimization-patterns.md +509 -0
  50. package/dist/skills/defaults/backend-development/stripe-integration/SKILL.md +522 -0
  51. package/dist/skills/defaults/backend-development/turborepo-caching.md +376 -0
  52. package/dist/skills/defaults/blockchain/defi-protocol-templates.md +430 -0
  53. package/dist/skills/defaults/blockchain/nft-standards.md +364 -0
  54. package/dist/skills/defaults/blockchain/solidity-security.md +514 -0
  55. package/dist/skills/defaults/blockchain/web3-testing.md +360 -0
  56. package/dist/skills/defaults/business/competitive-landscape/SKILL.md +527 -0
  57. package/dist/skills/defaults/business/market-sizing-analysis/SKILL.md +451 -0
  58. package/dist/skills/defaults/business/startup-financial-modeling/SKILL.md +494 -0
  59. package/dist/skills/defaults/business/startup-metrics-framework/SKILL.md +564 -0
  60. package/dist/skills/defaults/business/team-composition-analysis.md +437 -0
  61. package/dist/skills/defaults/compliance/employment-contract-templates/SKILL.md +527 -0
  62. package/dist/skills/defaults/compliance/gdpr-data-handling/SKILL.md +630 -0
  63. package/dist/skills/defaults/data-engineering/airflow-dag-patterns.md +436 -0
  64. package/dist/skills/defaults/data-engineering/airflow.md +519 -0
  65. package/dist/skills/defaults/data-engineering/data-quality.md +583 -0
  66. package/dist/skills/defaults/data-engineering/dbt-transformation-patterns.md +482 -0
  67. package/dist/skills/defaults/data-engineering/dbt.md +556 -0
  68. package/dist/skills/defaults/data-engineering/ml-pipeline-workflow/SKILL.md +247 -0
  69. package/dist/skills/defaults/data-engineering/spark-optimization.md +348 -0
  70. package/dist/skills/defaults/data-engineering/spark.md +411 -0
  71. package/dist/skills/defaults/database/postgresql.md +202 -0
  72. package/dist/skills/defaults/debugging/systematic-debugging.md +249 -0
  73. package/dist/skills/defaults/devops/architecture-decision-records.md +448 -0
  74. package/dist/skills/defaults/devops/changelog-automation.md +580 -0
  75. package/dist/skills/defaults/devops/cicd.md +314 -0
  76. package/dist/skills/defaults/devops/cloud.md +263 -0
  77. package/dist/skills/defaults/devops/code-review-excellence.md +299 -0
  78. package/dist/skills/defaults/devops/cost-optimization.md +295 -0
  79. package/dist/skills/defaults/devops/deployment-pipeline-design.md +356 -0
  80. package/dist/skills/defaults/devops/docker.md +281 -0
  81. package/dist/skills/defaults/devops/git-workflows.md +205 -0
  82. package/dist/skills/defaults/devops/github-actions.md +311 -0
  83. package/dist/skills/defaults/devops/gitlab-ci-patterns.md +266 -0
  84. package/dist/skills/defaults/devops/hybrid-cloud-networking.md +241 -0
  85. package/dist/skills/defaults/devops/istio-traffic-management.md +327 -0
  86. package/dist/skills/defaults/devops/kubernetes.md +339 -0
  87. package/dist/skills/defaults/devops/linkerd-patterns.md +311 -0
  88. package/dist/skills/defaults/devops/multi-cloud-architecture.md +181 -0
  89. package/dist/skills/defaults/devops/observability.md +243 -0
  90. package/dist/skills/defaults/devops/openapi-spec-generation.md +1024 -0
  91. package/dist/skills/defaults/devops/postmortem-writing.md +396 -0
  92. package/dist/skills/defaults/devops/prometheus-configuration.md +265 -0
  93. package/dist/skills/defaults/devops/secrets-management.md +341 -0
  94. package/dist/skills/defaults/devops/service-mesh-observability.md +385 -0
  95. package/dist/skills/defaults/devops/terraform-module-library.md +244 -0
  96. package/dist/skills/defaults/finance/backtesting-frameworks/SKILL.md +663 -0
  97. package/dist/skills/defaults/finance/risk-metrics-calculation/SKILL.md +557 -0
  98. package/dist/skills/defaults/frontend/accessibility-compliance.md +420 -0
  99. package/dist/skills/defaults/frontend/design-system-patterns.md +337 -0
  100. package/dist/skills/defaults/frontend/interaction-design.md +327 -0
  101. package/dist/skills/defaults/frontend/javascript.md +311 -0
  102. package/dist/skills/defaults/frontend/modern-javascript-patterns.md +927 -0
  103. package/dist/skills/defaults/frontend/react-native-design.md +440 -0
  104. package/dist/skills/defaults/frontend/react.md +345 -0
  105. package/dist/skills/defaults/frontend/responsive-design.md +472 -0
  106. package/dist/skills/defaults/frontend/tailwind-design-system.md +337 -0
  107. package/dist/skills/defaults/frontend/typescript-advanced-types.md +724 -0
  108. package/dist/skills/defaults/frontend/typescript.md +334 -0
  109. package/dist/skills/defaults/frontend/visual-design-foundations.md +326 -0
  110. package/dist/skills/defaults/frontend/web-component-design.md +279 -0
  111. package/dist/skills/defaults/game-development/godot-gdscript-patterns.md +188 -0
  112. package/dist/skills/defaults/game-development/unity-ecs-patterns.md +594 -0
  113. package/dist/skills/defaults/kubernetes/gitops-workflow.md +285 -0
  114. package/dist/skills/defaults/kubernetes/gitops.md +280 -0
  115. package/dist/skills/defaults/kubernetes/helm-chart-scaffolding.md +553 -0
  116. package/dist/skills/defaults/kubernetes/helm.md +343 -0
  117. package/dist/skills/defaults/kubernetes/k8s-manifest-generator.md +501 -0
  118. package/dist/skills/defaults/kubernetes/k8s-security-policies.md +342 -0
  119. package/dist/skills/defaults/kubernetes/manifests.md +330 -0
  120. package/dist/skills/defaults/kubernetes/security.md +337 -0
  121. package/dist/skills/defaults/llm-application/embedding-strategies.md +608 -0
  122. package/dist/skills/defaults/llm-application/hybrid-search-implementation.md +570 -0
  123. package/dist/skills/defaults/llm-application/hybrid-search.md +570 -0
  124. package/dist/skills/defaults/llm-application/langchain-architecture.md +666 -0
  125. package/dist/skills/defaults/llm-application/langchain.md +259 -0
  126. package/dist/skills/defaults/llm-application/llm-evaluation.md +695 -0
  127. package/dist/skills/defaults/llm-application/prompt-engineering-patterns.md +449 -0
  128. package/dist/skills/defaults/llm-application/prompt-engineering.md +219 -0
  129. package/dist/skills/defaults/llm-application/rag-implementation.md +434 -0
  130. package/dist/skills/defaults/llm-application/similarity-search-patterns.md +560 -0
  131. package/dist/skills/defaults/llm-application/similarity-search.md +560 -0
  132. package/dist/skills/defaults/llm-application/vector-index-tuning.md +523 -0
  133. package/dist/skills/defaults/mobile/mobile-android-design.md +440 -0
  134. package/dist/skills/defaults/mobile/mobile-ios-design.md +266 -0
  135. package/dist/skills/defaults/monitoring/distributed-tracing.md +436 -0
  136. package/dist/skills/defaults/monitoring/grafana-dashboards.md +370 -0
  137. package/dist/skills/defaults/monitoring/prometheus-configuration.md +379 -0
  138. package/dist/skills/defaults/monitoring/slo-implementation.md +323 -0
  139. package/dist/skills/defaults/refactoring/code-refactoring.md +349 -0
  140. package/dist/skills/defaults/security/anti-reversing-techniques/SKILL.md +559 -0
  141. package/dist/skills/defaults/security/auditor.md +168 -0
  142. package/dist/skills/defaults/security/binary-analysis-patterns/SKILL.md +438 -0
  143. package/dist/skills/defaults/security/memory-forensics/SKILL.md +483 -0
  144. package/dist/skills/defaults/security/mtls-configuration.md +349 -0
  145. package/dist/skills/defaults/security/protocol-reverse-engineering/SKILL.md +520 -0
  146. package/dist/skills/defaults/security/sast-configuration.md +182 -0
  147. package/dist/skills/defaults/security/security.md +313 -0
  148. package/dist/skills/defaults/security/stride-analysis.md +273 -0
  149. package/dist/skills/defaults/security/threat-mitigation-mapping.md +290 -0
  150. package/dist/skills/defaults/systems/bash-defensive-patterns/SKILL.md +539 -0
  151. package/dist/skills/defaults/systems/bats-testing-patterns/SKILL.md +631 -0
  152. package/dist/skills/defaults/systems/go-concurrency-patterns.md +657 -0
  153. package/dist/skills/defaults/systems/memory-safety-patterns.md +605 -0
  154. package/dist/skills/defaults/systems/rust-async-patterns.md +519 -0
  155. package/dist/skills/defaults/systems/shellcheck-configuration/SKILL.md +456 -0
  156. package/dist/skills/defaults/team-collaboration/multi-reviewer-patterns.md +126 -0
  157. package/dist/skills/defaults/team-collaboration/parallel-feature-development.md +151 -0
  158. package/dist/skills/defaults/testing/javascript-testing-patterns.md +1021 -0
  159. package/dist/skills/defaults/testing/python-testing-patterns.md +351 -0
  160. package/dist/skills/defaults/testing/testing.md +332 -0
  161. package/dist/skills/defaults/workflows/context-driven-development.md +384 -0
  162. package/dist/skills/defaults/workflows/track-management.md +592 -0
  163. package/dist/skills/defaults/workflows/workflow-patterns.md +622 -0
  164. package/dist/skills/index.d.ts +11 -0
  165. package/dist/skills/index.d.ts.map +1 -0
  166. package/dist/skills/index.js +129 -0
  167. package/dist/skills/index.js.map +1 -0
  168. package/dist/utils/character.js +6 -9
  169. package/dist/utils/character.js.map +1 -1
  170. package/dist/utils/contextManager.js +3 -7
  171. package/dist/utils/contextManager.js.map +1 -1
  172. package/dist/utils/inputbar.d.ts.map +1 -1
  173. package/dist/utils/inputbar.js +8 -1
  174. package/dist/utils/inputbar.js.map +1 -1
  175. package/dist/utils/output.d.ts.map +1 -1
  176. package/dist/utils/output.js +3 -35
  177. package/dist/utils/output.js.map +1 -1
  178. package/package.json +1 -1
@@ -0,0 +1,341 @@
1
+ ---
2
+ name: secrets-management
3
+ description: Implement secure secrets management for CI/CD pipelines using Vault, AWS Secrets Manager, or native platform solutions. Use when handling sensitive credentials, rotating secrets, or securing CI/CD environments.
4
+ ---
5
+
6
+ # Secrets Management
7
+
8
+ Secure secrets management practices for CI/CD pipelines using Vault, AWS Secrets Manager, and other tools.
9
+
10
+ ## Purpose
11
+
12
+ Implement secure secrets management in CI/CD pipelines without hardcoding sensitive information.
13
+
14
+ ## When to Use
15
+
16
+ - Store API keys and credentials
17
+ - Manage database passwords
18
+ - Handle TLS certificates
19
+ - Rotate secrets automatically
20
+ - Implement least-privilege access
21
+
22
+ ## Secrets Management Tools
23
+
24
+ ### HashiCorp Vault
25
+
26
+ - Centralized secrets management
27
+ - Dynamic secrets generation
28
+ - Secret rotation
29
+ - Audit logging
30
+ - Fine-grained access control
31
+
32
+ ### AWS Secrets Manager
33
+
34
+ - AWS-native solution
35
+ - Automatic rotation
36
+ - Integration with RDS
37
+ - CloudFormation support
38
+
39
+ ### Azure Key Vault
40
+
41
+ - Azure-native solution
42
+ - HSM-backed keys
43
+ - Certificate management
44
+ - RBAC integration
45
+
46
+ ### Google Secret Manager
47
+
48
+ - GCP-native solution
49
+ - Versioning
50
+ - IAM integration
51
+
52
+ ## HashiCorp Vault Integration
53
+
54
+ ### Setup Vault
55
+
56
+ ```bash
57
+ # Start Vault dev server
58
+ vault server -dev
59
+
60
+ # Set environment
61
+ export VAULT_ADDR='http://127.0.0.1:8200'
62
+ export VAULT_TOKEN='root'
63
+
64
+ # Enable secrets engine
65
+ vault secrets enable -path=secret kv-v2
66
+
67
+ # Store secret
68
+ vault kv put secret/database/config username=admin password=secret
69
+ ```
70
+
71
+ ### GitHub Actions with Vault
72
+
73
+ ```yaml
74
+ name: Deploy with Vault Secrets
75
+
76
+ on: [push]
77
+
78
+ jobs:
79
+ deploy:
80
+ runs-on: ubuntu-latest
81
+ steps:
82
+ - uses: actions/checkout@v4
83
+
84
+ - name: Import Secrets from Vault
85
+ uses: hashicorp/vault-action@v2
86
+ with:
87
+ url: https://vault.example.com:8200
88
+ token: ${{ secrets.VAULT_TOKEN }}
89
+ secrets: |
90
+ secret/data/database username | DB_USERNAME ;
91
+ secret/data/database password | DB_PASSWORD ;
92
+ secret/data/api key | API_KEY
93
+
94
+ - name: Use secrets
95
+ run: |
96
+ echo "Connecting to database as $DB_USERNAME"
97
+ # Use $DB_PASSWORD, $API_KEY
98
+ ```
99
+
100
+ ### GitLab CI with Vault
101
+
102
+ ```yaml
103
+ deploy:
104
+ image: vault:latest
105
+ before_script:
106
+ - export VAULT_ADDR=https://vault.example.com:8200
107
+ - export VAULT_TOKEN=$VAULT_TOKEN
108
+ - apk add curl jq
109
+ script: |
110
+ DB_PASSWORD=$(vault kv get -field=password secret/database/config)
111
+ API_KEY=$(vault kv get -field=key secret/api/credentials)
112
+ echo "Deploying with secrets..."
113
+ # Use $DB_PASSWORD, $API_KEY
114
+ ```
115
+
116
+ ## AWS Secrets Manager
117
+
118
+ ### Store Secret
119
+
120
+ ```bash
121
+ aws secretsmanager create-secret \
122
+ --name production/database/password \
123
+ --secret-string "super-secret-password"
124
+ ```
125
+
126
+ ### Retrieve in GitHub Actions
127
+
128
+ ```yaml
129
+ - name: Configure AWS credentials
130
+ uses: aws-actions/configure-aws-credentials@v4
131
+ with:
132
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
133
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
134
+ aws-region: us-west-2
135
+
136
+ - name: Get secret from AWS
137
+ run: |
138
+ SECRET=$(aws secretsmanager get-secret-value \
139
+ --secret-id production/database/password \
140
+ --query SecretString \
141
+ --output text)
142
+ echo "::add-mask::$SECRET"
143
+ echo "DB_PASSWORD=$SECRET" >> $GITHUB_ENV
144
+
145
+ - name: Use secret
146
+ run: |
147
+ # Use $DB_PASSWORD
148
+ ./deploy.sh
149
+ ```
150
+
151
+ ### Terraform with AWS Secrets Manager
152
+
153
+ ```hcl
154
+ data "aws_secretsmanager_secret_version" "db_password" {
155
+ secret_id = "production/database/password"
156
+ }
157
+
158
+ resource "aws_db_instance" "main" {
159
+ allocated_storage = 100
160
+ engine = "postgres"
161
+ instance_class = "db.t3.large"
162
+ username = "admin"
163
+ password = jsondecode(data.aws_secretsmanager_secret_version.db_password.secret_string)["password"]
164
+ }
165
+ ```
166
+
167
+ ## GitHub Secrets
168
+
169
+ ### Organization/Repository Secrets
170
+
171
+ ```yaml
172
+ - name: Use GitHub secret
173
+ run: |
174
+ echo "API Key: ${{ secrets.API_KEY }}"
175
+ echo "Database URL: ${{ secrets.DATABASE_URL }}"
176
+ ```
177
+
178
+ ### Environment Secrets
179
+
180
+ ```yaml
181
+ deploy:
182
+ runs-on: ubuntu-latest
183
+ environment: production
184
+ steps:
185
+ - name: Deploy
186
+ run: |
187
+ echo "Deploying with ${{ secrets.PROD_API_KEY }}"
188
+ ```
189
+
190
+ ## GitLab CI/CD Variables
191
+
192
+ ### Project Variables
193
+
194
+ ```yaml
195
+ deploy:
196
+ script:
197
+ - echo "Deploying with $API_KEY"
198
+ - echo "Database: $DATABASE_URL"
199
+ ```
200
+
201
+ ### Protected and Masked Variables
202
+
203
+ - Protected: Only available in protected branches
204
+ - Masked: Hidden in job logs
205
+ - File type: Stored as file
206
+
207
+ ## Best Practices
208
+
209
+ 1. **Never commit secrets** to Git
210
+ 2. **Use different secrets** per environment
211
+ 3. **Rotate secrets regularly**
212
+ 4. **Implement least-privilege access**
213
+ 5. **Enable audit logging**
214
+ 6. **Use secret scanning** (GitGuardian, TruffleHog)
215
+ 7. **Mask secrets in logs**
216
+ 8. **Encrypt secrets at rest**
217
+ 9. **Use short-lived tokens** when possible
218
+ 10. **Document secret requirements**
219
+
220
+ ## Secret Rotation
221
+
222
+ ### Automated Rotation with AWS
223
+
224
+ ```python
225
+ import boto3
226
+ import json
227
+
228
+ def lambda_handler(event, context):
229
+ client = boto3.client('secretsmanager')
230
+
231
+ # Get current secret
232
+ response = client.get_secret_value(SecretId='my-secret')
233
+ current_secret = json.loads(response['SecretString'])
234
+
235
+ # Generate new password
236
+ new_password = generate_strong_password()
237
+
238
+ # Update database password
239
+ update_database_password(new_password)
240
+
241
+ # Update secret
242
+ client.put_secret_value(
243
+ SecretId='my-secret',
244
+ SecretString=json.dumps({
245
+ 'username': current_secret['username'],
246
+ 'password': new_password
247
+ })
248
+ )
249
+
250
+ return {'statusCode': 200}
251
+ ```
252
+
253
+ ### Manual Rotation Process
254
+
255
+ 1. Generate new secret
256
+ 2. Update secret in secret store
257
+ 3. Update applications to use new secret
258
+ 4. Verify functionality
259
+ 5. Revoke old secret
260
+
261
+ ## External Secrets Operator
262
+
263
+ ### Kubernetes Integration
264
+
265
+ ```yaml
266
+ apiVersion: external-secrets.io/v1beta1
267
+ kind: SecretStore
268
+ metadata:
269
+ name: vault-backend
270
+ namespace: production
271
+ spec:
272
+ provider:
273
+ vault:
274
+ server: "https://vault.example.com:8200"
275
+ path: "secret"
276
+ version: "v2"
277
+ auth:
278
+ kubernetes:
279
+ mountPath: "kubernetes"
280
+ role: "production"
281
+
282
+ ---
283
+ apiVersion: external-secrets.io/v1beta1
284
+ kind: ExternalSecret
285
+ metadata:
286
+ name: database-credentials
287
+ namespace: production
288
+ spec:
289
+ refreshInterval: 1h
290
+ secretStoreRef:
291
+ name: vault-backend
292
+ kind: SecretStore
293
+ target:
294
+ name: database-credentials
295
+ creationPolicy: Owner
296
+ data:
297
+ - secretKey: username
298
+ remoteRef:
299
+ key: database/config
300
+ property: username
301
+ - secretKey: password
302
+ remoteRef:
303
+ key: database/config
304
+ property: password
305
+ ```
306
+
307
+ ## Secret Scanning
308
+
309
+ ### Pre-commit Hook
310
+
311
+ ```bash
312
+ #!/bin/bash
313
+ # .git/hooks/pre-commit
314
+
315
+ # Check for secrets with TruffleHog
316
+ docker run --rm -v "$(pwd):/repo" \
317
+ trufflesecurity/trufflehog:latest \
318
+ filesystem --directory=/repo
319
+
320
+ if [ $? -ne 0 ]; then
321
+ echo "❌ Secret detected! Commit blocked."
322
+ exit 1
323
+ fi
324
+ ```
325
+
326
+ ### CI/CD Secret Scanning
327
+
328
+ ```yaml
329
+ secret-scan:
330
+ stage: security
331
+ image: trufflesecurity/trufflehog:latest
332
+ script:
333
+ - trufflehog filesystem .
334
+ allow_failure: false
335
+ ```
336
+
337
+ ## Related Skills
338
+
339
+ - `github-actions-templates` - For GitHub Actions integration
340
+ - `gitlab-ci-patterns` - For GitLab CI integration
341
+ - `deployment-pipeline-design` - For pipeline architecture
@@ -0,0 +1,385 @@
1
+ ---
2
+ name: service-mesh-observability
3
+ description: Implement comprehensive observability for service meshes including distributed tracing, metrics, and visualization. Use when setting up mesh monitoring, debugging latency issues, or implementing SLOs for service communication.
4
+ ---
5
+
6
+ # Service Mesh Observability
7
+
8
+ Complete guide to observability patterns for Istio, Linkerd, and service mesh deployments.
9
+
10
+ ## When to Use This Skill
11
+
12
+ - Setting up distributed tracing across services
13
+ - Implementing service mesh metrics and dashboards
14
+ - Debugging latency and error issues
15
+ - Defining SLOs for service communication
16
+ - Visualizing service dependencies
17
+ - Troubleshooting mesh connectivity
18
+
19
+ ## Core Concepts
20
+
21
+ ### 1. Three Pillars of Observability
22
+
23
+ ```
24
+ ┌─────────────────────────────────────────────────────┐
25
+ │ Observability │
26
+ ├─────────────────┬─────────────────┬─────────────────┤
27
+ │ Metrics │ Traces │ Logs │
28
+ │ │ │ │
29
+ │ • Request rate │ • Span context │ • Access logs │
30
+ │ • Error rate │ • Latency │ • Error details │
31
+ │ • Latency P50 │ • Dependencies │ • Debug info │
32
+ │ • Saturation │ • Bottlenecks │ • Audit trail │
33
+ └─────────────────┴─────────────────┴─────────────────┘
34
+ ```
35
+
36
+ ### 2. Golden Signals for Mesh
37
+
38
+ | Signal | Description | Alert Threshold |
39
+ | -------------- | ------------------------- | ----------------- |
40
+ | **Latency** | Request duration P50, P99 | P99 > 500ms |
41
+ | **Traffic** | Requests per second | Anomaly detection |
42
+ | **Errors** | 5xx error rate | > 1% |
43
+ | **Saturation** | Resource utilization | > 80% |
44
+
45
+ ## Templates
46
+
47
+ ### Template 1: Istio with Prometheus & Grafana
48
+
49
+ ```yaml
50
+ # Install Prometheus
51
+ apiVersion: v1
52
+ kind: ConfigMap
53
+ metadata:
54
+ name: prometheus
55
+ namespace: istio-system
56
+ data:
57
+ prometheus.yml: |
58
+ global:
59
+ scrape_interval: 15s
60
+ scrape_configs:
61
+ - job_name: 'istio-mesh'
62
+ kubernetes_sd_configs:
63
+ - role: endpoints
64
+ namespaces:
65
+ names:
66
+ - istio-system
67
+ relabel_configs:
68
+ - source_labels: [__meta_kubernetes_service_name]
69
+ action: keep
70
+ regex: istio-telemetry
71
+ ---
72
+ # ServiceMonitor for Prometheus Operator
73
+ apiVersion: monitoring.coreos.com/v1
74
+ kind: ServiceMonitor
75
+ metadata:
76
+ name: istio-mesh
77
+ namespace: istio-system
78
+ spec:
79
+ selector:
80
+ matchLabels:
81
+ app: istiod
82
+ endpoints:
83
+ - port: http-monitoring
84
+ interval: 15s
85
+ ```
86
+
87
+ ### Template 2: Key Istio Metrics Queries
88
+
89
+ ```promql
90
+ # Request rate by service
91
+ sum(rate(istio_requests_total{reporter="destination"}[5m])) by (destination_service_name)
92
+
93
+ # Error rate (5xx)
94
+ sum(rate(istio_requests_total{reporter="destination", response_code=~"5.."}[5m]))
95
+ / sum(rate(istio_requests_total{reporter="destination"}[5m])) * 100
96
+
97
+ # P99 latency
98
+ histogram_quantile(0.99,
99
+ sum(rate(istio_request_duration_milliseconds_bucket{reporter="destination"}[5m]))
100
+ by (le, destination_service_name))
101
+
102
+ # TCP connections
103
+ sum(istio_tcp_connections_opened_total{reporter="destination"}) by (destination_service_name)
104
+
105
+ # Request size
106
+ histogram_quantile(0.99,
107
+ sum(rate(istio_request_bytes_bucket{reporter="destination"}[5m]))
108
+ by (le, destination_service_name))
109
+ ```
110
+
111
+ ### Template 3: Jaeger Distributed Tracing
112
+
113
+ ```yaml
114
+ # Jaeger installation for Istio
115
+ apiVersion: install.istio.io/v1alpha1
116
+ kind: IstioOperator
117
+ spec:
118
+ meshConfig:
119
+ enableTracing: true
120
+ defaultConfig:
121
+ tracing:
122
+ sampling: 100.0 # 100% in dev, lower in prod
123
+ zipkin:
124
+ address: jaeger-collector.istio-system:9411
125
+ ---
126
+ # Jaeger deployment
127
+ apiVersion: apps/v1
128
+ kind: Deployment
129
+ metadata:
130
+ name: jaeger
131
+ namespace: istio-system
132
+ spec:
133
+ selector:
134
+ matchLabels:
135
+ app: jaeger
136
+ template:
137
+ metadata:
138
+ labels:
139
+ app: jaeger
140
+ spec:
141
+ containers:
142
+ - name: jaeger
143
+ image: jaegertracing/all-in-one:1.50
144
+ ports:
145
+ - containerPort: 5775 # UDP
146
+ - containerPort: 6831 # Thrift
147
+ - containerPort: 6832 # Thrift
148
+ - containerPort: 5778 # Config
149
+ - containerPort: 16686 # UI
150
+ - containerPort: 14268 # HTTP
151
+ - containerPort: 14250 # gRPC
152
+ - containerPort: 9411 # Zipkin
153
+ env:
154
+ - name: COLLECTOR_ZIPKIN_HOST_PORT
155
+ value: ":9411"
156
+ ```
157
+
158
+ ### Template 4: Linkerd Viz Dashboard
159
+
160
+ ```bash
161
+ # Install Linkerd viz extension
162
+ linkerd viz install | kubectl apply -f -
163
+
164
+ # Access dashboard
165
+ linkerd viz dashboard
166
+
167
+ # CLI commands for observability
168
+ # Top requests
169
+ linkerd viz top deploy/my-app
170
+
171
+ # Per-route metrics
172
+ linkerd viz routes deploy/my-app --to deploy/backend
173
+
174
+ # Live traffic inspection
175
+ linkerd viz tap deploy/my-app --to deploy/backend
176
+
177
+ # Service edges (dependencies)
178
+ linkerd viz edges deployment -n my-namespace
179
+ ```
180
+
181
+ ### Template 5: Grafana Dashboard JSON
182
+
183
+ ```json
184
+ {
185
+ "dashboard": {
186
+ "title": "Service Mesh Overview",
187
+ "panels": [
188
+ {
189
+ "title": "Request Rate",
190
+ "type": "graph",
191
+ "targets": [
192
+ {
193
+ "expr": "sum(rate(istio_requests_total{reporter=\"destination\"}[5m])) by (destination_service_name)",
194
+ "legendFormat": "{{destination_service_name}}"
195
+ }
196
+ ]
197
+ },
198
+ {
199
+ "title": "Error Rate",
200
+ "type": "gauge",
201
+ "targets": [
202
+ {
203
+ "expr": "sum(rate(istio_requests_total{response_code=~\"5..\"}[5m])) / sum(rate(istio_requests_total[5m])) * 100"
204
+ }
205
+ ],
206
+ "fieldConfig": {
207
+ "defaults": {
208
+ "thresholds": {
209
+ "steps": [
210
+ { "value": 0, "color": "green" },
211
+ { "value": 1, "color": "yellow" },
212
+ { "value": 5, "color": "red" }
213
+ ]
214
+ }
215
+ }
216
+ }
217
+ },
218
+ {
219
+ "title": "P99 Latency",
220
+ "type": "graph",
221
+ "targets": [
222
+ {
223
+ "expr": "histogram_quantile(0.99, sum(rate(istio_request_duration_milliseconds_bucket{reporter=\"destination\"}[5m])) by (le, destination_service_name))",
224
+ "legendFormat": "{{destination_service_name}}"
225
+ }
226
+ ]
227
+ },
228
+ {
229
+ "title": "Service Topology",
230
+ "type": "nodeGraph",
231
+ "targets": [
232
+ {
233
+ "expr": "sum(rate(istio_requests_total{reporter=\"destination\"}[5m])) by (source_workload, destination_service_name)"
234
+ }
235
+ ]
236
+ }
237
+ ]
238
+ }
239
+ }
240
+ ```
241
+
242
+ ### Template 6: Kiali Service Mesh Visualization
243
+
244
+ ```yaml
245
+ # Kiali installation
246
+ apiVersion: kiali.io/v1alpha1
247
+ kind: Kiali
248
+ metadata:
249
+ name: kiali
250
+ namespace: istio-system
251
+ spec:
252
+ auth:
253
+ strategy: anonymous # or openid, token
254
+ deployment:
255
+ accessible_namespaces:
256
+ - "**"
257
+ external_services:
258
+ prometheus:
259
+ url: http://prometheus.istio-system:9090
260
+ tracing:
261
+ url: http://jaeger-query.istio-system:16686
262
+ grafana:
263
+ url: http://grafana.istio-system:3000
264
+ ```
265
+
266
+ ### Template 7: OpenTelemetry Integration
267
+
268
+ ```yaml
269
+ # OpenTelemetry Collector for mesh
270
+ apiVersion: v1
271
+ kind: ConfigMap
272
+ metadata:
273
+ name: otel-collector-config
274
+ data:
275
+ config.yaml: |
276
+ receivers:
277
+ otlp:
278
+ protocols:
279
+ grpc:
280
+ endpoint: 0.0.0.0:4317
281
+ http:
282
+ endpoint: 0.0.0.0:4318
283
+ zipkin:
284
+ endpoint: 0.0.0.0:9411
285
+
286
+ processors:
287
+ batch:
288
+ timeout: 10s
289
+
290
+ exporters:
291
+ jaeger:
292
+ endpoint: jaeger-collector:14250
293
+ tls:
294
+ insecure: true
295
+ prometheus:
296
+ endpoint: 0.0.0.0:8889
297
+
298
+ service:
299
+ pipelines:
300
+ traces:
301
+ receivers: [otlp, zipkin]
302
+ processors: [batch]
303
+ exporters: [jaeger]
304
+ metrics:
305
+ receivers: [otlp]
306
+ processors: [batch]
307
+ exporters: [prometheus]
308
+ ---
309
+ # Istio Telemetry v2 with OTel
310
+ apiVersion: telemetry.istio.io/v1alpha1
311
+ kind: Telemetry
312
+ metadata:
313
+ name: mesh-default
314
+ namespace: istio-system
315
+ spec:
316
+ tracing:
317
+ - providers:
318
+ - name: otel
319
+ randomSamplingPercentage: 10
320
+ ```
321
+
322
+ ## Alerting Rules
323
+
324
+ ```yaml
325
+ apiVersion: monitoring.coreos.com/v1
326
+ kind: PrometheusRule
327
+ metadata:
328
+ name: mesh-alerts
329
+ namespace: istio-system
330
+ spec:
331
+ groups:
332
+ - name: mesh.rules
333
+ rules:
334
+ - alert: HighErrorRate
335
+ expr: |
336
+ sum(rate(istio_requests_total{response_code=~"5.."}[5m])) by (destination_service_name)
337
+ / sum(rate(istio_requests_total[5m])) by (destination_service_name) > 0.05
338
+ for: 5m
339
+ labels:
340
+ severity: critical
341
+ annotations:
342
+ summary: "High error rate for {{ $labels.destination_service_name }}"
343
+
344
+ - alert: HighLatency
345
+ expr: |
346
+ histogram_quantile(0.99, sum(rate(istio_request_duration_milliseconds_bucket[5m]))
347
+ by (le, destination_service_name)) > 1000
348
+ for: 5m
349
+ labels:
350
+ severity: warning
351
+ annotations:
352
+ summary: "High P99 latency for {{ $labels.destination_service_name }}"
353
+
354
+ - alert: MeshCertExpiring
355
+ expr: |
356
+ (certmanager_certificate_expiration_timestamp_seconds - time()) / 86400 < 7
357
+ labels:
358
+ severity: warning
359
+ annotations:
360
+ summary: "Mesh certificate expiring in less than 7 days"
361
+ ```
362
+
363
+ ## Best Practices
364
+
365
+ ### Do's
366
+
367
+ - **Sample appropriately** - 100% in dev, 1-10% in prod
368
+ - **Use trace context** - Propagate headers consistently
369
+ - **Set up alerts** - For golden signals
370
+ - **Correlate metrics/traces** - Use exemplars
371
+ - **Retain strategically** - Hot/cold storage tiers
372
+
373
+ ### Don'ts
374
+
375
+ - **Don't over-sample** - Storage costs add up
376
+ - **Don't ignore cardinality** - Limit label values
377
+ - **Don't skip dashboards** - Visualize dependencies
378
+ - **Don't forget costs** - Monitor observability costs
379
+
380
+ ## Resources
381
+
382
+ - [Istio Observability](https://istio.io/latest/docs/tasks/observability/)
383
+ - [Linkerd Observability](https://linkerd.io/2.14/features/dashboard/)
384
+ - [OpenTelemetry](https://opentelemetry.io/)
385
+ - [Kiali](https://kiali.io/)