@drafthq/draft 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +38 -0
- package/.claude-plugin/plugin.json +26 -0
- package/LICENSE +21 -0
- package/README.md +272 -0
- package/bin/README.md +49 -0
- package/cli/bin/draft.js +13 -0
- package/cli/src/cli.js +113 -0
- package/cli/src/hosts/claude-code.js +46 -0
- package/cli/src/hosts/codex.js +33 -0
- package/cli/src/hosts/cursor.js +50 -0
- package/cli/src/hosts/index.js +24 -0
- package/cli/src/hosts/opencode.js +39 -0
- package/cli/src/installer.js +61 -0
- package/cli/src/lib/fsx.js +34 -0
- package/cli/src/lib/graph.js +23 -0
- package/cli/src/lib/log.js +32 -0
- package/cli/src/lib/paths.js +14 -0
- package/core/agents/architect.md +338 -0
- package/core/agents/debugger.md +193 -0
- package/core/agents/ops.md +104 -0
- package/core/agents/planner.md +158 -0
- package/core/agents/rca.md +314 -0
- package/core/agents/reviewer.md +256 -0
- package/core/agents/writer.md +110 -0
- package/core/guardrails/README.md +4 -0
- package/core/guardrails/code-quality.md +4 -0
- package/core/guardrails/dependency-triage.md +4 -0
- package/core/guardrails/design-norms.md +4 -0
- package/core/guardrails/language-standards.md +4 -0
- package/core/guardrails/review-checks.md +4 -0
- package/core/guardrails/secure-patterns.md +4 -0
- package/core/guardrails/security.md +4 -0
- package/core/guardrails.md +22 -0
- package/core/knowledge-base.md +127 -0
- package/core/methodology.md +1221 -0
- package/core/shared/condensation.md +224 -0
- package/core/shared/context-verify.md +44 -0
- package/core/shared/cross-skill-dispatch.md +127 -0
- package/core/shared/discovery-schema.md +75 -0
- package/core/shared/draft-context-loading.md +282 -0
- package/core/shared/git-report-metadata.md +106 -0
- package/core/shared/graph-query.md +239 -0
- package/core/shared/graph-usage-report.md +22 -0
- package/core/shared/jira-sync.md +170 -0
- package/core/shared/parallel-analysis.md +386 -0
- package/core/shared/parallel-fanout.md +10 -0
- package/core/shared/pattern-learning.md +146 -0
- package/core/shared/red-flags.md +58 -0
- package/core/shared/template-contract.md +22 -0
- package/core/shared/template-hygiene.md +10 -0
- package/core/shared/tool-resolver.md +10 -0
- package/core/shared/vcs-commands.md +97 -0
- package/core/shared/verification-gates.md +47 -0
- package/core/templates/CHANGELOG.md +70 -0
- package/core/templates/ai-context-export.md +8 -0
- package/core/templates/ai-context.md +270 -0
- package/core/templates/ai-profile.md +41 -0
- package/core/templates/architecture.md +203 -0
- package/core/templates/dependency-graph.md +103 -0
- package/core/templates/discovery.md +79 -0
- package/core/templates/guardrails.md +143 -0
- package/core/templates/hld.md +327 -0
- package/core/templates/intake-questions.md +403 -0
- package/core/templates/jira.md +119 -0
- package/core/templates/lld.md +283 -0
- package/core/templates/metadata.json +66 -0
- package/core/templates/plan.md +130 -0
- package/core/templates/product.md +110 -0
- package/core/templates/rca.md +86 -0
- package/core/templates/root-architecture.md +127 -0
- package/core/templates/root-product.md +53 -0
- package/core/templates/root-tech-stack.md +117 -0
- package/core/templates/service-index.md +55 -0
- package/core/templates/session-summary.md +8 -0
- package/core/templates/spec.md +165 -0
- package/core/templates/tech-matrix.md +101 -0
- package/core/templates/tech-stack.md +169 -0
- package/core/templates/track-architecture.md +311 -0
- package/core/templates/workflow.md +187 -0
- package/integrations/agents/AGENTS.md +24384 -0
- package/integrations/copilot/.github/copilot-instructions.md +24384 -0
- package/integrations/gemini/.gemini.md +26 -0
- package/package.json +53 -0
- package/scripts/fetch-memory-engine.sh +116 -0
- package/scripts/lib.sh +256 -0
- package/scripts/tools/_lib.sh +220 -0
- package/scripts/tools/adr-index.sh +117 -0
- package/scripts/tools/check-graph-usage-report.sh +95 -0
- package/scripts/tools/check-scope-conflicts.sh +139 -0
- package/scripts/tools/check-skill-line-caps.sh +115 -0
- package/scripts/tools/check-template-noop.sh +87 -0
- package/scripts/tools/check-track-hygiene.sh +230 -0
- package/scripts/tools/classify-files.sh +231 -0
- package/scripts/tools/cycle-detect.sh +75 -0
- package/scripts/tools/detect-test-framework.sh +135 -0
- package/scripts/tools/diff-templates-vs-tracks.sh +176 -0
- package/scripts/tools/emit-skill-metrics.sh +71 -0
- package/scripts/tools/fix-whitespace.sh +192 -0
- package/scripts/tools/freshness-check.sh +143 -0
- package/scripts/tools/git-metadata.sh +203 -0
- package/scripts/tools/graph-callers.sh +74 -0
- package/scripts/tools/graph-impact.sh +93 -0
- package/scripts/tools/graph-snapshot.sh +102 -0
- package/scripts/tools/hotspot-rank.sh +75 -0
- package/scripts/tools/manage-symlinks.sh +85 -0
- package/scripts/tools/mermaid-from-graph.sh +92 -0
- package/scripts/tools/migrate-track-frontmatter.sh +241 -0
- package/scripts/tools/parse-git-log.sh +135 -0
- package/scripts/tools/parse-reports.sh +114 -0
- package/scripts/tools/render-track.sh +145 -0
- package/scripts/tools/run-coverage.sh +153 -0
- package/scripts/tools/scan-markers.sh +144 -0
- package/scripts/tools/skill-caps.conf +24 -0
- package/scripts/tools/validate-frontmatter.sh +125 -0
- package/scripts/tools/verify-citations.sh +250 -0
- package/scripts/tools/verify-doc-anchors.sh +204 -0
- package/scripts/tools/verify-graph-binary.sh +154 -0
- package/skills/GRAPH.md +332 -0
- package/skills/adr/SKILL.md +374 -0
- package/skills/assist-review/SKILL.md +49 -0
- package/skills/bughunt/SKILL.md +668 -0
- package/skills/bughunt/references/regression-tests.md +399 -0
- package/skills/change/SKILL.md +267 -0
- package/skills/coverage/SKILL.md +336 -0
- package/skills/debug/SKILL.md +201 -0
- package/skills/decompose/SKILL.md +656 -0
- package/skills/deep-review/SKILL.md +326 -0
- package/skills/deploy-checklist/SKILL.md +254 -0
- package/skills/discover/SKILL.md +66 -0
- package/skills/docs/SKILL.md +42 -0
- package/skills/documentation/SKILL.md +197 -0
- package/skills/draft/SKILL.md +177 -0
- package/skills/draft/context-files.md +57 -0
- package/skills/draft/intent-mapping.md +37 -0
- package/skills/draft/quality-guide.md +51 -0
- package/skills/graph/SKILL.md +107 -0
- package/skills/impact/SKILL.md +86 -0
- package/skills/implement/SKILL.md +794 -0
- package/skills/incident-response/SKILL.md +245 -0
- package/skills/index/SKILL.md +848 -0
- package/skills/init/SKILL.md +1784 -0
- package/skills/init/references/architecture-spec.md +1259 -0
- package/skills/integrations/SKILL.md +53 -0
- package/skills/jira/SKILL.md +577 -0
- package/skills/jira/references/review.md +1322 -0
- package/skills/learn/SKILL.md +478 -0
- package/skills/new-track/SKILL.md +841 -0
- package/skills/ops/SKILL.md +57 -0
- package/skills/plan/SKILL.md +60 -0
- package/skills/quick-review/SKILL.md +216 -0
- package/skills/revert/SKILL.md +178 -0
- package/skills/review/SKILL.md +1114 -0
- package/skills/standup/SKILL.md +183 -0
- package/skills/status/SKILL.md +183 -0
- package/skills/tech-debt/SKILL.md +318 -0
- package/skills/testing-strategy/SKILL.md +195 -0
- package/skills/tour/SKILL.md +38 -0
- package/skills/upload/SKILL.md +117 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deep-review
|
|
3
|
+
description: Single-module production readiness audit (ACID, resilience, observability). Use to audit one service/module end-to-end — NOT for diff/PR review (use review / quick-review) or bug-finding sweeps (use bughunt).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deep Review — Production-Grade Module Audit
|
|
7
|
+
|
|
8
|
+
Perform an exhaustive end-to-end lifecycle review of a service, component, or module. Ensure ACID compliance and production-grade enterprise quality. Unlike standard review commands, this operates strictly at the module level.
|
|
9
|
+
|
|
10
|
+
## MANDATORY GRAPH LOOKUP (read before Phase 1)
|
|
11
|
+
|
|
12
|
+
When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Deep-review uses the graph to **narrow review scope** — a key 30–50% scope reduction:
|
|
13
|
+
|
|
14
|
+
1. Use `scripts/tools/graph-impact.sh`/`graph-callers.sh` and `architecture.json` for the audited module's structure — do not enumerate via `find`.
|
|
15
|
+
2. Run `scripts/tools/graph-impact.sh --repo . --file <each-changed-file>` per file in the diff (or per file in the module if no diff) to obtain the affected module set deterministically.
|
|
16
|
+
3. Run `scripts/tools/cycle-detect.sh --repo .` and flag any cycle that includes the audited module as Architecture Resilience finding.
|
|
17
|
+
4. Cross-check `draft/graph/hotspots.jsonl` to identify high-fanIn files inside the module — these get deeper inspection.
|
|
18
|
+
|
|
19
|
+
Filesystem `grep` is reserved for source-text scans (API contract strings, secret patterns, log message audits). Module enumeration and caller tracing go through the graph.
|
|
20
|
+
|
|
21
|
+
## Red Flags - STOP if you're:
|
|
22
|
+
|
|
23
|
+
See [shared red flags](../../core/shared/red-flags.md) — applies to all code-touching skills.
|
|
24
|
+
|
|
25
|
+
Skill-specific:
|
|
26
|
+
- Acting without reading the Draft context (`draft/.ai-context.md`, `draft/tech-stack.md`, `draft/product.md`)
|
|
27
|
+
- Modifying production code. This command is for auditing and reporting only. Fixes should be handled in a separate implementation track.
|
|
28
|
+
- Reviewing a module that was already reviewed recently, unless explicitly requested.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Arguments
|
|
33
|
+
|
|
34
|
+
- `$ARGUMENTS` — Optional: explicit module/service/component name (directory) to review. If omitted, auto-select the next unreviewed module.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Step 0: Verify Draft Context
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
ls draft/.ai-context.md 2>/dev/null
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
If `draft/` does not exist: **STOP** — "No Draft context found. Run `/draft:init` first. Deep review requires `draft/.ai-context.md` and `draft/tech-stack.md` to evaluate against project standards."
|
|
45
|
+
|
|
46
|
+
If `.ai-context.md` is missing, check for `draft/architecture.md` as a fallback (per `core/shared/draft-context-loading.md`).
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Module Selection
|
|
51
|
+
|
|
52
|
+
1. **Check review history:** Read `draft/deep-review-history.json` if it exists. This file tracks previously reviewed modules with timestamps.
|
|
53
|
+
2. **If `$ARGUMENTS` is provided:** Use that module. If it was previously reviewed, re-review it (the user explicitly requested it).
|
|
54
|
+
3. **If no argument:** Discover all modules using the following priority order:
|
|
55
|
+
1. Use module definitions from `draft/.ai-context.md` if it exists (check `## Modules` or `## Module Catalog` sections).
|
|
56
|
+
2. Use top-level directories under `src/` or equivalent source root.
|
|
57
|
+
3. Use directories containing `__init__.py`, `package.json`, or `go.mod`.
|
|
58
|
+
Document which heuristic was used in the report.
|
|
59
|
+
Select the first module NOT present in the review history. If all have been reviewed, pick the one with the oldest review date.
|
|
60
|
+
4. **Announce selection:** State which module was selected and why before proceeding.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Review Phases
|
|
65
|
+
|
|
66
|
+
### Phase 1: Context & Structural Analysis
|
|
67
|
+
- Load Draft context following the procedure in `core/shared/draft-context-loading.md`. Use loaded context to understand intended boundaries and critical invariants.
|
|
68
|
+
- **Load track HLD/LLD if any track owns this module.** Scan `draft/tracks/*/hld.md` for §Detailed Design components matching the module path. When found, extract claims from §High-Level Design / Key Design Decisions, §Checklist (Performance/Scale/Security/Resiliency/Multi-tenancy/Upgrade/Cost), §Observability, §Deployment, and any LLD §Classes and Interfaces invariants and §Error Handling policies. These claims become the design contract this audit measures against (HLD claims vs code reality).
|
|
69
|
+
- **Load Learned Anti-Patterns** — If `draft/guardrails.md` exists, read the `## Learned Anti-Patterns` section before analysis begins. During the audit, when an issue matches a learned anti-pattern, prefix the finding with `[KNOWN-ANTI-PATTERN: {pattern name}]`. This separates newly discovered issues from documented recurring patterns and allows the report to recommend systemic remediation rather than isolated fixes.
|
|
70
|
+
- Map the module's full dependency graph (imports, injected services, external calls)
|
|
71
|
+
- Trace the complete lifecycle: initialization → processing → persistence → cleanup
|
|
72
|
+
- Identify all entry points and exit paths
|
|
73
|
+
- Catalog all state mutations and side effects
|
|
74
|
+
- **API Contract Drift Detection:** Compare the module's actual code interfaces against documented contracts (OpenAPI/Swagger specs, Protobuf/gRPC definitions, GraphQL schema files, TypeScript type exports). Flag drift: endpoints that exist in code but not in the spec (or vice versa). Flag type mismatches between spec and implementation. Reference: Amazon, Google large-scale changes.
|
|
75
|
+
|
|
76
|
+
### Phase 2: ACID Compliance Audit
|
|
77
|
+
|
|
78
|
+
> Rule references: `[CQ-006, CQ-007, CQ-008]` error/exception context, `[SEC-03]` SQL parameterization, `[RC-004, RC-005]` data integrity & concurrency. Cite the rule ID in each finding.
|
|
79
|
+
|
|
80
|
+
Every ACID finding ("missing rollback", "fire-and-forget write", "race condition", "no isolation guarantee") must cite the closest applicable rule range (e.g., `[RC-004..RC-005]` for data integrity, `[CQ-006..CQ-008]` for error context, `[SEC-03]` for SQL safety).
|
|
81
|
+
|
|
82
|
+
**Evidence requirement (Ground-Truth Discipline G1, G4):** Every ACID finding ("missing rollback", "fire-and-forget write", "race condition", "no isolation guarantee") must cite `file:line` AND include a quoted code snippet showing the issue. A finding that says "no transactions found in module X" without quoting the code site is a graph-metadata claim, not an audit result — discard it. "Verify" and "Check" below mean *Read the candidate sites*, not "scan for keywords."
|
|
83
|
+
|
|
84
|
+
- **Atomicity:** Verify all multi-step operations are wrapped in transactions. Partial failure must not leave corrupt state. Check for missing rollback paths. `[RC-004]`
|
|
85
|
+
- **Consistency:** Validate all invariants, constraints, and business rules are enforced before and after every state transition. Check schema validation, data type enforcement, and boundary conditions. `[CQ-006, RC-003]`
|
|
86
|
+
- **Isolation:** Check for race conditions, shared mutable state, concurrent access without locking/synchronization. Verify transaction isolation levels where databases are involved. `[RC-005]`
|
|
87
|
+
- **Durability:** Confirm committed data survives crashes. Check for fire-and-forget patterns, missing flush/sync calls, and inadequate error handling around persistence. `[CQ-007, CQ-008]`
|
|
88
|
+
- **Event Sourcing:** Are events immutable? Is event replay idempotent? Is the event store append-only?
|
|
89
|
+
- **CQRS:** Are read/write models eventually consistent? Is consistency lag acceptable for the use case?
|
|
90
|
+
- **Saga Pattern:** Are compensating transactions defined for each step? What happens on partial saga failure?
|
|
91
|
+
- **Eventual Consistency:** Are there convergence guarantees? How is conflict resolution handled (LWW, CRDT, manual)? Reference: Amazon distributed systems.
|
|
92
|
+
|
|
93
|
+
### Phase 3: Production-Grade Assessment
|
|
94
|
+
|
|
95
|
+
**Applicability note:** Skip categories that are not applicable to the module type (e.g., circuit breakers and backpressure are backend-specific; skip for frontend/CLI modules).
|
|
96
|
+
|
|
97
|
+
> Rule references: `[RC-008, RC-009, RC-010]` observability & logging, `[SEC-04, SEC-06]` network/process boundaries, `[SEC-05]` secrets, `[RC-015]` config validation, `[CQ-006..CQ-008]` error context. Cite the rule ID in each finding.
|
|
98
|
+
|
|
99
|
+
Every finding in this phase must cite the relevant rule range (e.g., `[RC-008..RC-010]` for observability, `[SEC-04, SEC-06]` for network/process boundaries, `[RC-015]` for configuration).
|
|
100
|
+
|
|
101
|
+
- **Resilience:** Graceful degradation, circuit breakers, timeout handling, backpressure `[RC-005]`
|
|
102
|
+
- **Observability:** Logging coverage (not excessive), structured log fields, correlation IDs, metric emission points `[RC-008, RC-009, RC-010]`
|
|
103
|
+
- **Structured logging:** Are logs structured (JSON/key-value) vs free-form strings?
|
|
104
|
+
- **Log level correctness:** Are ERROR/WARN/INFO/DEBUG used appropriately? Are expected conditions logged at DEBUG, not ERROR?
|
|
105
|
+
- **PII leakage:** Do logs or error messages expose personally identifiable information, tokens, or credentials? `[SEC-05, RC-010]`
|
|
106
|
+
- **Tracing spans:** Are spans created at service boundaries? Do spans include relevant attributes (user_id, request_id)?
|
|
107
|
+
- **Metric cardinality:** Are metric labels bounded? Unbounded labels (e.g., user_id as label) cause metric explosion.
|
|
108
|
+
- **Alerting coverage:** Are critical failure modes covered by alerts? Are there runbooks linked to alerts?
|
|
109
|
+
- Reference: Netflix Full Cycle Developers, Google SRE.
|
|
110
|
+
- **Configuration:** Hardcoded values that should be configurable, missing environment variable validation `[RC-015, SEC-05]`
|
|
111
|
+
- **State Lifecycle:** Memory accumulation, zombie processes, dropped messages
|
|
112
|
+
- **SLO/SLA Alignment:**
|
|
113
|
+
- Does the module's observed/expected error rate match defined SLOs?
|
|
114
|
+
- **Latency profiles:** Are p50, p95, p99 latency targets defined and achievable?
|
|
115
|
+
- **Error budget:** What percentage of the error budget has been consumed? Is the module in "protect" or "innovate" mode?
|
|
116
|
+
- **Availability:** Does the module's uptime target (99.9%, 99.99%) match its actual architecture?
|
|
117
|
+
- If no SLOs are defined, recommend defining them. Reference: Google SRE (https://sre.google/sre-book/service-level-objectives/).
|
|
118
|
+
- **Database Schema Analysis:**
|
|
119
|
+
- **Missing indexes:** Queries filtering/joining on unindexed columns.
|
|
120
|
+
- **Wide table scans:** SELECT * or queries without WHERE clauses on large tables.
|
|
121
|
+
- **Schema constraints:** Missing NOT NULL, UNIQUE, FOREIGN KEY constraints.
|
|
122
|
+
- **Migration safety:** Can migrations run without downtime? Are they backward-compatible?
|
|
123
|
+
- **N+1 at schema level:** Relationships that require multiple queries instead of joins.
|
|
124
|
+
- Reference: Google large-scale changes.
|
|
125
|
+
|
|
126
|
+
### Phase 3.5: HLD/LLD Claims vs Code Reality (when HLD found in Phase 1)
|
|
127
|
+
|
|
128
|
+
> Rule references: `[RC-012]` API/contract drift, `[SEC-01..SEC-10]` for §Security claims, `[RC-005, RC-013]` for §Resiliency/§Architecture claims. Cite the rule ID alongside `[HLD-DRIFT: §<section>]`.
|
|
129
|
+
|
|
130
|
+
Cite the most specific rule range applicable to the drift (e.g., `[RC-012]` for API changes, `[SEC-01..SEC-10]` for security claims).
|
|
131
|
+
|
|
132
|
+
For each HLD claim extracted in Phase 1, validate it against code:
|
|
133
|
+
|
|
134
|
+
- **HLD §Performance** claims (e.g., "p95 < 200ms", "QPS = 10k") — search for benchmarks, load tests, or APM dashboard evidence. If absent, surface as Important: "HLD claims X but no measurement evidence in code/CI."
|
|
135
|
+
- **HLD §Scale** claims (horizontal scaling, vertical scaling, bottlenecks named) — verify deployment config (replicas, autoscaler), connection pools, queue capacities support the claim.
|
|
136
|
+
- **HLD §Security** claims (RBAC, encryption, credential protection) — verify the cited middleware/guard exists and is invoked on the documented surface.
|
|
137
|
+
- **HLD §Resiliency** claims (graceful degradation, circuit breakers, timeouts) — verify cited code paths implement the claim.
|
|
138
|
+
- **HLD §Multi-tenancy** claims (tenant isolation, predictable performance, migration path) — verify query partitioning, RBAC scope, migration tooling.
|
|
139
|
+
- **HLD §Upgrade** claims (backward compat, dependent service order) — verify schema migration policy, API version handling.
|
|
140
|
+
- **HLD §Cost** claims — flag if codebase introduces new cloud resources not reflected in HLD.
|
|
141
|
+
- **LLD §Classes/Interfaces invariants** (thread safety, idempotency, ordering) — search for violations: shared state without locks, non-idempotent retry paths, ordering assumptions broken by concurrency.
|
|
142
|
+
- **LLD §Error Handling policy** — verify retry/backoff/circuit-breaker thresholds in code match the LLD table.
|
|
143
|
+
|
|
144
|
+
Surface gaps as findings with prefix `[HLD-DRIFT: §<section>]` (Important if the gap is documentation-vs-implementation drift; Critical if the code violates a stated invariant or security claim).
|
|
145
|
+
|
|
146
|
+
### Phase 4: Identify Actionable Fixes (Spec Generation)
|
|
147
|
+
Instead of mutating the source code, translate all findings into clear, actionable requirements that a developer (or agent) can implement via Test-Driven Development.
|
|
148
|
+
|
|
149
|
+
### Phase 5: Resilience & Chaos Engineering Assessment
|
|
150
|
+
|
|
151
|
+
**Applicability note:** Skip categories not applicable to the module type (e.g., network partitions are irrelevant for purely local CLI tools).
|
|
152
|
+
|
|
153
|
+
> Rule references: `[RC-005]` concurrency & retries, `[SEC-04]` network boundaries, `[CQ-008]` timeouts/cleanup, `[RC-015]` capacity/config bounds. Cite the rule ID in each finding.
|
|
154
|
+
|
|
155
|
+
Cite relevant rule ranges for resilience findings (e.g., `[RC-005]` for retries, `[CQ-008]` for timeouts).
|
|
156
|
+
|
|
157
|
+
- **Dependency failure scenarios:** What happens when each external dependency (database, cache, message queue, external API) is unavailable? Are there timeouts, fallbacks, circuit breakers? `[RC-005, CQ-008]`
|
|
158
|
+
- **Timeout analysis:** Are all external calls bounded by timeouts? Are timeout values appropriate (not too long, not too short)?
|
|
159
|
+
- **Disk/resource exhaustion:** What happens when disk fills, memory is exhausted, file descriptors run out?
|
|
160
|
+
- **Clock skew:** Does the module make assumptions about clock synchronization? Are distributed timestamps handled correctly?
|
|
161
|
+
- **Network partitions:** How does the module behave during partial network failures? Split-brain scenarios?
|
|
162
|
+
- **Retry behavior:** Does retry logic use exponential backoff with jitter? Is there a retry budget to prevent retry storms?
|
|
163
|
+
- **Graceful degradation:** Can non-critical features be disabled without affecting core functionality?
|
|
164
|
+
- **Load shedding:** Under extreme load, does the module shed excess requests gracefully?
|
|
165
|
+
- **Capacity/Load Modeling:**
|
|
166
|
+
- What happens at 10x current traffic? 100x?
|
|
167
|
+
- Identify bottlenecks: connection pools, thread pools, rate limits, queue depth.
|
|
168
|
+
- Are there horizontal scaling capabilities?
|
|
169
|
+
- What is the theoretical maximum throughput?
|
|
170
|
+
- Reference: Netflix Chaos Monkey, Netflix Simian Army, Amazon GameDay.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Update Review History
|
|
175
|
+
|
|
176
|
+
After completing the review, update `draft/deep-review-history.json`:
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"reviews": [
|
|
181
|
+
{
|
|
182
|
+
"module": "<module-name>",
|
|
183
|
+
"path": "<module-path>",
|
|
184
|
+
"timestamp": "<ISO-8601>",
|
|
185
|
+
"issues_found": <count>,
|
|
186
|
+
"summary": "<one-line summary>"
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Create the file in the `draft/` directory if it does not exist. Append to the `reviews` array if it does. Do NOT save to `.claude/` or `.gemini/`.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Final Report Generation
|
|
197
|
+
|
|
198
|
+
Output a structured summary and detailed "Implementation Spec" for any needed fixes.
|
|
199
|
+
|
|
200
|
+
**File to create:** `draft/deep-review-reports/<module-name>.md`
|
|
201
|
+
|
|
202
|
+
Create the `draft/deep-review-reports/` directory if it does not exist.
|
|
203
|
+
|
|
204
|
+
**MANDATORY: Include YAML frontmatter with git metadata.** Follow the procedure in `core/shared/git-report-metadata.md` to gather git info and generate the frontmatter. Use `generated_by: "draft:deep-review"` and set `module` to the reviewed module name.
|
|
205
|
+
|
|
206
|
+
Additional deep-review fields beyond the standard template:
|
|
207
|
+
|
|
208
|
+
```yaml
|
|
209
|
+
module_path: "<module-path>"
|
|
210
|
+
reviewer: "{model name from runtime}"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Module reviewed:** name and path
|
|
214
|
+
**Issues by category:** ACID | Resilience | Observability
|
|
215
|
+
**Verdict:** PASS / CONDITIONAL PASS / FAIL
|
|
216
|
+
|
|
217
|
+
**Verdict criteria:**
|
|
218
|
+
- **FAIL** = any Critical issue found.
|
|
219
|
+
- **CONDITIONAL PASS** = no Critical issues but Important issues exist.
|
|
220
|
+
- **PASS** = only Minor issues or no issues.
|
|
221
|
+
|
|
222
|
+
Format findings as actionable tasks:
|
|
223
|
+
```markdown
|
|
224
|
+
### [Critical/Important/Minor] Issue Name `[RC-### or CQ-### or SEC-## if applicable]`
|
|
225
|
+
**File:** path/to/file:line
|
|
226
|
+
**Description:** What's wrong conceptually (e.g., Transaction lacks rollback on Exception XYZ).
|
|
227
|
+
**Proposed Fix Specification:**
|
|
228
|
+
- Add `try/except` block catching Exception XYZ.
|
|
229
|
+
- Explicitly call `db.rollback()`.
|
|
230
|
+
- Emit structured log with correlation ID.
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Cite the most specific rule ID from `core/guardrails/review-checks.md` (RC-###), `core/guardrails/security.md` (SEC-##), or `core/guardrails/code-quality.md` (CQ-###) that governs the finding. If no numbered rule applies, omit — the finding stands.
|
|
234
|
+
|
|
235
|
+
**For Phase 3 (Security):** Load `core/guardrails/security.md` and apply the 5-step security reasoning chain. Hard red line violations (SEC-01…SEC-10) are always Critical. Run `core/guardrails/dependency-triage.md` procedure for any dependency manifest files in the module's scope `[RC-014]`.
|
|
236
|
+
|
|
237
|
+
**Constraints:**
|
|
238
|
+
- Do not refactor code yourself.
|
|
239
|
+
- Flag ambiguous fixes for human review instead of guessing.
|
|
240
|
+
- If the module is too large, decompose it and review sub-modules sequentially.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Pattern Learning
|
|
245
|
+
|
|
246
|
+
Skip pattern learning if the analysis found zero findings.
|
|
247
|
+
|
|
248
|
+
After generating the report, execute the pattern learning phase from `core/shared/pattern-learning.md` to update `draft/guardrails.md` with patterns discovered during this module audit. Module-level reviews often reveal architecture and concurrency conventions that are valuable for future analysis.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Report Closing: Next Actions (REQUIRED)
|
|
253
|
+
|
|
254
|
+
Every deep-review report must end with a `## Next Actions` section listing the smallest set of follow-ups in execution order. Use this exact shape:
|
|
255
|
+
|
|
256
|
+
```markdown
|
|
257
|
+
## Next Actions
|
|
258
|
+
|
|
259
|
+
| # | Action | Owner | Blocker? | Skill / Command |
|
|
260
|
+
|---|---|---|---|---|
|
|
261
|
+
| 1 | <imperative one-liner> | <author\|on-call\|TBD> | yes/no | `/draft:<skill> <args>` or `n/a` |
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Rules:
|
|
265
|
+
- Production-blocking findings (`[SEC-*]`, ACID violations, unbounded resource use) produce blocker rows.
|
|
266
|
+
- Suggest `/draft:adr` for structural changes, `/draft:new-track` for multi-week remediation, `/draft:incident-response` for hot issues, `/draft:tech-debt` for systemic items.
|
|
267
|
+
- Cap at 10 actions; group related fixes under one row.
|
|
268
|
+
|
|
269
|
+
## Cross-Skill Dispatch
|
|
270
|
+
|
|
271
|
+
### Suggestions at Completion
|
|
272
|
+
|
|
273
|
+
After deep-review audit completion:
|
|
274
|
+
|
|
275
|
+
**If architecture debt found:**
|
|
276
|
+
```
|
|
277
|
+
"Architecture debt identified in module audit. Consider:
|
|
278
|
+
→ /draft:tech-debt — Catalog and prioritize the architecture debt
|
|
279
|
+
→ /draft:adr — Document undiscovered design decisions found during review"
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**If documentation gaps found:**
|
|
283
|
+
```
|
|
284
|
+
→ /draft:documentation runbook — Generate operational runbook for this module"
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Mandatory Self-Check (before final report)
|
|
288
|
+
|
|
289
|
+
Before printing the final report, internally verify and report:
|
|
290
|
+
|
|
291
|
+
1. **Graph files queried** — JSONL files loaded plus any live graph query-tool invocations (especially `impact` per file in scope).
|
|
292
|
+
2. **Layer 1 files deliberately skipped** — list any context sections skipped.
|
|
293
|
+
3. **Filesystem grep fallback justification** — for every `grep`/`find` run, name the concept it searched for. Source-text scans for API contract strings, secrets, or log audits are exempt.
|
|
294
|
+
|
|
295
|
+
If `draft/graph/schema.yaml` does not exist, set `Graph files queried: NONE` and use justification `graph data unavailable`.
|
|
296
|
+
|
|
297
|
+
## Graph Usage Report (append to report)
|
|
298
|
+
|
|
299
|
+
Emit the canonical footer from [core/shared/graph-usage-report.md](../../core/shared/graph-usage-report.md) §Canonical footer. The lint hook `scripts/tools/check-graph-usage-report.sh` validates the section on save.
|
|
300
|
+
## Skill Telemetry
|
|
301
|
+
|
|
302
|
+
As the last step after saving the deep-review report, emit a metrics record. Best-effort — never block.
|
|
303
|
+
|
|
304
|
+
**Payload fields:**
|
|
305
|
+
```json
|
|
306
|
+
{
|
|
307
|
+
"skill": "deep-review",
|
|
308
|
+
"module": "<module path or name>",
|
|
309
|
+
"phases_completed": <N>,
|
|
310
|
+
"critical_count": <N>,
|
|
311
|
+
"important_count": <N>,
|
|
312
|
+
"sec_violations": <N>,
|
|
313
|
+
"acid_violations": <N>,
|
|
314
|
+
"graph_queries": <N>,
|
|
315
|
+
"fallback_grep_count": <N>
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**Emit call:**
|
|
320
|
+
```bash
|
|
321
|
+
DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$HOME/.claude/plugins/draft}/scripts/tools"
|
|
322
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$HOME/.cursor/plugins/local/draft/scripts/tools"
|
|
323
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
324
|
+
[ -x "$DRAFT_TOOLS/emit-skill-metrics.sh" ] && bash "$DRAFT_TOOLS/emit-skill-metrics.sh" \
|
|
325
|
+
'{"skill":"deep-review","module":"<module>","phases_completed":<N>,"critical_count":<N>,"important_count":<N>,"sec_violations":<N>,"acid_violations":<N>,"graph_queries":<N>,"fallback_grep_count":<N>}'
|
|
326
|
+
```
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deploy-checklist
|
|
3
|
+
description: Pre-deployment verification checklist. Generates customized checklists based on tech-stack with rollback triggers. Auto-invoked by /draft:upload.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deploy Checklist
|
|
7
|
+
|
|
8
|
+
You are generating a pre-deployment verification checklist customized to this project's technology stack.
|
|
9
|
+
|
|
10
|
+
## MANDATORY GRAPH LOOKUP (read before Phase 1)
|
|
11
|
+
|
|
12
|
+
When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Use the graph to validate module boundaries before the deploy:
|
|
13
|
+
|
|
14
|
+
1. For each file in the deploy diff, run `scripts/tools/graph-impact.sh --repo . --file <path>` to enumerate the modules affected — flag any module **not** declared in `hld.md` §Detailed Design as a deployment-scope miss.
|
|
15
|
+
2. Run `scripts/tools/cycle-detect.sh --repo .` (and read `draft/graph/architecture.json` for the module overview) to ensure no fresh cycles were introduced after HLD sign-off.
|
|
16
|
+
3. Load `draft/graph/hotspots.jsonl` — any hotspot in the diff escalates the Resiliency row of Phase 0.
|
|
17
|
+
|
|
18
|
+
Filesystem `grep` is reserved for source-text scans (migration file names, flag-key strings). Module/impact discovery goes through the graph.
|
|
19
|
+
|
|
20
|
+
## Red Flags — STOP if you're:
|
|
21
|
+
|
|
22
|
+
See [shared red flags](../../core/shared/red-flags.md) — applies to all code-touching skills.
|
|
23
|
+
|
|
24
|
+
Skill-specific:
|
|
25
|
+
- Deploying without a rollback plan
|
|
26
|
+
- Skipping database migration verification
|
|
27
|
+
- Deploying on Friday without explicit team approval
|
|
28
|
+
- Pushing to production without monitoring in place
|
|
29
|
+
- Ignoring failed checklist items marked as critical
|
|
30
|
+
|
|
31
|
+
**Every deployment needs a rollback plan. No exceptions.**
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Pre-Check
|
|
36
|
+
|
|
37
|
+
### 0. Capture Git Context
|
|
38
|
+
|
|
39
|
+
Before starting, capture the current git state:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git branch --show-current # Current branch name
|
|
43
|
+
git rev-parse --short HEAD # Current commit hash
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Store this for the checklist header. The checklist is scoped to this specific branch/commit.
|
|
47
|
+
|
|
48
|
+
### 1. Verify Draft Context
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
ls draft/ 2>/dev/null
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
If `draft/` doesn't exist, this skill can still run standalone — generate a generic checklist.
|
|
55
|
+
|
|
56
|
+
### 2. Load Draft Context (if available)
|
|
57
|
+
|
|
58
|
+
Read and follow the base procedure in `core/shared/draft-context-loading.md`.
|
|
59
|
+
|
|
60
|
+
### 3. Run validator gate chain (WS-9)
|
|
61
|
+
|
|
62
|
+
Canonical chain documented in
|
|
63
|
+
[core/shared/verification-gates.md](../../core/shared/verification-gates.md).
|
|
64
|
+
A single non-zero exit aborts the checklist and the output groups defects
|
|
65
|
+
by validator.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
TRACK_DIR="$1" # absolute path to track-under-deploy, or .
|
|
69
|
+
|
|
70
|
+
DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$HOME/.claude/plugins/draft}/scripts/tools"
|
|
71
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$HOME/.cursor/plugins/local/draft/scripts/tools"
|
|
72
|
+
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
|
|
73
|
+
|
|
74
|
+
"$DRAFT_TOOLS/check-track-hygiene.sh" "$TRACK_DIR" || rc=$?
|
|
75
|
+
"$DRAFT_TOOLS/verify-citations.sh" "$TRACK_DIR" || rc=$?
|
|
76
|
+
"$DRAFT_TOOLS/verify-doc-anchors.sh" "$TRACK_DIR" || rc=$?
|
|
77
|
+
"$DRAFT_TOOLS/check-graph-usage-report.sh" "$TRACK_DIR" || rc=$?
|
|
78
|
+
"$DRAFT_TOOLS/check-scope-conflicts.sh" "$TRACK_DIR/.." || rc=$?
|
|
79
|
+
"$DRAFT_TOOLS/diff-templates-vs-tracks.sh" "$TRACK_DIR" || rc=$?
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
After the chain runs, write the result into `metadata.json:pre_deploy_status`
|
|
83
|
+
(`passing` / `failing` / `bypassed`). The downstream checklist sections must
|
|
84
|
+
not be considered "ready to deploy" if `pre_deploy_status != passing`.
|
|
85
|
+
|
|
86
|
+
## Step 1: Parse Arguments
|
|
87
|
+
|
|
88
|
+
Check for arguments:
|
|
89
|
+
- `/draft:deploy-checklist` — Interactive: detect active track or ask for service name
|
|
90
|
+
- `/draft:deploy-checklist <service>` — Generate checklist for named service
|
|
91
|
+
- `/draft:deploy-checklist track <id>` — Generate from track's change scope
|
|
92
|
+
|
|
93
|
+
If a track is active: read `draft/tracks/<id>/spec.md` and `plan.md` for change scope.
|
|
94
|
+
|
|
95
|
+
## Step 2: Load Context
|
|
96
|
+
|
|
97
|
+
1. Read `draft/tech-stack.md` — Identify deployment-relevant tech:
|
|
98
|
+
- Database type (migrations needed?)
|
|
99
|
+
- Container orchestration (K8s, Docker Compose?)
|
|
100
|
+
- CI/CD pipeline details
|
|
101
|
+
- Feature flag system
|
|
102
|
+
- Monitoring/alerting stack
|
|
103
|
+
2. Read `draft/workflow.md` — Deployment conventions, toolchain (git)
|
|
104
|
+
3. Read `draft/.ai-context.md` — Service topology, dependencies
|
|
105
|
+
4. **If track-scoped:** Read `draft/tracks/<id>/hld.md` and `lld.md` if present — these are the source of truth for HLD §Checklist (Performance, Scale, Security, Resiliency, Multi-tenancy, Upgrade, Cost, Flags), §Deployment, §Observability, and LLD §Alerting Thresholds. The deploy checklist validates they are populated.
|
|
106
|
+
|
|
107
|
+
## Step 3: Generate Checklist
|
|
108
|
+
|
|
109
|
+
Generate a four-phase checklist customized to the project's tech stack. Adapt items based on what the project actually uses — omit irrelevant items (e.g., skip database items if there is no database) and add project-specific items discovered in context.
|
|
110
|
+
|
|
111
|
+
### Phase 0: HLD/LLD Gate (track-scoped only, when hld.md exists)
|
|
112
|
+
|
|
113
|
+
> ** blocker:** the HLD's §Checklist sections were the design-time commitment. If they are still empty at deploy time, the design was never validated against operational reality. This phase enforces that.
|
|
114
|
+
|
|
115
|
+
For `criticality ∈ {high, mission-critical}` (read from `hld.md` frontmatter `classification.criticality`), every row below MUST be checked before Phase 1 begins. For `standard` criticality, missing rows produce warnings but do not block. For `low`, this phase is informational.
|
|
116
|
+
|
|
117
|
+
- [ ] **HLD §Performance** populated — QPS and p95 latency stated
|
|
118
|
+
- [ ] **HLD §Scale** populated — horizontal scaling story documented; bottlenecks named
|
|
119
|
+
- [ ] **HLD §Security** populated — credentials, RBAC, encryption answered
|
|
120
|
+
- [ ] **HLD §Resiliency** populated — failure modes and graceful degradation described
|
|
121
|
+
- [ ] **HLD §Multi-tenancy** populated — isolation, predictable performance, migration covered
|
|
122
|
+
- [ ] **HLD §Upgrade** populated — backward compat, dependent service order, blast radius
|
|
123
|
+
- [ ] **HLD §Flags and Controlled Rollout** populated — flag names, kill switches
|
|
124
|
+
- [ ] **HLD §Cost Implications** populated — Cloud cost calculation included for SaaS deployments
|
|
125
|
+
|
|
126
|
+
- [ ] **HLD §Deployment** populated — DP/CP platform call answered (on-prem / SaaS / Cloud Console / IBM cloud)
|
|
127
|
+
- [ ] **HLD §Observability** populated — key metrics named with thresholds
|
|
128
|
+
- [ ] **HLD §Approvals table** signed by Technical Leads and Architecture Review Board (and Cloud Operations if SaaS, QA if on-prem) — Date column populated
|
|
129
|
+
- [ ] **LLD §Alerting Thresholds** table populated (when `lld.md` exists) — every metric has Threshold, Severity, Action
|
|
130
|
+
|
|
131
|
+
If any blocker row is empty for high/mission-critical: STOP. Do not generate Phases 1–3, **do not run Step 5 (Save Output)**, and do not create the `deploy-checklist.md` file. Tell the developer: "HLD/LLD §[section] is empty for a [criticality] track. Fill it in `hld.md` / `lld.md` before deploy. Run `/draft:decompose` to refresh structural sections; author-driven sections must be filled manually."
|
|
132
|
+
|
|
133
|
+
If a partial file is needed for tracking, write it with `status: BLOCKED` in the frontmatter and `_latest` symlinks must NOT be updated — `/draft:upload` Step 2.5 detects `status: BLOCKED` and refuses to treat the file as a passing checklist.
|
|
134
|
+
|
|
135
|
+
### Phase 1: Pre-Deploy
|
|
136
|
+
|
|
137
|
+
- [ ] **Tests:** All tests passing in CI
|
|
138
|
+
- [ ] **Review:** Code reviewed and approved
|
|
139
|
+
- [ ] **Migrations:** Database migrations tested on staging (if applicable)
|
|
140
|
+
- [ ] **Migration Rollback:** Down-migration verified (if applicable)
|
|
141
|
+
- [ ] **Feature Flags:** New features behind flags (if applicable)
|
|
142
|
+
- [ ] **Config:** Environment variables and secrets verified for target environment
|
|
143
|
+
- [ ] **Dependencies:** No known vulnerable dependencies (`npm audit` / `pip audit` / equivalent)
|
|
144
|
+
- [ ] **Monitoring:** Alerting rules configured for new endpoints/services
|
|
145
|
+
- [ ] **Rollback Plan:** Documented and tested (see Rollback Triggers below)
|
|
146
|
+
- [ ] **Communication:** Team notified of deployment window
|
|
147
|
+
- [ ] **Backup:** Database backup taken (if schema changes)
|
|
148
|
+
- [ ] **Changelog:** Release notes or changelog updated
|
|
149
|
+
- [ ] **API Compatibility:** Breaking changes documented and consumers notified
|
|
150
|
+
|
|
151
|
+
### Phase 2: Deploy
|
|
152
|
+
|
|
153
|
+
- [ ] **Method:** [Canary / Blue-Green / Rolling / Direct] — specify strategy
|
|
154
|
+
- [ ] **Sequence:** Deploy order for multi-service changes documented
|
|
155
|
+
- [ ] **Monitoring Dashboard:** [URL] open during deployment
|
|
156
|
+
- [ ] **Smoke Tests:** Ready to run post-deploy
|
|
157
|
+
- [ ] **Rollback Command:** `[specific rollback command]` ready to execute
|
|
158
|
+
- [ ] **Health Checks:** Endpoints responding before traffic shift
|
|
159
|
+
- [ ] **Traffic Shift:** Gradual rollout percentage plan (if canary/blue-green)
|
|
160
|
+
- [ ] **Deployment Log:** Recording start time and each step completion
|
|
161
|
+
|
|
162
|
+
### Phase 3: Post-Deploy
|
|
163
|
+
|
|
164
|
+
- [ ] **Smoke Tests:** All passing
|
|
165
|
+
- [ ] **Error Rate:** Below threshold ([X]% — from baseline)
|
|
166
|
+
- [ ] **Latency:** Below threshold ([X]ms — p95 from baseline)
|
|
167
|
+
- [ ] **Logs:** No unexpected errors in first 15 minutes
|
|
168
|
+
- [ ] **Feature Verification:** New features working as expected
|
|
169
|
+
- [ ] **Data Integrity:** No data corruption indicators
|
|
170
|
+
- [ ] **Dependency Health:** Downstream services unaffected
|
|
171
|
+
- [ ] **Cleanup:** Feature flags toggled, old code paths removed (if applicable)
|
|
172
|
+
- [ ] **Documentation:** Runbook updated if operational procedures changed
|
|
173
|
+
- [ ] **Notification:** Team notified of successful deployment
|
|
174
|
+
|
|
175
|
+
### Rollback Triggers
|
|
176
|
+
|
|
177
|
+
Initiate rollback if ANY of these occur:
|
|
178
|
+
- Error rate exceeds 2x baseline
|
|
179
|
+
- p95 latency exceeds 3x baseline
|
|
180
|
+
- Data corruption detected
|
|
181
|
+
- Critical user-facing functionality broken
|
|
182
|
+
- Deployment stuck in partial state for >10 minutes
|
|
183
|
+
- Health check failures on >10% of instances
|
|
184
|
+
- Memory or CPU exceeding safe thresholds on deployed instances
|
|
185
|
+
|
|
186
|
+
### Rollback Procedure
|
|
187
|
+
|
|
188
|
+
1. Execute rollback command (documented in Phase 2)
|
|
189
|
+
2. Verify previous version is serving traffic
|
|
190
|
+
3. Confirm error rates return to baseline
|
|
191
|
+
4. Investigate root cause before re-attempting deployment
|
|
192
|
+
5. Post-mortem if rollback was triggered by data corruption or user impact
|
|
193
|
+
|
|
194
|
+
## Step 4: Present and Track
|
|
195
|
+
|
|
196
|
+
Present the checklist interactively. For each critical item (marked **bold**):
|
|
197
|
+
- If unchecked and user wants to proceed: warn "Critical item unchecked: [item]. Are you sure? [y/N]"
|
|
198
|
+
- Default: stop and address critical items
|
|
199
|
+
|
|
200
|
+
Allow the user to:
|
|
201
|
+
- Check off items as they complete them
|
|
202
|
+
- Add custom items specific to this deployment
|
|
203
|
+
- Mark items as N/A with justification
|
|
204
|
+
|
|
205
|
+
## Step 5: Save Output
|
|
206
|
+
|
|
207
|
+
**MANDATORY: Include YAML frontmatter with git metadata.** Follow `core/shared/git-report-metadata.md`.
|
|
208
|
+
|
|
209
|
+
Include the report header table immediately after frontmatter:
|
|
210
|
+
|
|
211
|
+
```markdown
|
|
212
|
+
| Field | Value |
|
|
213
|
+
|-------|-------|
|
|
214
|
+
| **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
|
|
215
|
+
| **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
|
|
216
|
+
| **Generated** | {ISO_TIMESTAMP} |
|
|
217
|
+
| **Synced To** | `{FULL_SHA}` |
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Save to:
|
|
221
|
+
- Track-scoped: `draft/tracks/<id>/deploy-checklist.md`
|
|
222
|
+
- Standalone: `draft/deploy-checklist-<timestamp>.md` with symlink `deploy-checklist-latest.md`
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
TIMESTAMP=$(date +%Y-%m-%dT%H%M)
|
|
226
|
+
# Example: draft/deploy-checklist-2026-03-15T1430.md
|
|
227
|
+
ln -sf deploy-checklist-${TIMESTAMP}.md draft/deploy-checklist-latest.md
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Mandatory Self-Check (before saving the checklist)
|
|
231
|
+
|
|
232
|
+
Before saving the checklist file, internally verify and report:
|
|
233
|
+
|
|
234
|
+
1. **Graph files queried** — JSONL files loaded plus any live graph query-tool invocations (`impact`, `cycles`, `modules`).
|
|
235
|
+
2. **Layer 1 files deliberately skipped** — list any context sections skipped.
|
|
236
|
+
3. **Filesystem grep fallback justification** — for every `grep`/`find` run, name the concept it searched for.
|
|
237
|
+
|
|
238
|
+
If `draft/graph/schema.yaml` does not exist, set `Graph files queried: NONE` and use justification `graph data unavailable`.
|
|
239
|
+
|
|
240
|
+
## Graph Usage Report (append to checklist)
|
|
241
|
+
|
|
242
|
+
Emit the canonical footer from [core/shared/graph-usage-report.md](../../core/shared/graph-usage-report.md). The lint hook `scripts/tools/check-graph-usage-report.sh` validates the section on save.
|
|
243
|
+
## Cross-Skill Dispatch
|
|
244
|
+
|
|
245
|
+
- **Auto-invoked by:** `/draft:upload` (pre-upload verification)
|
|
246
|
+
- **References:** `core/agents/ops.md` for production-safety mindset
|
|
247
|
+
- **Jira sync:** If ticket linked, attach checklist and post comment via `core/shared/jira-sync.md`
|
|
248
|
+
- **MCP:** GitHub MCP for change details, Jira MCP for ticket context
|
|
249
|
+
|
|
250
|
+
## Error Handling
|
|
251
|
+
|
|
252
|
+
**If no tech-stack.md:** Generate generic checklist with all items, note: "Customize after running `/draft:init`"
|
|
253
|
+
**If no active track:** Generate standalone checklist, ask which service/release
|
|
254
|
+
**If no workflow.md:** Use sensible defaults, recommend documenting deployment conventions
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: discover
|
|
3
|
+
description: "Primary router for discovery, debugging, investigation, quality, and exploration workflows. Analyzes user intent and dispatches to debug, bughunt, quick-review, deep-review, coverage, testing-strategy, learn, index, tour, impact, assist-review. The recommended entry point for any 'find out', 'check', 'review', or 'investigate' request."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Discover - Investigation & Quality Router
|
|
7
|
+
|
|
8
|
+
`/draft:discover` is the single front door for all investigation, auditing, pattern learning, and quality exploration activities.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- Any debugging or root-cause work
|
|
13
|
+
- Code quality reviews (lightweight to exhaustive to architectural)
|
|
14
|
+
- Coverage analysis and test strategy design
|
|
15
|
+
- Discovering and codifying project conventions
|
|
16
|
+
- Monorepo indexing and context aggregation
|
|
17
|
+
- Project tours, impact analysis, or reviewer assistance
|
|
18
|
+
|
|
19
|
+
## Routing Logic
|
|
20
|
+
|
|
21
|
+
Strong keyword and phrase matching with fallback to a menu when intent is broad or compound. Several quality commands auto-chain (e.g. review may call bughunt).
|
|
22
|
+
|
|
23
|
+
| User Intent Keywords | Dispatches To | Purpose |
|
|
24
|
+
|---------------------------------------------------|--------------------------|---------|
|
|
25
|
+
| debug, investigate bug, reproduce, isolate, diagnose | `/draft:debug` | Structured 4-phase debugging |
|
|
26
|
+
| hunt bugs, find bugs, exhaustive sweep, regression hunt | `/draft:bughunt` | 14-dimension bug hunt + regression tests |
|
|
27
|
+
| quick review, fast review, sanity check, lightweight review | `/draft:quick-review` | 4-dimension review (~2 min) |
|
|
28
|
+
| deep review, production audit, module audit, ACID compliance | `/draft:deep-review` | Full module lifecycle + architecture audit |
|
|
29
|
+
| coverage, code coverage, test coverage report | `/draft:coverage` | Coverage measurement and gap report |
|
|
30
|
+
| test strategy, testing plan, coverage targets, pyramid | `/draft:testing-strategy` | Test approach design |
|
|
31
|
+
| learn patterns, discover conventions, update guardrails, anti-patterns | `/draft:learn` | Pattern mining + guardrail evolution |
|
|
32
|
+
| index services, aggregate context, monorepo index | `/draft:index` | Monorepo service context aggregation |
|
|
33
|
+
| tour, walkthrough, onboard me, getting started tour | `/draft:tour` | Guided interactive project tour |
|
|
34
|
+
| blast radius, code impact, affected modules, downstream callers | `/draft:review` or `scripts/tools/graph-impact.sh` | Graph-derived blast-radius before merge |
|
|
35
|
+
| impact, delivery telemetry, track analytics, CDD effectiveness | `/draft:impact` | Project-wide track delivery telemetry |
|
|
36
|
+
| assist review, help reviewer, PR architectural audit | `/draft:assist-review` | Risk audit to support human reviewers |
|
|
37
|
+
|
|
38
|
+
## Dispatch Examples
|
|
39
|
+
|
|
40
|
+
User: "debug the flaky test in CI"
|
|
41
|
+
|
|
42
|
+
→ dispatches to `/draft:debug "flaky test in CI"`
|
|
43
|
+
|
|
44
|
+
User: "quick review the PR diff"
|
|
45
|
+
|
|
46
|
+
→ dispatches to `/draft:quick-review [pr context]`
|
|
47
|
+
|
|
48
|
+
User: "run a deep production audit on the auth service"
|
|
49
|
+
|
|
50
|
+
→ dispatches to `/draft:deep-review auth`
|
|
51
|
+
|
|
52
|
+
User: "learn the coding patterns in this repo and tighten guardrails"
|
|
53
|
+
|
|
54
|
+
→ dispatches to `/draft:learn`
|
|
55
|
+
|
|
56
|
+
User: "index the monorepo so agents see all services"
|
|
57
|
+
|
|
58
|
+
→ dispatches to `/draft:index --init-missing`
|
|
59
|
+
|
|
60
|
+
## Auto-Chains & Recommendations
|
|
61
|
+
|
|
62
|
+
- `/draft:implement` and `/draft:review` (primary) frequently call into discover skills at phase boundaries.
|
|
63
|
+
- `/draft:discover "full quality"` may suggest or chain review + bughunt + coverage.
|
|
64
|
+
- After major changes, `/draft:discover learn` is recommended to keep guardrails current.
|
|
65
|
+
|
|
66
|
+
Direct specialist commands are preserved as shims for existing workflows and scripts.
|