cfsa-antigravity 2.19.0 → 2.19.2
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/package.json +1 -1
- package/template/.agent/kit-sync.md +3 -3
- package/template/.claude/commands/audit-ambiguity-execute.md +6 -0
- package/template/.claude/commands/audit-ambiguity-rubrics.md +6 -0
- package/template/.claude/commands/audit-ambiguity.md +6 -0
- package/template/.claude/commands/bootstrap-agents-fill.md +6 -0
- package/template/.claude/commands/bootstrap-agents-provision.md +6 -0
- package/template/.claude/commands/bootstrap-agents.md +6 -0
- package/template/.claude/commands/create-prd-architecture.md +6 -0
- package/template/.claude/commands/create-prd-compile.md +6 -0
- package/template/.claude/commands/create-prd-design-system.md +6 -0
- package/template/.claude/commands/create-prd-security.md +6 -0
- package/template/.claude/commands/create-prd-stack.md +6 -0
- package/template/.claude/commands/decompose-architecture-structure.md +6 -0
- package/template/.claude/commands/decompose-architecture-validate.md +6 -0
- package/template/.claude/commands/evolve-contract.md +6 -0
- package/template/.claude/commands/evolve-feature-cascade.md +6 -0
- package/template/.claude/commands/evolve-feature-classify.md +6 -0
- package/template/.claude/commands/evolve-feature.md +6 -0
- package/template/.claude/commands/ideate-discover.md +6 -0
- package/template/.claude/commands/ideate-extract.md +6 -0
- package/template/.claude/commands/ideate-validate.md +6 -0
- package/template/.claude/commands/implement-slice-setup.md +6 -0
- package/template/.claude/commands/implement-slice-tdd.md +6 -0
- package/template/.claude/commands/plan-phase-preflight.md +6 -0
- package/template/.claude/commands/plan-phase-write.md +6 -0
- package/template/.claude/commands/propagate-decision-apply.md +6 -0
- package/template/.claude/commands/propagate-decision-scan.md +6 -0
- package/template/.claude/commands/propagate-decision.md +6 -0
- package/template/.claude/commands/remediate-pipeline-assess.md +6 -0
- package/template/.claude/commands/remediate-pipeline-execute.md +6 -0
- package/template/.claude/commands/remediate-pipeline.md +6 -0
- package/template/.claude/commands/remediate-shard-split.md +6 -0
- package/template/.claude/commands/resolve-ambiguity.md +6 -0
- package/template/.claude/commands/setup-workspace-cicd.md +6 -0
- package/template/.claude/commands/setup-workspace-data.md +6 -0
- package/template/.claude/commands/setup-workspace-hosting.md +6 -0
- package/template/.claude/commands/setup-workspace-scaffold.md +6 -0
- package/template/.claude/commands/sync-kit.md +6 -0
- package/template/.claude/commands/update-architecture-map.md +6 -0
- package/template/.claude/commands/validate-phase-quality.md +6 -0
- package/template/.claude/commands/validate-phase-readiness.md +6 -0
- package/template/.claude/commands/verify-infrastructure.md +6 -0
- package/template/.claude/commands/write-architecture-spec-deepen.md +6 -0
- package/template/.claude/commands/write-architecture-spec-design.md +6 -0
- package/template/.claude/commands/write-be-spec-classify.md +6 -0
- package/template/.claude/commands/write-be-spec-write.md +6 -0
- package/template/.claude/commands/write-fe-spec-classify.md +6 -0
- package/template/.claude/commands/write-fe-spec-write.md +6 -0
- package/template/.claude/skills/accessibility/SKILL.md +522 -0
- package/template/.claude/skills/accessibility/references/WCAG.md +162 -0
- package/template/.claude/skills/accessibility/references/ia-spec-checklist.md +35 -0
- package/template/.claude/skills/adversarial-review/SKILL.md +90 -0
- package/template/.claude/skills/antigravity-workflows/SKILL.md +81 -0
- package/template/.claude/skills/antigravity-workflows/resources/implementation-playbook.md +36 -0
- package/template/.claude/skills/api-design-principles/SKILL.md +169 -0
- package/template/.claude/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/template/.claude/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/template/.claude/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/template/.claude/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/template/.claude/skills/api-design-principles/resources/implementation-playbook.md +513 -0
- package/template/.claude/skills/api-versioning/SKILL.md +166 -0
- package/template/.claude/skills/api-versioning/references/typescript.md +157 -0
- package/template/.claude/skills/architecture-mapping/SKILL.md +219 -0
- package/template/.claude/skills/bootstrap-agents/SKILL.md +258 -0
- package/template/.claude/skills/brainstorming/SKILL.md +177 -0
- package/template/.claude/skills/brand-guidelines/SKILL.md +44 -0
- package/template/.claude/skills/clean-code/SKILL.md +196 -0
- package/template/.claude/skills/clean-code/references/typescript.md +126 -0
- package/template/.claude/skills/code-review-pro/SKILL.md +152 -0
- package/template/.claude/skills/concise-planning/SKILL.md +107 -0
- package/template/.claude/skills/cross-layer-consistency/SKILL.md +117 -0
- package/template/.claude/skills/database-schema-design/SKILL.md +205 -0
- package/template/.claude/skills/database-schema-design/references/relational.md +228 -0
- package/template/.claude/skills/deployment-procedures/SKILL.md +241 -0
- package/template/.claude/skills/design-anti-cliche/SKILL.md +159 -0
- package/template/.claude/skills/design-direction/SKILL.md +45 -0
- package/template/.claude/skills/error-handling-patterns/SKILL.md +226 -0
- package/template/.claude/skills/error-handling-patterns/references/go.md +162 -0
- package/template/.claude/skills/error-handling-patterns/references/python.md +262 -0
- package/template/.claude/skills/error-handling-patterns/references/rust.md +112 -0
- package/template/.claude/skills/error-handling-patterns/references/typescript.md +178 -0
- package/template/.claude/skills/find-skills/SKILL.md +145 -0
- package/template/.claude/skills/git-advanced/SKILL.md +972 -0
- package/template/.claude/skills/git-workflow/SKILL.md +420 -0
- package/template/.claude/skills/idea-extraction/SKILL.md +644 -0
- package/template/.claude/skills/logging-best-practices/SKILL.md +192 -0
- package/template/.claude/skills/logging-best-practices/references/go.md +49 -0
- package/template/.claude/skills/logging-best-practices/references/python.md +52 -0
- package/template/.claude/skills/logging-best-practices/references/typescript.md +215 -0
- package/template/.claude/skills/migration-management/SKILL.md +200 -0
- package/template/.claude/skills/migration-management/references/relational.md +214 -0
- package/template/.claude/skills/minimalist-surgical-development/SKILL.md +135 -0
- package/template/.claude/skills/parallel-agents/SKILL.md +165 -0
- package/template/.claude/skills/parallel-debugging/SKILL.md +135 -0
- package/template/.claude/skills/parallel-feature-development/SKILL.md +157 -0
- package/template/.claude/skills/performance-budgeting/SKILL.md +144 -0
- package/template/.claude/skills/pipeline-rubrics/SKILL.md +51 -0
- package/template/.claude/skills/pipeline-rubrics/references/architecture-rubric.md +19 -0
- package/template/.claude/skills/pipeline-rubrics/references/be-rubric.md +21 -0
- package/template/.claude/skills/pipeline-rubrics/references/fe-rubric.md +20 -0
- package/template/.claude/skills/pipeline-rubrics/references/ia-rubric.md +19 -0
- package/template/.claude/skills/pipeline-rubrics/references/scoring.md +32 -0
- package/template/.claude/skills/pipeline-rubrics/references/vision-rubric.md +12 -0
- package/template/.claude/skills/prd-templates/SKILL.md +107 -0
- package/template/.claude/skills/prd-templates/references/architecture-completeness-checklist.md +28 -0
- package/template/.claude/skills/prd-templates/references/architecture-design-template.md +88 -0
- package/template/.claude/skills/prd-templates/references/be-spec-classification.md +41 -0
- package/template/.claude/skills/prd-templates/references/be-spec-template.md +107 -0
- package/template/.claude/skills/prd-templates/references/bootstrap-verification-protocol.md +50 -0
- package/template/.claude/skills/prd-templates/references/constraint-exploration.md +41 -0
- package/template/.claude/skills/prd-templates/references/data-placement-template.md +74 -0
- package/template/.claude/skills/prd-templates/references/decision-confirmation-protocol.md +68 -0
- package/template/.claude/skills/prd-templates/references/decision-propagation.md +121 -0
- package/template/.claude/skills/prd-templates/references/decomposition-templates.md +226 -0
- package/template/.claude/skills/prd-templates/references/deep-ideation-loading-protocol.md +114 -0
- package/template/.claude/skills/prd-templates/references/design-system-decisions.md +198 -0
- package/template/.claude/skills/prd-templates/references/design-system-prerequisite-check.md +18 -0
- package/template/.claude/skills/prd-templates/references/domain-exhaustion-criteria.md +37 -0
- package/template/.claude/skills/prd-templates/references/engagement-tier-protocol.md +58 -0
- package/template/.claude/skills/prd-templates/references/engineering-standards-template.md +126 -0
- package/template/.claude/skills/prd-templates/references/evolution-layer-guidance.md +91 -0
- package/template/.claude/skills/prd-templates/references/expansion-modes.md +27 -0
- package/template/.claude/skills/prd-templates/references/fe-classification-procedures.md +47 -0
- package/template/.claude/skills/prd-templates/references/fe-spec-template.md +90 -0
- package/template/.claude/skills/prd-templates/references/feature-ledger-protocol.md +149 -0
- package/template/.claude/skills/prd-templates/references/folder-seeding-protocol.md +77 -0
- package/template/.claude/skills/prd-templates/references/fractal-cx-template.md +58 -0
- package/template/.claude/skills/prd-templates/references/fractal-feature-template.md +93 -0
- package/template/.claude/skills/prd-templates/references/fractal-node-index-template.md +55 -0
- package/template/.claude/skills/prd-templates/references/gate-applicability.md +92 -0
- package/template/.claude/skills/prd-templates/references/ideation-crosscut-template.md +36 -0
- package/template/.claude/skills/prd-templates/references/ideation-index-template.md +111 -0
- package/template/.claude/skills/prd-templates/references/ideation-meta-template.md +126 -0
- package/template/.claude/skills/prd-templates/references/infrastructure-report-template.md +71 -0
- package/template/.claude/skills/prd-templates/references/input-classification.md +23 -0
- package/template/.claude/skills/prd-templates/references/map-guard-protocol.md +65 -0
- package/template/.claude/skills/prd-templates/references/operational-templates.md +116 -0
- package/template/.claude/skills/prd-templates/references/persona-completeness-gate.md +20 -0
- package/template/.claude/skills/prd-templates/references/placeholder-guard-template.md +21 -0
- package/template/.claude/skills/prd-templates/references/placeholder-workflow-mapping.md +50 -0
- package/template/.claude/skills/prd-templates/references/shard-boundary-analysis.md +103 -0
- package/template/.claude/skills/prd-templates/references/shard-split-remediation.md +157 -0
- package/template/.claude/skills/prd-templates/references/skill-loading-protocol.md +36 -0
- package/template/.claude/skills/prd-templates/references/slice-completion-gates.md +29 -0
- package/template/.claude/skills/prd-templates/references/spec-coverage-sweep.md +44 -0
- package/template/.claude/skills/prd-templates/references/surface-model.md +61 -0
- package/template/.claude/skills/prd-templates/references/tdd-testing-policy.md +39 -0
- package/template/.claude/skills/prd-templates/references/vision-template.md +57 -0
- package/template/.claude/skills/prd-templates/references/workflow-checkpoint-protocol.md +112 -0
- package/template/.claude/skills/prd-templates/references/write-verification-protocol.md +57 -0
- package/template/.claude/skills/prompt-engineer/SKILL.md +203 -0
- package/template/.claude/skills/regex-patterns/SKILL.md +333 -0
- package/template/.claude/skills/regex-patterns/references/go.md +44 -0
- package/template/.claude/skills/regex-patterns/references/javascript.md +63 -0
- package/template/.claude/skills/regex-patterns/references/python.md +77 -0
- package/template/.claude/skills/regex-patterns/references/rust.md +43 -0
- package/template/.claude/skills/resolve-ambiguity/SKILL.md +278 -0
- package/template/.claude/skills/security-scanning-security-hardening/SKILL.md +231 -0
- package/template/.claude/skills/session-continuity/SKILL.md +732 -0
- package/template/.claude/skills/session-continuity/protocols/01-session-resumption.md +38 -0
- package/template/.claude/skills/session-continuity/protocols/02-progress-generation.md +85 -0
- package/template/.claude/skills/session-continuity/protocols/03-progress-update.md +70 -0
- package/template/.claude/skills/session-continuity/protocols/04-pattern-extraction.md +60 -0
- package/template/.claude/skills/session-continuity/protocols/05-session-close.md +37 -0
- package/template/.claude/skills/session-continuity/protocols/06-decision-analysis.md +84 -0
- package/template/.claude/skills/session-continuity/protocols/07-spec-pipeline-generation.md +48 -0
- package/template/.claude/skills/session-continuity/protocols/08-spec-pipeline-update.md +55 -0
- package/template/.claude/skills/session-continuity/protocols/09-parallel-claim.md +122 -0
- package/template/.claude/skills/session-continuity/protocols/10-placeholder-verification-gate.md +83 -0
- package/template/.claude/skills/session-continuity/protocols/11-parallel-synthesis.md +21 -0
- package/template/.claude/skills/session-continuity/protocols/ambiguity-gates.md +48 -0
- package/template/.claude/skills/skill-creator/SKILL.md +203 -0
- package/template/.claude/skills/skill-creator/references/.gitkeep +0 -0
- package/template/.claude/skills/skill-creator/scripts/.gitkeep +0 -0
- package/template/.claude/skills/spec-writing/SKILL.md +110 -0
- package/template/.claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/template/.claude/skills/systematic-debugging/SKILL.md +297 -0
- package/template/.claude/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/template/.claude/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/template/.claude/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/template/.claude/skills/systematic-debugging/find-polluter.sh +63 -0
- package/template/.claude/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/template/.claude/skills/systematic-debugging/test-academic.md +14 -0
- package/template/.claude/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/template/.claude/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/template/.claude/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/template/.claude/skills/tdd-workflow/SKILL.md +186 -0
- package/template/.claude/skills/tdd-workflow/references/typescript.md +231 -0
- package/template/.claude/skills/tech-stack-catalog/SKILL.md +49 -0
- package/template/.claude/skills/tech-stack-catalog/references/constraint-questions.md +237 -0
- package/template/.claude/skills/tech-stack-catalog/references/dev-tooling-decisions.md +37 -0
- package/template/.claude/skills/tech-stack-catalog/references/surface-decision-tables.md +69 -0
- package/template/.claude/skills/technical-writer/SKILL.md +242 -0
- package/template/.claude/skills/testing-strategist/SKILL.md +319 -0
- package/template/.claude/skills/testing-strategist/references/typescript.md +328 -0
- package/template/.claude/skills/verification-before-completion/SKILL.md +97 -0
- package/template/.claude/skills/workflow-automation/SKILL.md +166 -0
- package/template/.claude/skills/workflow-automation/references/inngest.md +88 -0
- package/template/.claude/skills/workflow-automation/references/temporal.md +64 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deployment-procedures
|
|
3
|
+
description: Production deployment principles and decision-making. Safe deployment workflows, rollback strategies, and verification. Teaches thinking, not scripts.
|
|
4
|
+
allowed-tools: Read, Glob, Grep, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Deployment Procedures
|
|
8
|
+
|
|
9
|
+
> Deployment principles and decision-making for safe production releases.
|
|
10
|
+
> **Learn to THINK, not memorize scripts.**
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## ⚠️ How to Use This Skill
|
|
15
|
+
|
|
16
|
+
This skill teaches **deployment principles**, not bash scripts to copy.
|
|
17
|
+
|
|
18
|
+
- Every deployment is unique
|
|
19
|
+
- Understand the WHY behind each step
|
|
20
|
+
- Adapt procedures to your platform
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 1. Platform Selection
|
|
25
|
+
|
|
26
|
+
### Decision Tree
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
What are you deploying?
|
|
30
|
+
│
|
|
31
|
+
├── Static site / JAMstack
|
|
32
|
+
│ └── Vercel, Netlify, Cloudflare Pages
|
|
33
|
+
│
|
|
34
|
+
├── Simple web app
|
|
35
|
+
│ ├── Managed → Railway, Render, Fly.io
|
|
36
|
+
│ └── Control → VPS + PM2/Docker
|
|
37
|
+
│
|
|
38
|
+
├── Microservices
|
|
39
|
+
│ └── Container orchestration
|
|
40
|
+
│
|
|
41
|
+
└── Serverless
|
|
42
|
+
└── Edge functions, Lambda
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Each Platform Has Different Procedures
|
|
46
|
+
|
|
47
|
+
| Platform | Deployment Method |
|
|
48
|
+
|----------|------------------|
|
|
49
|
+
| **Vercel/Netlify** | Git push, auto-deploy |
|
|
50
|
+
| **Railway/Render** | Git push or CLI |
|
|
51
|
+
| **VPS + PM2** | SSH + manual steps |
|
|
52
|
+
| **Docker** | Image push + orchestration |
|
|
53
|
+
| **Kubernetes** | kubectl apply |
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 2. Pre-Deployment Principles
|
|
58
|
+
|
|
59
|
+
### The 4 Verification Categories
|
|
60
|
+
|
|
61
|
+
| Category | What to Check |
|
|
62
|
+
|----------|--------------|
|
|
63
|
+
| **Code Quality** | Tests passing, linting clean, reviewed |
|
|
64
|
+
| **Build** | Production build works, no warnings |
|
|
65
|
+
| **Environment** | Env vars set, secrets current |
|
|
66
|
+
| **Safety** | Backup done, rollback plan ready |
|
|
67
|
+
|
|
68
|
+
### Pre-Deployment Checklist
|
|
69
|
+
|
|
70
|
+
- [ ] All tests passing
|
|
71
|
+
- [ ] Code reviewed and approved
|
|
72
|
+
- [ ] Production build successful
|
|
73
|
+
- [ ] Environment variables verified
|
|
74
|
+
- [ ] Database migrations ready (if any)
|
|
75
|
+
- [ ] Rollback plan documented
|
|
76
|
+
- [ ] Team notified
|
|
77
|
+
- [ ] Monitoring ready
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 3. Deployment Workflow Principles
|
|
82
|
+
|
|
83
|
+
### The 5-Phase Process
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
1. PREPARE
|
|
87
|
+
└── Verify code, build, env vars
|
|
88
|
+
|
|
89
|
+
2. BACKUP
|
|
90
|
+
└── Save current state before changing
|
|
91
|
+
|
|
92
|
+
3. DEPLOY
|
|
93
|
+
└── Execute with monitoring open
|
|
94
|
+
|
|
95
|
+
4. VERIFY
|
|
96
|
+
└── Health check, logs, key flows
|
|
97
|
+
|
|
98
|
+
5. CONFIRM or ROLLBACK
|
|
99
|
+
└── All good? Confirm. Issues? Rollback.
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Phase Principles
|
|
103
|
+
|
|
104
|
+
| Phase | Principle |
|
|
105
|
+
|-------|-----------|
|
|
106
|
+
| **Prepare** | Never deploy untested code |
|
|
107
|
+
| **Backup** | Can't rollback without backup |
|
|
108
|
+
| **Deploy** | Watch it happen, don't walk away |
|
|
109
|
+
| **Verify** | Trust but verify |
|
|
110
|
+
| **Confirm** | Have rollback trigger ready |
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 4. Post-Deployment Verification
|
|
115
|
+
|
|
116
|
+
### What to Verify
|
|
117
|
+
|
|
118
|
+
| Check | Why |
|
|
119
|
+
|-------|-----|
|
|
120
|
+
| **Health endpoint** | Service is running |
|
|
121
|
+
| **Error logs** | No new errors |
|
|
122
|
+
| **Key user flows** | Critical features work |
|
|
123
|
+
| **Performance** | Response times acceptable |
|
|
124
|
+
|
|
125
|
+
### Verification Window
|
|
126
|
+
|
|
127
|
+
- **First 5 minutes**: Active monitoring
|
|
128
|
+
- **15 minutes**: Confirm stable
|
|
129
|
+
- **1 hour**: Final verification
|
|
130
|
+
- **Next day**: Review metrics
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 5. Rollback Principles
|
|
135
|
+
|
|
136
|
+
### When to Rollback
|
|
137
|
+
|
|
138
|
+
| Symptom | Action |
|
|
139
|
+
|---------|--------|
|
|
140
|
+
| Service down | Rollback immediately |
|
|
141
|
+
| Critical errors | Rollback |
|
|
142
|
+
| Performance >50% degraded | Consider rollback |
|
|
143
|
+
| Minor issues | Fix forward if quick |
|
|
144
|
+
|
|
145
|
+
### Rollback Strategy by Platform
|
|
146
|
+
|
|
147
|
+
| Platform | Rollback Method |
|
|
148
|
+
|----------|----------------|
|
|
149
|
+
| **Vercel/Netlify** | Redeploy previous commit |
|
|
150
|
+
| **Railway/Render** | Rollback in dashboard |
|
|
151
|
+
| **VPS + PM2** | Restore backup, restart |
|
|
152
|
+
| **Docker** | Previous image tag |
|
|
153
|
+
| **K8s** | kubectl rollout undo |
|
|
154
|
+
|
|
155
|
+
### Rollback Principles
|
|
156
|
+
|
|
157
|
+
1. **Speed over perfection**: Rollback first, debug later
|
|
158
|
+
2. **Don't compound errors**: One rollback, not multiple changes
|
|
159
|
+
3. **Communicate**: Tell team what happened
|
|
160
|
+
4. **Post-mortem**: Understand why after stable
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 6. Zero-Downtime Deployment
|
|
165
|
+
|
|
166
|
+
### Strategies
|
|
167
|
+
|
|
168
|
+
| Strategy | How It Works |
|
|
169
|
+
|----------|--------------|
|
|
170
|
+
| **Rolling** | Replace instances one by one |
|
|
171
|
+
| **Blue-Green** | Switch traffic between environments |
|
|
172
|
+
| **Canary** | Gradual traffic shift |
|
|
173
|
+
|
|
174
|
+
### Selection Principles
|
|
175
|
+
|
|
176
|
+
| Scenario | Strategy |
|
|
177
|
+
|----------|----------|
|
|
178
|
+
| Standard release | Rolling |
|
|
179
|
+
| High-risk change | Blue-green (easy rollback) |
|
|
180
|
+
| Need validation | Canary (test with real traffic) |
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 7. Emergency Procedures
|
|
185
|
+
|
|
186
|
+
### Service Down Priority
|
|
187
|
+
|
|
188
|
+
1. **Assess**: What's the symptom?
|
|
189
|
+
2. **Quick fix**: Restart if unclear
|
|
190
|
+
3. **Rollback**: If restart doesn't help
|
|
191
|
+
4. **Investigate**: After stable
|
|
192
|
+
|
|
193
|
+
### Investigation Order
|
|
194
|
+
|
|
195
|
+
| Check | Common Issues |
|
|
196
|
+
|-------|--------------|
|
|
197
|
+
| **Logs** | Errors, exceptions |
|
|
198
|
+
| **Resources** | Disk full, memory |
|
|
199
|
+
| **Network** | DNS, firewall |
|
|
200
|
+
| **Dependencies** | Database, APIs |
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 8. Anti-Patterns
|
|
205
|
+
|
|
206
|
+
| ❌ Don't | ✅ Do |
|
|
207
|
+
|----------|-------|
|
|
208
|
+
| Deploy on Friday | Deploy early in week |
|
|
209
|
+
| Rush deployment | Follow the process |
|
|
210
|
+
| Skip staging | Always test first |
|
|
211
|
+
| Deploy without backup | Backup before deploy |
|
|
212
|
+
| Walk away after deploy | Monitor for 15+ min |
|
|
213
|
+
| Multiple changes at once | One change at a time |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 9. Decision Checklist
|
|
218
|
+
|
|
219
|
+
Before deploying:
|
|
220
|
+
|
|
221
|
+
- [ ] **Platform-appropriate procedure?**
|
|
222
|
+
- [ ] **Backup strategy ready?**
|
|
223
|
+
- [ ] **Rollback plan documented?**
|
|
224
|
+
- [ ] **Monitoring configured?**
|
|
225
|
+
- [ ] **Team notified?**
|
|
226
|
+
- [ ] **Time to monitor after?**
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## 10. Best Practices
|
|
231
|
+
|
|
232
|
+
1. **Small, frequent deploys** over big releases
|
|
233
|
+
2. **Feature flags** for risky changes
|
|
234
|
+
3. **Automate** repetitive steps
|
|
235
|
+
4. **Document** every deployment
|
|
236
|
+
5. **Review** what went wrong after issues
|
|
237
|
+
6. **Test rollback** before you need it
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
> **Remember:** Every deployment is a risk. Minimize risk through preparation, not speed.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design-anti-cliche
|
|
3
|
+
description: "Universal AI design correction rules. Always active. Prevents the agent from falling into common AI-generated design patterns that produce generic, indistinguishable output. Project-specific brand-guidelines can override any rule here."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Design Anti-Cliché Rules
|
|
7
|
+
|
|
8
|
+
> **Scope**: These rules apply to ALL design work — ideation, spec writing, design system creation, and implementation. They correct universal AI tendencies, not project-specific preferences.
|
|
9
|
+
|
|
10
|
+
> **Override**: The `brand-guidelines` skill can override ANY rule below. If the user's confirmed brand direction contradicts a rule here (e.g., purple IS the brand color), `brand-guidelines` takes precedence.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 1. Safe Harbor Forbidden Defaults
|
|
15
|
+
|
|
16
|
+
AI agents retreat to "safe" patterns from training data. These are **forbidden as defaults** — you may use them only if the user explicitly requests them or the design direction specifically calls for them.
|
|
17
|
+
|
|
18
|
+
| # | Forbidden Default | Why It's Banned | Use Only When |
|
|
19
|
+
|---|---|---|---|
|
|
20
|
+
| 1 | **Standard Hero Split** (left text / right image) | Most overused layout in AI output. Every SaaS site looks identical. | User explicitly requests split layout |
|
|
21
|
+
| 2 | **Bento Grids** as default landing page layout | Overused since Apple adopted it. Not every page is a dashboard. | Genuinely complex data that benefits from card-based organization |
|
|
22
|
+
| 3 | **Mesh / Aurora Gradients** as background decoration | Floating colored blobs scream "AI-generated." | Used purposefully as part of a confirmed design direction |
|
|
23
|
+
| 4 | **Glassmorphism** as "premium" indicator | Blur + thin border is the AI's go-to for "modern." It's a cliché. | Confirmed Glass design direction in brand-guidelines |
|
|
24
|
+
| 5 | **Fintech Blue / Deep Cyan** default palette | The "safe escape" color for any professional app. Zero personality. | User's industry genuinely warrants trust-signaling blue |
|
|
25
|
+
| 6 | **Generic Marketing Copy** | Buzzwords make every product indistinguishable | Never — always write specific, concrete copy |
|
|
26
|
+
|
|
27
|
+
### Banned Copy Words
|
|
28
|
+
|
|
29
|
+
Never use these in headlines, hero text, or primary CTAs unless the user's actual product documentation uses them:
|
|
30
|
+
|
|
31
|
+
`Orchestrate` · `Empower` · `Elevate` · `Seamless` · `Leverage` · `Synergize` · `Unlock` · `Supercharge` · `Game-changing` · `Next-generation` · `Cutting-edge` · `Revolutionary`
|
|
32
|
+
|
|
33
|
+
**Instead:** Describe what the product actually does in concrete terms. "Send invoices in 30 seconds" beats "Elevate your billing experience."
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. Purple Ban
|
|
38
|
+
|
|
39
|
+
Purple, violet, indigo, and magenta are the #1 AI design cliché. They are **banned as primary or brand colors** unless the user explicitly requests them.
|
|
40
|
+
|
|
41
|
+
### Banned Values
|
|
42
|
+
|
|
43
|
+
- **Hex codes**: `#8B5CF6`, `#A855F7`, `#9333EA`, `#7C3AED`, `#6D28D9`, `#A78BFA`, `#C4B5FD`, `#DDD6FE`, `#EDE9FE`
|
|
44
|
+
- **Tailwind classes**: `purple-*`, `violet-*`, `indigo-*`, `fuchsia-*` as primary/brand colors
|
|
45
|
+
- **CSS keywords**: `purple`, `violet`, `indigo`, `fuchsia`, `magenta`, `lavender` as primary/brand colors
|
|
46
|
+
- **Purple gradients** of any kind as hero or background treatment
|
|
47
|
+
|
|
48
|
+
### When Purple IS Allowed
|
|
49
|
+
|
|
50
|
+
- User explicitly says "I want purple" or "our brand is purple"
|
|
51
|
+
- `brand-guidelines` has purple in the confirmed color palette
|
|
52
|
+
- Used as a minor accent (not primary, not brand-defining)
|
|
53
|
+
- Data visualization where purple is part of a sequential/categorical scale
|
|
54
|
+
|
|
55
|
+
### Recommended Alternatives
|
|
56
|
+
|
|
57
|
+
When you'd reflexively reach for purple, try: **Teal**, **Emerald**, **Amber**, **Rose**, **Slate** — or ask the user what palette fits their brand.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 3. Layout Diversification
|
|
62
|
+
|
|
63
|
+
Break the "Standard Split" habit. When designing hero sections or landing pages, choose from these alternative structures:
|
|
64
|
+
|
|
65
|
+
| Layout | Description | Best For |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| **Massive Typographic Hero** | Headline at 300px+, visual behind or inside the letters | Bold brands, creative agencies |
|
|
68
|
+
| **Center-Staggered** | Each element (H1, P, CTA) has different horizontal alignment | Modern, editorial feel |
|
|
69
|
+
| **Layered Depth (Z-axis)** | Visuals overlap text, creating depth | Immersive, premium products |
|
|
70
|
+
| **Vertical Narrative** | No "above the fold" hero — story starts immediately with flowing fragments | Story-driven, content-first |
|
|
71
|
+
| **Extreme Asymmetry (90/10)** | Everything compressed to one edge, 90% negative space | Luxury, high-end, artistic |
|
|
72
|
+
| **Full-Bleed Media** | Image/video fills the entire viewport, text overlaid | Photography, portfolio, lifestyle |
|
|
73
|
+
|
|
74
|
+
> **Rule:** If you're about to use "left text / right image," stop. Pick one of the above or invent something new.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 4. UI Library Default Ban
|
|
79
|
+
|
|
80
|
+
Never automatically use a component library without asking the user. These are AI favorites from training data, not the user's choice:
|
|
81
|
+
|
|
82
|
+
- ❌ shadcn/ui (overused AI default)
|
|
83
|
+
- ❌ Radix UI (AI favorite for "accessible" claim)
|
|
84
|
+
- ❌ Chakra UI (common AI fallback)
|
|
85
|
+
- ❌ Material UI / MUI (generic corporate look)
|
|
86
|
+
|
|
87
|
+
**Always ask:** "Which UI approach do you prefer?" and offer options:
|
|
88
|
+
1. Pure CSS / Tailwind — custom components, no library
|
|
89
|
+
2. shadcn/ui — if the user explicitly wants it
|
|
90
|
+
3. Headless UI — unstyled, accessible primitives
|
|
91
|
+
4. Radix — if the user explicitly wants it
|
|
92
|
+
5. Custom components — maximum control
|
|
93
|
+
6. Other — the user's choice
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 5. Corner Radius Rule
|
|
98
|
+
|
|
99
|
+
The "safe boredom zone" of `4px–8px` (`rounded-md`) is the AI default for everything. It produces visually indistinct interfaces.
|
|
100
|
+
|
|
101
|
+
**Rule:** Make a deliberate choice. Don't sit in the middle.
|
|
102
|
+
|
|
103
|
+
| Intent | Radius | Examples |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| **Sharp / Technical / Luxury** | `0px–2px` | Brutalist, minimalist, professional |
|
|
106
|
+
| **Balanced / Modern** | `8px–12px` | SaaS dashboards, productivity tools |
|
|
107
|
+
| **Soft / Friendly / Playful** | `16px–32px` | Social apps, lifestyle, consumer |
|
|
108
|
+
| **Pill / Expressive** | `9999px` / `full` | Tags, badges, feature cards |
|
|
109
|
+
|
|
110
|
+
> The chosen radius should be consistent across the design system — don't mix sharp cards with pill buttons unless the design direction explicitly calls for contrast.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 6. Maestro Self-Check
|
|
115
|
+
|
|
116
|
+
Before delivering any design work (specs, mockups, or implementations), answer these questions internally. If any answer is "yes" to the bad pattern, revise before presenting.
|
|
117
|
+
|
|
118
|
+
| # | Question | Bad Answer |
|
|
119
|
+
|---|---|---|
|
|
120
|
+
| 1 | Does this look like something an AI would generate? | Yes → revise |
|
|
121
|
+
| 2 | Could I swap the brand name and this would fit any other product? | Yes → not specific enough |
|
|
122
|
+
| 3 | Am I using purple/indigo because it "feels modern"? | Yes → Purple Ban violation |
|
|
123
|
+
| 4 | Is the layout "left text / right image" or a bento grid? | Yes without explicit request → Safe Harbor violation |
|
|
124
|
+
| 5 | Would a designer at a top agency present this to a client? | No → raise the bar |
|
|
125
|
+
| 6 | Is every animation serving a purpose, or just decoration? | Decoration → remove it |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 7. Modern Cliché Scan
|
|
130
|
+
|
|
131
|
+
Run this scan before committing to any design approach:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
🔍 CLICHÉ SCAN:
|
|
135
|
+
├── Am I defaulting to "Left Text / Right Visual"? → BETRAY IT
|
|
136
|
+
├── Am I using Bento Grids to organize content safely? → BREAK THE GRID
|
|
137
|
+
├── Am I using "safe" SaaS fonts and color pairs? → DISRUPT THE PALETTE
|
|
138
|
+
├── Am I using purple/indigo because it "feels techy"? → REPLACE IT
|
|
139
|
+
├── Am I writing "Empower your team" copy? → WRITE SOMETHING REAL
|
|
140
|
+
└── Will I remember this design in a year? → If no, push harder
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 8. Override Protocol
|
|
146
|
+
|
|
147
|
+
These rules are **universal defaults**. They can be overridden by:
|
|
148
|
+
|
|
149
|
+
1. **`brand-guidelines` skill** — If the confirmed design direction uses a forbidden element (purple brand, glassmorphism direction, etc.), the brand guideline takes precedence
|
|
150
|
+
2. **Explicit user request** — If the user says "I want a bento grid layout," use it
|
|
151
|
+
3. **Design reference data** — If the searchable design database returns a style that uses a forbidden element and the user confirms it, use it
|
|
152
|
+
|
|
153
|
+
**Override hierarchy:** User request > brand-guidelines > design-anti-cliche defaults
|
|
154
|
+
|
|
155
|
+
When overriding, acknowledge the override:
|
|
156
|
+
```
|
|
157
|
+
Using glassmorphism per confirmed "Glass" design direction —
|
|
158
|
+
anti-cliché default overridden by brand-guidelines.
|
|
159
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: design-direction
|
|
3
|
+
description: >
|
|
4
|
+
Design direction interview methodology — constraint-first discovery of visual
|
|
5
|
+
direction for web, desktop, and mobile surfaces. Covers 5 constraint questions,
|
|
6
|
+
6 direction options, and CLI-surface variant.
|
|
7
|
+
triggers:
|
|
8
|
+
- /create-prd-stack (Design Direction axis)
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Design Direction
|
|
12
|
+
|
|
13
|
+
Constraint-first discovery of visual direction for all visual surfaces (web, desktop, mobile). For CLI-only projects, use the CLI variant at the end.
|
|
14
|
+
|
|
15
|
+
## Constraint Questions
|
|
16
|
+
|
|
17
|
+
Ask these five questions first:
|
|
18
|
+
|
|
19
|
+
1. What is the emotional tone of the product? (professional/trustworthy, playful/approachable, premium/luxury, raw/technical, editorial/content-first)
|
|
20
|
+
2. Who is the primary audience? (developers, consumers, enterprise, creatives, general public)
|
|
21
|
+
3. Are there existing brand assets? (logo, colors, fonts — if yes, the direction must work within them)
|
|
22
|
+
4. What are the top 2–3 competitors' visual styles?
|
|
23
|
+
5. Are there hard constraints? (WCAG AA required, white-label needs, dark mode required, existing brand guidelines)
|
|
24
|
+
|
|
25
|
+
## Option Table
|
|
26
|
+
|
|
27
|
+
Present 5 options + Hybrid:
|
|
28
|
+
|
|
29
|
+
| Direction | What It Is | Pros | Cons | Best For |
|
|
30
|
+
|---|---|---|---|---|
|
|
31
|
+
| Minimal/Functional | Clean, whitespace-heavy, typography-led | Timeless, fast, accessible | Can feel cold or generic | SaaS tools, developer products |
|
|
32
|
+
| Editorial/Magazine | Strong typographic hierarchy, content-first | Distinctive, great for content-heavy products | Complex to maintain | Media, blogs, knowledge platforms |
|
|
33
|
+
| Luxury/Refined | Restrained palette, premium materials feel, subtle motion | High perceived value | Can feel inaccessible | Premium SaaS, fintech, professional services |
|
|
34
|
+
| Playful/Expressive | Bold color, personality, illustration, animation | Memorable, high engagement | Can age quickly | Consumer apps, gaming, social |
|
|
35
|
+
| Technical/Brutalist | Raw, grid-exposed, monospace, data-dense | Authentic for technical audiences | Polarizing | Dev tools, dashboards, data products |
|
|
36
|
+
| Hybrid | Combine elements from two directions | Best of both | Requires design discipline | When constraints pull in two directions |
|
|
37
|
+
|
|
38
|
+
## Per-Axis Flow
|
|
39
|
+
|
|
40
|
+
1. Ask constraint questions
|
|
41
|
+
2. Present filtered option table with recommendation based on constraints
|
|
42
|
+
3. Wait for user confirmation
|
|
43
|
+
4. Fire bootstrap with `DESIGN_DIRECTION=[confirmed direction]`
|
|
44
|
+
|
|
45
|
+
> **CLI surfaces**: For CLI-only projects, replace the visual direction options with CLI-appropriate ones: output verbosity philosophy (terse vs. informative), color usage (minimal/semantic vs. rich), information density (compact vs. spacious), personality (friendly vs. utilitarian).
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: error-handling-patterns
|
|
3
|
+
description: Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Error Handling Patterns
|
|
7
|
+
|
|
8
|
+
Build resilient applications with robust error handling strategies that gracefully handle failures and provide excellent debugging experiences.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
- Implementing error handling in new features
|
|
13
|
+
- Designing error-resilient APIs
|
|
14
|
+
- Debugging production issues
|
|
15
|
+
- Improving application reliability
|
|
16
|
+
- Creating better error messages for users and developers
|
|
17
|
+
- Implementing retry and circuit breaker patterns
|
|
18
|
+
- Handling async/concurrent errors
|
|
19
|
+
- Building fault-tolerant distributed systems
|
|
20
|
+
|
|
21
|
+
## Stack-Specific References
|
|
22
|
+
|
|
23
|
+
After reading the methodology below, read the reference matching your surface's Languages column in the surface stack map (`.agent/instructions/tech-stack.md`):
|
|
24
|
+
|
|
25
|
+
| Language | Reference |
|
|
26
|
+
|----------|-----------|
|
|
27
|
+
| TypeScript / JavaScript | `references/typescript.md` |
|
|
28
|
+
| Python | `references/python.md` |
|
|
29
|
+
| Go | `references/go.md` |
|
|
30
|
+
| Rust | `references/rust.md` |
|
|
31
|
+
|
|
32
|
+
## Core Concepts
|
|
33
|
+
|
|
34
|
+
### 1. Error Handling Philosophies
|
|
35
|
+
|
|
36
|
+
Every language takes a different approach to error handling. Know which philosophy your language uses and follow its idioms:
|
|
37
|
+
|
|
38
|
+
| Philosophy | Description | Languages |
|
|
39
|
+
|-----------|-------------|-----------|
|
|
40
|
+
| **Exceptions** | Traditional try-catch, disrupts control flow | Python, TypeScript/JS, Java, C# |
|
|
41
|
+
| **Result Types** | Explicit success/failure, functional approach | Rust, Haskell, modern TypeScript |
|
|
42
|
+
| **Error Returns** | Explicit error as return value, requires discipline | Go |
|
|
43
|
+
| **Option/Maybe Types** | For nullable values without exceptions | Rust, Haskell, Swift |
|
|
44
|
+
| **Panics/Crashes** | Unrecoverable errors, programming bugs | Rust (panic), Go (panic), Python (SystemExit) |
|
|
45
|
+
|
|
46
|
+
**When to Use Each:**
|
|
47
|
+
|
|
48
|
+
- Exceptions: Unexpected errors, exceptional conditions
|
|
49
|
+
- Result Types: Expected errors, validation failures
|
|
50
|
+
- Panics/Crashes: Unrecoverable errors, programming bugs
|
|
51
|
+
|
|
52
|
+
### 2. Error Categories
|
|
53
|
+
|
|
54
|
+
**Recoverable Errors** — the application can handle and continue:
|
|
55
|
+
|
|
56
|
+
- Network timeouts
|
|
57
|
+
- Missing files
|
|
58
|
+
- Invalid user input
|
|
59
|
+
- API rate limits
|
|
60
|
+
|
|
61
|
+
**Unrecoverable Errors** — the application should crash and restart:
|
|
62
|
+
|
|
63
|
+
- Out of memory
|
|
64
|
+
- Stack overflow
|
|
65
|
+
- Programming bugs (null pointer, etc.)
|
|
66
|
+
|
|
67
|
+
## Universal Patterns
|
|
68
|
+
|
|
69
|
+
### Pattern 1: Circuit Breaker
|
|
70
|
+
|
|
71
|
+
Prevent cascading failures in distributed systems. When a downstream service fails repeatedly, stop calling it temporarily to let it recover.
|
|
72
|
+
|
|
73
|
+
**State machine:**
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
CLOSED → (failures ≥ threshold) → OPEN
|
|
77
|
+
OPEN → (timeout elapsed) → HALF_OPEN
|
|
78
|
+
HALF_OPEN → (success ≥ threshold) → CLOSED
|
|
79
|
+
HALF_OPEN → (any failure) → OPEN
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Parameters:**
|
|
83
|
+
- `failure_threshold` — how many failures before opening the circuit (e.g., 5)
|
|
84
|
+
- `timeout` — how long to stay open before trying again (e.g., 60s)
|
|
85
|
+
- `success_threshold` — how many successes in HALF_OPEN before closing (e.g., 2)
|
|
86
|
+
|
|
87
|
+
See language-specific references for implementation examples.
|
|
88
|
+
|
|
89
|
+
### Pattern 2: Error Aggregation
|
|
90
|
+
|
|
91
|
+
Collect multiple errors instead of failing on first error. Essential for form validation, batch processing, and multi-field input.
|
|
92
|
+
|
|
93
|
+
**The pattern:**
|
|
94
|
+
1. Create an error collector
|
|
95
|
+
2. Validate each field/item independently, adding errors to the collector
|
|
96
|
+
3. After all validations, check if errors exist
|
|
97
|
+
4. If yes, throw/return all errors at once
|
|
98
|
+
|
|
99
|
+
See language-specific references for implementation examples.
|
|
100
|
+
|
|
101
|
+
### Pattern 3: Graceful Degradation
|
|
102
|
+
|
|
103
|
+
Provide fallback functionality when errors occur. The system continues operating with reduced capability rather than failing completely.
|
|
104
|
+
|
|
105
|
+
**Strategies:**
|
|
106
|
+
- **Primary/fallback chain** — try cache, fall back to database, fall back to default
|
|
107
|
+
- **Multiple provider fallback** — try provider A, then B, then C
|
|
108
|
+
- **Feature degradation** — disable non-essential features when dependencies fail
|
|
109
|
+
- **Default values** — return safe defaults when data is temporarily unavailable
|
|
110
|
+
|
|
111
|
+
See language-specific references for implementation examples.
|
|
112
|
+
|
|
113
|
+
### Pattern 4: Retry with Exponential Backoff
|
|
114
|
+
|
|
115
|
+
Automatically retry failed operations with increasing delays between attempts.
|
|
116
|
+
|
|
117
|
+
**Parameters:**
|
|
118
|
+
- `max_attempts` — maximum retry count (e.g., 3)
|
|
119
|
+
- `backoff_factor` — multiplier for delay between attempts (e.g., 2.0)
|
|
120
|
+
- `retryable_exceptions` — which errors are worth retrying (network, timeout — NOT validation)
|
|
121
|
+
|
|
122
|
+
**Delay formula:** `delay = backoff_factor ^ attempt` (1s, 2s, 4s, 8s, ...)
|
|
123
|
+
|
|
124
|
+
See language-specific references for implementation examples.
|
|
125
|
+
|
|
126
|
+
## Best Practices
|
|
127
|
+
|
|
128
|
+
1. **Fail Fast**: Validate input early, fail quickly
|
|
129
|
+
2. **Preserve Context**: Include stack traces, metadata, timestamps
|
|
130
|
+
3. **Meaningful Messages**: Explain what happened and how to fix it
|
|
131
|
+
4. **Log Appropriately**: Error = log, expected failure = don't spam logs
|
|
132
|
+
5. **Handle at Right Level**: Catch where you can meaningfully handle
|
|
133
|
+
6. **Clean Up Resources**: Use try-finally, context managers, defer, RAII
|
|
134
|
+
7. **Don't Swallow Errors**: Log or re-throw, don't silently ignore
|
|
135
|
+
8. **Type-Safe Errors**: Use typed errors when possible
|
|
136
|
+
|
|
137
|
+
## Common Pitfalls
|
|
138
|
+
|
|
139
|
+
- **Catching Too Broadly**: `except Exception` / `catch (e)` hides bugs
|
|
140
|
+
- **Empty Catch Blocks**: Silently swallowing errors
|
|
141
|
+
- **Logging and Re-throwing**: Creates duplicate log entries
|
|
142
|
+
- **Not Cleaning Up**: Forgetting to close files, connections
|
|
143
|
+
- **Poor Error Messages**: "Error occurred" is not helpful
|
|
144
|
+
- **Ignoring Async Errors**: Unhandled promise rejections, goroutine panics
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Error Architecture Interview
|
|
149
|
+
|
|
150
|
+
This interview is mandatory for every project. All 5 decisions below must be confirmed before proceeding to Data Strategy. Do not skip or defer any decision — this is a hard gate.
|
|
151
|
+
|
|
152
|
+
### Decision 1 — Global Error Envelope
|
|
153
|
+
|
|
154
|
+
Every error response from any surface must conform to this canonical 4-field structure:
|
|
155
|
+
|
|
156
|
+
| Field | Description |
|
|
157
|
+
|-------|-------------|
|
|
158
|
+
| `code` | Machine-readable error code (e.g., `VALIDATION_FAILED`, `NOT_FOUND`). Clients switch on this field. |
|
|
159
|
+
| `message` | Human-readable explanation of what went wrong. Safe to display to end users. |
|
|
160
|
+
| `requestId` | Unique identifier for the request that caused the error. Used for support and debugging. |
|
|
161
|
+
| `details` | `object \| null`. Structured additional context (e.g., field-level validation errors) or `null` when no extra detail applies. |
|
|
162
|
+
|
|
163
|
+
**Locked JSON example:**
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"code": "VALIDATION_FAILED",
|
|
168
|
+
"message": "Email address is not valid.",
|
|
169
|
+
"requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
170
|
+
"details": { "field": "email", "reason": "must contain @" }
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
All four top-level fields are always present in every error response.
|
|
175
|
+
|
|
176
|
+
**Rule:** No other top-level fields (`status`, `error`, `timestamp`) may appear in the error envelope. HTTP status codes are conveyed via the HTTP response status line, not inside the body.
|
|
177
|
+
|
|
178
|
+
### Decision 2 — Error Propagation Chain
|
|
179
|
+
|
|
180
|
+
For each layer in the stack (database → service layer → API handler → transport → client), define: what errors are caught, what is logged (and at what level), and what is exposed to the next layer.
|
|
181
|
+
|
|
182
|
+
**Rule:** No layer may expose raw upstream errors to the client. Every layer must catch, wrap, and translate errors before passing them upward.
|
|
183
|
+
|
|
184
|
+
### Decision 3 — Unhandled Exception Strategy
|
|
185
|
+
|
|
186
|
+
Define the process-level catch mechanism:
|
|
187
|
+
|
|
188
|
+
- **Mechanism name** — the specific runtime feature or library used to catch unhandled exceptions (e.g., `process.on('uncaughtException')`, global error middleware, panic recovery).
|
|
189
|
+
- **Logged fields** — what information is captured when an unhandled exception occurs (stack trace, request context, environment, timestamp).
|
|
190
|
+
- **Client response** — must conform to the global error envelope defined in Decision 1.
|
|
191
|
+
- **Alerting timeline** — how quickly the team is notified after an unhandled exception (e.g., "PagerDuty within 5 minutes for >10 unhandled exceptions/minute").
|
|
192
|
+
|
|
193
|
+
### Decision 4 — Client Fallback Contract
|
|
194
|
+
|
|
195
|
+
Define per-surface behavior when the backend is unreachable or returns an error:
|
|
196
|
+
|
|
197
|
+
- **Offline mode support** — does the surface support offline operation? If yes, what subset of features remains available?
|
|
198
|
+
- **UI on network failure** — what does the user see when the network is down or the API is unreachable (toast, full-page error, inline message)?
|
|
199
|
+
- **Retry strategy** — automatic retry with backoff, manual retry button, or no retry?
|
|
200
|
+
- **Timeout thresholds** — how long the surface waits before declaring a request failed (e.g., 10s for API calls, 30s for file uploads).
|
|
201
|
+
|
|
202
|
+
### Decision 5 — Error Boundary Strategy
|
|
203
|
+
|
|
204
|
+
Define per-surface error boundary placement and behavior:
|
|
205
|
+
|
|
206
|
+
- **Boundary placement** — where error boundaries are placed in the component tree (page-level, section-level, component-level).
|
|
207
|
+
- **Fallback UI** — what the user sees when a boundary catches an error (generic error message, contextual fallback, partial degradation).
|
|
208
|
+
- **Telemetry reporting** — how caught errors are reported to the observability stack (error tracking service name, severity classification, PII scrubbing before reporting).
|
|
209
|
+
|
|
210
|
+
### User Presentation Prompts
|
|
211
|
+
|
|
212
|
+
Present these three questions to the user for confirmation:
|
|
213
|
+
|
|
214
|
+
1. "Does the global error envelope cover every field your clients need?"
|
|
215
|
+
2. "Are there surfaces where the fallback contract needs to differ?"
|
|
216
|
+
3. "Is the alerting timeline appropriate for your operational maturity?"
|
|
217
|
+
|
|
218
|
+
### Output
|
|
219
|
+
|
|
220
|
+
Write completed decisions to `architecture-draft.md` under `## Error Architecture` with five sub-sections matching the five decisions above:
|
|
221
|
+
|
|
222
|
+
1. `### Global Error Envelope`
|
|
223
|
+
2. `### Error Propagation Chain`
|
|
224
|
+
3. `### Unhandled Exception Strategy`
|
|
225
|
+
4. `### Client Fallback Contract`
|
|
226
|
+
5. `### Error Boundary Strategy`
|