engineering-intelligence 1.4.0 → 1.6.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.
Files changed (30) hide show
  1. package/README.md +5 -0
  2. package/dist/adapters/index.d.ts.map +1 -1
  3. package/dist/adapters/index.js +53 -26
  4. package/dist/adapters/index.js.map +1 -1
  5. package/dist/templates.d.ts +1 -1
  6. package/dist/templates.d.ts.map +1 -1
  7. package/dist/templates.js +37 -0
  8. package/dist/templates.js.map +1 -1
  9. package/dist/visualizer/index.d.ts.map +1 -1
  10. package/dist/visualizer/index.js +107 -0
  11. package/dist/visualizer/index.js.map +1 -1
  12. package/package.json +1 -1
  13. package/templates/canonical/rules/engineering-intelligence.md +4 -1
  14. package/templates/canonical/skills/adr-compliance-checker/SKILL.md +43 -0
  15. package/templates/canonical/skills/api-snapshot-testing-engine/SKILL.md +75 -0
  16. package/templates/canonical/skills/context-budget-optimizer/SKILL.md +97 -0
  17. package/templates/canonical/skills/context-sync-engine/SKILL.md +12 -1
  18. package/templates/canonical/skills/contract-test-generator/SKILL.md +40 -0
  19. package/templates/canonical/skills/convention-detector/SKILL.md +16 -2
  20. package/templates/canonical/skills/dead-code-detector/SKILL.md +34 -0
  21. package/templates/canonical/skills/engineering-change-review/SKILL.md +17 -2
  22. package/templates/canonical/skills/engineering-intelligence-skill/SKILL.md +36 -9
  23. package/templates/canonical/skills/environment-variable-auditor/SKILL.md +47 -0
  24. package/templates/canonical/skills/impact-analysis-engine/SKILL.md +10 -5
  25. package/templates/canonical/skills/llm-prompt-injection-guard/SKILL.md +47 -0
  26. package/templates/canonical/skills/memory-sync-engine/SKILL.md +4 -0
  27. package/templates/canonical/skills/operations-readiness-engine/SKILL.md +2 -0
  28. package/templates/canonical/skills/security-audit-engine/SKILL.md +20 -0
  29. package/templates/canonical/skills/testing-intelligence-engine/SKILL.md +1 -1
  30. package/templates/canonical/workflows/engineering-intelligence.md +2 -2
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: api-snapshot-testing-engine
3
+ description: Captures pre-change API request/response snapshots, replays them post-change, and flags semantic response regressions.
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # API Snapshot Testing Engine
8
+
9
+ Use this skill when an API endpoint, route handler, controller, serializer, GraphQL resolver, RPC method, webhook, or response-shaping code changes.
10
+
11
+ ## Snapshot Root
12
+
13
+ Store snapshots under:
14
+
15
+ ```text
16
+ .engineering-intelligence/snapshots/
17
+ ```
18
+
19
+ ## Procedure
20
+
21
+ 1. **Select Snapshot Scenarios**
22
+ - Read `knowledge-base/04-api-documentation.md`, `service-graph.json`, route files, and existing API tests.
23
+ - Select representative requests for changed endpoints:
24
+ - happy path
25
+ - auth failure
26
+ - validation error
27
+ - downstream timeout or dependency failure
28
+ - edge-case response shape
29
+
30
+ 2. **Capture Pre-Change Snapshots**
31
+ - Before implementation edits when feasible, capture pre-change request/response pairs.
32
+ - If runtime capture is unavailable, extract examples from existing tests or API docs and mark confidence accordingly.
33
+
34
+ 3. **Replay Post-Change**
35
+ - After implementation, replay the same requests against the changed code or test harness.
36
+ - Diff status code, headers that are part of the contract, response shape, computed values, pagination metadata, error format, and auth behavior.
37
+
38
+ 4. **Classify Differences**
39
+ - `expected`: intentional change covered by acceptance criteria or API compatibility notes
40
+ - `compatible`: additive or non-contractual difference
41
+ - `regression-candidate`: semantic difference that may break callers
42
+ - `breaking`: incompatible response or status change without approval
43
+
44
+ 5. **Block On Unexplained Regressions**
45
+ - `regression-candidate` and `breaking` diffs block Definition of Done until resolved, approved, or recorded as open risk.
46
+
47
+ ## Output
48
+
49
+ Write `.engineering-intelligence/snapshots/<unit>/snapshot-report.md`:
50
+
51
+ ```markdown
52
+ # API Snapshot Report: <unit>
53
+
54
+ ## Snapshot Sources
55
+ - pre-change: <runtime|test fixture|documentation|unavailable>
56
+ - post-change: <runtime|test fixture|unavailable>
57
+
58
+ ## Replay Results
59
+ | Scenario | Endpoint | Pre-Change | Post-Change | Classification | Evidence |
60
+ |---|---|---|---|---|---|
61
+
62
+ ## Blocking Differences
63
+ - <regression or breaking difference>
64
+
65
+ ## Approval / Rationale
66
+ - <expected difference and evidence>
67
+ ```
68
+
69
+ ## Quality Gates
70
+
71
+ - [ ] Changed API surfaces have snapshot scenarios or explicit unavailable rationale
72
+ - [ ] Pre-change snapshots are captured before implementation when feasible
73
+ - [ ] Post-change replay was performed or blocked with evidence
74
+ - [ ] Semantic differences are classified
75
+ - [ ] Unexplained regression candidates block completion
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: context-budget-optimizer
3
+ description: Minimizes AI IDE token usage by ranking, slicing, summarizing, and lazy-loading project intelligence while preserving required gates and output quality.
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # Context Budget Optimizer
8
+
9
+ Use this skill before broad intelligence reads in implementation, analysis, review, and synchronization workflows. The goal is to produce the same engineering output with fewer tokens by loading only the most relevant evidence.
10
+
11
+ ## Token Budget Policy
12
+
13
+ Default budget allocation:
14
+
15
+ | Budget Area | Target |
16
+ |---|---:|
17
+ | Intelligence context | <= 40% |
18
+ | Source/test snippets | 30% |
19
+ | Tool diagnostics | 20% |
20
+ | User interaction and final answer | 10% |
21
+
22
+ If the AI IDE exposes a context-window size, estimate against that. If not, use relative budgets and prefer compact artifacts over full documents.
23
+
24
+ ## Context Manifest
25
+
26
+ Before loading full documents, create or update:
27
+
28
+ ```text
29
+ .engineering-intelligence/context/context-manifest.md
30
+ ```
31
+
32
+ Format:
33
+
34
+ ```markdown
35
+ # Context Manifest
36
+
37
+ ## Scope
38
+ - Request:
39
+ - Candidate modules:
40
+ - Risk:
41
+
42
+ ## Ranked Context
43
+ | Rank | Artifact | Sections / Keys | Reason | Estimated Tokens | Load Mode |
44
+ |---:|---|---|---|---:|---|
45
+ | 1 | `.engineering-intelligence/context/module-map.md` | auth row | direct scope | 120 | slice |
46
+ | 2 | `knowledge-base/04-api-documentation.md` | H2: Auth API | API contract | 500 | section |
47
+ ```
48
+
49
+ ## Procedure
50
+
51
+ 1. **Resolve Scope**
52
+ - Use the user request, changed files, graph proximity, and impact report.
53
+ - Identify candidate modules, services, APIs, schemas, tests, and risk areas.
54
+
55
+ 2. **Rank Artifacts**
56
+ - Load compact maps first: context maps, graph node summaries, `aidlc-state.md`, active unit, acceptance criteria.
57
+ - Rank knowledge docs by graph proximity and section confidence.
58
+ - Prefer H2 sections with high/medium confidence.
59
+ - Penalize stale or low-confidence sections unless they are required for risk.
60
+
61
+ 3. **Slice Before Full Read**
62
+ - Load only relevant H2 sections, table rows, graph nodes/edges, and file snippets.
63
+ - Do not load an entire knowledge document when a section or table row is enough.
64
+ - Do not load all skills. Invoke only skills triggered by the current change.
65
+
66
+ 4. **Lazy Loading**
67
+ - Defer expensive artifacts until a gate requires them.
68
+ - Examples:
69
+ - Load API docs only when API surfaces are touched.
70
+ - Load migration docs only when schema/persistence changes.
71
+ - Load security assessment only for security-sensitive paths.
72
+ - Load snapshots only when API replay applies.
73
+
74
+ 5. **Summarize And Cache**
75
+ - Write compact summaries to `.engineering-intelligence/context/context-manifest.md`.
76
+ - Store pointers to source evidence instead of copying long excerpts.
77
+ - Reuse manifest rankings during resume/checkpoint flows.
78
+
79
+ 6. **Escalate When Budget Is Insufficient**
80
+ - If critical context cannot fit, stop and report what was excluded, why it matters, and whether the user wants a narrower scope.
81
+
82
+ ## Rules
83
+
84
+ - Never sacrifice required safety gates to save tokens.
85
+ - Prefer evidence pointers over pasted content.
86
+ - Prefer graph node/edge slices over full graph JSON.
87
+ - Prefer section-level confidence metadata over full-document reads.
88
+ - Keep initial intelligence loading under 40% of context budget whenever possible.
89
+ - Lazy Loading is mandatory for large projects.
90
+
91
+ ## Quality Gates
92
+
93
+ - [ ] Context Manifest exists for non-trivial workflows
94
+ - [ ] Ranked context explains why each artifact was loaded
95
+ - [ ] Initial context stayed within 40% budget or escalation was recorded
96
+ - [ ] Full documents were avoided when slices were enough
97
+ - [ ] Required gates still had enough evidence to run
@@ -84,14 +84,24 @@ Queue → Worker → Process → DB Write → Notify
84
84
  | stripe | 12.x | payments module | Medium — breaking changes |
