engineering-intelligence 0.8.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +3 -0
- package/dist/adapters/index.js.map +1 -1
- package/dist/cli/index.js +20 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +2 -10
- package/dist/installer/index.js.map +1 -1
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/index.js +1 -1
- package/dist/templates.d.ts +3 -2
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +24 -1
- package/dist/templates.js.map +1 -1
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +2 -11
- package/dist/validation/index.js.map +1 -1
- package/dist/visualizer/index.d.ts.map +1 -1
- package/dist/visualizer/index.js +100 -5
- package/dist/visualizer/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/canonical/agents/engineering-orchestrator.md +21 -2
- package/templates/canonical/skills/codebase-discovery-engine/SKILL.md +428 -0
- package/templates/canonical/skills/convention-detector/SKILL.md +199 -0
- package/templates/canonical/skills/debugging-engine/SKILL.md +189 -0
- package/templates/canonical/skills/engineering-intelligence-skill/SKILL.md +4 -1
- package/templates/canonical/skills/git-intelligence-engine/SKILL.md +146 -0
- package/templates/canonical/skills/graph-engine/SKILL.md +30 -5
- package/templates/canonical/skills/greenfield-architect/SKILL.md +287 -0
- package/templates/canonical/skills/impact-analysis-engine/SKILL.md +12 -4
- package/templates/canonical/skills/incremental-sync-engine/SKILL.md +17 -0
- package/templates/canonical/skills/ongoing-learning-engine/SKILL.md +175 -0
- package/templates/canonical/skills/performance-analysis-engine/SKILL.md +156 -0
- package/templates/canonical/skills/pr-intelligence-engine/SKILL.md +127 -0
- package/templates/canonical/skills/security-audit-engine/SKILL.md +165 -0
- package/templates/canonical/skills/staleness-detector/SKILL.md +185 -0
- package/templates/canonical/workflows/create-project.md +63 -0
- package/templates/canonical/workflows/discover-codebase.md +60 -0
|
@@ -20,6 +20,8 @@ When receiving a request, classify it immediately:
|
|
|
20
20
|
| "Change architecture of X" | `architecture` | Impact analysis → refactoring planner → implementation |
|
|
21
21
|
| "Fix security issue X" | `security` | Full implementation pipeline (high-risk gate) |
|
|
22
22
|
| "Initialize intelligence" | `initialization` | Initialization pipeline |
|
|
23
|
+
| "Understand this codebase", "Explore project" | `discovery` | Discovery pipeline |
|
|
24
|
+
| "Create new project", "Start from scratch" | `creation` | Creation pipeline |
|
|
23
25
|
| "Map architecture" | `mapping` | Graph engine (read-only) |
|
|
24
26
|
| "Analyze impact of X" | `analysis` | Impact analysis (read-only) |
|
|
25
27
|
| "Sync intelligence" | `sync` | Incremental sync (read-only) |
|
|
@@ -33,9 +35,24 @@ When receiving a request, classify it immediately:
|
|
|
33
35
|
2. Delegates to: `deep-project-knowledge-extractor`, `knowledge-base-validator`, `graph-engine`, `change-history-engine`
|
|
34
36
|
3. Does **not** modify product code
|
|
35
37
|
|
|
38
|
+
### Discovery Pipeline
|
|
39
|
+
|
|
40
|
+
1. Run `codebase-discovery-engine` → analyze repository structure, languages, frameworks, patterns
|
|
41
|
+
2. Present findings to the user — architecture overview, tech stack, key entry points, conventions detected
|
|
42
|
+
3. Ask clarifying questions about areas of ambiguity or interest
|
|
43
|
+
4. Feed discovery results into initialization pipeline if intelligence has not been initialized
|
|
44
|
+
5. Does **not** modify product code
|
|
45
|
+
|
|
46
|
+
### Creation Pipeline
|
|
47
|
+
|
|
48
|
+
1. Run `greenfield-architect` → gather requirements, select tech stack, design architecture
|
|
49
|
+
2. Scaffold project structure — directories, configs, entry points, CI templates
|
|
50
|
+
3. Run `initialize-intelligence-skill` → generate knowledge base and intelligence for the new project
|
|
51
|
+
4. Modifies product code (scaffolding only)
|
|
52
|
+
|
|
36
53
|
### Implementation Pipeline
|
|
37
54
|
|
|
38
|
-
1. **Pre-flight**: Read intelligence → identify relevant context
|
|
55
|
+
1. **Pre-flight**: Read intelligence → identify relevant context. Check if discovery has been run; if not, suggest running discovery first.
|
|
39
56
|
2. **Impact**: Run `impact-analysis-engine` → write impact report
|
|
40
57
|
3. **Implement**: Execute `engineering-intelligence-skill` → code changes + tests
|
|
41
58
|
4. **Validate**: Run tests, type checks, lints — record results honestly
|
|
@@ -54,6 +71,8 @@ These workflows analyze without modifying product code:
|
|
|
54
71
|
| `analyze-impact` | `change-detection-engine`, `impact-analysis-engine`, `graph-engine` | Impact report |
|
|
55
72
|
| `sync-engineering-intelligence` | `change-detection-engine`, `impact-analysis-engine`, `incremental-sync-engine` | Updated intelligence |
|
|
56
73
|
| `review-engineering-change` | `change-detection-engine`, `engineering-change-review` | Review report |
|
|
74
|
+
| `discover-codebase` | `codebase-discovery-engine`, `convention-detector`, `graph-engine` | Discovery report + conventions |
|
|
75
|
+
| `create-project` | `greenfield-architect`, `initialize-intelligence-skill` | Scaffolded project + intelligence |
|
|
57
76
|
|
|
58
77
|
## Agent Delegation
|
|
59
78
|
|
|
@@ -65,7 +84,7 @@ These workflows analyze without modifying product code:
|
|
|
65
84
|
|
|
66
85
|
## Skill Reference
|
|
67
86
|
|
|
68
|
-
Use these specialized capabilities when available: `initialize-intelligence-skill`, `engineering-intelligence-skill`, `graph-engine`, `change-detection-engine`, `impact-analysis-engine`, `testing-intelligence-engine`, `incremental-sync-engine`, `knowledge-sync-engine`, `memory-sync-engine`, `context-sync-engine`, `engineering-change-review`, `change-history-engine`, `architecture-review-engine`, `refactoring-planner`, `deep-project-knowledge-extractor`, `knowledge-base-validator`.
|
|
87
|
+
Use these specialized capabilities when available: `initialize-intelligence-skill`, `engineering-intelligence-skill`, `graph-engine`, `change-detection-engine`, `impact-analysis-engine`, `testing-intelligence-engine`, `incremental-sync-engine`, `knowledge-sync-engine`, `memory-sync-engine`, `context-sync-engine`, `engineering-change-review`, `change-history-engine`, `architecture-review-engine`, `refactoring-planner`, `deep-project-knowledge-extractor`, `knowledge-base-validator`, `codebase-discovery-engine`, `convention-detector`, `ongoing-learning-engine`, `greenfield-architect`, `git-intelligence-engine`, `pr-intelligence-engine`, `staleness-detector`, `security-audit-engine`, `performance-analysis-engine`, `debugging-engine`.
|
|
69
88
|
|
|
70
89
|
## Rules
|
|
71
90
|
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-discovery-engine
|
|
3
|
+
description: Autonomously explores and deeply understands a codebase before asking any questions. Scans repo structure, identifies tech stack with confidence scores, builds architecture hypotheses, maps entry points, detects conventions, analyzes git history, and produces a structured discovery report. Invoke when onboarding to a new repository or when deep understanding is required.
|
|
4
|
+
version: 3.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Codebase Discovery Engine
|
|
8
|
+
|
|
9
|
+
Autonomously explore and understand a codebase with minimal human interaction. The engine operates in four phases: automated discovery, hypothesis verification, targeted clarification, and confidence reporting. The goal is to build a comprehensive mental model of the project before asking any questions.
|
|
10
|
+
|
|
11
|
+
This capability does not modify product code.
|
|
12
|
+
|
|
13
|
+
## Inputs
|
|
14
|
+
|
|
15
|
+
- Repository root path (current working directory by default)
|
|
16
|
+
- Optional: scope constraints (specific package, service, directory, or monorepo workspace)
|
|
17
|
+
- Optional: depth limit (shallow = top-level only, deep = full recursive analysis)
|
|
18
|
+
|
|
19
|
+
## Outputs
|
|
20
|
+
|
|
21
|
+
- `.engineering-intelligence/reports/DISCOVERY-report.md` — structured discovery findings with per-area confidence scores
|
|
22
|
+
- Feeds directly into `initialize-intelligence-skill` for knowledge base generation
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Phase 1: Automated Discovery (No User Interaction)
|
|
27
|
+
|
|
28
|
+
Execute ALL of the following scans silently. Do not prompt the user during this phase.
|
|
29
|
+
|
|
30
|
+
### 1.1 Repository Structure Scan
|
|
31
|
+
|
|
32
|
+
1. **File tree analysis** — Generate annotated directory tree (top 3 levels). Identify:
|
|
33
|
+
- Source code directories vs configuration vs documentation vs generated output
|
|
34
|
+
- Monorepo workspace boundaries
|
|
35
|
+
- Hidden directories with significance (`.github`, `.gitlab`, `.circleci`, `.husky`, `.changeset`)
|
|
36
|
+
2. **File count distribution** — Count files by extension to determine primary and secondary languages
|
|
37
|
+
3. **Gitignore analysis** — Read `.gitignore` to understand build outputs, generated files, and secrets patterns
|
|
38
|
+
4. **Workspace root markers** — Identify the true project root vs nested project roots
|
|
39
|
+
|
|
40
|
+
### 1.2 Package Management Detection
|
|
41
|
+
|
|
42
|
+
Scan for ALL of the following package manifests and extract dependency information:
|
|
43
|
+
|
|
44
|
+
| Ecosystem | Manifest Files | Lock Files | What to Extract |
|
|
45
|
+
|---|---|---|---|
|
|
46
|
+
| **Node.js** | `package.json` | `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `bun.lockb` | dependencies, devDependencies, scripts, workspaces, engines |
|
|
47
|
+
| **Go** | `go.mod`, `go.sum` | — | module path, Go version, require directives |
|
|
48
|
+
| **Rust** | `Cargo.toml` | `Cargo.lock` | dependencies, features, workspace members, edition |
|
|
49
|
+
| **Python** | `pyproject.toml`, `setup.py`, `setup.cfg`, `requirements.txt`, `Pipfile`, `poetry.lock` | `poetry.lock`, `Pipfile.lock` | dependencies, python version, build system |
|
|
50
|
+
| **Java/Kotlin** | `pom.xml`, `build.gradle`, `build.gradle.kts`, `settings.gradle` | — | dependencies, plugins, modules, Java version |
|
|
51
|
+
| **Ruby** | `Gemfile`, `*.gemspec` | `Gemfile.lock` | gems, ruby version, groups |
|
|
52
|
+
| **PHP** | `composer.json` | `composer.lock` | require, autoload, scripts |
|
|
53
|
+
| **.NET** | `*.csproj`, `*.sln`, `Directory.Build.props` | — | PackageReference, TargetFramework |
|
|
54
|
+
| **Elixir** | `mix.exs` | `mix.lock` | deps, elixir version |
|
|
55
|
+
| **Swift** | `Package.swift` | `Package.resolved` | dependencies, targets |
|
|
56
|
+
|
|
57
|
+
### 1.3 Build System Identification
|
|
58
|
+
|
|
59
|
+
| Build Tool | Detection Files | What to Extract |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| **Webpack** | `webpack.config.*` | entry points, output config, loaders, plugins |
|
|
62
|
+
| **Vite** | `vite.config.*` | plugins, build target, SSR config |
|
|
63
|
+
| **Turbopack** | `turbo.json` (with Next.js) | — |
|
|
64
|
+
| **Turborepo** | `turbo.json` | pipeline tasks, cache config, workspace dependencies |
|
|
65
|
+
| **Nx** | `nx.json`, `project.json` | targets, executors, affected config |
|
|
66
|
+
| **Lerna** | `lerna.json` | versioning strategy, packages |
|
|
67
|
+
| **Bazel** | `WORKSPACE`, `BUILD`, `*.bzl` | targets, rules, dependencies |
|
|
68
|
+
| **Make** | `Makefile`, `GNUmakefile` | targets, phony targets, key variables |
|
|
69
|
+
| **Cargo** | `Cargo.toml` (already scanned) | build scripts, features |
|
|
70
|
+
| **Gradle** | `build.gradle*`, `gradlew` | tasks, plugins, subprojects |
|
|
71
|
+
| **Maven** | `pom.xml` (already scanned) | phases, plugins, profiles |
|
|
72
|
+
| **CMake** | `CMakeLists.txt` | targets, find_package calls |
|
|
73
|
+
| **pnpm workspaces** | `pnpm-workspace.yaml` | workspace packages |
|
|
74
|
+
|
|
75
|
+
### 1.4 Framework Detection
|
|
76
|
+
|
|
77
|
+
Identify frameworks with **confidence scores** by cross-referencing dependencies, file patterns, and configuration:
|
|
78
|
+
|
|
79
|
+
| Category | Frameworks to Detect | Key Signals |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| **Frontend** | Next.js, Nuxt, Remix, SvelteKit, Astro, Gatsby, Create React App, Vite+React, Vite+Vue, Vite+Svelte, Angular, Solid.js, Qwik | `next.config.*`, `nuxt.config.*`, `remix.config.*`, `svelte.config.*`, `astro.config.*`, `angular.json`, framework deps in package.json |
|
|
82
|
+
| **Backend** | Express, Fastify, Koa, Hono, NestJS, Django, Flask, FastAPI, Spring Boot, Rails, Phoenix, Gin, Fiber, Echo, ASP.NET | Framework imports in entry files, decorator patterns, config files |
|
|
83
|
+
| **Mobile** | React Native, Flutter, Swift UI, Jetpack Compose, Expo | `app.json`, `pubspec.yaml`, `*.swift`, `build.gradle` with Android plugins |
|
|
84
|
+
| **Desktop** | Electron, Tauri | `electron-builder.*`, `tauri.conf.json` |
|
|
85
|
+
| **Full-stack** | T3 Stack, Blitz.js, RedwoodJS, Wasp | Meta-framework config patterns |
|
|
86
|
+
|
|
87
|
+
### 1.5 Database & ORM Detection
|
|
88
|
+
|
|
89
|
+
| ORM / DB Tool | Detection Signals |
|
|
90
|
+
|---|---|
|
|
91
|
+
| **Prisma** | `prisma/schema.prisma`, `@prisma/client` in deps |
|
|
92
|
+
| **TypeORM** | `typeorm` in deps, `ormconfig.*`, entity decorators |
|
|
93
|
+
| **Drizzle** | `drizzle-orm` in deps, `drizzle.config.*` |
|
|
94
|
+
| **Sequelize** | `sequelize` in deps, `.sequelizerc`, migration dirs |
|
|
95
|
+
| **Mongoose** | `mongoose` in deps, schema definitions |
|
|
96
|
+
| **SQLAlchemy** | `sqlalchemy` in deps, `alembic/` dir, model files |
|
|
97
|
+
| **Django ORM** | `models.py` in Django apps, `DATABASES` in settings |
|
|
98
|
+
| **Hibernate** | `hibernate.cfg.xml`, JPA annotations |
|
|
99
|
+
| **ActiveRecord** | `db/migrate/`, `app/models/`, Rails conventions |
|
|
100
|
+
| **Knex** | `knex` in deps, `knexfile.*`, migration dirs |
|
|
101
|
+
| **MikroORM** | `@mikro-orm/*` in deps, `mikro-orm.config.*` |
|
|
102
|
+
| **Diesel** | `diesel` in Cargo.toml, `diesel.toml`, migrations dir |
|
|
103
|
+
| **GORM** | `gorm.io/gorm` in go.mod |
|
|
104
|
+
| **Ent** | `entgo.io/ent` in go.mod, `ent/schema/` dir |
|
|
105
|
+
| **Raw SQL** | `.sql` files, query builder usage without ORM |
|
|
106
|
+
| **Database engines** | Connection strings, Docker services: PostgreSQL, MySQL, MongoDB, Redis, SQLite, DynamoDB, Cassandra, CockroachDB |
|
|
107
|
+
|
|
108
|
+
### 1.6 Authentication Detection
|
|
109
|
+
|
|
110
|
+
| Auth Solution | Detection Signals |
|
|
111
|
+
|---|---|
|
|
112
|
+
| **NextAuth / Auth.js** | `next-auth` in deps, `[...nextauth].ts`, `auth.config.*` |
|
|
113
|
+
| **Passport.js** | `passport` in deps, strategy configurations |
|
|
114
|
+
| **JWT patterns** | `jsonwebtoken` / `jose` in deps, token signing/verification code |
|
|
115
|
+
| **OAuth / OpenID** | OAuth client configs, redirect URIs, provider setup |
|
|
116
|
+
| **SAML** | `passport-saml`, SAML metadata files |
|
|
117
|
+
| **Clerk** | `@clerk/*` in deps, Clerk middleware |
|
|
118
|
+
| **Auth0** | `@auth0/*` in deps, Auth0 config |
|
|
119
|
+
| **Supabase Auth** | `@supabase/supabase-js` with auth usage |
|
|
120
|
+
| **Firebase Auth** | `firebase/auth` imports |
|
|
121
|
+
| **Keycloak** | Keycloak adapter configs |
|
|
122
|
+
| **Custom auth** | Hand-rolled middleware with session/token logic |
|
|
123
|
+
| **RBAC/ABAC** | Role definitions, permission matrices, guard patterns |
|
|
124
|
+
|
|
125
|
+
### 1.7 CI/CD Detection
|
|
126
|
+
|
|
127
|
+
| CI/CD Platform | Detection Files | What to Extract |
|
|
128
|
+
|---|---|---|
|
|
129
|
+
| **GitHub Actions** | `.github/workflows/*.yml` | Jobs, triggers, matrix strategies, secrets refs |
|
|
130
|
+
| **GitLab CI** | `.gitlab-ci.yml` | Stages, jobs, rules, includes |
|
|
131
|
+
| **Jenkins** | `Jenkinsfile` | Pipeline stages, agents, post actions |
|
|
132
|
+
| **CircleCI** | `.circleci/config.yml` | Jobs, workflows, orbs |
|
|
133
|
+
| **Travis CI** | `.travis.yml` | Language, stages, deploy |
|
|
134
|
+
| **Azure Pipelines** | `azure-pipelines.yml` | Stages, pools, templates |
|
|
135
|
+
| **Bitbucket Pipelines** | `bitbucket-pipelines.yml` | Steps, caches, deployments |
|
|
136
|
+
| **Drone CI** | `.drone.yml` | Steps, triggers, volumes |
|
|
137
|
+
| **Vercel** | `vercel.json` | Build config, rewrites, functions |
|
|
138
|
+
| **Netlify** | `netlify.toml` | Build command, plugins, redirects |
|
|
139
|
+
| **Railway** | `railway.json`, `Procfile` | Start commands, services |
|
|
140
|
+
| **Render** | `render.yaml` | Services, build/start commands |
|
|
141
|
+
|
|
142
|
+
### 1.8 Infrastructure Detection
|
|
143
|
+
|
|
144
|
+
| Infrastructure | Detection Signals |
|
|
145
|
+
|---|---|
|
|
146
|
+
| **Docker** | `Dockerfile`, `.dockerignore`, `docker-compose.yml`, `docker-compose.*.yml` |
|
|
147
|
+
| **Kubernetes** | `k8s/`, `kubernetes/`, `*.yaml` with `apiVersion: apps/v1`, Helm charts (`Chart.yaml`) |
|
|
148
|
+
| **Terraform** | `*.tf`, `.terraform/`, `terraform.tfstate` |
|
|
149
|
+
| **Pulumi** | `Pulumi.yaml`, `Pulumi.*.yaml` |
|
|
150
|
+
| **CDK** | `cdk.json`, `lib/*-stack.ts` |
|
|
151
|
+
| **CloudFormation** | `template.yaml` with `AWSTemplateFormatVersion` |
|
|
152
|
+
| **Ansible** | `ansible.cfg`, `playbooks/`, `roles/` |
|
|
153
|
+
| **Serverless** | `serverless.yml`, `serverless.ts` |
|
|
154
|
+
| **SST** | `sst.config.ts` |
|
|
155
|
+
|
|
156
|
+
### 1.9 Testing Detection
|
|
157
|
+
|
|
158
|
+
| Testing Tool | Detection Signals | What to Extract |
|
|
159
|
+
|---|---|---|
|
|
160
|
+
| **Jest** | `jest.config.*`, `jest` in deps | Test file patterns, coverage config, transforms |
|
|
161
|
+
| **Vitest** | `vitest.config.*`, `vitest` in deps | Test file patterns, coverage |
|
|
162
|
+
| **Mocha** | `.mocharc.*`, `mocha` in deps | Reporter, timeout, spec patterns |
|
|
163
|
+
| **pytest** | `pytest.ini`, `pyproject.toml [tool.pytest]`, `conftest.py` | Markers, fixtures, plugins |
|
|
164
|
+
| **JUnit** | `@Test` annotations, JUnit deps in build files | Test runners, assertion libs |
|
|
165
|
+
| **RSpec** | `.rspec`, `spec/`, `spec_helper.rb` | Configuration, shared contexts |
|
|
166
|
+
| **Go test** | `*_test.go` files | Test functions, benchmarks, table-driven tests |
|
|
167
|
+
| **Rust test** | `#[test]`, `#[cfg(test)]` | Unit vs integration test organization |
|
|
168
|
+
| **Cypress** | `cypress.config.*`, `cypress/` | E2E specs, component tests, fixtures |
|
|
169
|
+
| **Playwright** | `playwright.config.*` | Test projects, browsers, base URL |
|
|
170
|
+
| **Testing Library** | `@testing-library/*` in deps | Which framework variant (React, Vue, etc.) |
|
|
171
|
+
| **Storybook** | `.storybook/`, `*.stories.*` | Addons, framework, static dirs |
|
|
172
|
+
| **Supertest** | `supertest` in deps | API integration test patterns |
|
|
173
|
+
|
|
174
|
+
### 1.10 Documentation & Existing Knowledge
|
|
175
|
+
|
|
176
|
+
1. Read `README.md` — extract project description, setup instructions, architecture notes
|
|
177
|
+
2. Scan `docs/` directory — identify existing architecture docs, API docs, guides
|
|
178
|
+
3. Read `CONTRIBUTING.md` — extract development workflow, code standards, PR process
|
|
179
|
+
4. Read `CHANGELOG.md` — understand release cadence, versioning strategy
|
|
180
|
+
5. Read `ADR/` or `adr/` or `docs/decisions/` — existing architectural decision records
|
|
181
|
+
6. Scan inline comments — look for `TODO`, `FIXME`, `HACK`, `XXX`, `NOTE` patterns
|
|
182
|
+
7. Read `LICENSE` — identify license type
|
|
183
|
+
|
|
184
|
+
### 1.11 Git History Analysis
|
|
185
|
+
|
|
186
|
+
1. **Hotspot analysis** — Identify the 20 most-changed files via `git log --pretty=format: --name-only | sort | uniq -c | sort -rn | head -20`
|
|
187
|
+
2. **Change velocity** — Commits per week/month over the last 6 months
|
|
188
|
+
3. **Primary contributors per module** — `git shortlog -sn -- <path>` for major directories
|
|
189
|
+
4. **Recent activity** — Files changed in the last 30 days (indicates active development areas)
|
|
190
|
+
5. **Large commits** — Identify bulk refactors or migrations from git history
|
|
191
|
+
6. **Branch patterns** — `git branch -r` to understand branching strategy (feature branches, release branches, trunk-based)
|
|
192
|
+
7. **Tag/release pattern** — `git tag --sort=-creatordate | head -10` to understand versioning cadence
|
|
193
|
+
|
|
194
|
+
### 1.12 Monorepo Detection
|
|
195
|
+
|
|
196
|
+
| Tool | Detection Signal |
|
|
197
|
+
|---|---|
|
|
198
|
+
| **Nx** | `nx.json`, `project.json` in subdirectories |
|
|
199
|
+
| **Turborepo** | `turbo.json` with `pipeline` |
|
|
200
|
+
| **Lerna** | `lerna.json` |
|
|
201
|
+
| **pnpm workspaces** | `pnpm-workspace.yaml` |
|
|
202
|
+
| **Yarn workspaces** | `workspaces` field in root `package.json` |
|
|
203
|
+
| **npm workspaces** | `workspaces` field in root `package.json` + npm lock |
|
|
204
|
+
| **Cargo workspaces** | `[workspace]` section in root `Cargo.toml` |
|
|
205
|
+
| **Go workspaces** | `go.work` file |
|
|
206
|
+
| **Bazel** | `WORKSPACE` + multiple `BUILD` files |
|
|
207
|
+
|
|
208
|
+
When a monorepo is detected:
|
|
209
|
+
- Enumerate all workspace packages/apps
|
|
210
|
+
- Identify shared libraries vs applications
|
|
211
|
+
- Map inter-package dependency graph
|
|
212
|
+
- Identify independent vs coupled packages
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Phase 2: Hypothesis Verification
|
|
217
|
+
|
|
218
|
+
After automated discovery, classify every finding by confidence level:
|
|
219
|
+
|
|
220
|
+
### Confidence Classification Rules
|
|
221
|
+
|
|
222
|
+
| Level | Score | Action | Example |
|
|
223
|
+
|---|---|---|---|
|
|
224
|
+
| **HIGH** | >85% | State as fact with evidence | "The project uses Next.js 14 with App Router (evidence: `next.config.mjs`, `app/` directory structure, `next` v14.2.3 in package.json)" |
|
|
225
|
+
| **MEDIUM** | 50–85% | Present as belief with reasoning | "I believe the project uses a modular monolith pattern because modules communicate via direct imports rather than HTTP/events, and there are clear directory boundaries — correct?" |
|
|
226
|
+
| **LOW** | <50% | Ask a direct question | "I see Redis in docker-compose but no Redis client in dependencies. Is Redis used in production, or is it only for development?" |
|
|
227
|
+
|
|
228
|
+
### Confidence Scoring Heuristic
|
|
229
|
+
|
|
230
|
+
- **Config file explicitly declares it** → 95% confidence
|
|
231
|
+
- **Dependency present + matching file patterns** → 85% confidence
|
|
232
|
+
- **Dependency present but no matching usage found** → 60% confidence
|
|
233
|
+
- **File patterns suggest it but no dependency** → 50% confidence
|
|
234
|
+
- **Inferred from indirect evidence only** → 30% confidence
|
|
235
|
+
- **Single ambiguous signal** → 15% confidence
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Phase 3: Targeted Clarification (Maximum 5–10 Questions)
|
|
240
|
+
|
|
241
|
+
After Phases 1 and 2, ask ONLY questions that cannot be answered from code evidence. Group them into these categories:
|
|
242
|
+
|
|
243
|
+
### 3.1 Business Domain
|
|
244
|
+
- What is the core business domain? What problem does this solve for users?
|
|
245
|
+
- Are there domain-specific terms or jargon the team uses?
|
|
246
|
+
|
|
247
|
+
### 3.2 Deployment & Environments
|
|
248
|
+
- Where is this deployed? (cloud provider, region, multi-region?)
|
|
249
|
+
- What environments exist? (dev, staging, preview, production)
|
|
250
|
+
- What is the deployment process? (manual, CD, blue-green, canary)
|
|
251
|
+
|
|
252
|
+
### 3.3 Team Conventions
|
|
253
|
+
- What is the code review process? (required approvals, automated checks)
|
|
254
|
+
- What is the release cadence? (continuous, weekly, sprints)
|
|
255
|
+
- Are there unwritten rules not captured in linters or configs?
|
|
256
|
+
|
|
257
|
+
### 3.4 Pain Points & Tech Debt
|
|
258
|
+
- What areas of the codebase cause the most friction?
|
|
259
|
+
- Is there an active migration or refactoring effort?
|
|
260
|
+
- Are there known reliability or performance issues?
|
|
261
|
+
|
|
262
|
+
### 3.5 Future Direction
|
|
263
|
+
- What major changes are planned for the architecture?
|
|
264
|
+
- Are there technology migrations in progress or planned?
|
|
265
|
+
|
|
266
|
+
**Rules for clarification questions:**
|
|
267
|
+
- Never ask about something discoverable from code
|
|
268
|
+
- Never ask more than 10 questions total
|
|
269
|
+
- Group related questions together
|
|
270
|
+
- Provide your best guess alongside each question so the user can simply confirm or correct
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Phase 4: Confidence Report
|
|
275
|
+
|
|
276
|
+
Generate `.engineering-intelligence/reports/DISCOVERY-report.md` with this structure:
|
|
277
|
+
|
|
278
|
+
```markdown
|
|
279
|
+
# Codebase Discovery Report
|
|
280
|
+
|
|
281
|
+
Generated: <timestamp>
|
|
282
|
+
Repository: <repo path>
|
|
283
|
+
Scope: <full repo | specific scope>
|
|
284
|
+
|
|
285
|
+
## Executive Summary
|
|
286
|
+
|
|
287
|
+
<2-3 paragraph overview of the project, its purpose, tech stack, and architecture>
|
|
288
|
+
|
|
289
|
+
## Tech Stack (Confidence Scores)
|
|
290
|
+
|
|
291
|
+
| Category | Detection | Confidence | Evidence |
|
|
292
|
+
|---|---|---|---|
|
|
293
|
+
| Primary Language | TypeScript | 95% | `tsconfig.json`, 847 `.ts` files |
|
|
294
|
+
| Framework | Next.js 14 (App Router) | 95% | `next.config.mjs`, `app/` dir |
|
|
295
|
+
| Database | PostgreSQL via Prisma | 90% | `prisma/schema.prisma`, `@prisma/client` |
|
|
296
|
+
| Auth | NextAuth v5 | 85% | `auth.config.ts`, `next-auth` dep |
|
|
297
|
+
| CI/CD | GitHub Actions | 95% | `.github/workflows/ci.yml` |
|
|
298
|
+
| ... | ... | ... | ... |
|
|
299
|
+
|
|
300
|
+
## Architecture Hypothesis
|
|
301
|
+
|
|
302
|
+
<architecture pattern, layer definitions, module boundaries, communication patterns>
|
|
303
|
+
|
|
304
|
+
### Architecture Confidence: <overall score>%
|
|
305
|
+
|
|
306
|
+
## Entry Points
|
|
307
|
+
|
|
308
|
+
| Entry Point | Type | Path | Purpose |
|
|
309
|
+
|---|---|---|---|
|
|
310
|
+
| ... | ... | ... | ... |
|
|
311
|
+
|
|
312
|
+
## Module Map
|
|
313
|
+
|
|
314
|
+
| Module | Path | Responsibility | Confidence |
|
|
315
|
+
|---|---|---|---|
|
|
316
|
+
| ... | ... | ... | ... |
|
|
317
|
+
|
|
318
|
+
## Git Insights
|
|
319
|
+
|
|
320
|
+
### Hotspots (Most Changed Files)
|
|
321
|
+
| File | Changes | Last Modified | Primary Contributor |
|
|
322
|
+
|---|---|---|---|
|
|
323
|
+
| ... | ... | ... | ... |
|
|
324
|
+
|
|
325
|
+
### Change Velocity
|
|
326
|
+
<commits per week trend>
|
|
327
|
+
|
|
328
|
+
### Active Areas (Last 30 Days)
|
|
329
|
+
<list of recently active directories/modules>
|
|
330
|
+
|
|
331
|
+
## Detected Patterns
|
|
332
|
+
|
|
333
|
+
### Naming Conventions
|
|
334
|
+
<observed patterns>
|
|
335
|
+
|
|
336
|
+
### Code Organization
|
|
337
|
+
<folder structure patterns>
|
|
338
|
+
|
|
339
|
+
### Import Patterns
|
|
340
|
+
<import style and organization>
|
|
341
|
+
|
|
342
|
+
### Test Patterns
|
|
343
|
+
<test file placement, naming, assertion style>
|
|
344
|
+
|
|
345
|
+
## Unknowns & Uncertainties
|
|
346
|
+
|
|
347
|
+
| Area | What's Unknown | Why It Matters | Suggested Resolution |
|
|
348
|
+
|---|---|---|---|
|
|
349
|
+
| ... | ... | ... | ... |
|
|
350
|
+
|
|
351
|
+
## Clarification Questions
|
|
352
|
+
|
|
353
|
+
<numbered list of 5-10 targeted questions from Phase 3>
|
|
354
|
+
|
|
355
|
+
## Per-Area Confidence Summary
|
|
356
|
+
|
|
357
|
+
| Area | Confidence | Status |
|
|
358
|
+
|---|---|---|
|
|
359
|
+
| Tech Stack | 92% | ✅ High |
|
|
360
|
+
| Architecture | 75% | ⚠️ Medium |
|
|
361
|
+
| Data Model | 88% | ✅ High |
|
|
362
|
+
| Auth & Security | 60% | ⚠️ Medium |
|
|
363
|
+
| Infrastructure | 45% | ❌ Low |
|
|
364
|
+
| Business Domain | 20% | ❌ Low — needs human input |
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## Procedure
|
|
370
|
+
|
|
371
|
+
1. **Scan repository structure** — Execute file tree analysis, file count distribution, and gitignore analysis from §1.1.
|
|
372
|
+
|
|
373
|
+
2. **Detect package management** — Scan for all manifest files from §1.2. Record ecosystem, versions, and dependency counts.
|
|
374
|
+
|
|
375
|
+
3. **Identify build system** — Check for all build tool indicators from §1.3. Note build commands from package scripts.
|
|
376
|
+
|
|
377
|
+
4. **Detect frameworks** — Cross-reference dependencies, config files, and file patterns from §1.4. Assign initial confidence scores.
|
|
378
|
+
|
|
379
|
+
5. **Detect data layer** — Scan for ORM configs, schema files, migration directories, and database connection patterns from §1.5.
|
|
380
|
+
|
|
381
|
+
6. **Detect authentication** — Look for auth libraries, middleware, token patterns, and role definitions from §1.6.
|
|
382
|
+
|
|
383
|
+
7. **Scan CI/CD** — Read all CI/CD configuration files from §1.7. Extract pipeline stages, triggers, and deployment targets.
|
|
384
|
+
|
|
385
|
+
8. **Scan infrastructure** — Identify containerization, orchestration, and IaC tools from §1.8.
|
|
386
|
+
|
|
387
|
+
9. **Detect testing setup** — Find test configs, test files, and coverage settings from §1.9. Identify testing strategy (unit, integration, e2e).
|
|
388
|
+
|
|
389
|
+
10. **Read existing documentation** — Extract knowledge from README, docs, ADRs, and changelogs from §1.10.
|
|
390
|
+
|
|
391
|
+
11. **Analyze git history** — Run hotspot analysis, contributor mapping, and change velocity calculations from §1.11.
|
|
392
|
+
|
|
393
|
+
12. **Check for monorepo** — Detect workspace tools and map package dependencies from §1.12.
|
|
394
|
+
|
|
395
|
+
13. **Map entry points** — Trace application entry points, routing, and middleware chains from discovered framework and config evidence.
|
|
396
|
+
|
|
397
|
+
14. **Build architecture hypothesis** — Synthesize findings into an architecture hypothesis: monolith vs microservices, layer boundaries, communication patterns.
|
|
398
|
+
|
|
399
|
+
15. **Classify confidence** — Apply confidence scoring from Phase 2 to every finding.
|
|
400
|
+
|
|
401
|
+
16. **Generate clarification questions** — Formulate 5-10 targeted questions from Phase 3 for areas with <50% confidence.
|
|
402
|
+
|
|
403
|
+
17. **Write DISCOVERY-report.md** — Generate the full report following the Phase 4 template.
|
|
404
|
+
|
|
405
|
+
18. **Present findings** — Share high-confidence facts, medium-confidence hypotheses (seeking confirmation), and low-confidence questions with the user.
|
|
406
|
+
|
|
407
|
+
## Quality Gates
|
|
408
|
+
|
|
409
|
+
- [ ] All 12 discovery scans (§1.1–§1.12) were executed
|
|
410
|
+
- [ ] Every tech stack detection has a confidence score with evidence
|
|
411
|
+
- [ ] Architecture hypothesis is stated with supporting evidence
|
|
412
|
+
- [ ] No findings are stated without evidence citations
|
|
413
|
+
- [ ] Clarification questions number between 5 and 10
|
|
414
|
+
- [ ] No question asks about something discoverable from code
|
|
415
|
+
- [ ] DISCOVERY-report.md exists at `.engineering-intelligence/reports/DISCOVERY-report.md`
|
|
416
|
+
- [ ] Per-area confidence summary covers all major areas
|
|
417
|
+
- [ ] Git history analysis includes hotspots and change velocity
|
|
418
|
+
- [ ] Monorepo detection was performed (even if result is "not a monorepo")
|
|
419
|
+
- [ ] Unknowns and uncertainties are explicitly listed
|
|
420
|
+
|
|
421
|
+
## Cross-References
|
|
422
|
+
|
|
423
|
+
- Used by: `initialize-intelligence-skill`, `engineering-orchestrator`
|
|
424
|
+
- Consumed by: all sync engines, `convention-detector`, `ongoing-learning-engine`
|
|
425
|
+
- Depends on: git history access, file system read access
|
|
426
|
+
- Feeds into: `knowledge-base/00-project-overview.md`, `.engineering-intelligence/memory/technology-decisions.md`
|
|
427
|
+
|
|
428
|
+
This capability does not modify product code.
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: convention-detector
|
|
3
|
+
description: Detects and codifies project conventions by analyzing naming patterns, import organization, code structure, API patterns, test patterns, git conventions, and architecture patterns. Produces a conventions document and enhances coding-patterns memory.
|
|
4
|
+
version: 3.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Convention Detector
|
|
8
|
+
|
|
9
|
+
Systematically analyze a codebase to detect, classify, and document conventions that are implicitly followed but not explicitly written down. Conventions are inferred from statistical patterns across the codebase — a pattern must appear in >70% of relevant files to be classified as a convention.
|
|
10
|
+
|
|
11
|
+
This capability does not modify product code.
|
|
12
|
+
|
|
13
|
+
## Inputs
|
|
14
|
+
|
|
15
|
+
- Repository root path
|
|
16
|
+
- Optional: scope constraints (specific package, service, or directory)
|
|
17
|
+
- Optional: output from `codebase-discovery-engine` (tech stack, framework, file patterns)
|
|
18
|
+
|
|
19
|
+
## Procedure
|
|
20
|
+
|
|
21
|
+
1. **Sample files** — Select a representative sample of at least 20 source files across different modules. Prioritize recently modified files and files by different contributors to capture team-wide conventions (not individual habits).
|
|
22
|
+
|
|
23
|
+
2. **Detect naming conventions** — Analyze the following naming patterns:
|
|
24
|
+
|
|
25
|
+
| Target | What to Detect | Example Patterns |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| Variables | camelCase, snake_case, PascalCase, SCREAMING_SNAKE | `userName` vs `user_name` |
|
|
28
|
+
| Functions | camelCase, snake_case, verb-first, noun-first | `getUser()` vs `user_get()` |
|
|
29
|
+
| Classes/Types | PascalCase, suffixes (Service, Controller, Repository) | `UserService`, `AuthMiddleware` |
|
|
30
|
+
| Files | kebab-case, camelCase, PascalCase, dot-separated | `user-service.ts` vs `UserService.ts` |
|
|
31
|
+
| Directories | singular, plural, kebab-case, camelCase | `model/` vs `models/` |
|
|
32
|
+
| Tests | `.test.`, `.spec.`, `_test`, `Test` suffix | `user.test.ts` vs `user.spec.ts` |
|
|
33
|
+
| Constants | SCREAMING_SNAKE, PascalCase enum members | `MAX_RETRIES`, `HttpStatus.OK` |
|
|
34
|
+
| Database | snake_case tables, camelCase columns, pluralization | `user_accounts` vs `UserAccount` |
|
|
35
|
+
| API routes | kebab-case, snake_case, camelCase, plural resources | `/api/user-accounts` vs `/api/userAccounts` |
|
|
36
|
+
|
|
37
|
+
3. **Detect import organization** — Analyze import blocks for:
|
|
38
|
+
|
|
39
|
+
| Pattern | What to Detect |
|
|
40
|
+
|---|---|
|
|
41
|
+
| **Grouping** | External → internal → relative? Alphabetical within groups? |
|
|
42
|
+
| **Path style** | Absolute (`@/components/Button`) vs relative (`../../components/Button`) |
|
|
43
|
+
| **Path aliases** | `@/`, `~/`, `#/` — check `tsconfig.json` paths, webpack aliases |
|
|
44
|
+
| **Barrel files** | `index.ts` re-exports? Per-directory or selective? |
|
|
45
|
+
| **Type imports** | Separate `import type` vs inline `type` keyword |
|
|
46
|
+
| **Wildcard imports** | `import * as` usage frequency |
|
|
47
|
+
| **Default vs named** | Preference for default or named exports |
|
|
48
|
+
| **Side-effect imports** | CSS/style imports, polyfills |
|
|
49
|
+
|
|
50
|
+
4. **Detect code structure patterns** — Analyze:
|
|
51
|
+
|
|
52
|
+
| Pattern | What to Detect |
|
|
53
|
+
|---|---|
|
|
54
|
+
| **Paradigm** | Functional vs class-based vs mixed |
|
|
55
|
+
| **Error handling** | Try-catch, Result/Either types, error-first callbacks, custom error classes |
|
|
56
|
+
| **Logging** | Logger library, log levels, structured logging, log format |
|
|
57
|
+
| **Validation** | Zod, Joi, class-validator, manual checks, where validation lives |
|
|
58
|
+
| **Configuration** | Environment variables, config files, feature flags, config patterns |
|
|
59
|
+
| **Dependency injection** | Constructor injection, container-based, module-based, manual wiring |
|
|
60
|
+
| **Async patterns** | async/await, Promises, callbacks, Observables |
|
|
61
|
+
| **Null handling** | Optional chaining, null checks, Maybe/Option types, assertions |
|
|
62
|
+
| **Comment style** | JSDoc, docstrings, inline comments, section headers |
|
|
63
|
+
| **Function length** | Typical function LOC, max observed, decomposition style |
|
|
64
|
+
| **Module exports** | Single responsibility per file? Multiple exports? |
|
|
65
|
+
|
|
66
|
+
5. **Detect API patterns** — Analyze API endpoints for:
|
|
67
|
+
|
|
68
|
+
| Pattern | What to Detect |
|
|
69
|
+
|---|---|
|
|
70
|
+
| **REST conventions** | Resource naming, HTTP method usage, nested resources |
|
|
71
|
+
| **Response envelope** | `{ data, error, meta }` vs raw responses vs `{ success, result }` |
|
|
72
|
+
| **Error format** | Error codes, error messages, error detail structure |
|
|
73
|
+
| **Pagination** | Cursor-based, offset-based, page-based, query params |
|
|
74
|
+
| **Versioning** | URL path (`/v1/`), header-based, query param |
|
|
75
|
+
| **Auth headers** | Bearer token, API key, cookie-based |
|
|
76
|
+
| **Request validation** | Schema validation middleware, manual checks |
|
|
77
|
+
| **Status codes** | Consistent status code usage patterns |
|
|
78
|
+
| **Serialization** | camelCase vs snake_case in JSON responses |
|
|
79
|
+
|
|
80
|
+
6. **Detect test patterns** — Analyze test files for:
|
|
81
|
+
|
|
82
|
+
| Pattern | What to Detect |
|
|
83
|
+
|---|---|
|
|
84
|
+
| **File placement** | Co-located (`__tests__/`, adjacent), separate `test/` tree, or `spec/` |
|
|
85
|
+
| **Naming** | `*.test.*`, `*.spec.*`, `*_test.*`, `Test*` prefix |
|
|
86
|
+
| **Structure** | `describe`/`it` nesting, flat tests, BDD-style, given-when-then |
|
|
87
|
+
| **Assertion style** | `expect().toBe()`, `assert.*`, `should.*`, custom matchers |
|
|
88
|
+
| **Mocking** | `jest.mock()`, `vi.mock()`, dependency injection, manual stubs |
|
|
89
|
+
| **Fixtures** | Factory functions, fixture files, inline data, builders |
|
|
90
|
+
| **Setup/teardown** | `beforeEach`/`afterEach`, `setup()`/`teardown()`, per-test setup |
|
|
91
|
+
| **Coverage** | Coverage thresholds, ignored paths, branch vs line coverage |
|
|
92
|
+
| **Integration tests** | Database setup, API testing, test containers |
|
|
93
|
+
| **E2E tests** | Page objects, test selectors (`data-testid`), base URLs |
|
|
94
|
+
|
|
95
|
+
7. **Detect git patterns** — Analyze git history and config for:
|
|
96
|
+
|
|
97
|
+
| Pattern | What to Detect |
|
|
98
|
+
|---|---|
|
|
99
|
+
| **Commit format** | Conventional commits, free-form, ticket references, emoji |
|
|
100
|
+
| **Branch naming** | `feature/`, `fix/`, `chore/`, ticket number prefix, kebab-case |
|
|
101
|
+
| **PR conventions** | PR templates, required reviewers, auto-merge, squash vs merge |
|
|
102
|
+
| **Release process** | Tags, changelogs, release branches, semantic versioning |
|
|
103
|
+
| **Hooks** | Husky, lefthook, pre-commit, lint-staged |
|
|
104
|
+
| **Merge strategy** | Squash merge, merge commits, rebase, linear history |
|
|
105
|
+
|
|
106
|
+
8. **Detect architecture patterns** — Analyze structural boundaries:
|
|
107
|
+
|
|
108
|
+
| Pattern | What to Detect |
|
|
109
|
+
|---|---|
|
|
110
|
+
| **Layer boundaries** | Clear separation of presentation/business/data layers |
|
|
111
|
+
| **Module boundaries** | Feature-based, layer-based, domain-based organization |
|
|
112
|
+
| **State management** | Redux, Zustand, Jotai, MobX, React Context, Vuex/Pinia, signals |
|
|
113
|
+
| **Data fetching** | React Query, SWR, tRPC, REST clients, GraphQL clients |
|
|
114
|
+
| **Middleware chains** | Ordered middleware, decorator patterns, interceptors |
|
|
115
|
+
| **Event patterns** | Event emitters, pub/sub, event sourcing, domain events |
|
|
116
|
+
| **Repository pattern** | Data access abstraction, query encapsulation |
|
|
117
|
+
| **Service pattern** | Business logic isolation, service layer thickness |
|
|
118
|
+
|
|
119
|
+
9. **Calculate adherence scores** — For each detected convention, calculate:
|
|
120
|
+
- **Adherence rate**: percentage of relevant files/instances following the convention
|
|
121
|
+
- **Exceptions**: specific files or modules that deviate (and possible reasons)
|
|
122
|
+
- **Confidence**: how certain the detection is (based on sample size)
|
|
123
|
+
|
|
124
|
+
10. **Write conventions document** — Generate `knowledge-base/16-conventions.md` following the output format below.
|
|
125
|
+
|
|
126
|
+
11. **Enhance coding patterns memory** — Update `.engineering-intelligence/memory/coding-patterns.md` with durable conventions that are unlikely to change.
|
|
127
|
+
|
|
128
|
+
## Output: `knowledge-base/16-conventions.md`
|
|
129
|
+
|
|
130
|
+
```markdown
|
|
131
|
+
# Project Conventions
|
|
132
|
+
|
|
133
|
+
Generated: <timestamp>
|
|
134
|
+
Sample size: <N files analyzed across M modules>
|
|
135
|
+
|
|
136
|
+
## Naming Conventions
|
|
137
|
+
|
|
138
|
+
| Target | Convention | Adherence | Exceptions | Evidence |
|
|
139
|
+
|---|---|---|---|---|
|
|
140
|
+
| Variables | camelCase | 98% | None | Sampled 150 variable declarations |
|
|
141
|
+
| Files | kebab-case | 94% | Legacy `utils/` dir uses camelCase | `src/components/user-profile.tsx` |
|
|
142
|
+
| ... | ... | ... | ... | ... |
|
|
143
|
+
|
|
144
|
+
## Import Organization
|
|
145
|
+
|
|
146
|
+
<detected import ordering rules, path conventions, barrel file usage>
|
|
147
|
+
|
|
148
|
+
## Code Structure
|
|
149
|
+
|
|
150
|
+
<paradigm, error handling, logging, validation patterns>
|
|
151
|
+
|
|
152
|
+
## API Conventions
|
|
153
|
+
|
|
154
|
+
<REST conventions, response format, error format>
|
|
155
|
+
|
|
156
|
+
## Test Conventions
|
|
157
|
+
|
|
158
|
+
<file placement, naming, assertion style, mocking approach>
|
|
159
|
+
|
|
160
|
+
## Git Conventions
|
|
161
|
+
|
|
162
|
+
<commit format, branch naming, merge strategy>
|
|
163
|
+
|
|
164
|
+
## Architecture Conventions
|
|
165
|
+
|
|
166
|
+
<layer boundaries, module organization, state management>
|
|
167
|
+
|
|
168
|
+
## Convention Violations
|
|
169
|
+
|
|
170
|
+
| Convention | Violation | Location | Severity |
|
|
171
|
+
|---|---|---|---|
|
|
172
|
+
| ... | ... | ... | ... |
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Output: `.engineering-intelligence/memory/coding-patterns.md` (Enhanced)
|
|
176
|
+
|
|
177
|
+
Add a `## Conventions` section with only durable patterns that pass the durability check: "Will this convention still be relevant after 10+ more changes?"
|
|
178
|
+
|
|
179
|
+
## Quality Gates
|
|
180
|
+
|
|
181
|
+
- [ ] At least 20 source files sampled across different modules
|
|
182
|
+
- [ ] Naming convention detection covers files, variables, functions, and types
|
|
183
|
+
- [ ] Import organization patterns are documented with examples
|
|
184
|
+
- [ ] Test patterns include file placement and assertion style
|
|
185
|
+
- [ ] Git conventions are extracted from actual git history (not assumed)
|
|
186
|
+
- [ ] Each convention has an adherence rate and evidence citation
|
|
187
|
+
- [ ] Exceptions to conventions are listed (not hidden)
|
|
188
|
+
- [ ] `knowledge-base/16-conventions.md` exists and follows the output format
|
|
189
|
+
- [ ] `coding-patterns.md` is enhanced with a Conventions section
|
|
190
|
+
- [ ] Only patterns with >70% adherence are classified as conventions
|
|
191
|
+
|
|
192
|
+
## Cross-References
|
|
193
|
+
|
|
194
|
+
- Depends on: `codebase-discovery-engine` (tech stack context)
|
|
195
|
+
- Used by: `initialize-intelligence-skill`, `engineering-intelligence-skill`
|
|
196
|
+
- Feeds into: `knowledge-base/16-conventions.md`, `.engineering-intelligence/memory/coding-patterns.md`
|
|
197
|
+
- Consumed by: `ongoing-learning-engine` (for convention drift detection)
|
|
198
|
+
|
|
199
|
+
This capability does not modify product code.
|