engineering-intelligence 1.3.0 → 1.5.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/README.md +5 -0
- package/dist/adapters/index.js +9 -9
- package/dist/adapters/index.js.map +1 -1
- package/dist/templates.d.ts +1 -1
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +70 -0
- package/dist/templates.js.map +1 -1
- package/dist/visualizer/index.d.ts.map +1 -1
- package/dist/visualizer/index.js +107 -0
- package/dist/visualizer/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/canonical/rules/engineering-intelligence.md +9 -2
- package/templates/canonical/skills/adr-compliance-checker/SKILL.md +43 -0
- package/templates/canonical/skills/aidlc-lifecycle-engine/SKILL.md +39 -0
- package/templates/canonical/skills/api-backward-compatibility-engine/SKILL.md +80 -0
- package/templates/canonical/skills/api-snapshot-testing-engine/SKILL.md +75 -0
- package/templates/canonical/skills/context-budget-optimizer/SKILL.md +97 -0
- package/templates/canonical/skills/context-sync-engine/SKILL.md +26 -4
- package/templates/canonical/skills/contract-test-generator/SKILL.md +40 -0
- package/templates/canonical/skills/convention-detector/SKILL.md +16 -2
- package/templates/canonical/skills/database-migration-safety-engine/SKILL.md +79 -0
- package/templates/canonical/skills/dead-code-detector/SKILL.md +34 -0
- package/templates/canonical/skills/engineering-change-review/SKILL.md +17 -2
- package/templates/canonical/skills/engineering-intelligence-skill/SKILL.md +92 -8
- package/templates/canonical/skills/environment-variable-auditor/SKILL.md +47 -0
- package/templates/canonical/skills/graph-engine/SKILL.md +22 -5
- package/templates/canonical/skills/impact-analysis-engine/SKILL.md +30 -9
- package/templates/canonical/skills/knowledge-base-validator/SKILL.md +19 -3
- package/templates/canonical/skills/llm-prompt-injection-guard/SKILL.md +47 -0
- package/templates/canonical/skills/memory-sync-engine/SKILL.md +20 -0
- package/templates/canonical/skills/operations-readiness-engine/SKILL.md +17 -4
- package/templates/canonical/skills/requirement-scoper/SKILL.md +9 -0
- package/templates/canonical/skills/security-audit-engine/SKILL.md +30 -3
- package/templates/canonical/skills/staleness-detector/SKILL.md +19 -0
- package/templates/canonical/skills/testing-intelligence-engine/SKILL.md +37 -1
- package/templates/canonical/skills/type-safety-engine/SKILL.md +81 -0
- package/templates/canonical/workflows/engineering-intelligence.md +6 -4
- package/templates/canonical/workflows/initialize-engineering-intelligence.md +3 -2
|
@@ -18,6 +18,7 @@ Use `.engineering-intelligence/aidlc/` as the canonical AI-DLC root:
|
|
|
18
18
|
| `.engineering-intelligence/aidlc/audit.md` | Append-only chronological log of decisions, user answers, tool checks, and transitions |
|
|
19
19
|
| `.engineering-intelligence/aidlc/open-questions.md` | Unresolved ambiguities and owner/status |
|
|
20
20
|
| `.engineering-intelligence/aidlc/execution-plan.md` | Adaptive stage plan with mandatory/conditional/skipped stages |
|
|
21
|
+
| `.engineering-intelligence/aidlc/checkpoints.md` | Resume checkpoints after major workflow steps |
|
|
21
22
|
| `.engineering-intelligence/aidlc/discovery/vision.md` | Business objectives, personas, value, success metrics |
|
|
22
23
|
| `.engineering-intelligence/aidlc/discovery/technical-environment.md` | Runtime, deployment, integrations, data stores, auth, constraints |
|
|
23
24
|
| `.engineering-intelligence/aidlc/agile/product-backlog.md` | Epics, stories, priorities, dependencies, and status |
|
|
@@ -78,6 +79,16 @@ For brownfield systems, run reverse engineering and write:
|
|
|
78
79
|
|
|
79
80
|
Then compile validated requirements, backlog updates, acceptance criteria, sprint plan, and an adaptive `execution-plan.md`.
|
|
80
81
|
|
|
82
|
+
`execution-plan.md` must include a formal unit dependency graph:
|
|
83
|
+
|
|
84
|
+
```markdown
|
|
85
|
+
## Units Dependency Graph
|
|
86
|
+
| Unit | Depends On | Can Run In Parallel | Files Owned | Conflict Risk |
|
|
87
|
+
|---|---|---|---|---|
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Units with no declared dependencies and no overlapping owned files may run in parallel. Conflicts discovered during parallel or sequential execution must be logged in `cross-unit-discoveries.md`.
|
|
91
|
+
|
|
81
92
|
### 2. Construction
|
|
82
93
|
|
|
83
94
|
Execute per unit of work. Each unit may include:
|
|
@@ -115,6 +126,32 @@ Each stage must end with binary evidence:
|
|
|
115
126
|
- Required tests, type checks, linters, scans, or build commands ran, failed, or were explicitly unavailable
|
|
116
127
|
- Human approval is recorded before irreversible actions
|
|
117
128
|
- Breadcrumb is updated in `aidlc-state.md`
|
|
129
|
+
- Checkpoint is written after impact analysis, implementation, type/API/migration safety gates, validation, synchronization, and change record
|
|
130
|
+
|
|
131
|
+
## Checkpoint And Resume
|
|
132
|
+
|
|
133
|
+
Write `.engineering-intelligence/aidlc/checkpoints.md` and update `aidlc-state.md` after each major step:
|
|
134
|
+
|
|
135
|
+
| Checkpoint | Meaning | Resume Action |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| `impact-analysis-complete` | Impact report exists | Resume at implementation planning |
|
|
138
|
+
| `implementation-complete` | Code edits are done | Resume at validation |
|
|
139
|
+
| `safety-gates-complete` | Type/API/migration gates passed or blocked | Resume at testing/backpressure |
|
|
140
|
+
| `tests-passing` | Required validation passed | Resume at sync |
|
|
141
|
+
| `sync-complete` | Intelligence artifacts updated | Resume at change record |
|
|
142
|
+
| `change-record-complete` | CHG record exists | Resume at final report |
|
|
143
|
+
|
|
144
|
+
On re-invocation, detect the latest checkpoint and continue from the next step instead of restarting, unless the user asks for a fresh run.
|
|
145
|
+
|
|
146
|
+
## Dry-Run Mode
|
|
147
|
+
|
|
148
|
+
If the user asks for dry run, preview, or plan-only execution:
|
|
149
|
+
- Generate the impact report
|
|
150
|
+
- Select delivery mode
|
|
151
|
+
- Show files likely to change and why
|
|
152
|
+
- Run safe current-state checks such as type/lint/test discovery
|
|
153
|
+
- Do not edit product code
|
|
154
|
+
- Write a pre-flight report under `.engineering-intelligence/reports/`
|
|
118
155
|
|
|
119
156
|
## Environmental Backpressure
|
|
120
157
|
|
|
@@ -136,6 +173,8 @@ AI-DLC: <phase> -> <stage> -> <status>
|
|
|
136
173
|
- [ ] Brownfield reverse engineering exists before broad changes
|
|
137
174
|
- [ ] Requirements and execution plan are durable files
|
|
138
175
|
- [ ] Construction is split into explicit units
|
|
176
|
+
- [ ] Unit dependency graph exists in `execution-plan.md`
|
|
139
177
|
- [ ] Cross-unit discoveries are loaded and updated
|
|
178
|
+
- [ ] Checkpoints are written and resume is supported
|
|
140
179
|
- [ ] Validation uses environmental backpressure
|
|
141
180
|
- [ ] Operations readiness is addressed when deployment or production behavior changes
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-backward-compatibility-engine
|
|
3
|
+
description: Diffs API contracts, classifies changes as additive, deprecated, or breaking, and requires versioning or migration notes for breaking changes.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# API Backward Compatibility Engine
|
|
8
|
+
|
|
9
|
+
Use this skill when routes, handlers, request schemas, response schemas, GraphQL schemas, RPC contracts, events, SDKs, webhooks, or public service interfaces change.
|
|
10
|
+
|
|
11
|
+
## Procedure
|
|
12
|
+
|
|
13
|
+
1. **Load Current API Contract**
|
|
14
|
+
- `knowledge-base/04-api-documentation.md`
|
|
15
|
+
- OpenAPI / Swagger specs
|
|
16
|
+
- GraphQL schemas
|
|
17
|
+
- Protobuf / gRPC definitions
|
|
18
|
+
- Route files, request validators, response serializers
|
|
19
|
+
- Event schema registries or webhook docs
|
|
20
|
+
|
|
21
|
+
2. **Diff Proposed Or Actual Change**
|
|
22
|
+
- Endpoints added/removed/renamed
|
|
23
|
+
- Methods changed
|
|
24
|
+
- Request fields added/removed/renamed/type-changed
|
|
25
|
+
- Response fields added/removed/renamed/type-changed
|
|
26
|
+
- Auth/permission requirements changed
|
|
27
|
+
- Error codes/status codes changed
|
|
28
|
+
- Pagination, sorting, idempotency, or rate-limit semantics changed
|
|
29
|
+
|
|
30
|
+
3. **Classify Each Change**
|
|
31
|
+
- `additive`: backward-compatible addition
|
|
32
|
+
- `deprecated`: old behavior still works but has deprecation path
|
|
33
|
+
- `breaking`: existing clients can fail or observe incompatible semantics
|
|
34
|
+
|
|
35
|
+
4. **Require Versioning For Breaking Changes**
|
|
36
|
+
- Require explicit version bump, migration notes, or recorded human approval.
|
|
37
|
+
- Block change finalization if breaking changes lack versioning/migration documentation.
|
|
38
|
+
|
|
39
|
+
5. **Generate Compatibility Notes**
|
|
40
|
+
- Update API docs and change record.
|
|
41
|
+
- Identify impacted tests and client contracts.
|
|
42
|
+
|
|
43
|
+
## Output
|
|
44
|
+
|
|
45
|
+
Write `.engineering-intelligence/aidlc/construction/<unit>/api-compatibility.md`:
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
# API Backward Compatibility: <unit>
|
|
49
|
+
|
|
50
|
+
## Contract Sources
|
|
51
|
+
- <path>
|
|
52
|
+
|
|
53
|
+
## Change Classification
|
|
54
|
+
| API Surface | Change | Class | Client Impact | Required Action |
|
|
55
|
+
|---|---|---|---|---|
|
|
56
|
+
|
|
57
|
+
## Breaking Changes
|
|
58
|
+
- <change>
|
|
59
|
+
- Version bump: <path/evidence or missing>
|
|
60
|
+
- Migration notes: <path/evidence or missing>
|
|
61
|
+
|
|
62
|
+
## Validation
|
|
63
|
+
- Contract tests:
|
|
64
|
+
- Snapshot/replay checks:
|
|
65
|
+
- Manual verification:
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Blocking Conditions
|
|
69
|
+
|
|
70
|
+
- Breaking change without version bump, migration notes, or explicit approval
|
|
71
|
+
- Removed API without deprecation path
|
|
72
|
+
- Response contract changed without compatibility test
|
|
73
|
+
- Auth requirement changed without security/permission test
|
|
74
|
+
|
|
75
|
+
## Quality Gates
|
|
76
|
+
|
|
77
|
+
- [ ] Contract sources were loaded
|
|
78
|
+
- [ ] Every API change is classified as additive, deprecated, or breaking
|
|
79
|
+
- [ ] Breaking changes have version bump or explicit approval
|
|
80
|
+
- [ ] API docs and tests are updated for contract changes
|
|
@@ -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,29 +84,48 @@ 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. **
|
|
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:
|
|
99
|
+
- direct graph neighbors first
|
|
100
|
+
- critical-path maps next
|
|
101
|
+
- impacted API/schema/security docs next
|
|
102
|
+
- broad background docs last
|
|
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`.
|
|
105
|
+
|
|
106
|
+
2. **Check Impact** — Review the impact report and graph updates. Identify which context maps are affected.
|
|
90
107
|
|
|
91
|
-
|
|
108
|
+
3. **Update Affected Maps** — For each affected map:
|
|
92
109
|
- Update specific entries, not the entire map
|
|
93
110
|
- Add new entries for new modules/services/paths
|
|
94
111
|
- Remove entries for deleted modules/services
|
|
95
112
|
- Update paths and descriptions for renamed elements
|
|
96
113
|
|
|
97
|
-
|
|
114
|
+
4. **Preserve Conciseness** — Each map should be:
|
|
98
115
|
- Under 150 lines
|
|
99
116
|
- Table-formatted where possible
|
|
100
117
|
- Navigational (paths and quick descriptions), not explanatory
|
|
101
118
|
- Optimized for AI agent context windows
|
|
102
119
|
|
|
103
|
-
|
|
120
|
+
5. **Verify Accuracy** — Cross-check updated maps against:
|
|
104
121
|
- Current `.engineering-intelligence/graph/` data
|
|
105
122
|
- Actual file system paths (do they still exist?)
|
|
106
123
|
|
|
107
124
|
## Rules
|
|
108
125
|
|
|
109
126
|
- Keep context concise and navigational — not a knowledge-base duplicate
|
|
127
|
+
- Load context by relevance, not by directory order
|
|
128
|
+
- Keep initial intelligence loading under 40% of the available context budget when possible
|
|
110
129
|
- Use tables over prose wherever possible
|
|
111
130
|
- Update only affected maps from the impact report
|
|
112
131
|
- Do not regenerate unrelated context
|
|
@@ -115,6 +134,9 @@ Queue → Worker → Process → DB Write → Notify
|
|
|
115
134
|
## Quality Gates
|
|
116
135
|
|
|
117
136
|
- [ ] Each map is under 150 lines
|
|
137
|
+
- [ ] Relevant docs were ranked by graph proximity before broad loading
|
|
138
|
+
- [ ] `context-manifest.md` was updated for non-trivial work
|
|
139
|
+
- [ ] Context budget was preserved or an escalation was recorded
|
|
118
140
|
- [ ] Updated entries reference real, existing paths
|
|
119
141
|
- [ ] Only impact-affected maps were modified
|
|
120
142
|
- [ ] Table format used where appropriate
|
|
@@ -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,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: database-migration-safety-engine
|
|
3
|
+
description: Reviews database migrations for backward compatibility, rollback coverage, locks, destructive operations, and production-dangerous changes.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Database Migration Safety Engine
|
|
8
|
+
|
|
9
|
+
Use this skill whenever schemas, migrations, ORM models, data stores, indexes, or persistence contracts change.
|
|
10
|
+
|
|
11
|
+
## Procedure
|
|
12
|
+
|
|
13
|
+
1. **Detect Migration System**
|
|
14
|
+
- Prisma, Drizzle, TypeORM, Sequelize, Alembic, Django migrations, Rails migrations, Flyway, Liquibase, Knex, raw SQL, Terraform-managed database resources.
|
|
15
|
+
|
|
16
|
+
2. **Classify Operations**
|
|
17
|
+
- Additive: new nullable column, new table, additive index
|
|
18
|
+
- Backward-compatible with caution: new non-null column with default, enum expansion, trigger change
|
|
19
|
+
- Dangerous: column/table drop, rename without compatibility window, type narrowing, destructive data rewrite, full table lock, index without `CONCURRENTLY` for PostgreSQL production tables
|
|
20
|
+
- Irreversible: data deletion, lossy transform, externalized state mutation
|
|
21
|
+
|
|
22
|
+
3. **Validate Rollback**
|
|
23
|
+
- Check for a down migration or rollback equivalent.
|
|
24
|
+
- Generate down migration stubs when missing, but mark them for human review.
|
|
25
|
+
- Record irreversible steps explicitly.
|
|
26
|
+
|
|
27
|
+
4. **Check Zero-Downtime Safety**
|
|
28
|
+
- Prefer expand/contract migrations.
|
|
29
|
+
- Require deprecation windows for drops/renames.
|
|
30
|
+
- Require online index creation where supported, such as PostgreSQL `CREATE INDEX CONCURRENTLY`.
|
|
31
|
+
- Require explicit approval for production-dangerous operations.
|
|
32
|
+
|
|
33
|
+
5. **Map Query Impact**
|
|
34
|
+
- Parse ORM model definitions and raw SQL strings.
|
|
35
|
+
- Build or update a schema-to-query map.
|
|
36
|
+
- Flag queries referencing changed columns/tables as directly impacted.
|
|
37
|
+
|
|
38
|
+
## Output
|
|
39
|
+
|
|
40
|
+
Write `.engineering-intelligence/aidlc/construction/<unit>/database-migration-safety.md`:
|
|
41
|
+
|
|
42
|
+
```markdown
|
|
43
|
+
# Database Migration Safety: <unit>
|
|
44
|
+
|
|
45
|
+
## Migration Files
|
|
46
|
+
- <path>
|
|
47
|
+
|
|
48
|
+
## Operation Classification
|
|
49
|
+
| Operation | Object | Classification | Risk | Evidence |
|
|
50
|
+
|---|---|---|---|---|
|
|
51
|
+
|
|
52
|
+
## Rollback / Down Migration
|
|
53
|
+
- Exists: <yes/no>
|
|
54
|
+
- Stub generated: <yes/no>
|
|
55
|
+
- Irreversible steps: <list or none>
|
|
56
|
+
|
|
57
|
+
## Schema-To-Query Impact
|
|
58
|
+
| Changed Schema Object | Query / ORM Usage | Impact | Evidence |
|
|
59
|
+
|---|---|---|---|
|
|
60
|
+
|
|
61
|
+
## Approval Required
|
|
62
|
+
- <dangerous operation requiring explicit approval>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Blocking Conditions
|
|
66
|
+
|
|
67
|
+
- Missing down migration for medium-or-higher risk migration
|
|
68
|
+
- Drop/rename without deprecation window
|
|
69
|
+
- Full table lock risk not acknowledged
|
|
70
|
+
- Production-dangerous operation without explicit approval
|
|
71
|
+
- Changed column referenced by unupdated query
|
|
72
|
+
|
|
73
|
+
## Quality Gates
|
|
74
|
+
|
|
75
|
+
- [ ] Migration system was detected
|
|
76
|
+
- [ ] Operations were classified
|
|
77
|
+
- [ ] Down migration or rollback strategy exists
|
|
78
|
+
- [ ] Schema-to-query impacts are listed
|
|
79
|
+
- [ ] Explicit approval is recorded for dangerous operations
|
|
@@ -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
|
|
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
|
|
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
|