@wipal/agent-team 1.0.0
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.
- package/.claude/rules/common/general-rules.md +141 -0
- package/.claude/rules/lessons/lessons.md +91 -0
- package/.claude/rules/role-rules/dev-fe-rules.md +146 -0
- package/.claude/rules/role-rules/sa-rules.md +226 -0
- package/.claude/skills/SKILL-INDEX.md +299 -0
- package/.claude/skills/community/security-validator/SKILL.md +392 -0
- package/.claude/skills/core/agent-creation/SKILL.md +338 -0
- package/.claude/skills/core/code-review/SKILL.md +154 -0
- package/.claude/skills/core/git-automation/SKILL.md +93 -0
- package/.claude/skills/core/retrospect-work/SKILL.md +172 -0
- package/.claude/skills/domain/architecture/adr-writing/SKILL.md +254 -0
- package/.claude/skills/domain/architecture/adr-writing/references/adr-best-practices.md +257 -0
- package/.claude/skills/domain/architecture/adr-writing/references/adr-examples.md +246 -0
- package/.claude/skills/domain/architecture/adr-writing/references/adr-template.md +160 -0
- package/.claude/skills/domain/architecture/architecture-patterns/SKILL.md +316 -0
- package/.claude/skills/domain/architecture/architecture-patterns/references/event-driven.md +393 -0
- package/.claude/skills/domain/architecture/architecture-patterns/references/microservices.md +315 -0
- package/.claude/skills/domain/architecture/architecture-patterns/references/monolith.md +321 -0
- package/.claude/skills/domain/architecture/architecture-patterns/references/serverless.md +457 -0
- package/.claude/skills/domain/architecture/performance-engineering/SKILL.md +227 -0
- package/.claude/skills/domain/architecture/performance-engineering/references/benchmarking.md +336 -0
- package/.claude/skills/domain/architecture/performance-engineering/references/caching-strategies.md +284 -0
- package/.claude/skills/domain/architecture/performance-engineering/references/optimization.md +298 -0
- package/.claude/skills/domain/architecture/security-architecture/SKILL.md +206 -0
- package/.claude/skills/domain/architecture/security-architecture/references/auth-patterns.md +209 -0
- package/.claude/skills/domain/architecture/security-architecture/references/compliance.md +246 -0
- package/.claude/skills/domain/architecture/security-architecture/references/threat-modeling.md +219 -0
- package/.claude/skills/domain/architecture/system-design/SKILL.md +227 -0
- package/.claude/skills/domain/architecture/system-design/references/distributed-systems.md +231 -0
- package/.claude/skills/domain/architecture/system-design/references/resilience.md +344 -0
- package/.claude/skills/domain/architecture/system-design/references/scalability.md +303 -0
- package/.claude/skills/domain/architecture/tech-selection/SKILL.md +192 -0
- package/.claude/skills/domain/architecture/tech-selection/references/build-vs-buy.md +258 -0
- package/.claude/skills/domain/architecture/tech-selection/references/evaluation-framework.md +203 -0
- package/.claude/skills/domain/architecture/tech-selection/references/tech-radar.md +257 -0
- package/.claude/skills/domain/backend/api-design/SKILL.md +121 -0
- package/.claude/skills/domain/backend/database-design/SKILL.md +156 -0
- package/.claude/skills/domain/backend/performance-be/SKILL.md +210 -0
- package/.claude/skills/domain/backend/security/SKILL.md +138 -0
- package/.claude/skills/domain/backend/testing-be/SKILL.md +203 -0
- package/.claude/skills/domain/devops/ci-cd/SKILL.md +188 -0
- package/.claude/skills/domain/devops/containerization/SKILL.md +177 -0
- package/.claude/skills/domain/devops/deployment/SKILL.md +198 -0
- package/.claude/skills/domain/devops/infrastructure-as-code/SKILL.md +178 -0
- package/.claude/skills/domain/devops/monitoring/SKILL.md +163 -0
- package/.claude/skills/domain/frontend/accessibility/SKILL.md +179 -0
- package/.claude/skills/domain/frontend/frontend-design/SKILL.md +138 -0
- package/.claude/skills/domain/frontend/performance-fe/SKILL.md +195 -0
- package/.claude/skills/domain/frontend/state-management/SKILL.md +190 -0
- package/.claude/skills/domain/frontend/testing-fe/SKILL.md +193 -0
- package/.claude/skills/domain/product/requirements-gathering/SKILL.md +136 -0
- package/.claude/skills/domain/product/roadmap-planning/SKILL.md +169 -0
- package/.claude/skills/domain/product/sprint-planning/SKILL.md +151 -0
- package/.claude/skills/domain/product/stakeholder-communication/SKILL.md +162 -0
- package/.claude/skills/domain/product/user-stories/SKILL.md +141 -0
- package/.claude/skills/domain/quality/bug-reporting/SKILL.md +150 -0
- package/.claude/skills/domain/quality/regression-testing/SKILL.md +178 -0
- package/.claude/skills/domain/quality/test-automation/SKILL.md +185 -0
- package/.claude/skills/domain/quality/test-planning/SKILL.md +177 -0
- package/.claude/skills/leadership/code-review-advanced/SKILL.md +167 -0
- package/.claude/skills/leadership/mentoring/SKILL.md +151 -0
- package/.claude/skills/leadership/technical-debt/SKILL.md +166 -0
- package/.claude/skills/leadership/technical-decision/SKILL.md +160 -0
- package/.claude/skills/security-reports/.gitkeep +0 -0
- package/.claude/skills/skills-registry.yaml +441 -0
- package/README.md +232 -0
- package/bin/agent-team.js +107 -0
- package/package.json +51 -0
- package/src/commands/add.js +227 -0
- package/src/commands/init.js +136 -0
- package/src/commands/list.js +66 -0
- package/src/commands/remove.js +71 -0
- package/src/commands/switch.js +53 -0
- package/src/index.js +11 -0
- package/src/interactive/prompts.js +153 -0
- package/src/server/api/agents.js +150 -0
- package/src/server/api/roles.js +97 -0
- package/src/server/api/skills.js +79 -0
- package/src/server/index.js +78 -0
- package/src/ui/agents.html +174 -0
- package/src/ui/css/styles.css +470 -0
- package/src/ui/index.html +107 -0
- package/src/ui/roles.html +371 -0
- package/src/ui/skills.html +332 -0
- package/src/utils/file-utils.js +193 -0
- package/src/utils/skill-resolver.js +594 -0
- package/src/utils/skill-scanner.js +154 -0
- package/templates/CLAUDE.md.tmpl +42 -0
- package/templates/knowledge.md.tmpl +31 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deployment
|
|
3
|
+
description: |
|
|
4
|
+
Deployment strategies and patterns for production releases. Use when: deploying
|
|
5
|
+
to production, implementing blue/green or canary deployments, rolling updates,
|
|
6
|
+
or when user mentions "deploy", "release", "blue-green", "canary", "rollback".
|
|
7
|
+
Ensures safe, reliable production deployments.
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
category: devops
|
|
10
|
+
tags:
|
|
11
|
+
- deployment
|
|
12
|
+
- release
|
|
13
|
+
- blue-green
|
|
14
|
+
- canary
|
|
15
|
+
- rollback
|
|
16
|
+
depends_on:
|
|
17
|
+
- ci-cd
|
|
18
|
+
recommends:
|
|
19
|
+
- containerization
|
|
20
|
+
- monitoring
|
|
21
|
+
used_by: []
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# Skill: Deployment
|
|
25
|
+
|
|
26
|
+
## Core Principle
|
|
27
|
+
**Deploy safely, rollback quickly.** Every deployment should be reversible in seconds.
|
|
28
|
+
|
|
29
|
+
## Hard Rules
|
|
30
|
+
|
|
31
|
+
1. **NEVER deploy on Friday** - Unless you enjoy weekend debugging
|
|
32
|
+
2. **NEVER skip rollback plan** - Know how to undo before you do
|
|
33
|
+
3. **ALWAYS test in staging** - Production is not a testing ground
|
|
34
|
+
4. **ALWAYS monitor after deploy** - Watch metrics for 15 minutes
|
|
35
|
+
5. **ALWAYS have feature flags** - Decouple deploy from release
|
|
36
|
+
|
|
37
|
+
## Deployment Strategies
|
|
38
|
+
|
|
39
|
+
### 1. Rolling Update (Default)
|
|
40
|
+
```
|
|
41
|
+
┌───────┐ ┌───────┐ ┌───────┐
|
|
42
|
+
│ v1 │ ──▶ │ v1/v2 │ ──▶ │ v2 │
|
|
43
|
+
│ ─ ─ ─ │ │ ─ ─ ─ │ │ ─ ─ ─ │
|
|
44
|
+
│ v1 │ │ v1 │ │ v2 │
|
|
45
|
+
│ ─ ─ ─ │ │ ─ ─ ─ │ │ ─ ─ ─ │
|
|
46
|
+
│ v1 │ │ v2 │ │ v2 │
|
|
47
|
+
└───────┘ └───────┘ └───────┘
|
|
48
|
+
0% 50% 100%
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. Blue-Green
|
|
52
|
+
```
|
|
53
|
+
┌─────────────┐
|
|
54
|
+
│ Router │
|
|
55
|
+
└──────┬──────┘
|
|
56
|
+
┌─────┴─────┐
|
|
57
|
+
▼ ▼
|
|
58
|
+
┌──────────┐ ┌──────────┐
|
|
59
|
+
│ Blue │ │ Green │
|
|
60
|
+
│ (v1) │ │ (v2) │
|
|
61
|
+
│ LIVE │ │ IDLE │
|
|
62
|
+
└──────────┘ └──────────┘
|
|
63
|
+
|
|
64
|
+
Switch traffic: Blue → Green
|
|
65
|
+
Rollback: Green → Blue
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3. Canary
|
|
69
|
+
```
|
|
70
|
+
┌───────────────────────────────────┐
|
|
71
|
+
│ Load Balancer │
|
|
72
|
+
└───────────────┬───────────────────┘
|
|
73
|
+
┌───────┴───────┐
|
|
74
|
+
▼ ▼
|
|
75
|
+
┌─────────┐ ┌──────────┐
|
|
76
|
+
│ Stable │ │ Canary │
|
|
77
|
+
│ v1 │ │ v2 │
|
|
78
|
+
│ 95% │ │ 5% │
|
|
79
|
+
└─────────┘ └──────────┘
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Kubernetes Rolling Update
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
apiVersion: apps/v1
|
|
86
|
+
kind: Deployment
|
|
87
|
+
metadata:
|
|
88
|
+
name: myapp
|
|
89
|
+
spec:
|
|
90
|
+
replicas: 3
|
|
91
|
+
strategy:
|
|
92
|
+
type: RollingUpdate
|
|
93
|
+
rollingUpdate:
|
|
94
|
+
maxSurge: 1 # Max pods over desired count
|
|
95
|
+
maxUnavailable: 0 # Max unavailable during update
|
|
96
|
+
template:
|
|
97
|
+
spec:
|
|
98
|
+
containers:
|
|
99
|
+
- name: app
|
|
100
|
+
image: myapp:v2
|
|
101
|
+
readinessProbe:
|
|
102
|
+
httpGet:
|
|
103
|
+
path: /health
|
|
104
|
+
port: 3000
|
|
105
|
+
initialDelaySeconds: 5
|
|
106
|
+
periodSeconds: 10
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Blue-Green with Kubernetes
|
|
110
|
+
|
|
111
|
+
```yaml
|
|
112
|
+
# blue-service.yaml
|
|
113
|
+
apiVersion: v1
|
|
114
|
+
kind: Service
|
|
115
|
+
metadata:
|
|
116
|
+
name: myapp-blue
|
|
117
|
+
spec:
|
|
118
|
+
selector:
|
|
119
|
+
app: myapp
|
|
120
|
+
version: blue
|
|
121
|
+
---
|
|
122
|
+
# green-service.yaml
|
|
123
|
+
apiVersion: v1
|
|
124
|
+
kind: Service
|
|
125
|
+
metadata:
|
|
126
|
+
name: myapp-green
|
|
127
|
+
spec:
|
|
128
|
+
selector:
|
|
129
|
+
app: myapp
|
|
130
|
+
version: green
|
|
131
|
+
---
|
|
132
|
+
# Switch by updating the active service selector
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Common Mistakes
|
|
136
|
+
|
|
137
|
+
| ❌ Mistake | ✅ Fix |
|
|
138
|
+
|------------|--------|
|
|
139
|
+
| Deploy without rollback plan | Document rollback steps first |
|
|
140
|
+
| Deploy all at once | Gradual rollout (10% → 50% → 100%) |
|
|
141
|
+
| No health checks | Add readiness/liveness probes |
|
|
142
|
+
| Deploy on Friday | Deploy Tue-Thu |
|
|
143
|
+
| No monitoring | Watch metrics for 15 min post-deploy |
|
|
144
|
+
| Big bang deploys | Small, frequent deploys |
|
|
145
|
+
|
|
146
|
+
## Deployment Checklist
|
|
147
|
+
|
|
148
|
+
### Before
|
|
149
|
+
- [ ] Rollback plan documented
|
|
150
|
+
- [ ] Staging tested
|
|
151
|
+
- [ ] Database migrations run
|
|
152
|
+
- [ ] Feature flags ready
|
|
153
|
+
- [ ] Team notified
|
|
154
|
+
|
|
155
|
+
### During
|
|
156
|
+
- [ ] Monitor error rates
|
|
157
|
+
- [ ] Check latency metrics
|
|
158
|
+
- [ ] Verify health checks pass
|
|
159
|
+
- [ ] Monitor logs for errors
|
|
160
|
+
|
|
161
|
+
### After
|
|
162
|
+
- [ ] Verify all pods healthy
|
|
163
|
+
- [ ] Check business metrics
|
|
164
|
+
- [ ] Monitor for 15 minutes
|
|
165
|
+
- [ ] Update changelog
|
|
166
|
+
|
|
167
|
+
## Rollback Commands
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Kubernetes
|
|
171
|
+
kubectl rollout undo deployment/myapp
|
|
172
|
+
kubectl rollout undo deployment/myapp --to-revision=2
|
|
173
|
+
|
|
174
|
+
# Check history
|
|
175
|
+
kubectl rollout history deployment/myapp
|
|
176
|
+
|
|
177
|
+
# ECS
|
|
178
|
+
aws ecs update-service --cluster prod --service myapp --task-definition myapp:1
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Feature Flags
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
// Decouple deploy from release
|
|
185
|
+
if (featureFlags.isEnabled('new-checkout', user)) {
|
|
186
|
+
return <NewCheckout />;
|
|
187
|
+
}
|
|
188
|
+
return <LegacyCheckout />;
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Quick Checklist
|
|
192
|
+
|
|
193
|
+
- [ ] Rollback plan exists
|
|
194
|
+
- [ ] Gradual rollout enabled
|
|
195
|
+
- [ ] Health checks configured
|
|
196
|
+
- [ ] Monitoring active
|
|
197
|
+
- [ ] Feature flags ready
|
|
198
|
+
- [ ] Team notified
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: infrastructure-as-code
|
|
3
|
+
description: |
|
|
4
|
+
Infrastructure as Code patterns using Terraform, Pulumi, CloudFormation.
|
|
5
|
+
Use when: provisioning cloud resources, managing infrastructure, creating
|
|
6
|
+
repeatable deployments, or when user mentions "Terraform", "IaC", "Pulumi",
|
|
7
|
+
"CloudFormation", "infrastructure", "provisioning".
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
category: devops
|
|
10
|
+
tags:
|
|
11
|
+
- terraform
|
|
12
|
+
- iac
|
|
13
|
+
- infrastructure
|
|
14
|
+
- cloud
|
|
15
|
+
depends_on: []
|
|
16
|
+
recommends:
|
|
17
|
+
- ci-cd
|
|
18
|
+
- deployment
|
|
19
|
+
used_by:
|
|
20
|
+
- deployment
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Skill: Infrastructure as Code
|
|
24
|
+
|
|
25
|
+
## Core Principle
|
|
26
|
+
**Infrastructure is code.** Version control, review, test, and automate everything.
|
|
27
|
+
|
|
28
|
+
## Hard Rules
|
|
29
|
+
|
|
30
|
+
1. **NEVER commit state files** - Use remote state
|
|
31
|
+
2. **NEVER hardcode secrets** - Use variables + secret managers
|
|
32
|
+
3. **ALWAYS use modules** - DRY principle
|
|
33
|
+
4. **ALWAYS tag resources** - Cost tracking, ownership
|
|
34
|
+
5. **ALWAYS plan before apply** - Review changes first
|
|
35
|
+
|
|
36
|
+
## Terraform Project Structure
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
terraform/
|
|
40
|
+
├── modules/
|
|
41
|
+
│ ├── vpc/
|
|
42
|
+
│ ├── ecs/
|
|
43
|
+
│ └── rds/
|
|
44
|
+
├── environments/
|
|
45
|
+
│ ├── dev/
|
|
46
|
+
│ │ ├── main.tf
|
|
47
|
+
│ │ ├── variables.tf
|
|
48
|
+
│ │ └── terraform.tfvars
|
|
49
|
+
│ └── prod/
|
|
50
|
+
├── .terraform-version
|
|
51
|
+
└── backend.hcl
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Module Template
|
|
55
|
+
|
|
56
|
+
```hcl
|
|
57
|
+
# modules/ecs/main.tf
|
|
58
|
+
variable "environment" {
|
|
59
|
+
description = "Environment name"
|
|
60
|
+
type = string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
variable "cpu" {
|
|
64
|
+
description = "CPU units"
|
|
65
|
+
type = number
|
|
66
|
+
default = 256
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
variable "memory" {
|
|
70
|
+
description = "Memory in MB"
|
|
71
|
+
type = number
|
|
72
|
+
default = 512
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
resource "aws_ecs_service" "main" {
|
|
76
|
+
name = "${var.environment}-app"
|
|
77
|
+
cluster = var.cluster_id
|
|
78
|
+
task_definition = aws_ecs_task_definition.main.arn
|
|
79
|
+
|
|
80
|
+
tags = {
|
|
81
|
+
Environment = var.environment
|
|
82
|
+
ManagedBy = "terraform"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
output "service_arn" {
|
|
87
|
+
value = aws_ecs_service.main.arn
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Remote State Configuration
|
|
92
|
+
|
|
93
|
+
```hcl
|
|
94
|
+
# backend.hcl
|
|
95
|
+
terraform {
|
|
96
|
+
backend "s3" {
|
|
97
|
+
bucket = "my-terraform-state"
|
|
98
|
+
key = "env/dev/terraform.tfstate"
|
|
99
|
+
region = "us-east-1"
|
|
100
|
+
encrypt = true
|
|
101
|
+
dynamodb_table = "terraform-locks"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Common Mistakes
|
|
107
|
+
|
|
108
|
+
| ❌ Mistake | ✅ Fix |
|
|
109
|
+
|------------|--------|
|
|
110
|
+
| Local state files | Remote state (S3 + DynamoDB) |
|
|
111
|
+
| Hardcoded values | Variables + tfvars |
|
|
112
|
+
| No tagging | Add required tags |
|
|
113
|
+
| Monolithic configs | Use modules |
|
|
114
|
+
| Manual changes | Always use Terraform |
|
|
115
|
+
| No state locking | Enable DynamoDB locks |
|
|
116
|
+
|
|
117
|
+
## Best Practices
|
|
118
|
+
|
|
119
|
+
### Naming Convention
|
|
120
|
+
```hcl
|
|
121
|
+
# {environment}-{service}-{resource}
|
|
122
|
+
resource "aws_instance" "web" {
|
|
123
|
+
# dev-webserver-ec2
|
|
124
|
+
tags = {
|
|
125
|
+
Name = "${var.environment}-webserver-ec2"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Required Tags
|
|
131
|
+
```hcl
|
|
132
|
+
variable "common_tags" {
|
|
133
|
+
type = map(string)
|
|
134
|
+
default = {
|
|
135
|
+
Project = "myapp"
|
|
136
|
+
ManagedBy = "terraform"
|
|
137
|
+
CostCenter = "engineering"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Workflow
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# 1. Initialize
|
|
146
|
+
terraform init
|
|
147
|
+
|
|
148
|
+
# 2. Plan (always review)
|
|
149
|
+
terraform plan -out=tfplan
|
|
150
|
+
|
|
151
|
+
# 3. Apply (after review)
|
|
152
|
+
terraform apply tfplan
|
|
153
|
+
|
|
154
|
+
# 4. Destroy (when needed)
|
|
155
|
+
terraform destroy -target=aws_instance.web
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## CI/CD Integration
|
|
159
|
+
|
|
160
|
+
```yaml
|
|
161
|
+
# .github/workflows/terraform.yml
|
|
162
|
+
- name: Terraform Plan
|
|
163
|
+
run: terraform plan -no-color -out=tfplan
|
|
164
|
+
|
|
165
|
+
- name: Terraform Apply
|
|
166
|
+
if: github.ref == 'refs/heads/main'
|
|
167
|
+
run: terraform apply -auto-approve tfplan
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Quick Checklist
|
|
171
|
+
|
|
172
|
+
- [ ] Remote state configured
|
|
173
|
+
- [ ] State locking enabled
|
|
174
|
+
- [ ] Secrets in variables
|
|
175
|
+
- [ ] Resources tagged
|
|
176
|
+
- [ ] Modules used
|
|
177
|
+
- [ ] Plan before apply
|
|
178
|
+
- [ ] .tfvars in .gitignore
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: monitoring
|
|
3
|
+
description: |
|
|
4
|
+
Application and infrastructure monitoring with Prometheus, Grafana, Datadog.
|
|
5
|
+
Use when: setting up observability, creating dashboards, configuring alerts,
|
|
6
|
+
or when user mentions "monitoring", "metrics", "observability", "Prometheus",
|
|
7
|
+
"Grafana", "alerts", "dashboard". Ensures visibility into system health.
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
category: devops
|
|
10
|
+
tags:
|
|
11
|
+
- monitoring
|
|
12
|
+
- observability
|
|
13
|
+
- prometheus
|
|
14
|
+
- grafana
|
|
15
|
+
- alerts
|
|
16
|
+
depends_on: []
|
|
17
|
+
recommends:
|
|
18
|
+
- deployment
|
|
19
|
+
used_by: []
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Skill: Monitoring
|
|
23
|
+
|
|
24
|
+
## Core Principle
|
|
25
|
+
**You can't fix what you can't see.** Observability is not optional—it's essential.
|
|
26
|
+
|
|
27
|
+
## The Three Pillars
|
|
28
|
+
|
|
29
|
+
| Pillar | Tool | Purpose |
|
|
30
|
+
|--------|------|---------|
|
|
31
|
+
| **Metrics** | Prometheus | Numbers over time |
|
|
32
|
+
| **Logs** | Loki/ELK | What happened |
|
|
33
|
+
| **Traces** | Jaeger | Where time spent |
|
|
34
|
+
|
|
35
|
+
## RED Method (Services)
|
|
36
|
+
|
|
37
|
+
- **Rate** - Requests per second
|
|
38
|
+
- **Errors** - Error rate
|
|
39
|
+
- **Duration** - Latency distribution
|
|
40
|
+
|
|
41
|
+
## USE Method (Resources)
|
|
42
|
+
|
|
43
|
+
- **Utilization** - % time busy
|
|
44
|
+
- **Saturation** - Queue length
|
|
45
|
+
- **Errors** - Error count
|
|
46
|
+
|
|
47
|
+
## Prometheus Metrics
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// Application instrumentation
|
|
51
|
+
import { Counter, Histogram, Gauge } from 'prom-client';
|
|
52
|
+
|
|
53
|
+
// Counter: Things that increase
|
|
54
|
+
const httpRequestsTotal = new Counter({
|
|
55
|
+
name: 'http_requests_total',
|
|
56
|
+
help: 'Total HTTP requests',
|
|
57
|
+
labelNames: ['method', 'path', 'status'],
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Histogram: Distributions (latency)
|
|
61
|
+
const httpRequestDuration = new Histogram({
|
|
62
|
+
name: 'http_request_duration_seconds',
|
|
63
|
+
help: 'HTTP request duration',
|
|
64
|
+
labelNames: ['method', 'path'],
|
|
65
|
+
buckets: [0.01, 0.05, 0.1, 0.5, 1, 5],
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Gauge: Current state
|
|
69
|
+
const activeConnections = new Gauge({
|
|
70
|
+
name: 'active_connections',
|
|
71
|
+
help: 'Active connections',
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Common Mistakes
|
|
76
|
+
|
|
77
|
+
| ❌ Mistake | ✅ Fix |
|
|
78
|
+
|------------|--------|
|
|
79
|
+
| Too many metrics | Focus on RED/USE |
|
|
80
|
+
| No alerts | Alert on symptoms |
|
|
81
|
+
| Alert fatigue | Reduce noise, severity |
|
|
82
|
+
| No dashboards | Pre-built dashboards |
|
|
83
|
+
| Missing context | Add labels |
|
|
84
|
+
|
|
85
|
+
## Alerting Rules
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
# Prometheus alerting rules
|
|
89
|
+
groups:
|
|
90
|
+
- name: application
|
|
91
|
+
rules:
|
|
92
|
+
- alert: HighErrorRate
|
|
93
|
+
expr: rate(http_requests_total{status=~"5.."}[5m]) > 0.05
|
|
94
|
+
for: 5m
|
|
95
|
+
labels:
|
|
96
|
+
severity: critical
|
|
97
|
+
annotations:
|
|
98
|
+
summary: "High error rate on {{ $labels.service }}"
|
|
99
|
+
description: "Error rate is {{ $value }} requests/s"
|
|
100
|
+
|
|
101
|
+
- alert: HighLatency
|
|
102
|
+
expr: histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m])) > 1
|
|
103
|
+
for: 5m
|
|
104
|
+
labels:
|
|
105
|
+
severity: warning
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Grafana Dashboard
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"title": "Application Overview",
|
|
113
|
+
"panels": [
|
|
114
|
+
{
|
|
115
|
+
"title": "Request Rate",
|
|
116
|
+
"type": "graph",
|
|
117
|
+
"targets": [
|
|
118
|
+
{
|
|
119
|
+
"expr": "rate(http_requests_total[5m])",
|
|
120
|
+
"legendFormat": "{{method}} {{path}}"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"title": "Error Rate",
|
|
126
|
+
"type": "stat",
|
|
127
|
+
"targets": [
|
|
128
|
+
{
|
|
129
|
+
"expr": "rate(http_requests_total{status=~\"5..\"}[5m]) / rate(http_requests_total[5m]) * 100"
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"title": "P99 Latency",
|
|
135
|
+
"type": "graph",
|
|
136
|
+
"targets": [
|
|
137
|
+
{
|
|
138
|
+
"expr": "histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m]))"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## SLO/SLI/SLA Framework
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
SLA = Agreement (99.9% uptime)
|
|
150
|
+
↓
|
|
151
|
+
SLO = Objective (99.9% uptime this month)
|
|
152
|
+
↓
|
|
153
|
+
SLI = Indicator (successful requests / total requests)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Quick Checklist
|
|
157
|
+
|
|
158
|
+
- [ ] RED metrics instrumented
|
|
159
|
+
- [ ] Alerts configured
|
|
160
|
+
- [ ] Dashboards created
|
|
161
|
+
- [ ] Runbooks linked to alerts
|
|
162
|
+
- [ ] Log aggregation setup
|
|
163
|
+
- [ ] Distributed tracing enabled
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: accessibility
|
|
3
|
+
description: |
|
|
4
|
+
WCAG compliance and accessibility best practices. Use when: building UI
|
|
5
|
+
components, ensuring keyboard navigation, screen reader support, or when
|
|
6
|
+
user mentions "accessibility", "a11y", "WCAG", "ARIA", "keyboard", "screen reader".
|
|
7
|
+
Accessibility is not optional - build for everyone.
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
category: frontend
|
|
10
|
+
tags:
|
|
11
|
+
- accessibility
|
|
12
|
+
- a11y
|
|
13
|
+
- wcag
|
|
14
|
+
- aria
|
|
15
|
+
depends_on:
|
|
16
|
+
- frontend-design
|
|
17
|
+
recommends: []
|
|
18
|
+
used_by: []
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Skill: Accessibility
|
|
22
|
+
|
|
23
|
+
## Core Principle
|
|
24
|
+
**Build for everyone.** 15% of users have disabilities. Accessible code is better code.
|
|
25
|
+
|
|
26
|
+
## WCAG Principles (POUR)
|
|
27
|
+
|
|
28
|
+
| Principle | Description | Examples |
|
|
29
|
+
|-----------|-------------|----------|
|
|
30
|
+
| **Perceivable** | Users can see/hear content | Alt text, captions |
|
|
31
|
+
| **Operable** | Users can navigate | Keyboard, focus |
|
|
32
|
+
| **Understandable** | Users can understand | Clear language, labels |
|
|
33
|
+
| **Robust** | Works with assistive tech | ARIA, semantic HTML |
|
|
34
|
+
|
|
35
|
+
## Hard Rules
|
|
36
|
+
|
|
37
|
+
1. **NEVER rely on color alone** - Always have text/icons
|
|
38
|
+
2. **NEVER skip heading levels** - h1 → h2 → h3
|
|
39
|
+
3. **ALWAYS have alt text** - For meaningful images
|
|
40
|
+
4. **ALWAYS support keyboard** - All interactions
|
|
41
|
+
5. **ALWAYS use semantic HTML** - Not just divs
|
|
42
|
+
|
|
43
|
+
## Semantic HTML
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
// ❌ Bad: Non-semantic
|
|
47
|
+
<div onClick={handleClick}>Submit</div>
|
|
48
|
+
|
|
49
|
+
// ✅ Good: Semantic
|
|
50
|
+
<button onClick={handleClick}>Submit</button>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## ARIA Patterns
|
|
54
|
+
|
|
55
|
+
### Labels
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
// Icon button needs label
|
|
59
|
+
<button aria-label="Close menu">
|
|
60
|
+
<XIcon />
|
|
61
|
+
</button>
|
|
62
|
+
|
|
63
|
+
// Input with label
|
|
64
|
+
<label htmlFor="email">Email address</label>
|
|
65
|
+
<input id="email" type="email" aria-describedby="email-hint" />
|
|
66
|
+
<span id="email-hint">We'll never share your email</span>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Live Regions
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
// Announce changes
|
|
73
|
+
<div role="status" aria-live="polite">
|
|
74
|
+
{message}
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
// Alert important info
|
|
78
|
+
<div role="alert" aria-live="assertive">
|
|
79
|
+
{errorMessage}
|
|
80
|
+
</div>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Dialogs
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<dialog
|
|
87
|
+
role="dialog"
|
|
88
|
+
aria-modal="true"
|
|
89
|
+
aria-labelledby="dialog-title"
|
|
90
|
+
>
|
|
91
|
+
<h2 id="dialog-title">Confirm Delete</h2>
|
|
92
|
+
{/* Trap focus, handle Escape */}
|
|
93
|
+
</dialog>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Common Mistakes
|
|
97
|
+
|
|
98
|
+
| ❌ Mistake | ✅ Fix |
|
|
99
|
+
|------------|--------|
|
|
100
|
+
| `<div onClick>` | `<button onClick>` |
|
|
101
|
+
| Color only indication | Add icon + text |
|
|
102
|
+
| Missing alt text | `alt="description"` |
|
|
103
|
+
| Skip heading levels | h1 → h2 → h3 |
|
|
104
|
+
| No focus indicator | `:focus-visible` |
|
|
105
|
+
| Mouse-only interactions | Keyboard support |
|
|
106
|
+
|
|
107
|
+
## Focus Management
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
/* Visible focus indicator */
|
|
111
|
+
:focus-visible {
|
|
112
|
+
outline: 2px solid #007bff;
|
|
113
|
+
outline-offset: 2px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Skip link */
|
|
117
|
+
.skip-link {
|
|
118
|
+
position: absolute;
|
|
119
|
+
top: -40px;
|
|
120
|
+
}
|
|
121
|
+
.skip-link:focus {
|
|
122
|
+
top: 0;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
// Focus trap for modals
|
|
128
|
+
import { FocusTrap } from '@react-aria/focus';
|
|
129
|
+
|
|
130
|
+
<FocusTrap>
|
|
131
|
+
<Modal>{children}</Modal>
|
|
132
|
+
</FocusTrap>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Keyboard Navigation
|
|
136
|
+
|
|
137
|
+
| Key | Action |
|
|
138
|
+
|-----|--------|
|
|
139
|
+
| Tab | Next focusable |
|
|
140
|
+
| Shift+Tab | Previous focusable |
|
|
141
|
+
| Enter/Space | Activate button |
|
|
142
|
+
| Escape | Close modal |
|
|
143
|
+
| Arrow keys | Navigate lists |
|
|
144
|
+
|
|
145
|
+
## Form Accessibility
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
<fieldset>
|
|
149
|
+
<legend>Shipping Method</legend>
|
|
150
|
+
<label>
|
|
151
|
+
<input type="radio" name="shipping" value="standard" />
|
|
152
|
+
Standard (5-7 days)
|
|
153
|
+
</label>
|
|
154
|
+
<label>
|
|
155
|
+
<input type="radio" name="shipping" value="express" />
|
|
156
|
+
Express (2-3 days)
|
|
157
|
+
</label>
|
|
158
|
+
</fieldset>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Testing Checklist
|
|
162
|
+
|
|
163
|
+
- [ ] Keyboard navigation works
|
|
164
|
+
- [ ] Focus visible on all interactive
|
|
165
|
+
- [ ] Screen reader announces content
|
|
166
|
+
- [ ] Color contrast 4.5:1 (WCAG AA)
|
|
167
|
+
- [ ] Form labels present
|
|
168
|
+
- [ ] Error messages announced
|
|
169
|
+
- [ ] No autoplay media
|
|
170
|
+
|
|
171
|
+
## Quick Audit
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Run accessibility audit
|
|
175
|
+
npx axe-cli https://yoursite.com
|
|
176
|
+
|
|
177
|
+
# Lighthouse accessibility
|
|
178
|
+
npx lighthouse https://yoursite.com --only-categories=accessibility
|
|
179
|
+
```
|