85
85
  ```
86
86
 
87
+ ### `context-manifest.md` — Token Budget And Relevance Plan
88
+
89
+ ```markdown
90
+ # Context Manifest
91
+
92
+ | Rank | Artifact | Sections / Keys | Reason | Estimated Tokens | Load Mode |
93
+ |---:|---|---|---|---:|---|
94
+ ```
95
+
87
96
  ## Procedure
88
97
 
89
- 1. **Context Relevance Selection** — Before reading broad intelligence, rank knowledge and context documents by graph proximity to the change scope:
98
+ 1. **Context Relevance Selection** — Use `context-budget-optimizer` before reading broad intelligence. Rank knowledge and context documents by graph proximity to the change scope:
90
99
  - direct graph neighbors first
91
100
  - critical-path maps next
92
101
  - impacted API/schema/security docs next
93
102
  - broad background docs last
94
103
  Estimate token cost and load in relevance order until roughly 40% of the available context budget is consumed. Reserve the rest for implementation, tests, diagnostics, and user interaction. If critical docs cannot fit, escalate with the missing docs and reason.
104
+ Write the ranking to `.engineering-intelligence/context/context-manifest.md`.
95
105
 
96
106
  2. **Check Impact** — Review the impact report and graph updates. Identify which context maps are affected.
97
107
 
@@ -125,6 +135,7 @@ Queue → Worker → Process → DB Write → Notify
125
135
 
126
136
  - [ ] Each map is under 150 lines
127
137
  - [ ] Relevant docs were ranked by graph proximity before broad loading
138
+ - [ ] `context-manifest.md` was updated for non-trivial work
128
139
  - [ ] Context budget was preserved or an escalation was recorded
129
140
  - [ ] Updated entries reference real, existing paths
130
141
  - [ ] Only impact-affected maps were modified
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: contract-test-generator
3
+ description: Generates consumer-driven contract test stubs for service boundaries based on API contracts and service graph topology.
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # Contract Test Generator
8
+
9
+ Use this skill when service boundaries, API clients, webhooks, events, GraphQL schemas, or RPC contracts change.
10
+
11
+ ## Procedure
12
+
13
+ 1. Read `service-graph.json`, `knowledge-base/04-api-documentation.md`, OpenAPI/GraphQL/protobuf schemas, and existing contract tests.
14
+ 2. Detect the project’s contract-test framework if any: Pact, Spring Cloud Contract, protobuf conformance tests, schema snapshots, custom integration harness, or plain test framework.
15
+ 3. Generate or recommend stubs matching the project’s exact test structure and assertion style.
16
+ 4. Cover canonical scenarios:
17
+ - happy path
18
+ - auth failure
19
+ - validation error
20
+ - downstream timeout
21
+ - unexpected response shape
22
+ 5. Feed generated stubs and commands into `testing-intelligence-engine`.
23
+
24
+ ## Output
25
+
26
+ Write `.engineering-intelligence/aidlc/construction/<unit>/contract-test-plan.md`:
27
+
28
+ ```markdown
29
+ # Contract Test Plan: <unit>
30
+
31
+ | Boundary | Consumer | Provider | Scenario | Stub/Test Path | Status |
32
+ |---|---|---|---|---|---|
33
+ ```
34
+
35
+ ## Quality Gates
36
+
37
+ - [ ] Changed service boundaries are identified
38
+ - [ ] Existing contract-test style is matched
39
+ - [ ] Canonical failure scenarios are covered or explicitly not applicable
40
+ - [ ] Contract tests are linked to acceptance criteria
@@ -121,6 +121,19 @@ This capability does not modify product code.
121
121
  - **Exceptions**: specific files or modules that deviate (and possible reasons)
122
122
  - **Confidence**: how certain the detection is (based on sample size)
123
123
 
124
+ ## Convention Severity
125
+
126
+ Classify violations with these blocking rules:
127
+
128
+ | Severity | Meaning | Completion Rule |
129
+ |---|---|---|
130
+ | `critical` | Violates architectural boundary, security convention, data access rule, public API shape, or framework lifecycle rule | Blocks completion |
131
+ | `major` | Breaks dominant project structure, error handling, logging, import style, or test pattern in a way that creates maintenance risk | Must fix or record review finding |
132
+ | `minor` | Local naming/order/style mismatch that is mechanically fixable | Auto-correct when safe |
133
+ | `exception` | Existing legacy or documented exception | Record but do not block |
134
+
135
+ A pattern must exceed `>70%` adherence to be treated as a convention. Structural means the violation changes file placement, layer ownership, dependency direction, API envelope, persistence access, or lifecycle hook usage rather than simple naming.
136
+
124
137
  10. **Write conventions document** — Generate `knowledge-base/16-conventions.md` following the output format below.
125
138
 
126
139
  11. **Enhance coding patterns memory** — Update `.engineering-intelligence/memory/coding-patterns.md` with durable conventions that are unlikely to change.
@@ -167,8 +180,8 @@ Sample size: <N files analyzed across M modules>
167
180
 
168
181
  ## Convention Violations
169
182
 
170
- | Convention | Violation | Location | Severity |
171
- |---|---|---|---|
183
+ | Convention | Violation | Location | Severity | Blocks Completion | Recommended Action |
184
+ |---|---|---|---|---|---|
172
185
  | ... | ... | ... | ... |
173
186
  ```
