@sylix/coworker 2.0.11 → 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 (169) hide show
  1. package/dist/commands/slash/config.d.ts.map +1 -1
  2. package/dist/commands/slash/config.js +22 -4
  3. package/dist/commands/slash/config.js.map +1 -1
  4. package/dist/core/CoWorkerAgent.d.ts.map +1 -1
  5. package/dist/core/CoWorkerAgent.js +6 -3
  6. package/dist/core/CoWorkerAgent.js.map +1 -1
  7. package/dist/skills/defaults/accessibility/screen-reader-testing.md +545 -0
  8. package/dist/skills/defaults/accessibility/wcag-audit-patterns.md +555 -0
  9. package/dist/skills/defaults/ai-ml/rag.md +276 -0
  10. package/dist/skills/defaults/backend-development/api-design-principles.md +528 -0
  11. package/dist/skills/defaults/backend-development/api-design.md +285 -0
  12. package/dist/skills/defaults/backend-development/architecture-patterns.md +494 -0
  13. package/dist/skills/defaults/backend-development/async-python.md +237 -0
  14. package/dist/skills/defaults/backend-development/auth-implementation-patterns.md +638 -0
  15. package/dist/skills/defaults/backend-development/bazel-build-optimization.md +387 -0
  16. package/dist/skills/defaults/backend-development/billing-automation/SKILL.md +566 -0
  17. package/dist/skills/defaults/backend-development/code-review-excellence.md +538 -0
  18. package/dist/skills/defaults/backend-development/cqrs-implementation.md +554 -0
  19. package/dist/skills/defaults/backend-development/database-design.md +305 -0
  20. package/dist/skills/defaults/backend-development/debugging-strategies.md +536 -0
  21. package/dist/skills/defaults/backend-development/e2e-testing-patterns.md +544 -0
  22. package/dist/skills/defaults/backend-development/error-handling-patterns.md +641 -0
  23. package/dist/skills/defaults/backend-development/fastapi-templates.md +559 -0
  24. package/dist/skills/defaults/backend-development/fastapi.md +309 -0
  25. package/dist/skills/defaults/backend-development/git-advanced-workflows.md +405 -0
  26. package/dist/skills/defaults/backend-development/microservices-patterns.md +595 -0
  27. package/dist/skills/defaults/backend-development/microservices.md +284 -0
  28. package/dist/skills/defaults/backend-development/monorepo-management.md +623 -0
  29. package/dist/skills/defaults/backend-development/nodejs-backend-patterns.md +1048 -0
  30. package/dist/skills/defaults/backend-development/nx-workspace-patterns.md +457 -0
  31. package/dist/skills/defaults/backend-development/paypal-integration/SKILL.md +478 -0
  32. package/dist/skills/defaults/backend-development/pci-compliance/SKILL.md +480 -0
  33. package/dist/skills/defaults/backend-development/python-anti-patterns.md +349 -0
  34. package/dist/skills/defaults/backend-development/python-background-jobs.md +364 -0
  35. package/dist/skills/defaults/backend-development/python-code-style.md +360 -0
  36. package/dist/skills/defaults/backend-development/python-configuration.md +368 -0
  37. package/dist/skills/defaults/backend-development/python-design-patterns.md +296 -0
  38. package/dist/skills/defaults/backend-development/python-error-handling.md +323 -0
  39. package/dist/skills/defaults/backend-development/python-packaging.md +887 -0
  40. package/dist/skills/defaults/backend-development/python-performance-optimization.md +874 -0
  41. package/dist/skills/defaults/backend-development/python-project-structure.md +252 -0
  42. package/dist/skills/defaults/backend-development/python-resilience.md +376 -0
  43. package/dist/skills/defaults/backend-development/python-resource-management.md +421 -0
  44. package/dist/skills/defaults/backend-development/python-type-safety.md +428 -0
  45. package/dist/skills/defaults/backend-development/sql-optimization-patterns.md +509 -0
  46. package/dist/skills/defaults/backend-development/stripe-integration/SKILL.md +522 -0
  47. package/dist/skills/defaults/backend-development/turborepo-caching.md +376 -0
  48. package/dist/skills/defaults/blockchain/defi-protocol-templates.md +430 -0
  49. package/dist/skills/defaults/blockchain/nft-standards.md +364 -0
  50. package/dist/skills/defaults/blockchain/solidity-security.md +514 -0
  51. package/dist/skills/defaults/blockchain/web3-testing.md +360 -0
  52. package/dist/skills/defaults/business/competitive-landscape/SKILL.md +527 -0
  53. package/dist/skills/defaults/business/market-sizing-analysis/SKILL.md +451 -0
  54. package/dist/skills/defaults/business/startup-financial-modeling/SKILL.md +494 -0
  55. package/dist/skills/defaults/business/startup-metrics-framework/SKILL.md +564 -0
  56. package/dist/skills/defaults/business/team-composition-analysis.md +437 -0
  57. package/dist/skills/defaults/compliance/employment-contract-templates/SKILL.md +527 -0
  58. package/dist/skills/defaults/compliance/gdpr-data-handling/SKILL.md +630 -0
  59. package/dist/skills/defaults/data-engineering/airflow-dag-patterns.md +436 -0
  60. package/dist/skills/defaults/data-engineering/airflow.md +519 -0
  61. package/dist/skills/defaults/data-engineering/data-quality.md +583 -0
  62. package/dist/skills/defaults/data-engineering/dbt-transformation-patterns.md +482 -0
  63. package/dist/skills/defaults/data-engineering/dbt.md +556 -0
  64. package/dist/skills/defaults/data-engineering/ml-pipeline-workflow/SKILL.md +247 -0
  65. package/dist/skills/defaults/data-engineering/spark-optimization.md +348 -0
  66. package/dist/skills/defaults/data-engineering/spark.md +411 -0
  67. package/dist/skills/defaults/database/postgresql.md +202 -0
  68. package/dist/skills/defaults/debugging/systematic-debugging.md +249 -0
  69. package/dist/skills/defaults/devops/architecture-decision-records.md +448 -0
  70. package/dist/skills/defaults/devops/changelog-automation.md +580 -0
  71. package/dist/skills/defaults/devops/cicd.md +314 -0
  72. package/dist/skills/defaults/devops/cloud.md +263 -0
  73. package/dist/skills/defaults/devops/code-review-excellence.md +299 -0
  74. package/dist/skills/defaults/devops/cost-optimization.md +295 -0
  75. package/dist/skills/defaults/devops/deployment-pipeline-design.md +356 -0
  76. package/dist/skills/defaults/devops/docker.md +281 -0
  77. package/dist/skills/defaults/devops/git-workflows.md +205 -0
  78. package/dist/skills/defaults/devops/github-actions.md +311 -0
  79. package/dist/skills/defaults/devops/gitlab-ci-patterns.md +266 -0
  80. package/dist/skills/defaults/devops/hybrid-cloud-networking.md +241 -0
  81. package/dist/skills/defaults/devops/istio-traffic-management.md +327 -0
  82. package/dist/skills/defaults/devops/kubernetes.md +339 -0
  83. package/dist/skills/defaults/devops/linkerd-patterns.md +311 -0
  84. package/dist/skills/defaults/devops/multi-cloud-architecture.md +181 -0
  85. package/dist/skills/defaults/devops/observability.md +243 -0
  86. package/dist/skills/defaults/devops/openapi-spec-generation.md +1024 -0
  87. package/dist/skills/defaults/devops/postmortem-writing.md +396 -0
  88. package/dist/skills/defaults/devops/prometheus-configuration.md +265 -0
  89. package/dist/skills/defaults/devops/secrets-management.md +341 -0
  90. package/dist/skills/defaults/devops/service-mesh-observability.md +385 -0
  91. package/dist/skills/defaults/devops/terraform-module-library.md +244 -0
  92. package/dist/skills/defaults/finance/backtesting-frameworks/SKILL.md +663 -0
  93. package/dist/skills/defaults/finance/risk-metrics-calculation/SKILL.md +557 -0
  94. package/dist/skills/defaults/frontend/accessibility-compliance.md +420 -0
  95. package/dist/skills/defaults/frontend/design-system-patterns.md +337 -0
  96. package/dist/skills/defaults/frontend/interaction-design.md +327 -0
  97. package/dist/skills/defaults/frontend/javascript.md +311 -0
  98. package/dist/skills/defaults/frontend/modern-javascript-patterns.md +927 -0
  99. package/dist/skills/defaults/frontend/react-native-design.md +440 -0
  100. package/dist/skills/defaults/frontend/react.md +345 -0
  101. package/dist/skills/defaults/frontend/responsive-design.md +472 -0
  102. package/dist/skills/defaults/frontend/tailwind-design-system.md +337 -0
  103. package/dist/skills/defaults/frontend/typescript-advanced-types.md +724 -0
  104. package/dist/skills/defaults/frontend/typescript.md +334 -0
  105. package/dist/skills/defaults/frontend/visual-design-foundations.md +326 -0
  106. package/dist/skills/defaults/frontend/web-component-design.md +279 -0
  107. package/dist/skills/defaults/game-development/godot-gdscript-patterns.md +188 -0
  108. package/dist/skills/defaults/game-development/unity-ecs-patterns.md +594 -0
  109. package/dist/skills/defaults/kubernetes/gitops-workflow.md +285 -0
  110. package/dist/skills/defaults/kubernetes/gitops.md +280 -0
  111. package/dist/skills/defaults/kubernetes/helm-chart-scaffolding.md +553 -0
  112. package/dist/skills/defaults/kubernetes/helm.md +343 -0
  113. package/dist/skills/defaults/kubernetes/k8s-manifest-generator.md +501 -0
  114. package/dist/skills/defaults/kubernetes/k8s-security-policies.md +342 -0
  115. package/dist/skills/defaults/kubernetes/manifests.md +330 -0
  116. package/dist/skills/defaults/kubernetes/security.md +337 -0
  117. package/dist/skills/defaults/llm-application/embedding-strategies.md +608 -0
  118. package/dist/skills/defaults/llm-application/hybrid-search-implementation.md +570 -0
  119. package/dist/skills/defaults/llm-application/hybrid-search.md +570 -0
  120. package/dist/skills/defaults/llm-application/langchain-architecture.md +666 -0
  121. package/dist/skills/defaults/llm-application/langchain.md +259 -0
  122. package/dist/skills/defaults/llm-application/llm-evaluation.md +695 -0
  123. package/dist/skills/defaults/llm-application/prompt-engineering-patterns.md +449 -0
  124. package/dist/skills/defaults/llm-application/prompt-engineering.md +219 -0
  125. package/dist/skills/defaults/llm-application/rag-implementation.md +434 -0
  126. package/dist/skills/defaults/llm-application/similarity-search-patterns.md +560 -0
  127. package/dist/skills/defaults/llm-application/similarity-search.md +560 -0
  128. package/dist/skills/defaults/llm-application/vector-index-tuning.md +523 -0
  129. package/dist/skills/defaults/mobile/mobile-android-design.md +440 -0
  130. package/dist/skills/defaults/mobile/mobile-ios-design.md +266 -0
  131. package/dist/skills/defaults/monitoring/distributed-tracing.md +436 -0
  132. package/dist/skills/defaults/monitoring/grafana-dashboards.md +370 -0
  133. package/dist/skills/defaults/monitoring/prometheus-configuration.md +379 -0
  134. package/dist/skills/defaults/monitoring/slo-implementation.md +323 -0
  135. package/dist/skills/defaults/refactoring/code-refactoring.md +349 -0
  136. package/dist/skills/defaults/security/anti-reversing-techniques/SKILL.md +559 -0
  137. package/dist/skills/defaults/security/auditor.md +168 -0
  138. package/dist/skills/defaults/security/binary-analysis-patterns/SKILL.md +438 -0
  139. package/dist/skills/defaults/security/memory-forensics/SKILL.md +483 -0
  140. package/dist/skills/defaults/security/mtls-configuration.md +349 -0
  141. package/dist/skills/defaults/security/protocol-reverse-engineering/SKILL.md +520 -0
  142. package/dist/skills/defaults/security/sast-configuration.md +182 -0
  143. package/dist/skills/defaults/security/security.md +313 -0
  144. package/dist/skills/defaults/security/stride-analysis.md +273 -0
  145. package/dist/skills/defaults/security/threat-mitigation-mapping.md +290 -0
  146. package/dist/skills/defaults/systems/bash-defensive-patterns/SKILL.md +539 -0
  147. package/dist/skills/defaults/systems/bats-testing-patterns/SKILL.md +631 -0
  148. package/dist/skills/defaults/systems/go-concurrency-patterns.md +657 -0
  149. package/dist/skills/defaults/systems/memory-safety-patterns.md +605 -0
  150. package/dist/skills/defaults/systems/rust-async-patterns.md +519 -0
  151. package/dist/skills/defaults/systems/shellcheck-configuration/SKILL.md +456 -0
  152. package/dist/skills/defaults/team-collaboration/multi-reviewer-patterns.md +126 -0
  153. package/dist/skills/defaults/team-collaboration/parallel-feature-development.md +151 -0
  154. package/dist/skills/defaults/testing/javascript-testing-patterns.md +1021 -0
  155. package/dist/skills/defaults/testing/python-testing-patterns.md +351 -0
  156. package/dist/skills/defaults/testing/testing.md +332 -0
  157. package/dist/skills/defaults/workflows/context-driven-development.md +384 -0
  158. package/dist/skills/defaults/workflows/track-management.md +592 -0
  159. package/dist/skills/defaults/workflows/workflow-patterns.md +622 -0
  160. package/dist/skills/index.d.ts +11 -0
  161. package/dist/skills/index.d.ts.map +1 -0
  162. package/dist/skills/index.js +129 -0
  163. package/dist/skills/index.js.map +1 -0
  164. package/dist/utils/character.js +4 -4
  165. package/dist/utils/character.js.map +1 -1
  166. package/dist/utils/inputbar.d.ts.map +1 -1
  167. package/dist/utils/inputbar.js +7 -0
  168. package/dist/utils/inputbar.js.map +1 -1
  169. package/package.json +1 -1
