swe-workflow-skills 0.1.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/LICENSE +21 -0
- package/README.md +144 -0
- package/VERSION +1 -0
- package/bin/cli.mjs +44 -0
- package/catalog.json +225 -0
- package/commands/role.md +34 -0
- package/hooks/session-start.mjs +118 -0
- package/install.mjs +318 -0
- package/package.json +47 -0
- package/roles.json +194 -0
- package/scripts/resolve.mjs +296 -0
- package/skills/accessibility-design/SKILL.md +128 -0
- package/skills/accessibility-design/evals/evals.json +51 -0
- package/skills/accessibility-design/references/accessibility-patterns.md +321 -0
- package/skills/api-design/SKILL.md +144 -0
- package/skills/api-design/evals/evals.json +48 -0
- package/skills/api-design/references/rest-conventions.md +147 -0
- package/skills/api-design/templates/api-spec.md +156 -0
- package/skills/architecture-design/SKILL.md +86 -0
- package/skills/architecture-design/evals/evals.json +44 -0
- package/skills/architecture-design/references/clean-architecture.md +147 -0
- package/skills/architecture-design/references/component-principles.md +129 -0
- package/skills/architecture-design/references/principles.md +81 -0
- package/skills/architecture-design/references/solid-principles.md +106 -0
- package/skills/architecture-design/templates/adr.md +63 -0
- package/skills/architecture-documentation/SKILL.md +126 -0
- package/skills/architecture-documentation/evals/evals.json +44 -0
- package/skills/architecture-documentation/references/abstraction-levels.md +91 -0
- package/skills/architecture-documentation/references/diagram-tooling.md +141 -0
- package/skills/architecture-documentation/templates/architecture-doc.md +171 -0
- package/skills/bug-investigating/SKILL.md +133 -0
- package/skills/bug-investigating/evals/evals.json +56 -0
- package/skills/bug-investigating/references/common-bugs.md +62 -0
- package/skills/bug-investigating/references/debugging-patterns.md +94 -0
- package/skills/cicd-pipeline/SKILL.md +87 -0
- package/skills/cicd-pipeline/evals/evals.json +34 -0
- package/skills/cicd-pipeline/references/pipeline-patterns.md +206 -0
- package/skills/cicd-pipeline/templates/github-actions.md +206 -0
- package/skills/code-reviewing/SKILL.md +92 -0
- package/skills/code-reviewing/evals/evals.json +62 -0
- package/skills/code-reviewing/references/error-handling.md +108 -0
- package/skills/code-reviewing/references/review-checklist.md +144 -0
- package/skills/configuration-strategy/SKILL.md +109 -0
- package/skills/configuration-strategy/evals/evals.json +41 -0
- package/skills/configuration-strategy/references/config-patterns.md +161 -0
- package/skills/containerization/SKILL.md +90 -0
- package/skills/containerization/evals/evals.json +36 -0
- package/skills/containerization/references/dockerfile-patterns.md +168 -0
- package/skills/containerization/templates/dockerfile.md +154 -0
- package/skills/data-modeling/SKILL.md +83 -0
- package/skills/data-modeling/evals/evals.json +43 -0
- package/skills/data-modeling/references/conventions.md +57 -0
- package/skills/data-modeling/templates/schema.md +120 -0
- package/skills/dependency-impact-analysis/SKILL.md +113 -0
- package/skills/dependency-impact-analysis/evals/evals.json +41 -0
- package/skills/dependency-impact-analysis/references/impact-patterns.md +150 -0
- package/skills/dependency-management/SKILL.md +161 -0
- package/skills/dependency-management/evals/evals.json +48 -0
- package/skills/dependency-management/references/evaluation-checklist.md +127 -0
- package/skills/deployment-checklist/SKILL.md +132 -0
- package/skills/deployment-checklist/evals/evals.json +58 -0
- package/skills/deployment-checklist/references/pre-deploy-gates.md +91 -0
- package/skills/deployment-repo/SKILL.md +190 -0
- package/skills/deployment-repo/evals/evals.json +44 -0
- package/skills/deployment-repo/references/deployment-repo-patterns.md +258 -0
- package/skills/deployment-repo/references/version-compatibility.md +227 -0
- package/skills/deployment-repo/templates/deployment-repo-structure.md +226 -0
- package/skills/effort-estimation/SKILL.md +95 -0
- package/skills/effort-estimation/evals/evals.json +32 -0
- package/skills/effort-estimation/references/estimation-methods.md +154 -0
- package/skills/feature-planning/SKILL.md +84 -0
- package/skills/feature-planning/evals/evals.json +44 -0
- package/skills/feature-planning/templates/plan.md +55 -0
- package/skills/feature-planning/templates/task.md +26 -0
- package/skills/frontend-architecture/SKILL.md +154 -0
- package/skills/frontend-architecture/evals/evals.json +34 -0
- package/skills/frontend-architecture/references/component-patterns.md +264 -0
- package/skills/frontend-architecture/templates/folder-structure.md +203 -0
- package/skills/git-workflow/SKILL.md +127 -0
- package/skills/git-workflow/evals/evals.json +44 -0
- package/skills/git-workflow/references/conventions.md +142 -0
- package/skills/git-workflow/templates/pull-request.md +57 -0
- package/skills/gitops-delivery/SKILL.md +319 -0
- package/skills/gitops-delivery/evals/evals.json +44 -0
- package/skills/gitops-delivery/references/gitops-patterns.md +478 -0
- package/skills/gitops-delivery/templates/gitops-config.md +196 -0
- package/skills/incident-response/SKILL.md +130 -0
- package/skills/incident-response/evals/evals.json +55 -0
- package/skills/incident-response/references/communication-templates.md +134 -0
- package/skills/incident-response/references/severity-levels.md +77 -0
- package/skills/incident-response/templates/incident-timeline.md +57 -0
- package/skills/infrastructure-as-code/SKILL.md +86 -0
- package/skills/infrastructure-as-code/evals/evals.json +33 -0
- package/skills/infrastructure-as-code/references/iac-patterns.md +179 -0
- package/skills/infrastructure-as-code/templates/terraform-module.md +158 -0
- package/skills/metrics-and-okrs/SKILL.md +113 -0
- package/skills/metrics-and-okrs/evals/evals.json +33 -0
- package/skills/metrics-and-okrs/references/metric-catalog.md +90 -0
- package/skills/metrics-and-okrs/templates/okr-document.md +61 -0
- package/skills/ml-experiment-tracking/SKILL.md +96 -0
- package/skills/ml-experiment-tracking/evals/evals.json +32 -0
- package/skills/ml-experiment-tracking/references/tracking-tools.md +127 -0
- package/skills/ml-model-deployment/SKILL.md +106 -0
- package/skills/ml-model-deployment/evals/evals.json +34 -0
- package/skills/ml-model-deployment/references/serving-patterns.md +162 -0
- package/skills/ml-pipeline-design/SKILL.md +162 -0
- package/skills/ml-pipeline-design/evals/evals.json +34 -0
- package/skills/ml-pipeline-design/references/pipeline-components.md +174 -0
- package/skills/observability-design/SKILL.md +162 -0
- package/skills/observability-design/evals/evals.json +52 -0
- package/skills/observability-design/references/logging-patterns.md +229 -0
- package/skills/observability-design/references/slo-framework.md +151 -0
- package/skills/observability-design/templates/slo-document.md +80 -0
- package/skills/performance-optimization/SKILL.md +83 -0
- package/skills/performance-optimization/evals/evals.json +47 -0
- package/skills/performance-optimization/references/bottleneck-patterns.md +256 -0
- package/skills/performance-optimization/references/concurrency.md +101 -0
- package/skills/prd-writing/SKILL.md +109 -0
- package/skills/prd-writing/evals/evals.json +33 -0
- package/skills/prd-writing/references/prd-examples.md +132 -0
- package/skills/prd-writing/templates/prd.md +71 -0
- package/skills/prd-writing/templates/rfc.md +79 -0
- package/skills/project-documentation/SKILL.md +104 -0
- package/skills/project-documentation/evals/evals.json +48 -0
- package/skills/project-documentation/references/contributing-guide.md +100 -0
- package/skills/project-documentation/templates/changelog.md +59 -0
- package/skills/project-documentation/templates/readme.md +121 -0
- package/skills/project-proposal/SKILL.md +90 -0
- package/skills/project-proposal/evals/evals.json +31 -0
- package/skills/project-proposal/references/proposal-examples.md +140 -0
- package/skills/project-proposal/templates/proposal.md +76 -0
- package/skills/project-review/SKILL.md +111 -0
- package/skills/project-review/evals/evals.json +42 -0
- package/skills/refactoring/SKILL.md +90 -0
- package/skills/refactoring/evals/evals.json +44 -0
- package/skills/refactoring/references/transformations.md +132 -0
- package/skills/retrospective/SKILL.md +157 -0
- package/skills/retrospective/evals/evals.json +34 -0
- package/skills/retrospective/references/facilitation-guide.md +130 -0
- package/skills/retrospective/templates/post-mortem.md +121 -0
- package/skills/rollback-strategy/SKILL.md +116 -0
- package/skills/rollback-strategy/evals/evals.json +55 -0
- package/skills/rollback-strategy/references/rollback-patterns.md +125 -0
- package/skills/rollback-strategy/templates/rollback-plan.md +69 -0
- package/skills/security-audit/SKILL.md +146 -0
- package/skills/security-audit/evals/evals.json +66 -0
- package/skills/security-audit/references/owasp-top-10.md +167 -0
- package/skills/security-audit/templates/security-report.md +79 -0
- package/skills/skill-router/SKILL.md +171 -0
- package/skills/skill-router/evals/evals.json +39 -0
- package/skills/strategic-review/SKILL.md +106 -0
- package/skills/strategic-review/evals/evals.json +42 -0
- package/skills/strategic-review/templates/full-review-prompt.md +84 -0
- package/skills/tdd-workflow/SKILL.md +147 -0
- package/skills/tdd-workflow/evals/evals.json +58 -0
- package/skills/tdd-workflow/references/test-quality.md +71 -0
- package/skills/technical-debt-review/SKILL.md +113 -0
- package/skills/technical-debt-review/evals/evals.json +41 -0
- package/skills/technical-debt-review/references/debt-taxonomy.md +124 -0
- package/skills/technical-debt-review/templates/debt-audit.md +85 -0
- package/skills/test-data-strategy/SKILL.md +129 -0
- package/skills/test-data-strategy/evals/evals.json +49 -0
- package/skills/test-data-strategy/references/data-generation-patterns.md +341 -0
- package/skills/test-suite-design/SKILL.md +137 -0
- package/skills/test-suite-design/evals/evals.json +69 -0
- package/skills/test-suite-design/references/test-infrastructure.md +175 -0
- package/skills/test-suite-design/references/testing-pyramid.md +140 -0
- package/skills/ui-ux-design/SKILL.md +117 -0
- package/skills/ui-ux-design/evals/evals.json +35 -0
- package/skills/ui-ux-design/references/interaction-patterns.md +145 -0
- package/skills/ui-ux-design/templates/screen-spec.md +97 -0
- package/skills/verification-before-completion/SKILL.md +85 -0
- package/skills/verification-before-completion/evals/evals.json +53 -0
- package/skills/writing-skills/SKILL.md +87 -0
- package/skills/writing-skills/evals/evals.json +41 -0
- package/skills/writing-skills/references/pressure-testing.md +69 -0
- package/uninstall.mjs +182 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# IaC Patterns
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
- Terraform module pattern
|
|
5
|
+
- State management patterns
|
|
6
|
+
- Security patterns
|
|
7
|
+
- Common anti-patterns
|
|
8
|
+
|
|
9
|
+
## Terraform Module Pattern
|
|
10
|
+
|
|
11
|
+
### Module structure
|
|
12
|
+
```
|
|
13
|
+
modules/database/
|
|
14
|
+
├── main.tf # Resource definitions
|
|
15
|
+
├── variables.tf # Input variables with descriptions and validation
|
|
16
|
+
├── outputs.tf # Output values for consumers
|
|
17
|
+
├── versions.tf # Required provider versions
|
|
18
|
+
└── README.md # Usage documentation
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Well-defined variables
|
|
22
|
+
```hcl
|
|
23
|
+
variable "instance_class" {
|
|
24
|
+
description = "RDS instance class"
|
|
25
|
+
type = string
|
|
26
|
+
default = "db.t3.micro"
|
|
27
|
+
validation {
|
|
28
|
+
condition = can(regex("^db\\.", var.instance_class))
|
|
29
|
+
error_message = "Instance class must start with 'db.'"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
variable "environment" {
|
|
34
|
+
description = "Deployment environment"
|
|
35
|
+
type = string
|
|
36
|
+
validation {
|
|
37
|
+
condition = contains(["dev", "staging", "production"], var.environment)
|
|
38
|
+
error_message = "Environment must be dev, staging, or production."
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Consistent tagging
|
|
44
|
+
```hcl
|
|
45
|
+
locals {
|
|
46
|
+
common_tags = {
|
|
47
|
+
Environment = var.environment
|
|
48
|
+
Project = var.project_name
|
|
49
|
+
ManagedBy = "terraform"
|
|
50
|
+
Team = var.team
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
resource "aws_db_instance" "main" {
|
|
55
|
+
# ... configuration ...
|
|
56
|
+
tags = merge(local.common_tags, {
|
|
57
|
+
Name = "${var.project_name}-${var.environment}-db"
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## State Management Patterns
|
|
63
|
+
|
|
64
|
+
### Remote backend (Terraform + AWS)
|
|
65
|
+
```hcl
|
|
66
|
+
terraform {
|
|
67
|
+
backend "s3" {
|
|
68
|
+
bucket = "mycompany-terraform-state"
|
|
69
|
+
key = "environments/production/terraform.tfstate"
|
|
70
|
+
region = "us-east-1"
|
|
71
|
+
dynamodb_table = "terraform-locks"
|
|
72
|
+
encrypt = true
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Rules:
|
|
78
|
+
- One state file per environment per component. Never share state across environments.
|
|
79
|
+
- Enable encryption on the state bucket (state contains secrets).
|
|
80
|
+
- Enable DynamoDB locking to prevent concurrent applies.
|
|
81
|
+
- Enable versioning on the state bucket for recovery.
|
|
82
|
+
- Never commit `.tfstate` files to git.
|
|
83
|
+
|
|
84
|
+
### Environment separation
|
|
85
|
+
```
|
|
86
|
+
environments/
|
|
87
|
+
├── dev/
|
|
88
|
+
│ ├── main.tf # module "db" { source = "../../modules/database" ... }
|
|
89
|
+
│ └── terraform.tfvars # instance_class = "db.t3.micro"
|
|
90
|
+
├── staging/
|
|
91
|
+
│ ├── main.tf
|
|
92
|
+
│ └── terraform.tfvars # instance_class = "db.t3.small"
|
|
93
|
+
└── production/
|
|
94
|
+
├── main.tf
|
|
95
|
+
└── terraform.tfvars # instance_class = "db.r6g.large"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Each environment has its own state, its own tfvars, and composes the same modules with different parameters.
|
|
99
|
+
|
|
100
|
+
## Security Patterns
|
|
101
|
+
|
|
102
|
+
### Least-privilege security groups
|
|
103
|
+
```hcl
|
|
104
|
+
# GOOD: Specific port, specific source
|
|
105
|
+
resource "aws_security_group_rule" "api_from_alb" {
|
|
106
|
+
type = "ingress"
|
|
107
|
+
from_port = 3000
|
|
108
|
+
to_port = 3000
|
|
109
|
+
protocol = "tcp"
|
|
110
|
+
source_security_group_id = aws_security_group.alb.id
|
|
111
|
+
security_group_id = aws_security_group.api.id
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# BAD: Open to the world
|
|
115
|
+
resource "aws_security_group_rule" "bad_example" {
|
|
116
|
+
type = "ingress"
|
|
117
|
+
from_port = 0
|
|
118
|
+
to_port = 65535
|
|
119
|
+
protocol = "-1"
|
|
120
|
+
cidr_blocks = ["0.0.0.0/0"] # Never do this
|
|
121
|
+
security_group_id = aws_security_group.api.id
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Encryption by default
|
|
126
|
+
```hcl
|
|
127
|
+
resource "aws_db_instance" "main" {
|
|
128
|
+
storage_encrypted = true # Always
|
|
129
|
+
# ...
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
resource "aws_s3_bucket_server_side_encryption_configuration" "main" {
|
|
133
|
+
bucket = aws_s3_bucket.main.id
|
|
134
|
+
rule {
|
|
135
|
+
apply_server_side_encryption_by_default {
|
|
136
|
+
sse_algorithm = "aws:kms"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### No hardcoded secrets
|
|
143
|
+
```hcl
|
|
144
|
+
# BAD
|
|
145
|
+
resource "aws_db_instance" "main" {
|
|
146
|
+
password = "supersecret123"
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
# GOOD: Use a secrets manager or variable with sensitive flag
|
|
150
|
+
variable "db_password" {
|
|
151
|
+
type = string
|
|
152
|
+
sensitive = true
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
# BETTER: Generate and store in secrets manager
|
|
156
|
+
resource "random_password" "db" {
|
|
157
|
+
length = 32
|
|
158
|
+
special = true
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
resource "aws_secretsmanager_secret_version" "db" {
|
|
162
|
+
secret_id = aws_secretsmanager_secret.db.id
|
|
163
|
+
secret_string = random_password.db.result
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Common Anti-patterns
|
|
168
|
+
|
|
169
|
+
**Mega-module**: One giant module that creates VPC + RDS + ECS + CloudFront. Split into focused, composable modules.
|
|
170
|
+
|
|
171
|
+
**Hardcoded values**: Region, account ID, instance sizes baked into resource blocks. Use variables with validation.
|
|
172
|
+
|
|
173
|
+
**No state locking**: Two engineers running `terraform apply` simultaneously can corrupt state. Always enable locking.
|
|
174
|
+
|
|
175
|
+
**Local state**: State on someone's laptop means no collaboration and no recovery. Always use remote backends.
|
|
176
|
+
|
|
177
|
+
**Apply from laptop**: Manual applies bypass code review and audit trails. Apply through CI/CD only. `terraform plan` locally for development, `terraform apply` through pipelines.
|
|
178
|
+
|
|
179
|
+
**Ignoring plan output**: Applying without reading the plan. Always review what will be created, changed, or destroyed — especially in production.
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Terraform Module Template
|
|
2
|
+
|
|
3
|
+
Standard file structure for a reusable Terraform module. Copy and replace `<MODULE_NAME>`, `<RESOURCE_TYPE>`, and `<DESCRIPTION>` placeholders.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## File Structure
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
modules/<MODULE_NAME>/
|
|
11
|
+
├── main.tf # Resources
|
|
12
|
+
├── variables.tf # Inputs
|
|
13
|
+
├── outputs.tf # Outputs
|
|
14
|
+
├── versions.tf # Provider and Terraform version constraints
|
|
15
|
+
└── README.md # Usage, inputs, outputs table
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## versions.tf
|
|
21
|
+
|
|
22
|
+
```hcl
|
|
23
|
+
terraform {
|
|
24
|
+
required_version = ">= 1.6"
|
|
25
|
+
|
|
26
|
+
required_providers {
|
|
27
|
+
aws = {
|
|
28
|
+
source = "hashicorp/aws"
|
|
29
|
+
version = "~> 5.0"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## variables.tf
|
|
38
|
+
|
|
39
|
+
```hcl
|
|
40
|
+
variable "environment" {
|
|
41
|
+
description = "Deployment environment (dev, staging, production)"
|
|
42
|
+
type = string
|
|
43
|
+
validation {
|
|
44
|
+
condition = contains(["dev", "staging", "production"], var.environment)
|
|
45
|
+
error_message = "environment must be dev, staging, or production."
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
variable "name" {
|
|
50
|
+
description = "Base name for resources. Used in naming and tagging."
|
|
51
|
+
type = string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
variable "tags" {
|
|
55
|
+
description = "Additional tags to apply to all resources."
|
|
56
|
+
type = map(string)
|
|
57
|
+
default = {}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
# Add module-specific variables below.
|
|
61
|
+
# Pattern: description, type, optional default, optional validation.
|
|
62
|
+
|
|
63
|
+
variable "instance_count" {
|
|
64
|
+
description = "Number of instances to provision."
|
|
65
|
+
type = number
|
|
66
|
+
default = 1
|
|
67
|
+
validation {
|
|
68
|
+
condition = var.instance_count >= 1
|
|
69
|
+
error_message = "instance_count must be at least 1."
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## main.tf
|
|
77
|
+
|
|
78
|
+
```hcl
|
|
79
|
+
locals {
|
|
80
|
+
# Merge caller tags with mandatory module tags
|
|
81
|
+
common_tags = merge(var.tags, {
|
|
82
|
+
Environment = var.environment
|
|
83
|
+
Module = "<MODULE_NAME>"
|
|
84
|
+
ManagedBy = "terraform"
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
name_prefix = "${var.name}-${var.environment}"
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
resource "aws_<RESOURCE_TYPE>" "main" {
|
|
91
|
+
# Use locals.name_prefix, never hardcode region or environment
|
|
92
|
+
# Use data sources (aws_vpc, aws_subnets) instead of hardcoding IDs
|
|
93
|
+
|
|
94
|
+
tags = local.common_tags
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
> **Rules:** No hardcoded regions (`us-east-1`). No hardcoded account IDs. Use `data` sources for VPCs, subnets, AMIs. Use `local.common_tags` on every resource — cost attribution and compliance depend on it.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## outputs.tf
|
|
103
|
+
|
|
104
|
+
```hcl
|
|
105
|
+
output "id" {
|
|
106
|
+
description = "ID of the <RESOURCE_TYPE> resource."
|
|
107
|
+
value = aws_<RESOURCE_TYPE>.main.id
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
output "arn" {
|
|
111
|
+
description = "ARN of the <RESOURCE_TYPE> resource."
|
|
112
|
+
value = aws_<RESOURCE_TYPE>.main.arn
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# Mark sensitive outputs appropriately
|
|
116
|
+
output "connection_string" {
|
|
117
|
+
description = "Connection string for downstream modules."
|
|
118
|
+
value = aws_<RESOURCE_TYPE>.main.endpoint
|
|
119
|
+
sensitive = true
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## README.md (Module)
|
|
126
|
+
|
|
127
|
+
```markdown
|
|
128
|
+
# <MODULE_NAME>
|
|
129
|
+
|
|
130
|
+
<DESCRIPTION>
|
|
131
|
+
|
|
132
|
+
## Usage
|
|
133
|
+
|
|
134
|
+
```hcl
|
|
135
|
+
module "<MODULE_NAME>" {
|
|
136
|
+
source = "../../modules/<MODULE_NAME>"
|
|
137
|
+
|
|
138
|
+
name = "my-app"
|
|
139
|
+
environment = "production"
|
|
140
|
+
tags = { Team = "platform", CostCenter = "infra" }
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Inputs
|
|
145
|
+
|
|
146
|
+
| Name | Description | Type | Default | Required |
|
|
147
|
+
|------|-------------|------|---------|----------|
|
|
148
|
+
| environment | Deployment environment | `string` | — | yes |
|
|
149
|
+
| name | Base name for resources | `string` | — | yes |
|
|
150
|
+
| tags | Additional tags | `map(string)` | `{}` | no |
|
|
151
|
+
|
|
152
|
+
## Outputs
|
|
153
|
+
|
|
154
|
+
| Name | Description |
|
|
155
|
+
|------|-------------|
|
|
156
|
+
| id | Resource ID |
|
|
157
|
+
| arn | Resource ARN |
|
|
158
|
+
```
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: metrics-and-okrs
|
|
3
|
+
description: "Define OKRs, KPIs, success metrics, and engineering health metrics (DORA). Triggers: OKR, KPI, metrics, success metrics, key results, objectives, measure success, DORA metrics, engineering metrics, velocity, cycle time, deployment frequency, how do we measure, what should we track."
|
|
4
|
+
model: haiku
|
|
5
|
+
allowed-tools: Read, Grep, Glob, Write, Edit
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Metrics & OKRs
|
|
9
|
+
|
|
10
|
+
Define meaningful metrics that drive decisions and OKRs that align engineering work with business outcomes. Good metrics answer "are we succeeding?" Bad metrics create busywork.
|
|
11
|
+
|
|
12
|
+
## Core Rule
|
|
13
|
+
|
|
14
|
+
**Every metric must drive a decision.** If knowing the metric's value wouldn't change what you do, stop tracking it. Metrics without decisions are vanity metrics.
|
|
15
|
+
|
|
16
|
+
## Workflow: OKRs
|
|
17
|
+
|
|
18
|
+
### Step 1: Understand the Context
|
|
19
|
+
|
|
20
|
+
Before writing OKRs:
|
|
21
|
+
|
|
22
|
+
- **What's the time horizon?** Quarterly is standard. Annual is too long for engineering.
|
|
23
|
+
- **What level?** Company → Team → Individual? Start with team-level.
|
|
24
|
+
- **What's the business priority?** Growth? Retention? Reliability? Cost reduction?
|
|
25
|
+
- **What did we learn from last quarter?** What OKRs were hit, missed, and why?
|
|
26
|
+
|
|
27
|
+
### Step 2: Write Objectives
|
|
28
|
+
|
|
29
|
+
An Objective is a qualitative, inspiring goal that answers "where do we want to go?"
|
|
30
|
+
|
|
31
|
+
**Good Objectives:**
|
|
32
|
+
- "Make the checkout experience delightfully fast"
|
|
33
|
+
- "Build a platform our enterprise customers trust"
|
|
34
|
+
- "Eliminate the deployment bottleneck"
|
|
35
|
+
|
|
36
|
+
**Bad Objectives:**
|
|
37
|
+
- "Improve latency by 40%" (this is a Key Result, not an Objective)
|
|
38
|
+
- "Complete the Q3 roadmap" (this is output, not outcome)
|
|
39
|
+
- "Increase revenue" (too vague, not actionable by engineering)
|
|
40
|
+
|
|
41
|
+
Rules: 3-5 objectives per team per quarter. Each should be ambitious but achievable. If you hit 100% of all OKRs, you aimed too low. 70% achievement is healthy.
|
|
42
|
+
|
|
43
|
+
### Step 3: Write Key Results
|
|
44
|
+
|
|
45
|
+
Key Results are quantitative measures that prove the Objective is being met.
|
|
46
|
+
|
|
47
|
+
**Good Key Results:**
|
|
48
|
+
- "Reduce checkout page load time from 3.2s to under 1.5s at P95"
|
|
49
|
+
- "Achieve 99.95% API availability (up from 99.8%)"
|
|
50
|
+
- "Reduce time from PR merge to production from 4 hours to 30 minutes"
|
|
51
|
+
|
|
52
|
+
**Bad Key Results:**
|
|
53
|
+
- "Launch the new checkout page" (this is output, not outcome)
|
|
54
|
+
- "Improve performance" (not measurable)
|
|
55
|
+
- "No production incidents" (not realistic and incentivizes hiding incidents)
|
|
56
|
+
|
|
57
|
+
Each Objective should have 2-4 Key Results. Each Key Result needs:
|
|
58
|
+
- **Current value** (baseline)
|
|
59
|
+
- **Target value** (goal)
|
|
60
|
+
- **How it's measured** (data source, calculation)
|
|
61
|
+
|
|
62
|
+
### Step 4: Validate the OKRs
|
|
63
|
+
|
|
64
|
+
Check each OKR against these criteria:
|
|
65
|
+
- [ ] Is the Objective inspiring and clearly directional?
|
|
66
|
+
- [ ] Are Key Results measurable with a specific number?
|
|
67
|
+
- [ ] Can we actually measure this today? (If not, first KR might be "instrument X")
|
|
68
|
+
- [ ] Do Key Results measure outcomes, not outputs?
|
|
69
|
+
- [ ] Is 70% achievement of all KRs realistic with focused effort?
|
|
70
|
+
- [ ] Are there perverse incentives? (Reducing errors by not logging them)
|
|
71
|
+
|
|
72
|
+
### Step 5: Produce the OKR Document
|
|
73
|
+
|
|
74
|
+
Use the template at [templates/okr-document.md](templates/okr-document.md).
|
|
75
|
+
|
|
76
|
+
## Workflow: Project Success Metrics
|
|
77
|
+
|
|
78
|
+
For any project or feature, define metrics in three categories:
|
|
79
|
+
|
|
80
|
+
**Leading indicators** (early signals during development):
|
|
81
|
+
- Sprint velocity, burndown trend, scope change rate
|
|
82
|
+
- Test coverage of new code, CI pipeline pass rate
|
|
83
|
+
|
|
84
|
+
**Lagging indicators** (results after launch):
|
|
85
|
+
- User adoption (DAU, feature usage rate)
|
|
86
|
+
- Performance metrics (latency, error rate, availability)
|
|
87
|
+
- Business metrics (conversion rate, revenue, support ticket volume)
|
|
88
|
+
|
|
89
|
+
**Health indicators** (ongoing system health):
|
|
90
|
+
- DORA metrics (see below)
|
|
91
|
+
- Technical debt metrics (code quality trends, dependency freshness)
|
|
92
|
+
|
|
93
|
+
See [references/metric-catalog.md](references/metric-catalog.md) for a catalog of useful metrics by category.
|
|
94
|
+
|
|
95
|
+
## Workflow: DORA Engineering Metrics
|
|
96
|
+
|
|
97
|
+
The four DORA metrics are the industry standard for measuring engineering team effectiveness:
|
|
98
|
+
|
|
99
|
+
| Metric | What It Measures | Elite | High | Medium | Low |
|
|
100
|
+
|--------|-----------------|-------|------|--------|-----|
|
|
101
|
+
| **Deployment Frequency** | How often you deploy | Multiple/day | Weekly | Monthly | Quarterly |
|
|
102
|
+
| **Lead Time for Changes** | PR merge to production | < 1 hour | < 1 day | < 1 week | > 1 month |
|
|
103
|
+
| **Change Failure Rate** | % of deploys causing incidents | < 5% | < 10% | < 15% | > 30% |
|
|
104
|
+
| **Mean Time to Recover** | Incident to resolution | < 1 hour | < 1 day | < 1 week | > 1 month |
|
|
105
|
+
|
|
106
|
+
These four metrics together tell you if your team is delivering quickly and reliably. Optimizing one at the expense of another is a trap (deploying fast but breaking things, or never breaking things but never shipping).
|
|
107
|
+
|
|
108
|
+
## Principles Applied
|
|
109
|
+
|
|
110
|
+
- **KISS**: 3-5 OKRs per team, 2-4 KRs each. More means none get attention.
|
|
111
|
+
- **Outcomes over outputs**: Measure "user checkout time reduced" not "new checkout page shipped."
|
|
112
|
+
- **YAGNI**: Don't build a metrics dashboard for 50 KPIs. Start with the 5 that would actually change a decision.
|
|
113
|
+
- **Leading over lagging**: Prefer metrics you can act on now over metrics you can only measure after the fact.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skill_name": "metrics-and-okrs",
|
|
3
|
+
"evals": [
|
|
4
|
+
{
|
|
5
|
+
"id": 1,
|
|
6
|
+
"prompt": "Write OKRs for our backend engineering team for Q2. Our priorities are: improve API reliability (we had 3 outages last quarter), reduce deployment friction (deploys take 4 hours), and ship the new billing system. Team of 6 engineers.",
|
|
7
|
+
"expected_output": "Should produce 3 objectives with 2-4 measurable key results each, using baselines where available, targeting realistic improvements, and flagging that 'ship billing system' needs to be reframed as an outcome.",
|
|
8
|
+
"assertions": [
|
|
9
|
+
"Frames objectives as inspiring goals, not tasks",
|
|
10
|
+
"Reframes 'ship billing system' as an outcome (e.g., 'billing accuracy' or 'customer billing complaints reduced')",
|
|
11
|
+
"Key results are measurable with specific numbers",
|
|
12
|
+
"Includes baseline values where the user provided data (outage count, deploy time)",
|
|
13
|
+
"Targets are ambitious but not absurd (not 'zero outages ever')",
|
|
14
|
+
"Reliability KRs use SLO-like framing (availability %, MTTR)",
|
|
15
|
+
"Deployment KRs use DORA metrics (lead time, frequency)",
|
|
16
|
+
"Produces a complete OKR document"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": 2,
|
|
21
|
+
"prompt": "We launched a new search feature 2 weeks ago. My PM is asking 'how do we know if it's successful?'. Help me define the success metrics.",
|
|
22
|
+
"expected_output": "Should define leading and lagging indicators, distinguish between product metrics and technical metrics, and establish measurement timelines.",
|
|
23
|
+
"assertions": [
|
|
24
|
+
"Defines product metrics (search usage rate, click-through, zero-result rate)",
|
|
25
|
+
"Defines technical metrics (search latency, error rate)",
|
|
26
|
+
"Establishes baselines (what was the old search doing?)",
|
|
27
|
+
"Distinguishes leading (this week) from lagging (30 days) indicators",
|
|
28
|
+
"Suggests a timeframe for evaluation (not 'check once and declare victory')",
|
|
29
|
+
"Warns against vanity metrics (total searches without context is meaningless)"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Metric Catalog
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
- Product metrics
|
|
5
|
+
- Engineering metrics
|
|
6
|
+
- Reliability metrics
|
|
7
|
+
- Business metrics
|
|
8
|
+
- Anti-metrics (what NOT to measure)
|
|
9
|
+
|
|
10
|
+
## Product Metrics
|
|
11
|
+
|
|
12
|
+
| Metric | Formula | Good For |
|
|
13
|
+
|--------|---------|----------|
|
|
14
|
+
| Daily Active Users (DAU) | Unique users performing a core action / day | Growth tracking |
|
|
15
|
+
| Feature Adoption Rate | Users who used feature / Total active users | Feature success |
|
|
16
|
+
| Task Completion Rate | Successful completions / Attempts | UX quality |
|
|
17
|
+
| Time to Value | Time from signup to first meaningful action | Onboarding quality |
|
|
18
|
+
| Retention (Day N) | Users active on day N / Users who signed up N days ago | Product-market fit |
|
|
19
|
+
| NPS | % Promoters - % Detractors | Customer satisfaction |
|
|
20
|
+
| Churn Rate | Users lost / Total users (per period) | Retention health |
|
|
21
|
+
|
|
22
|
+
## Engineering Metrics
|
|
23
|
+
|
|
24
|
+
### DORA Metrics (team effectiveness)
|
|
25
|
+
| Metric | How to Measure | Target |
|
|
26
|
+
|--------|---------------|--------|
|
|
27
|
+
| Deployment Frequency | Count deploys per week/day | Multiple per day (elite) |
|
|
28
|
+
| Lead Time for Changes | Median time from commit to production | < 1 day |
|
|
29
|
+
| Change Failure Rate | Deploys causing incidents / Total deploys | < 5% |
|
|
30
|
+
| Mean Time to Recover | Median incident duration (detection → resolution) | < 1 hour |
|
|
31
|
+
|
|
32
|
+
### Development Health
|
|
33
|
+
| Metric | How to Measure | Warning Signal |
|
|
34
|
+
|--------|---------------|----------------|
|
|
35
|
+
| Cycle Time | Median time from "in progress" to "done" | Increasing over time |
|
|
36
|
+
| PR Review Time | Median time from PR open to first review | > 24 hours |
|
|
37
|
+
| PR Size | Median lines changed per PR | > 400 lines regularly |
|
|
38
|
+
| Build Time | CI pipeline duration | > 15 minutes |
|
|
39
|
+
| Test Coverage | Lines covered / Total lines (of new code) | Declining trend |
|
|
40
|
+
| Flaky Test Rate | Tests with inconsistent results / Total tests | > 2% |
|
|
41
|
+
| Dependency Freshness | Packages more than 1 major version behind | Increasing count |
|
|
42
|
+
|
|
43
|
+
## Reliability Metrics
|
|
44
|
+
|
|
45
|
+
| Metric | Formula | Typical SLO |
|
|
46
|
+
|--------|---------|------------|
|
|
47
|
+
| Availability | Successful requests / Total requests | 99.9% - 99.99% |
|
|
48
|
+
| Latency (P50) | Median response time | < 200ms |
|
|
49
|
+
| Latency (P99) | 99th percentile response time | < 1s |
|
|
50
|
+
| Error Rate | 5xx responses / Total responses | < 0.1% |
|
|
51
|
+
| Saturation | Resource utilization (CPU, memory, connections) | < 80% |
|
|
52
|
+
| Error Budget Remaining | Budget consumed / Total budget | > 50% is healthy |
|
|
53
|
+
|
|
54
|
+
## Business Metrics
|
|
55
|
+
|
|
56
|
+
| Metric | Formula | Good For |
|
|
57
|
+
|--------|---------|----------|
|
|
58
|
+
| Revenue per Feature | Revenue attributable to a feature / Cost to build | ROI of features |
|
|
59
|
+
| Cost per Transaction | Infrastructure cost / Number of transactions | Efficiency |
|
|
60
|
+
| Support Ticket Volume | Tickets per feature area per week | Quality signal |
|
|
61
|
+
| Time to Market | Idea to production for a typical feature | Organizational speed |
|
|
62
|
+
|
|
63
|
+
## Anti-Metrics (What NOT to Measure)
|
|
64
|
+
|
|
65
|
+
**Lines of Code**: More lines ≠ more value. Incentivizes bloat over simplicity.
|
|
66
|
+
|
|
67
|
+
**Number of Commits**: More commits ≠ more productivity. Incentivizes tiny meaningless commits.
|
|
68
|
+
|
|
69
|
+
**Story Points Completed (as individual performance)**: Points measure task size, not person performance. Using them for individual evaluation destroys team dynamics.
|
|
70
|
+
|
|
71
|
+
**100% Test Coverage**: Incentivizes writing shallow tests to hit the number rather than meaningful tests for real behavior.
|
|
72
|
+
|
|
73
|
+
**Bug Count (as a quality metric)**: More bugs found can mean better testing, not worse code. Punishing bug count discourages reporting.
|
|
74
|
+
|
|
75
|
+
**Hours Worked**: Measures input, not output. Incentivizes presence over results.
|
|
76
|
+
|
|
77
|
+
## Choosing the Right Metrics
|
|
78
|
+
|
|
79
|
+
Ask three questions for every metric:
|
|
80
|
+
|
|
81
|
+
1. **Does it drive a decision?** If the metric changes, would you do something differently? If not, stop tracking it.
|
|
82
|
+
|
|
83
|
+
2. **Can it be gamed?** If someone optimizes purely for this metric, would the overall system get worse? If yes, add a counterbalancing metric.
|
|
84
|
+
|
|
85
|
+
3. **Is it a leading or lagging indicator?** Leading indicators (cycle time, build time) let you act before problems grow. Lagging indicators (revenue, churn) tell you what already happened.
|
|
86
|
+
|
|
87
|
+
For every primary metric, consider a counterbalance:
|
|
88
|
+
- Deployment frequency ↔ Change failure rate (deploy fast BUT safely)
|
|
89
|
+
- Feature velocity ↔ Support ticket volume (ship features BUT quality ones)
|
|
90
|
+
- Cost reduction ↔ Performance metrics (reduce spend BUT maintain SLOs)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# OKR Document Template
|
|
2
|
+
|
|
3
|
+
```markdown
|
|
4
|
+
# OKRs: [Team Name] — [Quarter/Period]
|
|
5
|
+
|
|
6
|
+
**Author**: [Name]
|
|
7
|
+
**Period**: [Q1 2025 / Jan-Mar 2025]
|
|
8
|
+
**Last updated**: [YYYY-MM-DD]
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Objective 1: [Inspiring qualitative goal]
|
|
13
|
+
|
|
14
|
+
| Key Result | Baseline | Target | Current | Status |
|
|
15
|
+
|-----------|----------|--------|---------|--------|
|
|
16
|
+
| [Measurable outcome] | [Starting value] | [Goal value] | [Now] | 🟢🟡🔴 |
|
|
17
|
+
| [Measurable outcome] | [Starting value] | [Goal value] | [Now] | 🟢🟡🔴 |
|
|
18
|
+
| [Measurable outcome] | [Starting value] | [Goal value] | [Now] | 🟢🟡🔴 |
|
|
19
|
+
|
|
20
|
+
**How measured**: [Data source, dashboard link, calculation method]
|
|
21
|
+
**Owner**: [Person accountable for driving this objective]
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Objective 2: [Inspiring qualitative goal]
|
|
26
|
+
|
|
27
|
+
| Key Result | Baseline | Target | Current | Status |
|
|
28
|
+
|-----------|----------|--------|---------|--------|
|
|
29
|
+
| [Measurable outcome] | [Starting value] | [Goal value] | [Now] | 🟢🟡🔴 |
|
|
30
|
+
| [Measurable outcome] | [Starting value] | [Goal value] | [Now] | 🟢🟡🔴 |
|
|
31
|
+
|
|
32
|
+
**How measured**: [Data source]
|
|
33
|
+
**Owner**: [Person]
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Objective 3: [Inspiring qualitative goal]
|
|
38
|
+
|
|
39
|
+
| Key Result | Baseline | Target | Current | Status |
|
|
40
|
+
|-----------|----------|--------|---------|--------|
|
|
41
|
+
| [Measurable outcome] | [Starting value] | [Goal value] | [Now] | 🟢🟡🔴 |
|
|
42
|
+
| [Measurable outcome] | [Starting value] | [Goal value] | [Now] | 🟢🟡🔴 |
|
|
43
|
+
|
|
44
|
+
**How measured**: [Data source]
|
|
45
|
+
**Owner**: [Person]
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Status Key
|
|
50
|
+
|
|
51
|
+
- 🟢 On track (≥ 70% of target)
|
|
52
|
+
- 🟡 At risk (40-70% of target)
|
|
53
|
+
- 🔴 Off track (< 40% of target)
|
|
54
|
+
|
|
55
|
+
## End-of-Quarter Review
|
|
56
|
+
|
|
57
|
+
**Overall score**: [0-1.0 average across all KRs]
|
|
58
|
+
**Key wins**: [What went well]
|
|
59
|
+
**Key misses**: [What didn't work and why]
|
|
60
|
+
**Learnings for next quarter**: [What to carry forward]
|
|
61
|
+
```
|