174
187
 
@@ -185,6 +198,7 @@ Add a `## Conventions` section with only durable patterns that pass the durabili
185
198
  - [ ] Git conventions are extracted from actual git history (not assumed)
186
199
  - [ ] Each convention has an adherence rate and evidence citation
187
200
  - [ ] Exceptions to conventions are listed (not hidden)
201
+ - [ ] Convention violations include severity and blocking decision
188
202
  - [ ] `knowledge-base/16-conventions.md` exists and follows the output format
189
203
  - [ ] `coding-patterns.md` is enhanced with a Conventions section
190
204
  - [ ] Only patterns with >70% adherence are classified as conventions
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: dead-code-detector
3
+ description: Detects unused exports, unreachable code paths, zombie dependencies, and stale modules by combining static analysis with git history.
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # Dead Code Detector
8
+
9
+ Use this skill during initialization, major refactors, dependency cleanup, and technical-debt reviews.
10
+
11
+ ## Procedure
12
+
13
+ 1. Scan imports/exports, route registrations, job registrations, dependency injection containers, and public entry points.
14
+ 2. Identify unused exports, unreferenced files, unreachable branches, feature flags that are always on/off, and manifest dependencies with no import/use evidence.
15
+ 3. Cross-reference `git-intelligence-engine` for stale modules, low ownership, and no recent changes.
16
+ 4. Avoid false positives for framework-discovered files, reflection, migrations, generated code, and public package exports.
17
+ 5. Produce candidates, not automatic deletions.
18
+
19
+ ## Output
20
+
21
+ Write or update `knowledge-base/12-technical-debt.md`:
22
+
23
+ ```markdown
24
+ ## Dead Code Candidates
25
+ | Candidate | Type | Confidence | Evidence | Safe Removal Steps |
26
+ |---|---|---|---|---|
27
+ ```
28
+
29
+ ## Quality Gates
30
+
31
+ - [ ] Static references were checked
32
+ - [ ] Framework dynamic entry points were considered
33
+ - [ ] Git staleness was included
34
+ - [ ] Findings include confidence and safe-removal steps
@@ -67,6 +67,16 @@ Review completed engineering work for correctness, completeness, and alignment w
67
67
  | Change record | Does the CHG record accurately reflect the work? |