@@ -0,0 +1,205 @@
1
+ ---
2
+ name: git-workflows
3
+ description: Master Git workflows including branching strategies, PR best practices, and collaborative development.
4
+ ---
5
+
6
+ # Git Workflows — CoWorker Edition
7
+
8
+ Collaborate effectively with Git.
9
+
10
+ ## When to Use This Skill
11
+
12
+ - Setting up project workflows
13
+ - Managing branches
14
+ - Code reviews
15
+ - Release management
16
+
17
+ ## Core Concepts
18
+
19
+ ### 1. Branching Strategy
20
+
21
+ ```
22
+ main (production)
23
+
24
+ ├── develop (integration)
25
+ │ │
26
+ │ ├── feature/user-auth
27
+ │ ├── feature/payments
28
+ │ └── bugfix/login-fix
29
+
30
+ └── release/v1.2.0
31
+
32
+ └── hotfix/security-patch
33
+ ```
34
+
35
+ ### 2. Commit Messages
36
+
37
+ ```bash
38
+ # Good commit messages
39
+ git commit -m "feat: add user authentication flow"
40
+
41
+ # Conventional commits format
42
+ # type(scope): description
43
+
44
+ # Types:
45
+ # feat: New feature
46
+ # fix: Bug fix
47
+ # docs: Documentation
48
+ # style: Formatting
49
+ # refactor: Code restructuring
50
+ # test: Tests
51
+ # chore: Maintenance
52
+
53
+ # Examples:
54
+ git commit -m "fix: resolve memory leak in data processor"
55
+ git commit -m "docs: update API documentation"
56
+ git commit -m "refactor(auth): extract token validation"
57
+ git commit -m "test(api): add integration tests for users"
58
+ ```
59
+
60
+ ### 3. Working with Branches
61
+
62
+ ```bash
63
+ # Create feature branch
64
+ git checkout -b feature/user-dashboard
65
+
66
+ # Keep branch updated with main
67
+ git fetch origin
68
+ git rebase origin/main
69
+
70
+ # Interactive rebase to clean commits
71
+ git rebase -i HEAD~3
72
+
73
+ # Squash commits
74
+ git rebase -i main
75
+ # Change 'pick' to 'squash' for commits to combine
76
+ ```
77
+
78
+ ### 4. Pull Request Workflow
79
+
80
+ ```bash
81
+ # Update branch before PR
82
+ git fetch origin
83
+ git rebase origin/main
84
+
85
+ # Push branch
86
+ git push -u origin feature/user-dashboard
87
+
88
+ # Create PR with good description
89
+ # - What does this PR do?
90
+ # - Why is this change needed?
91
+ # - How was it tested?
92
+ # - Screenshots if UI changes
93
+
94
+ # Update PR with additional commits
95
+ git push
96
+
97
+ # Squash merge on GitHub/GitLab
98
+ ```
99
+
100
+ ### 5. Code Review Practices
101
+
102
+ ```bash
103
+ # Review own PR first
104
+ git diff main...HEAD # What changed since main
105
+ git log --oneline main..HEAD # Commit history
106
+
107
+ # Good PR description
108
+ """
109
+ ## Summary
110
+ Implements user dashboard with analytics.
111
+
112
+ ## Changes
113
+ - Add Dashboard component
114
+ - Add analytics API endpoints
115
+ - Add chart visualizations
116
+
117
+ ## Testing
118
+ - [ ] Unit tests pass
119
+ - [ ] Manual testing on staging
120
+ - [ ] Works on mobile
121
+
122
+ ## Screenshots
123
+ [attach screenshots]
124
+ """
125
+ ```
126
+
127
+ ### 6. Git Hooks
128
+
129
+ ```bash
130
+ # .git/hooks/pre-commit
131
+ #!/bin/sh
132
+ npm run lint
133
+ npm run typecheck
134
+
135
+ # .git/hooks/commit-msg
136
+ #!/bin/sh
137
+ COMMIT_MSG=$(cat "$1")
138
+ PATTERN="^(feat|fix|docs|refactor|test|chore)(\(.+\))?: .{1,50}"
139
+
140
+ if ! echo "$COMMIT_MSG" | grep -qE "$PATTERN"; then
141
+ echo "Invalid commit message format"
142
+ exit 1
143
+ fi
144
+ ```
145
+
146
+ ```yaml
147
+ # GitHub Actions - enforce conventional commits
148
+ name: Enforce Conventional Commits
149
+
150
+ on:
151
+ pull_request:
152
+ branches: [main]
153
+
154
+ jobs:
155
+ commitlint:
156
+ runs-on: ubuntu-latest
157
+ steps:
158
+ - uses: actions/checkout@v4
159
+ with:
160
+ fetch-depth: 0
161
+
162
+ - uses: actions/setup-node@v4
163
+ with:
164
+ node-version: '20'
165
+
166
+ - run: npx commitlint --edit "${{ github.event.pull_request.title }}"
167
+ ```
168
+
169
+ ### 7. Undoing Changes
170
+
171
+ ```bash
172
+ # Unstage files
173
+ git reset HEAD file.txt
174
+
175
+ # Undo last commit (keep changes)
176
+ git reset --soft HEAD~1
177
+
178
+ # Undo last commit (discard changes)
179
+ git reset --hard HEAD~1
180
+
181
+ # Revert a commit (creates new commit)
182
+ git revert abc123
183
+
184
+ # Reset to specific state
185
+ git checkout -- file.txt # Discard local changes
186
+ git checkout HEAD -- file.txt # Reset to last commit
187
+ ```
188
+
189
+ ## Best Practices
190
+
191
+ 1. **Atomic commits** - One logical change per commit
192
+ 2. **Descriptive messages** - Clear and concise
193
+ 3. **Small PRs** - Easier to review
194
+ 4. **Keep main clean** - Never commit to main directly
195
+ 5. **Rebase over merge** - Clean history
196
+ 6. **Squash feature branches** - Single commit per feature
197
+
198
+ ## Common Mistakes
199
+
200
+ - Committing to main
201
+ - Large PRs
202
+ - Generic commit messages
203
+ - Not testing before push
204
+ - Force pushing to shared branches
205
+ - Not cleaning up merged branches
@@ -0,0 +1,311 @@
1
+ ---
2
+ name: github-actions-templates
3
+ description: Create production-ready GitHub Actions workflows for automated testing, building, and deploying applications. Use when setting up CI/CD with GitHub Actions, automating development workflows, or creating reusable workflow templates.
4
+ ---
5
+
6
+ # GitHub Actions Templates
7
+
8
+ Production-ready GitHub Actions workflow patterns for testing, building, and deploying applications.
9
+
10
+ ## When to Use This Skill
11
+
12
+ - Automate testing and deployment
13
+ - Build Docker images and push to registries
14
+ - Deploy to Kubernetes clusters
15
+ - Run security scans
16
+ - Implement matrix builds for multiple environments
17
+
18
+ ## Common Workflow Patterns
19
+
20
+ ### Pattern 1: Test Workflow
21
+
22
+ ```yaml
23
+ name: Test
24
+
25
+ on:
26
+ push:
27
+ branches: [main, develop]
28
+ pull_request:
29
+ branches: [main]
30
+
31
+ jobs:
32
+ test:
33
+ runs-on: ubuntu-latest
34
+
35
+ strategy:
36
+ matrix:
37
+ node-version: [18.x, 20.x]
38
+
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+
42
+ - name: Use Node.js ${{ matrix.node-version }}
43
+ uses: actions/setup-node@v4
44
+ with:
45
+ node-version: ${{ matrix.node-version }}
46
+ cache: "npm"
47
+
48
+ - name: Install dependencies
49
+ run: npm ci
50
+
51
+ - name: Run linter
52
+ run: npm run lint
53
+
54
+ - name: Run tests
55
+ run: npm test
56
+
57
+ - name: Upload coverage
58
+ uses: codecov/codecov-action@v3
59
+ with:
60
+ files: ./coverage/lcov.info
61
+ ```
62
+
63
+ ### Pattern 2: Build and Push Docker Image
64
+
65
+ ```yaml
66
+ name: Build and Push
67
+
68
+ on:
69
+ push:
70
+ branches: [main]
71
+ tags: ["v*"]
72
+
73
+ env:
74
+ REGISTRY: ghcr.io
75
+ IMAGE_NAME: ${{ github.repository }}
76
+
77
+ jobs:
78
+ build:
79
+ runs-on: ubuntu-latest
80
+ permissions:
81
+ contents: read
82
+ packages: write
83
+
84
+ steps:
85
+ - uses: actions/checkout@v4
86
+
87
+ - name: Log in to Container Registry
88
+ uses: docker/login-action@v3
89
+ with:
90
+ registry: ${{ env.REGISTRY }}
91
+ username: ${{ github.actor }}
92
+ password: ${{ secrets.GITHUB_TOKEN }}
93
+
94
+ - name: Extract metadata
95
+ id: meta
96
+ uses: docker/metadata-action@v5
97
+ with:
98
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
99
+ tags: |
100
+ type=ref,event=branch
101
+ type=ref,event=pr
102
+ type=semver,pattern={{version}}
103
+ type=semver,pattern={{major}}.{{minor}}
104
+
105
+ - name: Build and push
106
+ uses: docker/build-push-action@v5
107
+ with:
108
+ context: .
109
+ push: true
110
+ tags: ${{ steps.meta.outputs.tags }}
111
+ labels: ${{ steps.meta.outputs.labels }}
112
+ cache-from: type=gha
113
+ cache-to: type=gha,mode=max
114
+ ```
115
+
116
+ ### Pattern 3: Deploy to Kubernetes
117
+
118
+ ```yaml
119
+ name: Deploy to Kubernetes
120
+
121
+ on:
122
+ push:
123
+ branches: [main]
124
+
125
+ jobs:
126
+ deploy:
127
+ runs-on: ubuntu-latest
128
+
129
+ steps:
130
+ - uses: actions/checkout@v4
131
+
132
+ - name: Configure AWS credentials
133
+ uses: aws-actions/configure-aws-credentials@v4
134
+ with:
135
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
136
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
137
+ aws-region: us-west-2
138
+
139
+ - name: Update kubeconfig
140
+ run: |
141
+ aws eks update-kubeconfig --name production-cluster --region us-west-2
142
+
143
+ - name: Deploy to Kubernetes
144
+ run: |
145
+ kubectl apply -f k8s/
146
+ kubectl rollout status deployment/my-app -n production
147
+ kubectl get services -n production
148
+
149
+ - name: Verify deployment
150
+ run: |
151
+ kubectl get pods -n production
152
+ kubectl describe deployment my-app -n production
153
+ ```
154
+
155
+ ### Pattern 4: Matrix Build
156
+
157
+ ```yaml
158
+ name: Matrix Build
159
+
160
+ on: [push, pull_request]
161
+
162
+ jobs:
163
+ build:
164
+ runs-on: ${{ matrix.os }}
165
+
166
+ strategy:
167
+ matrix:
168
+ os: [ubuntu-latest, macos-latest, windows-latest]
169
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
170
+
171
+ steps:
172
+ - uses: actions/checkout@v4
173
+
174
+ - name: Set up Python
175
+ uses: actions/setup-python@v5
176
+ with:
177
+ python-version: ${{ matrix.python-version }}
178
+
179
+ - name: Install dependencies
180
+ run: |
181
+ python -m pip install --upgrade pip
182
+ pip install -r requirements.txt
183
+
184
+ - name: Run tests
185
+ run: pytest
186
+ ```
187
+
188
+ ## Workflow Best Practices
189
+
190
+ 1. **Use specific action versions** (@v4, not @latest)
191
+ 2. **Cache dependencies** to speed up builds
192
+ 3. **Use secrets** for sensitive data
193
+ 4. **Implement status checks** on PRs
194
+ 5. **Use matrix builds** for multi-version testing
195
+ 6. **Set appropriate permissions**
196
+ 7. **Use reusable workflows** for common patterns
197
+ 8. **Implement approval gates** for production
198
+ 9. **Add notification steps** for failures
199
+ 10. **Use self-hosted runners** for sensitive workloads
200
+
201
+ ## Reusable Workflows
202
+
203
+ ```yaml
204
+ # .github/workflows/reusable-test.yml
205
+ name: Reusable Test Workflow
206
+
207
+ on:
208
+ workflow_call:
209
+ inputs:
210
+ node-version:
211
+ required: true
212
+ type: string
213
+ secrets:
214
+ NPM_TOKEN:
215
+ required: true
216
+
217
+ jobs:
218
+ test:
219
+ runs-on: ubuntu-latest
220
+ steps:
221
+ - uses: actions/checkout@v4
222
+ - uses: actions/setup-node@v4
223
+ with:
224
+ node-version: ${{ inputs.node-version }}
225
+ - run: npm ci
226
+ - run: npm test
227
+ ```
228
+
229
+ **Use reusable workflow:**
230
+
231
+ ```yaml
232
+ jobs:
233
+ call-test:
234
+ uses: ./.github/workflows/reusable-test.yml
235
+ with:
236
+ node-version: "20.x"
237
+ secrets:
238
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
239
+ ```
240
+
241
+ ## Security Scanning
242
+
243
+ ```yaml
244
+ name: Security Scan
245
+
246
+ on:
247
+ push:
248
+ branches: [main]
249
+ pull_request:
250
+ branches: [main]
251
+
252
+ jobs:
253
+ security:
254
+ runs-on: ubuntu-latest
255
+
256
+ steps:
257
+ - uses: actions/checkout@v4
258
+
259
+ - name: Run Trivy vulnerability scanner
260
+ uses: aquasecurity/trivy-action@master
261
+ with:
262
+ scan-type: "fs"
263
+ scan-ref: "."
264
+ format: "sarif"
265
+ output: "trivy-results.sarif"
266
+
267
+ - name: Upload Trivy results to GitHub Security
268
+ uses: github/codeql-action/upload-sarif@v2
269
+ with:
270
+ sarif_file: "trivy-results.sarif"
271
+
272
+ - name: Run Snyk Security Scan
273
+ uses: snyk/actions/node@master
274
+ env:
275
+ SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
276
+ ```
277
+
278
+ ## Deployment with Approvals
279
+
280
+ ```yaml
281
+ name: Deploy to Production
282
+
283
+ on:
284
+ push:
285
+ tags: ["v*"]
286
+
287
+ jobs:
288
+ deploy:
289
+ runs-on: ubuntu-latest
290
+ environment:
291
+ name: production
292
+ url: https://app.example.com
293
+
294
+ steps:
295
+ - uses: actions/checkout@v4
296
+
297
+ - name: Deploy application
298
+ run: |
299
+ echo "Deploying to production..."
300
+ # Deployment commands here
301
+
302
+ - name: Notify Slack
303
+ if: success()
304
+ uses: slackapi/slack-github-action@v1
305
+ with:
306
+ webhook-url: ${{ secrets.SLACK_WEBHOOK }}
307
+ payload: |
308
+ {
309
+ "text": "Deployment to production completed successfully!"
310
+ }
311
+ ```