@schilling.mark.a/software-methodology 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/.github/copilot-instructions.md +106 -0
- package/LICENSE +21 -0
- package/README.md +174 -0
- package/atdd-workflow/SKILL.md +117 -0
- package/atdd-workflow/references/green-phase.md +38 -0
- package/atdd-workflow/references/red-phase.md +62 -0
- package/atdd-workflow/references/refactor-phase.md +75 -0
- package/bdd-specification/SKILL.md +88 -0
- package/bdd-specification/references/example-mapping.md +105 -0
- package/bdd-specification/references/gherkin-patterns.md +214 -0
- package/cicd-pipeline/SKILL.md +64 -0
- package/cicd-pipeline/references/deployment-rollback.md +176 -0
- package/cicd-pipeline/references/environment-promotion.md +159 -0
- package/cicd-pipeline/references/pipeline-stages.md +198 -0
- package/clean-code/SKILL.md +77 -0
- package/clean-code/references/behavioral-patterns.md +329 -0
- package/clean-code/references/creational-patterns.md +197 -0
- package/clean-code/references/enterprise-patterns.md +334 -0
- package/clean-code/references/solid.md +230 -0
- package/clean-code/references/structural-patterns.md +238 -0
- package/continuous-improvement/SKILL.md +69 -0
- package/continuous-improvement/references/measurement.md +133 -0
- package/continuous-improvement/references/process-update.md +118 -0
- package/continuous-improvement/references/root-cause-analysis.md +144 -0
- package/dist/atdd-workflow.skill +0 -0
- package/dist/bdd-specification.skill +0 -0
- package/dist/cicd-pipeline.skill +0 -0
- package/dist/clean-code.skill +0 -0
- package/dist/continuous-improvement.skill +0 -0
- package/dist/green-implementation.skill +0 -0
- package/dist/product-strategy.skill +0 -0
- package/dist/story-mapping.skill +0 -0
- package/dist/ui-design-system.skill +0 -0
- package/dist/ui-design-workflow.skill +0 -0
- package/dist/ux-design.skill +0 -0
- package/dist/ux-research.skill +0 -0
- package/docs/INTEGRATION.md +229 -0
- package/docs/QUICKSTART.md +126 -0
- package/docs/SHARING.md +828 -0
- package/docs/SKILLS.md +296 -0
- package/green-implementation/SKILL.md +155 -0
- package/green-implementation/references/angular-patterns.md +239 -0
- package/green-implementation/references/common-rejections.md +180 -0
- package/green-implementation/references/playwright-patterns.md +321 -0
- package/green-implementation/references/rxjs-patterns.md +161 -0
- package/package.json +57 -0
- package/product-strategy/SKILL.md +71 -0
- package/product-strategy/references/business-model-canvas.md +199 -0
- package/product-strategy/references/canvas-alignment.md +108 -0
- package/product-strategy/references/value-proposition-canvas.md +159 -0
- package/project-templates/context.md.template +56 -0
- package/project-templates/test-strategy.md.template +87 -0
- package/story-mapping/SKILL.md +104 -0
- package/story-mapping/references/backbone.md +66 -0
- package/story-mapping/references/release-planning.md +92 -0
- package/story-mapping/references/task-template.md +78 -0
- package/story-mapping/references/walking-skeleton.md +63 -0
- package/ui-design-system/SKILL.md +48 -0
- package/ui-design-system/references/accessibility.md +134 -0
- package/ui-design-system/references/components.md +257 -0
- package/ui-design-system/references/design-tokens.md +209 -0
- package/ui-design-system/references/layout.md +136 -0
- package/ui-design-system/references/typography.md +114 -0
- package/ui-design-workflow/SKILL.md +90 -0
- package/ui-design-workflow/references/acceptance-targets.md +144 -0
- package/ui-design-workflow/references/component-selection.md +108 -0
- package/ui-design-workflow/references/scenario-to-ui.md +151 -0
- package/ui-design-workflow/references/screen-flows.md +116 -0
- package/ux-design/SKILL.md +75 -0
- package/ux-design/references/information-architecture.md +144 -0
- package/ux-design/references/interaction-patterns.md +141 -0
- package/ux-design/references/onboarding.md +159 -0
- package/ux-design/references/usability-evaluation.md +132 -0
- package/ux-research/SKILL.md +75 -0
- package/ux-research/references/journey-mapping.md +168 -0
- package/ux-research/references/mental-models.md +106 -0
- package/ux-research/references/personas.md +102 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Environment Promotion
|
|
2
|
+
|
|
3
|
+
## What Is Environment Promotion?
|
|
4
|
+
|
|
5
|
+
Code does not go directly from commit to production. It moves through a sequence of environments, each one closer to production and each one with stricter conditions. Promotion is the act of moving code from one environment to the next. Each promotion requires the previous environment's gates to have passed.
|
|
6
|
+
|
|
7
|
+
This is not bureaucracy. It is risk reduction. Each environment catches a different class of failure. Production is the most expensive environment to fail in — so it is the last one code reaches, and only after it has survived every earlier environment.
|
|
8
|
+
|
|
9
|
+
## The Environment Sequence
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
LOCAL → CI (ephemeral) → STAGING → PRODUCTION
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Each environment below defines: what it is, what infrastructure it runs on, what tests run against it, and what must pass before code promotes to the next environment.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Environment 1: Local
|
|
20
|
+
|
|
21
|
+
**What it is:** The developer's machine. Code is written, tested locally, and committed here.
|
|
22
|
+
|
|
23
|
+
**Infrastructure:** Developer's workstation. Local database, local dependencies.
|
|
24
|
+
|
|
25
|
+
**Tests that run:** Unit tests and acceptance tests (developer runs these manually or via local test command before committing). The developer verifies green locally before pushing.
|
|
26
|
+
|
|
27
|
+
**Promotion condition:** Developer pushes commit to the repository. This triggers the CI pipeline automatically — no manual promotion step.
|
|
28
|
+
|
|
29
|
+
**What this environment catches:** Syntax errors. Logic errors the developer can see immediately. Failures that surface within seconds of writing the code.
|
|
30
|
+
|
|
31
|
+
**What this environment does NOT catch:** Environment-specific failures (works on my machine). Integration failures between components. Security vulnerabilities. Anything that requires infrastructure the developer does not have locally.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Environment 2: CI (Ephemeral)
|
|
36
|
+
|
|
37
|
+
**What it is:** An automated, disposable environment spun up by the CI platform for every commit or pull request. It exists only for the duration of the pipeline run, then is destroyed.
|
|
38
|
+
|
|
39
|
+
**Infrastructure:** CI platform (GitHub Actions runner, GitLab CI runner, Jenkins agent, etc.). Fresh OS image, clean dependency install, ephemeral database for integration tests.
|
|
40
|
+
|
|
41
|
+
**Tests that run:** Stages 1–5 of the pipeline: Build, Unit Tests, Integration Tests, Acceptance Tests, Security Scan. (See pipeline-stages.md for detail on each.)
|
|
42
|
+
|
|
43
|
+
**Promotion condition:** All Stages 1–5 pass. Code is merged to main (for pull requests) or proceeds to Staging Deploy (for main branch pushes).
|
|
44
|
+
|
|
45
|
+
**What this environment catches:** Build failures. Regressions (tests that passed before this commit but fail now). Integration failures between components. Security vulnerabilities and secrets. Environment drift (code that works locally but fails in a clean environment).
|
|
46
|
+
|
|
47
|
+
**What this environment does NOT catch:** Failures that only manifest under real infrastructure conditions (network latency, database at scale, real traffic patterns). Configuration differences between CI and production.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Environment 3: Staging
|
|
52
|
+
|
|
53
|
+
**What it is:** A persistent environment that mirrors production as closely as possible. It is the last environment before production — the final check before real users are affected.
|
|
54
|
+
|
|
55
|
+
**Infrastructure:** Production-equivalent. Same OS, same database engine, same network topology, same deployment platform. Differs only in scale (fewer instances) and traffic source (no real user traffic — only automated tests and manual exploratory testing).
|
|
56
|
+
|
|
57
|
+
**Tests that run:** Stages 6–7 of the pipeline: Staging Deploy and Smoke Tests. Additionally, QA or the team may perform manual exploratory testing in staging before approving production promotion.
|
|
58
|
+
|
|
59
|
+
**Promotion condition:** Smoke tests pass. If manual approval is configured for production deploy, an authorized person approves. (See Approval Gates below.)
|
|
60
|
+
|
|
61
|
+
**What this environment catches:** Configuration mismatches between CI and production infrastructure. Failures that only manifest against real infrastructure (database migrations at scale, network timeouts, TLS configuration). Integration failures with external services that are stubbed in CI but real in staging.
|
|
62
|
+
|
|
63
|
+
**What this environment does NOT catch:** Failures caused by real user traffic patterns (load, concurrency, edge-case input from real users). Failures that only manifest over time (memory leaks, slow degradation).
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Environment 4: Production
|
|
68
|
+
|
|
69
|
+
**What it is:** The live environment. Real users. Real traffic. Real consequences.
|
|
70
|
+
|
|
71
|
+
**Infrastructure:** Production infrastructure. Full scale. Real external services. Real traffic.
|
|
72
|
+
|
|
73
|
+
**Tests that run:** Stage 8 (Production Deploy) and Stage 9 (Health Check). Health check monitors error rates and response times against established baselines.
|
|
74
|
+
|
|
75
|
+
**Promotion condition:** Health check passes for the configured observation period. If the deployment strategy is canary, the canary period completes without error rate increase before full rollout.
|
|
76
|
+
|
|
77
|
+
**What this environment catches:** Everything the earlier environments missed. If something reaches production and fails, it is a production incident — continuous-improvement's root cause analysis investigates which earlier gate should have caught it.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Approval Gates
|
|
82
|
+
|
|
83
|
+
Most promotions are automatic — the pipeline moves forward when the gate passes. Some promotions require human approval. Approval gates slow the pipeline intentionally. They exist only where the risk of an automated promotion outweighs the cost of the delay.
|
|
84
|
+
|
|
85
|
+
### When to Require Approval
|
|
86
|
+
|
|
87
|
+
- **Production deploy for customer-facing changes:** If the release includes changes that users will see (new screens, changed behavior, pricing changes), require approval before production deploy.
|
|
88
|
+
- **Production deploy after a recent production incident:** If a rollback occurred in the last N deployments, require approval until stability is confirmed.
|
|
89
|
+
- **Infrastructure changes:** Changes to the deployment platform, database configuration, or network topology require approval regardless of test results.
|
|
90
|
+
|
|
91
|
+
### When Approval Is NOT Required
|
|
92
|
+
|
|
93
|
+
- **Hotfix deploys after a production incident:** Speed matters more than process. The hotfix goes through all automated gates but skips the manual approval gate. This is a conscious trade-off — document it.
|
|
94
|
+
- **Internal tools with no external users:** The risk of a failed deploy is low. Automated gates are sufficient.
|
|
95
|
+
|
|
96
|
+
### Approval Record
|
|
97
|
+
|
|
98
|
+
Every approval is logged: who approved, when, and for which deployment. This is an audit trail — not optional.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Environment Configuration Document
|
|
103
|
+
|
|
104
|
+
Create: `/docs/cicd/environments.md`
|
|
105
|
+
|
|
106
|
+
```markdown
|
|
107
|
+
# Environment Configuration
|
|
108
|
+
|
|
109
|
+
**Created:** [Date]
|
|
110
|
+
**Last updated:** [Date]
|
|
111
|
+
|
|
112
|
+
## Environment Inventory
|
|
113
|
+
|
|
114
|
+
| Environment | Infrastructure | Persistent | Traffic source | Approval to promote |
|
|
115
|
+
|---|---|---|---|---|
|
|
116
|
+
| Local | Developer workstation | Yes | Developer | No — push triggers CI |
|
|
117
|
+
| CI | [CI platform] ephemeral runners | No | Pipeline only | No — automatic on gate pass |
|
|
118
|
+
| Staging | [Staging infrastructure] | Yes | Smoke tests + manual QA | [Yes / No] |
|
|
119
|
+
| Production | [Production infrastructure] | Yes | Real users | [Yes / No] |
|
|
120
|
+
|
|
121
|
+
## Approval Gates
|
|
122
|
+
|
|
123
|
+
- **Staging → Production:** [Required / Not required]
|
|
124
|
+
- If required: [Who can approve — role or team]
|
|
125
|
+
- [Under what conditions approval is mandatory vs optional]
|
|
126
|
+
- **Post-incident override:** [Policy for deploys after a recent rollback]
|
|
127
|
+
|
|
128
|
+
## Environment Parity Rules
|
|
129
|
+
|
|
130
|
+
Staging must match production on:
|
|
131
|
+
- [ ] OS and runtime version
|
|
132
|
+
- [ ] Database engine and version
|
|
133
|
+
- [ ] Network topology (VPC, subnets, security groups)
|
|
134
|
+
- [ ] Deployment platform (same container orchestrator, same serverless runtime)
|
|
135
|
+
- [ ] TLS configuration
|
|
136
|
+
- [ ] External service endpoints (staging may use staging versions of external APIs, but the integration pattern must be identical)
|
|
137
|
+
|
|
138
|
+
Staging may differ on:
|
|
139
|
+
- Scale (fewer instances)
|
|
140
|
+
- Traffic volume (no real user traffic)
|
|
141
|
+
- Data (synthetic or anonymized, not real user data)
|
|
142
|
+
|
|
143
|
+
## Smoke Test Suite
|
|
144
|
+
|
|
145
|
+
The smoke test suite is a curated subset of acceptance tests covering the highest-value user journeys.
|
|
146
|
+
|
|
147
|
+
| Smoke test | Maps to scenario | Why it is critical-path |
|
|
148
|
+
|---|---|---|
|
|
149
|
+
| [Test name] | [Feature: scenario name] | [Why this is critical] |
|
|
150
|
+
| [Test name] | [Feature: scenario name] | [Why this is critical] |
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Rules
|
|
154
|
+
|
|
155
|
+
- Every environment exists for a reason. Do not add environments without a clear class of failure they are designed to catch.
|
|
156
|
+
- Staging must mirror production infrastructure. Parity drift is the single most common cause of "works in staging, fails in production."
|
|
157
|
+
- Approval gates are documented and logged. An undocumented approval is not an approval.
|
|
158
|
+
- Ephemeral environments (CI) are rebuilt from scratch every time. This prevents state from accumulating and hiding failures.
|
|
159
|
+
- The smoke test suite is maintained alongside the acceptance test suite. When a new critical-path feature ships, add its acceptance test to the smoke suite.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# Pipeline Stages
|
|
2
|
+
|
|
3
|
+
## What Is a Pipeline Stage?
|
|
4
|
+
|
|
5
|
+
A pipeline stage is a unit of automated work with a gate. The gate is a pass/fail condition. If the gate passes, code moves to the next stage. If it fails, the pipeline stops, notifies, and waits for a fix. No stage is skipped. No gate is bypassed in normal operation.
|
|
6
|
+
|
|
7
|
+
The stages below are in fixed order. Every project uses all of them. The configuration within each stage (which tools, which commands) varies by project — but the sequence and the gate conditions do not.
|
|
8
|
+
|
|
9
|
+
## Stage Sequence
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
COMMIT → BUILD → UNIT TEST → INTEGRATION TEST → ACCEPTANCE TEST
|
|
13
|
+
→ SECURITY SCAN → STAGING DEPLOY → SMOKE TEST → PRODUCTION DEPLOY → HEALTH CHECK
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Each stage below defines: what runs, what the gate checks, what artifact it consumes from the methodology, and what failure looks like.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Stage 1: Build
|
|
21
|
+
|
|
22
|
+
**What runs:** Compile, transpile, or bundle the application. Resolve all dependencies. Produce a deployable artifact (container image, binary, bundle).
|
|
23
|
+
|
|
24
|
+
**Gate:** Build succeeds with zero errors. All dependencies resolved. Artifact produced.
|
|
25
|
+
|
|
26
|
+
**Consumes:** Source code from the commit that triggered the pipeline.
|
|
27
|
+
|
|
28
|
+
**Failure means:** The code does not compile. A dependency is missing or incompatible. The artifact cannot be produced. This is typically a syntax error, a missing package, or a broken import — not a logic error.
|
|
29
|
+
|
|
30
|
+
**Fix:** The developer who committed fixes the build error and pushes a new commit. The pipeline re-runs from Stage 1.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Stage 2: Unit Tests
|
|
35
|
+
|
|
36
|
+
**What runs:** All unit tests in the project. These are the tests written during the GREEN phase of atdd-workflow — fast, isolated, testing individual behaviors.
|
|
37
|
+
|
|
38
|
+
**Gate:** All unit tests pass. Code coverage meets the project threshold (typically ≥90%, as defined in `/docs/test-strategy.md`).
|
|
39
|
+
|
|
40
|
+
**Consumes:** The built artifact from Stage 1. The unit test suite from `tests/unit/`.
|
|
41
|
+
|
|
42
|
+
**Failure means:** A unit test failed. Either the code introduced a regression, or a test expectation is wrong. Coverage dropped below threshold, meaning new code was added without corresponding tests — which should not happen if atdd-workflow RED phase was followed.
|
|
43
|
+
|
|
44
|
+
**Fix:** The developer investigates the failing test. If the code is wrong, fix the code. If the test expectation is wrong (rare in ATDD — the test was written first), update the test. Push. Pipeline re-runs.
|
|
45
|
+
|
|
46
|
+
**Connection to atdd-workflow:** Unit tests are the inner loop tests from RED-GREEN-REFACTOR. If they all passed locally during development but fail in the pipeline, the likely cause is an environment difference (dependency version, OS, configuration). Check that the pipeline build environment matches the developer's local environment.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Stage 3: Integration Tests
|
|
51
|
+
|
|
52
|
+
**What runs:** Tests that verify components work together — database interactions, API calls between services, message queue consumption. These tests require a running infrastructure (database, cache, external service stubs).
|
|
53
|
+
|
|
54
|
+
**Gate:** All integration tests pass.
|
|
55
|
+
|
|
56
|
+
**Consumes:** The built artifact. A test infrastructure environment spun up by the pipeline (ephemeral — destroyed after this stage).
|
|
57
|
+
|
|
58
|
+
**Failure means:** Components do not communicate correctly. A database schema mismatch. An API contract violation between services. A message format incompatibility.
|
|
59
|
+
|
|
60
|
+
**Fix:** The developer investigates the integration failure. Often a schema migration that was not included in the commit, or an API contract that changed without updating the consumer. Push fix. Pipeline re-runs.
|
|
61
|
+
|
|
62
|
+
**Note:** If the project is a single-service application with no inter-service communication, this stage runs database integration tests only. If there are no external dependencies at all, this stage is a no-op gate (passes automatically) — do not remove it from the pipeline definition. It exists as a placeholder for when dependencies are added.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Stage 4: Acceptance Tests
|
|
67
|
+
|
|
68
|
+
**What runs:** The full acceptance test suite — the outer loop tests from atdd-workflow's RED phase. These are the tests that map directly to Gherkin scenarios in the feature files. They run against a fully assembled application.
|
|
69
|
+
|
|
70
|
+
**Gate:** All acceptance tests pass. Every scenario in every feature file has a passing test.
|
|
71
|
+
|
|
72
|
+
**Consumes:** The built artifact. A fully assembled test environment (application + database + any dependencies). The feature files from `features/` and the acceptance tests from `tests/acceptance/`.
|
|
73
|
+
|
|
74
|
+
**Failure means:** A scenario that passed locally does not pass in the pipeline. The assembled application does not behave as the feature file specifies. This is the most important gate — it is the last line of defense before code reaches users.
|
|
75
|
+
|
|
76
|
+
**Connection to atdd-workflow and bdd-specification:** Acceptance tests are the mechanized form of the Gherkin scenarios. If a scenario exists in a feature file but has no passing acceptance test, this gate will catch it. The traceability between feature files and acceptance tests is enforced here — not just locally.
|
|
77
|
+
|
|
78
|
+
**Connection to ui-design-workflow:** Acceptance targets defined in screen flows become assertions in acceptance tests. If an acceptance target was defined but not tested, the coverage gap surfaces here.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Stage 5: Security Scan
|
|
83
|
+
|
|
84
|
+
**What runs:** Static analysis of source code for security vulnerabilities (OWASP Top 10). Dependency scanning for known CVEs in third-party libraries. Secret detection (API keys, credentials accidentally committed).
|
|
85
|
+
|
|
86
|
+
**Gate:** No critical or high-severity vulnerabilities found. No secrets detected in the codebase.
|
|
87
|
+
|
|
88
|
+
**Consumes:** The source code. The dependency manifest (package.json, requirements.txt, pom.xml, Gemfile, etc.).
|
|
89
|
+
|
|
90
|
+
**Failure means:** A known vulnerability exists in a dependency. A security anti-pattern was introduced in the code. A credential was committed. Critical and high severity block the pipeline. Medium and low are logged but do not block.
|
|
91
|
+
|
|
92
|
+
**Fix:** For dependency vulnerabilities: update or replace the vulnerable dependency. For code vulnerabilities: fix the anti-pattern. For secrets: remove the secret from the commit history (not just the latest commit — the secret is in git history), rotate the credential, and push. Pipeline re-runs.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Stage 6: Staging Deploy
|
|
97
|
+
|
|
98
|
+
**What runs:** Deploy the artifact to the staging environment. Staging mirrors production infrastructure as closely as possible — same OS, same database engine, same network topology. The only difference is scale and traffic source.
|
|
99
|
+
|
|
100
|
+
**Gate:** Deployment completes successfully. The application starts and reports healthy.
|
|
101
|
+
|
|
102
|
+
**Consumes:** The artifact from Stage 1. The staging environment configuration from `/docs/cicd/environments.md`.
|
|
103
|
+
|
|
104
|
+
**Failure means:** The artifact does not run in the staging environment. A configuration difference between build and staging caused a crash. A database migration failed. An environment variable is missing.
|
|
105
|
+
|
|
106
|
+
**Fix:** Compare staging configuration to build environment. Fix the mismatch. Push. Pipeline re-runs from Stage 1 (full pipeline — do not skip stages).
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Stage 7: Smoke Tests (Staging)
|
|
111
|
+
|
|
112
|
+
**What runs:** A small, fast subset of critical-path tests against the live staging deployment. These are not the full acceptance suite — they are the 5–10 tests that verify the most critical user journeys actually work end-to-end against real infrastructure.
|
|
113
|
+
|
|
114
|
+
**Gate:** All smoke tests pass against staging.
|
|
115
|
+
|
|
116
|
+
**Consumes:** The running staging deployment. A curated smoke test suite (subset of acceptance tests, selected for critical-path coverage).
|
|
117
|
+
|
|
118
|
+
**Failure means:** Something that passed in the isolated acceptance test environment does not work against real infrastructure. A timing issue. A network timeout. A configuration that acceptance tests did not exercise.
|
|
119
|
+
|
|
120
|
+
**Fix:** Investigate the smoke test failure in staging. If it is an infrastructure issue, fix the environment configuration. If it is a code issue that only manifests under real conditions, fix the code. Push. Full pipeline re-runs.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Stage 8: Production Deploy
|
|
125
|
+
|
|
126
|
+
**What runs:** Deploy the artifact to production using the deployment strategy defined in `/docs/cicd/deployment.md` (blue-green, canary, rolling, or replace).
|
|
127
|
+
|
|
128
|
+
**Gate:** Deployment completes. The production health check passes (Stage 9). If the deployment strategy is canary, the canary period passes without error rate increase before full rollout proceeds.
|
|
129
|
+
|
|
130
|
+
**Consumes:** The artifact. The production environment configuration. The deployment strategy document.
|
|
131
|
+
|
|
132
|
+
**Approval gate (optional):** For high-risk deployments, require manual approval before production deploy proceeds. The approval gate sits between Stage 7 (smoke tests pass) and Stage 8. Who can approve and under what conditions is defined in `/docs/cicd/environments.md`.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Stage 9: Health Check (Production)
|
|
137
|
+
|
|
138
|
+
**What runs:** Verify that production is healthy after deployment. Application responds to health endpoints. Error rates have not spiked. Key metrics are within normal range.
|
|
139
|
+
|
|
140
|
+
**Gate:** Health check passes. Error rate is within baseline ±threshold (defined per project). Response time is within baseline ±threshold.
|
|
141
|
+
|
|
142
|
+
**Consumes:** The running production deployment. Monitoring baselines established from previous deployments.
|
|
143
|
+
|
|
144
|
+
**Failure means:** The deployment succeeded but production is unhealthy. This is the automatic rollback trigger — see `/docs/cicd/deployment.md` for rollback procedures.
|
|
145
|
+
|
|
146
|
+
**Connection to continuous-improvement:** If the health check fails and rollback occurs, this is a production incident. continuous-improvement's root cause analysis runs. The investigation traces back through the pipeline to find which gate should have caught the problem but did not.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Pipeline Configuration Document
|
|
151
|
+
|
|
152
|
+
Create: `/docs/cicd/pipeline.md`
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
# CI/CD Pipeline Configuration
|
|
156
|
+
|
|
157
|
+
**Created:** [Date]
|
|
158
|
+
**Last updated:** [Date]
|
|
159
|
+
**Platform:** [GitHub Actions / GitLab CI / Jenkins / etc.]
|
|
160
|
+
|
|
161
|
+
## Trigger
|
|
162
|
+
- Push to `main` branch triggers the full pipeline
|
|
163
|
+
- Pull request to `main` triggers Stages 1–5 only (no deploy)
|
|
164
|
+
|
|
165
|
+
## Stages
|
|
166
|
+
|
|
167
|
+
| Stage | Tool / Command | Gate | Blocks on failure |
|
|
168
|
+
|---|---|---|---|
|
|
169
|
+
| 1 — Build | [build command] | Zero errors, artifact produced | Yes |
|
|
170
|
+
| 2 — Unit Tests | [test command] | All pass, coverage ≥[threshold]% | Yes |
|
|
171
|
+
| 3 — Integration Tests | [test command] | All pass | Yes |
|
|
172
|
+
| 4 — Acceptance Tests | [test command] | All pass | Yes |
|
|
173
|
+
| 5 — Security Scan | [scan tool] | No critical/high CVEs, no secrets | Yes |
|
|
174
|
+
| 6 — Staging Deploy | [deploy command] | Deployment succeeds | Yes |
|
|
175
|
+
| 7 — Smoke Tests | [test command] | All pass | Yes |
|
|
176
|
+
| 8 — Production Deploy | [deploy command] | See deployment.md | Yes |
|
|
177
|
+
| 9 — Health Check | [health check command] | Error rate and latency within baseline | Yes (triggers rollback) |
|
|
178
|
+
|
|
179
|
+
## Approval Gates
|
|
180
|
+
- **Production deploy:** [Required / Not required]
|
|
181
|
+
- If required: [Who can approve] [Under what conditions]
|
|
182
|
+
|
|
183
|
+
## Notification
|
|
184
|
+
- Pipeline failure: [Notify channel/team]
|
|
185
|
+
- Production deploy success: [Notify channel/team]
|
|
186
|
+
- Rollback triggered: [Notify channel/team — this is urgent]
|
|
187
|
+
|
|
188
|
+
## Test Strategy Reference
|
|
189
|
+
All test commands and coverage thresholds are defined in `/docs/test-strategy.md`.
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Rules
|
|
193
|
+
|
|
194
|
+
- Every stage runs in order. No stage is skipped in normal operation.
|
|
195
|
+
- Every gate is a hard pass/fail. No "warnings only" for critical or high severity items.
|
|
196
|
+
- Pull requests run Stages 1–5. Merges to main run the full pipeline. This means every piece of code is tested before it reaches the deploy stages.
|
|
197
|
+
- The pipeline configuration is version-controlled alongside the application code. A change to the pipeline is a commit, reviewed the same way as any other code change.
|
|
198
|
+
- If a stage consistently fails on valid code, the stage configuration is wrong — not the code. Investigate the stage, not the developer.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clean-code
|
|
3
|
+
description: Design principles and design patterns for writing clean, maintainable code. Use during the GREEN phase when writing implementation code and during the REFACTOR phase when improving code structure. Provides decision guidance on which SOLID principles apply, when to extract abstractions, and which Gang of Four or enterprise patterns fit the current problem. Works alongside atdd-workflow skill — tests must stay green throughout.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Clean Code — Design Principles and Patterns
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Decision guide for applying design principles and patterns during GREEN and REFACTOR phases. Does not replace atdd-workflow — tests must remain green at every step. This skill answers: "What principle or pattern applies here, and how?"
|
|
11
|
+
|
|
12
|
+
## When to Read This Skill
|
|
13
|
+
|
|
14
|
+
**During GREEN phase:** When minimal code feels structurally wrong even as a stepping stone — read `references/solid.md` to check if a principle is being violated that will make the next RED-GREEN cycle impossible.
|
|
15
|
+
|
|
16
|
+
**During REFACTOR phase:** Always. Read the decision tree below, then load only the relevant reference file.
|
|
17
|
+
|
|
18
|
+
## Decision Tree — Which Reference to Load
|
|
19
|
+
|
|
20
|
+
### "I have duplication"
|
|
21
|
+
→ Read `references/solid.md` — DRY and SRP will guide the extraction
|
|
22
|
+
|
|
23
|
+
### "I have an if/else or switch that keeps growing"
|
|
24
|
+
→ Read `references/behavioral-patterns.md` — Strategy, Command, or State will eliminate the branching
|
|
25
|
+
|
|
26
|
+
### "I have a class doing too many things"
|
|
27
|
+
→ Read `references/solid.md` — SRP first. Then read `references/structural-patterns.md` if the class needs to be decomposed into a hierarchy
|
|
28
|
+
|
|
29
|
+
### "I need to add a new behavior without changing existing code"
|
|
30
|
+
→ Read `references/solid.md` — OCP. Then read `references/behavioral-patterns.md` for the pattern that enables it
|
|
31
|
+
|
|
32
|
+
### "I have concrete dependencies that make testing hard"
|
|
33
|
+
→ Read `references/solid.md` — DIP. Then read `references/structural-patterns.md` for Adapter or Facade if wrapping external systems
|
|
34
|
+
|
|
35
|
+
### "I have a complex object that requires a specific construction sequence"
|
|
36
|
+
→ Read `references/creational-patterns.md`
|
|
37
|
+
|
|
38
|
+
### "I need to compose behaviors at runtime"
|
|
39
|
+
→ Read `references/behavioral-patterns.md` — Strategy or Decorator
|
|
40
|
+
|
|
41
|
+
### "I have a thin wrapper around an external system"
|
|
42
|
+
→ Read `references/structural-patterns.md` — Adapter or Facade
|
|
43
|
+
|
|
44
|
+
### "I have a complex subsystem I want to hide behind a simple interface"
|
|
45
|
+
→ Read `references/structural-patterns.md` — Facade
|
|
46
|
+
|
|
47
|
+
### "I have a tree structure or nested hierarchy"
|
|
48
|
+
→ Read `references/structural-patterns.md` — Composite
|
|
49
|
+
|
|
50
|
+
### "I have enterprise-scale concerns: repositories, services, event handling"
|
|
51
|
+
→ Read `references/enterprise-patterns.md`
|
|
52
|
+
|
|
53
|
+
## Constraints
|
|
54
|
+
|
|
55
|
+
- **Tests must stay green.** Every refactoring step is followed by a test run. If tests break, revert and take a smaller step.
|
|
56
|
+
- **Don't over-engineer.** Apply a pattern only when the code currently requires it. A second occurrence of the same problem (Rule of Three) is the signal to extract.
|
|
57
|
+
- **Use ubiquitous language.** All class names, method names, and interfaces must use terms from `/docs/ubiquitous-language.md`.
|
|
58
|
+
- **Patterns serve the domain.** Name pattern implementations after domain concepts, not after the pattern. A Strategy for tax calculation is called `TaxCalculator`, not `TaxStrategy`.
|
|
59
|
+
|
|
60
|
+
## Rule of Three
|
|
61
|
+
|
|
62
|
+
Do not extract a pattern on first occurrence. Wait until:
|
|
63
|
+
1. The same problem appears a second time — now you have two concrete examples
|
|
64
|
+
2. You can see the abstraction that unifies both
|
|
65
|
+
3. Extract — the abstraction is now grounded in reality, not speculation
|
|
66
|
+
|
|
67
|
+
## Integration with atdd-workflow
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
🔴 RED → Write failing test (atdd-workflow)
|
|
71
|
+
🟢 GREEN → Write minimal code. If a SOLID violation makes the next cycle
|
|
72
|
+
impossible, consult references/solid.md before proceeding.
|
|
73
|
+
(clean-code)
|
|
74
|
+
♻️ REFACTOR → Identify smell from decision tree above. Load relevant
|
|
75
|
+
reference. Apply pattern. Run tests. Commit when green.
|
|
76
|
+
(clean-code + atdd-workflow)
|
|
77
|
+
```
|