68
68
  | Impact report | Was the impact report referenced correctly? |
69
69
 
70
+ ### 6. Rollback Readiness
71
+
72
+ | Check | What to Verify |
73
+ |---|---|
74
+ | Medium+ rollback | Medium, high, and critical risk changes include rollback instructions |
75
+ | Data rollback | Migration rollback, compensating SQL, or irreversible approval is recorded |
76
+ | Feature flags | Flag rollback is documented where applicable |
77
+ | Infrastructure | IaC or deployment rollback is documented where applicable |
78
+ | CHG alignment | CHG record rollback section matches operations readiness |
79
+
70
80
  ## Finding Severity Scale
71
81
 
72
82
  | Severity | Symbol | Meaning | Action Required |
@@ -80,7 +90,7 @@ Review completed engineering work for correctness, completeness, and alignment w
80
90
  ## Procedure
81
91
 
82
92
  1. **Read Context** — Load the impact report, implementation diff, and test results.
83
- 2. **Review Each Dimension** — Walk through all five review dimensions above.
93
+ 2. **Review Each Dimension** — Walk through all six review dimensions above.
84
94
  3. **Score Findings** — Assign severity to each finding.
85
95
  4. **Check Intelligence** — Verify graph, knowledge, memory, and context were appropriately synced.
86
96
  5. **Write Report** — Generate the review report.
@@ -129,6 +139,11 @@ Write `.engineering-intelligence/reports/REV-XXX-<slug>.md`:
129
139
 
130
140
  ## Stale Intelligence Risks
131
141
  - <areas where docs may drift from code>
142
+
143
+ ## Rollback Readiness
144
+ | Area | Status | Evidence |
145
+ |---|---|---|
146
+ | Code rollback | ✅/⚠️/❌ | <CHG or operations-readiness evidence> |
132
147
  ```
133
148
 
134
149
  ## Rules
@@ -141,7 +156,7 @@ Write `.engineering-intelligence/reports/REV-XXX-<slug>.md`:
141
156
 
142
157
  ## Quality Gates
143
158
 
144
- - [ ] All five review dimensions were evaluated
159
+ - [ ] All six review dimensions were evaluated
145
160
  - [ ] Each finding has severity, location, and evidence
146
161
  - [ ] Test execution was verified (not assumed)
147
162
  - [ ] Intelligence sync status was checked
@@ -32,15 +32,17 @@ Classify the incoming request before starting:
32
32
 
33
33
  ### 1. Pre-Flight: Read Intelligence
34
34
 
35
- Read these artifacts and identify relevant context:
36
- - `knowledge-base/` — architecture, APIs, runtime flow relevant to the change
37
- - `.engineering-intelligence/aidlc/` — active AI-DLC state, plan, audit, open questions, construction units
38
- - `.engineering-intelligence/memory/` — decisions, constraints, patterns that apply
39
- - `.engineering-intelligence/context/` — module map, critical paths, dangerous areas near the change
40
- - `.engineering-intelligence/graph/` — dependency and service relationships
35
+ Use `context-budget-optimizer` before loading broad intelligence. Do not read all of `knowledge-base/` or all graph JSON by default. Build `.engineering-intelligence/context/context-manifest.md`, then load only relevant slices:
36
+ - `knowledge-base/` — only H2 sections relevant to the changed modules, APIs, schemas, or risk areas
37
+ - `.engineering-intelligence/aidlc/` — `aidlc-state.md`, active checkpoint, active unit, acceptance criteria, and execution-plan rows relevant to the request
38
+ - `.engineering-intelligence/memory/` — only matching decisions, constraints, conventions, regression patterns, and ADR references
39
+ - `.engineering-intelligence/context/` — module/service/runtime rows near the change scope
40
+ - `.engineering-intelligence/graph/` — only relevant nodes/edges by graph proximity
41
41
 
42
42
  **If intelligence is missing or stale**: Run `initialize-intelligence-skill` first.
43
43
 
44
+ Token rule: keep initial intelligence loading under 40% of the available context budget whenever possible. Lazy-load safety-gate evidence only when the trigger applies.
45
+
44
46
  #### Pre-Flight Freshness Gate
45
47
 
46
48
  Before impact analysis or code edits:
@@ -49,7 +51,9 @@ Before impact analysis or code edits:
49
51
  2. Run `staleness-detector` scoped to those modules and related knowledge/context/memory artifacts.
50
52
  3. If any freshness score is below `60`, run `incremental-sync-engine` for the stale artifacts before editing product code, or explicitly mark stale context in the impact report with the affected documents and scores.
51
53
  4. If any score is below `50`, implementation is blocked until incremental sync runs or the user explicitly accepts stale-context risk.
52
- 5. Skip stale H2 sections that carry low confidence metadata unless they are refreshed or verified against source.
54
+ 5. Use the `staleness-detector` **Pre-Implementation Drift Trigger** decision: `Proceed`, `Sync before implementation`, or `Block implementation`.
55
+ 6. Carry that exact decision into the impact report's freshness-gate line.
56
+ 7. Skip stale H2 sections that carry low confidence metadata unless they are refreshed or verified against source.
53
57
 
54
58
  ### 2. Impact Analysis: Write Report
55
59
 
@@ -139,7 +143,12 @@ When TDD delivery mode is selected:
139
143
  - Use environmental backpressure: analyze failed diagnostics, fix, and rerun the relevant command until it passes or a blocker is recorded
140
144
  - Run `type-safety-engine` for typed projects or record why no type system applies
141
145
  - Run `api-backward-compatibility-engine` when API, event, webhook, SDK, route, or schema contracts changed
146
+ - Run `api-snapshot-testing-engine` when API response behavior can be replayed or sampled
142
147
  - Run `database-migration-safety-engine` when schema, ORM model, migration, index, or data persistence contracts changed
148
+ - Run `security-audit-engine` in targeted dependency-risk mode when package manifests add or upgrade dependencies; critical CVEs block completion
149
+ - Run `environment-variable-auditor` when environment variable reads, validation schemas, deployment config, or CI secrets change
150
+ - Run `adr-compliance-checker` when accepted ADRs or architecture decisions apply to the changed area
151
+ - Run `llm-prompt-injection-guard` when user-controlled data reaches prompts, RAG, agent tools, LLM calls, or durable AI memory
143
152
  - Write `.engineering-intelligence/aidlc/construction/<unit>/build-and-test/build-and-test-summary.md` for non-trivial units
144
153
  - **Never claim validation passed unless it actually ran and passed**
145
154
  - Record partial or failed validation honestly
@@ -199,9 +208,21 @@ Create `.changes/CHG-XXX-<summary>.md`:
199
208
  - Freshness gate: <passed|synced|stale risk accepted>
200
209
  - Type safety: <passed|failed|not applicable>
201
210
  - API compatibility: <passed|failed|not applicable>
211
+ - API snapshots: <passed|failed|not applicable>
202
212
  - Migration safety: <passed|failed|not applicable>
213
+ - Dependency security: <passed|failed|not applicable>
214
+ - Environment variables: <passed|failed|not applicable>
215
+ - ADR compliance: <passed|failed|not applicable>
216
+ - LLM prompt injection: <passed|failed|not applicable>
203
217
  - Convention enforcement: <passed|findings>
204
218
 
219
+ ## Rollback
220
+ - Code rollback: <git revert command or branch rollback>
221
+ - Data rollback: <down migration / compensating operation / N/A with justification>
222
+ - Feature flag rollback: <toggle / N/A with justification>
223
+ - Infrastructure rollback: <IaC rollback / N/A with justification>
224
+ - Irreversible steps requiring approval: <list or none>
225
+
205
226
  ## Related Reports
206
227
  - IMP-XXX: <link to impact report>
207
228
  - REV-XXX: <link to review report, if applicable>
@@ -242,6 +263,12 @@ Summarize to the user:
242
263
  - [ ] Acceptance criteria are mapped to validation evidence
243
264
  - [ ] Acceptance Criteria Verification Matrix has no unmapped criteria unless recorded as open items
244
265
  - [ ] Type safety, API compatibility, and migration safety gates ran when applicable
266
+ - [ ] API snapshot replay ran for changed API behavior when feasible
267
+ - [ ] Dependency security ran for new or upgraded packages
268
+ - [ ] Environment variable audit ran when config/env usage changed
269
+ - [ ] ADR compliance checked applicable accepted decisions
270
+ - [ ] LLM prompt injection guard ran for LLM/user-input paths
271
+ - [ ] Medium-and-above risk changes include rollback instructions or explicit N/A justification
245
272
  - [ ] Environmental backpressure was used for validation failures
246
273
  - [ ] Change record references the correct impact report
247
274
  - [ ] High-risk changes went through review gate
@@ -249,6 +276,6 @@ Summarize to the user:
249
276
 
250
277
  ## Cross-References
251
278
 
252
- - Depends on: `initialize-intelligence-skill` (prerequisite), `change-detection-engine`, `impact-analysis-engine`, `graph-engine`, `staleness-detector`
253
- - Uses during execution: `testing-intelligence-engine`, `type-safety-engine`, `api-backward-compatibility-engine`, `database-migration-safety-engine`, `incremental-sync-engine`, `change-history-engine`
279
+ - Depends on: `initialize-intelligence-skill` (prerequisite), `context-budget-optimizer`, `change-detection-engine`, `impact-analysis-engine`, `graph-engine`, `staleness-detector`
280
+ - Uses during execution: `testing-intelligence-engine`, `api-snapshot-testing-engine`, `type-safety-engine`, `api-backward-compatibility-engine`, `database-migration-safety-engine`, `security-audit-engine`, `environment-variable-auditor`, `adr-compliance-checker`, `llm-prompt-injection-guard`, `incremental-sync-engine`, `change-history-engine`
254
281
  - Optional: `engineering-change-review` (for high-risk), `refactoring-planner` (for refactors), `convention-detector` (for convention compliance)
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: environment-variable-auditor
3
+ description: Audits environment variable usage against examples, validation schemas, CI secrets, and deployment configuration.
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # Environment Variable Auditor
8
+
9
+ Use this skill when code adds, removes, or changes environment variables, configuration schemas, deployment manifests, or CI/CD secrets.
10
+
11
+ ## Procedure
12
+
13
+ 1. Detect environment variable reads:
14
+ - Node: `process.env.*`
15
+ - Python: `os.environ`, `os.getenv`
16
+ - Go: `os.Getenv`
17
+ - Ruby: `ENV[]`
18
+ - Java/Kotlin/C#: equivalent environment APIs
19
+ 2. Compare against `.env.example`, `.env.sample`, README setup docs, deployment manifests, CI secret declarations, and validation schemas such as Zod, envalid, pydantic, dotenv-safe, or custom config loaders.
20
+ 3. Flag:
21
+ - missing example entries
22
+ - missing validation/default
23
+ - stale example vars no longer used
24
+ - required vars not present in CI/deployment docs
25
+ - secrets accidentally committed or documented with real values
26
+ 4. Block completion for newly required production env vars without docs and validation.
27
+
28
+ ## Output
29
+
30
+ Write `.engineering-intelligence/aidlc/construction/<unit>/environment-variable-audit.md`:
31
+
32
+ ```markdown
33
+ # Environment Variable Audit: <unit>
34
+
35
+ | Variable | Usage | Example Present | Validation Present | Deployment/CI Present | Risk |
36
+ |---|---|---|---|---|---|
37
+
38
+ ## Required Fixes
39
+ - <missing or stale env handling>
40
+ ```
41
+
42
+ ## Quality Gates
43
+
44
+ - [ ] Env reads were scanned
45
+ - [ ] Example files and validation schemas were checked
46
+ - [ ] CI/deployment declarations were checked when present
47
+ - [ ] New required env vars are documented and validated
@@ -41,9 +41,11 @@ Determine what can break before changing code. Produce a reusable impact report
41
41
  - Query paths referencing changed schema fields from schema-to-query mapping
42
42
  - API clients or contract tests affected by additive, deprecated, or breaking API changes
43
43
 
44
- 5. **Trace Transitive Impact** — Follow 2nd and 3rd order effects through the graph. Identify files that are indirectly affected by consumers of the directly affected modules. Walk the dependency chain until impact attenuates or reaches a service boundary.
44
+ 5. **Traverse Sensitive Data Paths** — Query `data-flow-graph.json` for sensitive-source to sensitive-sink reachability involving the changed scope. Sensitive data propagation to unencrypted channels, logs, analytics events, prompt/RAG memory, or unvalidated sinks escalates risk and becomes a security finding in the impact report.
45
45
 
46
- 6. **Score Risk** — Assign risk based on:
46
+ 6. **Trace Transitive Impact** — Follow 2nd and 3rd order effects through the graph. Identify files that are indirectly affected by consumers of the directly affected modules. Walk the dependency chain until impact attenuates or reaches a service boundary.
47
+
48
+ 7. **Score Risk** — Assign risk based on:
47
49
 
48
50
  | Factor | Low | Medium | High | Critical |
49
51
  |---|---|---|---|---|
@@ -55,7 +57,7 @@ Determine what can break before changing code. Produce a reusable impact report
55
57
  | **Change coupling** | None | Low (1-2 coupled files) | Medium (3-5 coupled files) | High (6+ coupled files) |
56
58
  | **Hot path** | Cold path | Normal | Critical path | Revenue/security/SLO path |
57
59
 
58
- 7. **Identify Validation Needs** — Map impact to required validation:
60
+ 8. **Identify Validation Needs** — Map impact to required validation:
59
61
 
60
62
  | Impact Area | Validation Required |
61
63
  |---|---|
@@ -66,9 +68,9 @@ Determine what can break before changing code. Produce a reusable impact report
66
68
  | UI change | Visual regression, accessibility |
67
69
  | Infrastructure | Deploy to staging, smoke test |
68
70
 
69
- 8. **Map Intelligence Artifacts** — Determine which intelligence artifacts need synchronization after the change is implemented.
71
+ 9. **Map Intelligence Artifacts** — Determine which intelligence artifacts need synchronization after the change is implemented.
70
72
 
71
- > **Surprise Impact Detection**: Flag any dependency discovered during analysis that is NOT in the current graph these are surprise impacts that should be added to the graph. Surprise impacts indicate missing edges or nodes and must be reported in the Unknowns section of the impact report.
73
+ > **Surprise Impact Detection**: Flag any dependency discovered during analysis that is NOT in the current graph. Submit the edge to `graph-engine` incremental mode as an `inferred` edge with evidence so the graph learns from the surprise. Surprise impacts must also be reported in the Unknowns section of the impact report until the graph update is complete.
72
74
 
73
75
  ## Output Format
74
76
 
@@ -105,6 +107,7 @@ Write `.engineering-intelligence/reports/IMP-XXX-<slug>.md`:
105
107
  |---|---|---|
106
108
  | API <name> | additive | api-backward-compatibility-engine |
107
109
  | Table.column | schema-to-query impact | database-migration-safety-engine |
110
+ | Sensitive data path | unencrypted sink | security-audit-engine |
108
111
 
109
112
  ## Risk Assessment
110
113
  - Overall risk: <level>
@@ -145,6 +148,8 @@ Write `.engineering-intelligence/reports/IMP-XXX-<slug>.md`:
145
148
  - [ ] Direct and indirect impact are separated
146
149
  - [ ] Type-level dependencies are traced for typed languages
147
150
  - [ ] API and schema/query impact are classified when relevant
151
+ - [ ] Sensitive data path traversal was performed for data-flow changes
152
+ - [ ] Surprise impacts were submitted to graph-engine incremental mode
148
153
  - [ ] Risk score is justified with evidence
149
154
  - [ ] Validation requirements are specific (not generic)
150
155
  - [ ] Report ends with the "did not modify product code" statement
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: llm-prompt-injection-guard
3
+ description: Detects user-input-to-LLM prompt injection paths, unsafe RAG ingestion, unvalidated LLM outputs, and poisoned AI memory/documentation flows.
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # LLM Prompt Injection Guard
8
+
9
+ Use this skill for AI-augmented applications, RAG pipelines, agent tools, prompt builders, chat handlers, knowledge ingestion, or any code that sends user-controlled data to an LLM.
10
+
11
+ ## Procedure
12
+
13
+ 1. Detect LLM calls, prompt templates, tool outputs, embedding pipelines, document ingestion, and agent memory writes.
14
+ 2. Trace user-controlled sources into prompts, system messages, tool descriptions, retrieval documents, logs, knowledge-base files, and memory files.
15
+ 3. Flag missing controls:
16
+ - no prompt boundary separation
17
+ - no input sanitization or quoting
18
+ - no output schema validation
19
+ - tool results trusted without validation
20
+ - externally sourced content written into durable memory without provenance
21
+ - secrets or policies exposed to user-influenced context
22
+ 4. Require adversarial tests for high-risk LLM paths.
23
+
24
+ ## Output
25
+
26
+ Write `.engineering-intelligence/reports/LLM-PROMPT-INJECTION-<slug>.md`:
27
+
28
+ ```markdown
29
+ # LLM Prompt Injection Review: <summary>
30
+
31
+ ## Data Paths
32
+ | Source | LLM / Memory Sink | Control Present | Risk | Evidence |
33
+ |---|---|---|---|---|
34
+
35
+ ## Findings
36
+ - <prompt injection or output validation risk>
37
+
38
+ ## Required Tests
39
+ - <adversarial test cases>
40
+ ```
41
+
42
+ ## Quality Gates
43
+
44
+ - [ ] LLM calls and memory/document ingestion paths were inventoried
45
+ - [ ] User-controlled sources were traced to LLM and durable-memory sinks
46
+ - [ ] Output validation was checked
47
+ - [ ] High-risk paths have adversarial tests or blocking findings
@@ -24,6 +24,10 @@ Maintain durable, long-lived engineering memory. Memory is for decisions and pat
24
24
  | `technology-decisions.md` | Stack choices, framework versions, deprecation timelines, migration plans | Dependency updates, technology migrations |
25
25
  | `regression-patterns.md` | Recurring bug categories and proven regression test templates | Bugfixes that reveal reusable failure patterns |
26
26
 
27
+ ## Regression Pattern Ownership
28
+
29
+ Testing Intelligence Engine owns detection and proposal of regression patterns during bugfix validation. Memory Sync owns durable persistence to `.engineering-intelligence/memory/regression-patterns.md` after confirming the pattern is reusable and evidence-backed. Testing Intelligence must not directly persist durable memory unless it is explicitly running through Memory Sync.
30
+
27
31
  ## Staleness Detection Rules
28
32
 
29
33
  A memory entry may be stale if:
@@ -8,6 +8,8 @@ version: 1.0.0
8
8
 
9
9
  Use this skill when a change affects deployment, infrastructure, runtime behavior, SLOs, data migrations, incident response, or production monitoring.
10
10
 
11
+ For medium-and-above risk changes, use the rollback planning section even when the change is not deployment-bound. Rollback planning is a release safety gate, not only an infrastructure concern.
12
+
11
13
  ## Procedure
12
14
 
13
15
  1. Identify deployment target, environment variables, infrastructure files, CI/CD gates, and runtime services.