aiknowsys 0.0.1
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/AGENTS.template.md +207 -0
- package/CODEBASE_CHANGELOG.template.md +145 -0
- package/CODEBASE_ESSENTIALS.template.md +382 -0
- package/LICENSE +21 -0
- package/README.md +714 -0
- package/bin/cli.js +81 -0
- package/lib/commands/init.js +227 -0
- package/lib/commands/install-agents.js +100 -0
- package/lib/commands/install-skills.js +92 -0
- package/lib/commands/migrate.js +161 -0
- package/lib/commands/scan.js +418 -0
- package/lib/utils.js +93 -0
- package/package.json +53 -0
- package/scripts/migrate-existing.sh +222 -0
- package/scripts/scan-codebase.sh +379 -0
- package/scripts/setup.sh +273 -0
- package/templates/agents/README.md +270 -0
- package/templates/agents/architect.agent.template.md +58 -0
- package/templates/agents/developer.agent.template.md +27 -0
- package/templates/agents/setup-agents.sh +65 -0
- package/templates/skills/code-refactoring/SKILL.md +662 -0
- package/templates/skills/dependency-updates/SKILL.md +561 -0
- package/templates/skills/documentation-management/SKILL.md +744 -0
- package/templates/skills/skill-creator/SKILL.md +252 -0
- package/templates/skills/skill-creator/template.md +89 -0
package/README.md
ADDED
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
# aiknowsys - Knowledge System Template
|
|
2
|
+
|
|
3
|
+
**AI-Powered Development Workflow for Consistent, High-Quality Code**
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
A battle-tested knowledge management system that enables AI-assisted development while maintaining architectural consistency and preventing regressions. Originally developed for production use in the [gnwebsite project](https://github.com/arpa73/gnwebsite), now extracted as a reusable template for any tech stack.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## What Is This?
|
|
12
|
+
|
|
13
|
+
A structured workflow system consisting of:
|
|
14
|
+
|
|
15
|
+
1. **CODEBASE_ESSENTIALS.md** - Single source of truth for patterns, conventions, and invariants
|
|
16
|
+
2. **Custom Agents** (Developer + Architect) - Automated code review enforcing KISS/DRY/SOLID/YAGNI
|
|
17
|
+
3. **Skills System** - Domain-specific how-to guides for common tasks
|
|
18
|
+
4. **Changelog** - Session-by-session validation and learning history
|
|
19
|
+
5. **Validation Matrix** - Mandatory test running before completion
|
|
20
|
+
|
|
21
|
+
**Result:** AI assistants that understand your codebase, follow your patterns, and catch issues before production.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Why Use This?
|
|
26
|
+
|
|
27
|
+
### Real-World Impact
|
|
28
|
+
|
|
29
|
+
From production use in gnwebsite:
|
|
30
|
+
|
|
31
|
+
✅ **Prevented pattern drift** - Caught MediaAsset using two different URL generation methods
|
|
32
|
+
✅ **Comprehensive testing** - Logger utility got 16 tests because ESSENTIALS mandates testing
|
|
33
|
+
✅ **Caught regressions** - Mailerlite integration tests caught 8 production bugs
|
|
34
|
+
✅ **Consistent refactoring** - Test-driven refactoring prevented behavior changes
|
|
35
|
+
✅ **Fast onboarding** - New AI sessions start productive immediately
|
|
36
|
+
|
|
37
|
+
### Before vs After
|
|
38
|
+
|
|
39
|
+
| Without Knowledge System | With Knowledge System |
|
|
40
|
+
|-------------------------|----------------------|
|
|
41
|
+
| AI suggests inconsistent patterns | AI follows documented standards |
|
|
42
|
+
| "Quick fixes" create technical debt | Process ensures quality every time |
|
|
43
|
+
| Validation is manual/forgotten | Validation is automatic/mandatory |
|
|
44
|
+
| Patterns exist in tribal knowledge | Patterns documented and enforced |
|
|
45
|
+
| Each session restarts context | Historical context preserved |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
### Install via npm (Recommended)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# For new projects - interactive setup
|
|
55
|
+
npx aiknowsys init
|
|
56
|
+
|
|
57
|
+
# For existing projects - auto-detect and migrate
|
|
58
|
+
npx aiknowsys migrate
|
|
59
|
+
|
|
60
|
+
# Or install globally
|
|
61
|
+
npm install -g aiknowsys
|
|
62
|
+
aiknowsys init
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Available commands:**
|
|
66
|
+
|
|
67
|
+
| Command | Description |
|
|
68
|
+
|---------|-------------|
|
|
69
|
+
| `npx aiknowsys init` | Initialize for a new project |
|
|
70
|
+
| `npx aiknowsys migrate` | Full migration for existing projects |
|
|
71
|
+
| `npx aiknowsys scan` | Scan codebase and generate draft ESSENTIALS |
|
|
72
|
+
| `npx aiknowsys install-agents` | Install Developer + Architect agents |
|
|
73
|
+
| `npx aiknowsys install-skills` | Install universal skills |
|
|
74
|
+
|
|
75
|
+
### Alternative: Manual Setup
|
|
76
|
+
|
|
77
|
+
<details>
|
|
78
|
+
<summary>Click to expand manual setup instructions</summary>
|
|
79
|
+
|
|
80
|
+
#### For New Projects
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Clone the template
|
|
84
|
+
git clone https://github.com/YOUR_ORG/aiknowsys.git
|
|
85
|
+
cd aiknowsys
|
|
86
|
+
|
|
87
|
+
# Run interactive setup
|
|
88
|
+
./scripts/setup.sh
|
|
89
|
+
|
|
90
|
+
# Follow prompts to customize for your tech stack
|
|
91
|
+
# Files will be generated with your configuration
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### For Existing Projects
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Clone into your project
|
|
98
|
+
git clone https://github.com/YOUR_ORG/aiknowsys.git temp-template
|
|
99
|
+
cp -r temp-template/scripts ./
|
|
100
|
+
cp -r temp-template/templates ./
|
|
101
|
+
|
|
102
|
+
# Run migration workflow
|
|
103
|
+
./scripts/migrate-existing.sh
|
|
104
|
+
|
|
105
|
+
# Scanner will:
|
|
106
|
+
# 1. Detect your tech stack automatically
|
|
107
|
+
# 2. Generate draft CODEBASE_ESSENTIALS.md (70% complete)
|
|
108
|
+
# 3. Install custom agents
|
|
109
|
+
# 4. Set up universal skills
|
|
110
|
+
# 5. Initialize changelog
|
|
111
|
+
|
|
112
|
+
# Complete TODO sections in CODEBASE_ESSENTIALS.md
|
|
113
|
+
# Start using: @Developer <your request>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
</details>
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Core Components
|
|
121
|
+
|
|
122
|
+
### 1. CODEBASE_ESSENTIALS.md
|
|
123
|
+
|
|
124
|
+
**Purpose:** Single-source reference for architecture, patterns, and critical invariants.
|
|
125
|
+
|
|
126
|
+
**Contains:**
|
|
127
|
+
- Technology stack snapshot
|
|
128
|
+
- Validation commands (tests, type checking, linting)
|
|
129
|
+
- Core patterns (how you do auth, API calls, state management)
|
|
130
|
+
- Critical invariants (rules that must NEVER be violated)
|
|
131
|
+
- Common gotchas (things that trip up new contributors)
|
|
132
|
+
|
|
133
|
+
**See examples:**
|
|
134
|
+
- [Python/Django API](examples/python-django/CODEBASE_ESSENTIALS.md) - Django REST Framework patterns
|
|
135
|
+
- [TypeScript/Vue SPA](examples/typescript-vue/CODEBASE_ESSENTIALS.md) - Vue 3 Composition API patterns
|
|
136
|
+
- [Rust/Actix Web API](examples/rust-actix/CODEBASE_ESSENTIALS.md) - Type-safe Rust patterns
|
|
137
|
+
|
|
138
|
+
**Why it matters:** AI reads this at session start, ensuring all suggestions align with your architecture.
|
|
139
|
+
|
|
140
|
+
### 2. Custom Agents (Developer + Architect)
|
|
141
|
+
|
|
142
|
+
**Purpose:** Automated quality gate enforcing documented patterns.
|
|
143
|
+
|
|
144
|
+
**Workflow:**
|
|
145
|
+
```
|
|
146
|
+
User → @Developer → Implements feature → Auto-handoff → @SeniorArchitect → Reviews against ESSENTIALS → ✅ Approve or 🔄 Refactor
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**What Architect checks:**
|
|
150
|
+
- KISS (Keep It Simple) - No unnecessary complexity
|
|
151
|
+
- DRY (Don't Repeat Yourself) - Proper abstraction
|
|
152
|
+
- SOLID - Single responsibility, dependency inversion
|
|
153
|
+
- YAGNI (You Ain't Gonna Need It) - No speculative features
|
|
154
|
+
- CODEBASE_ESSENTIALS.md compliance
|
|
155
|
+
|
|
156
|
+
**Result:** Instant feedback loop (seconds vs hours), consistent enforcement.
|
|
157
|
+
|
|
158
|
+
### 3. Skills System
|
|
159
|
+
|
|
160
|
+
**Purpose:** Step-by-step workflows for common tasks.
|
|
161
|
+
|
|
162
|
+
**Included universal skills:**
|
|
163
|
+
- `dependency-updates` - Safe upgrade procedures
|
|
164
|
+
- `documentation-management` - Changelog archiving, AI-friendly writing
|
|
165
|
+
- `code-refactoring` - Test-driven refactoring patterns
|
|
166
|
+
- `testing-best-practices` - Framework-agnostic testing guide
|
|
167
|
+
- `skill-creator` - How to create new skills
|
|
168
|
+
|
|
169
|
+
**Custom skills you can add:**
|
|
170
|
+
- Feature implementation workflows
|
|
171
|
+
- Deployment procedures
|
|
172
|
+
- Database migration patterns
|
|
173
|
+
- Security review checklists
|
|
174
|
+
|
|
175
|
+
### 4. Validation Matrix
|
|
176
|
+
|
|
177
|
+
**Purpose:** Ensure all changes pass tests before claiming completion.
|
|
178
|
+
|
|
179
|
+
**Example:**
|
|
180
|
+
```markdown
|
|
181
|
+
| Changed | Commands | Required |
|
|
182
|
+
|---------|----------|----------|
|
|
183
|
+
| Backend | pytest | ✅ MANDATORY |
|
|
184
|
+
| Frontend | npm run type-check | ✅ MANDATORY |
|
|
185
|
+
| Frontend Logic | npm run test:run | ✅ MANDATORY |
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Rule:** Never say "done" until validation passes.
|
|
189
|
+
|
|
190
|
+
### 5. Session Changelog
|
|
191
|
+
|
|
192
|
+
**Purpose:** Historical context prevents repeating mistakes.
|
|
193
|
+
|
|
194
|
+
**Entry format:**
|
|
195
|
+
```markdown
|
|
196
|
+
## Session: Logger Utility Implementation (Jan 18, 2026)
|
|
197
|
+
|
|
198
|
+
**Goal**: Add structured logging with type safety
|
|
199
|
+
|
|
200
|
+
**Changes**:
|
|
201
|
+
- [src/utils/logger.ts](src/utils/logger.ts#L1-L50): Created logger
|
|
202
|
+
- [tests/logger.test.ts](tests/logger.test.ts): Added 16 tests
|
|
203
|
+
|
|
204
|
+
**Validation**:
|
|
205
|
+
- ✅ All 456 tests passed
|
|
206
|
+
- ✅ TypeScript: No errors
|
|
207
|
+
|
|
208
|
+
**Key Learning**: Logger needs environment detection for test mocking
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Production-Ready Examples
|
|
214
|
+
|
|
215
|
+
The template includes **7 comprehensive examples** showing real patterns across different ecosystems:
|
|
216
|
+
|
|
217
|
+
### Backend Examples
|
|
218
|
+
|
|
219
|
+
#### Python/Django REST API
|
|
220
|
+
|
|
221
|
+
**Stack:** Django 4.2 + DRF + PostgreSQL + pytest + Docker
|
|
222
|
+
|
|
223
|
+
**Key patterns:**
|
|
224
|
+
- ViewSet + Serializer + Router (DRF)
|
|
225
|
+
- factory-boy for test data generation
|
|
226
|
+
- TimestampedModel abstract base class
|
|
227
|
+
- SQLAlchemy migrations
|
|
228
|
+
- Environment configuration with django-environ
|
|
229
|
+
|
|
230
|
+
**What you'll learn:**
|
|
231
|
+
- How to structure Django REST API patterns
|
|
232
|
+
- Comprehensive pytest testing with factories
|
|
233
|
+
- N+1 query prevention with `select_related`
|
|
234
|
+
- Production deployment checklist
|
|
235
|
+
|
|
236
|
+
[→ View Django Example](examples/python-django/CODEBASE_ESSENTIALS.md)
|
|
237
|
+
|
|
238
|
+
#### Python/FastAPI
|
|
239
|
+
|
|
240
|
+
**Stack:** FastAPI 0.108 + SQLAlchemy 2.0 + Pydantic + Alembic + PostgreSQL
|
|
241
|
+
|
|
242
|
+
**Key patterns:**
|
|
243
|
+
- Router + Pydantic schemas + dependency injection
|
|
244
|
+
- Async SQLAlchemy with asyncpg
|
|
245
|
+
- JWT authentication with python-jose
|
|
246
|
+
- Alembic migrations
|
|
247
|
+
- pytest-asyncio testing
|
|
248
|
+
|
|
249
|
+
**What you'll learn:**
|
|
250
|
+
- FastAPI async/await patterns
|
|
251
|
+
- Type-safe async database access
|
|
252
|
+
- Pydantic validation + OpenAPI docs
|
|
253
|
+
- Common gotchas (mixing sync/async, N+1 queries)
|
|
254
|
+
|
|
255
|
+
[→ View FastAPI Example](examples/python-fastapi/CODEBASE_ESSENTIALS.md)
|
|
256
|
+
|
|
257
|
+
#### Node.js/Express + TypeScript
|
|
258
|
+
|
|
259
|
+
**Stack:** Express 4.18 + TypeScript + Prisma + PostgreSQL + Jest
|
|
260
|
+
|
|
261
|
+
**Key patterns:**
|
|
262
|
+
- Router + Controller + Service layer
|
|
263
|
+
- Zod validation + custom error handling
|
|
264
|
+
- JWT authentication with passport
|
|
265
|
+
- Prisma ORM with migrations
|
|
266
|
+
- Supertest for API testing
|
|
267
|
+
|
|
268
|
+
**What you'll learn:**
|
|
269
|
+
- Express TypeScript setup
|
|
270
|
+
- Service layer separation
|
|
271
|
+
- Type-safe middleware
|
|
272
|
+
- Common gotchas (async errors, integer parsing)
|
|
273
|
+
|
|
274
|
+
[→ View Express Example](examples/nodejs-express/CODEBASE_ESSENTIALS.md)
|
|
275
|
+
|
|
276
|
+
#### Rust/Actix Web API
|
|
277
|
+
|
|
278
|
+
**Stack:** Actix Web 4.4 + SQLx + PostgreSQL + Tokio + Serde
|
|
279
|
+
|
|
280
|
+
**Key patterns:**
|
|
281
|
+
- Handler + Extractor + Responder
|
|
282
|
+
- Custom error types with ResponseError trait
|
|
283
|
+
- SQLx compile-time query verification
|
|
284
|
+
- Integration tests with test database
|
|
285
|
+
- Async error handling with Result types
|
|
286
|
+
|
|
287
|
+
**What you'll learn:**
|
|
288
|
+
- Type-safe Rust web API development
|
|
289
|
+
- Database migrations with SQLx CLI
|
|
290
|
+
- Production optimization (LTO, code-gen-units)
|
|
291
|
+
- Common gotchas (lifetime errors, async runtime conflicts)
|
|
292
|
+
|
|
293
|
+
[→ View Rust Example](examples/rust-actix/CODEBASE_ESSENTIALS.md)
|
|
294
|
+
|
|
295
|
+
### Frontend Examples
|
|
296
|
+
|
|
297
|
+
#### TypeScript/React + Vite
|
|
298
|
+
|
|
299
|
+
**Stack:** React 18.2 + TypeScript + Vite + Zustand + TanStack Query + Tailwind
|
|
300
|
+
|
|
301
|
+
**Key patterns:**
|
|
302
|
+
- Functional components + hooks + custom hooks
|
|
303
|
+
- Zustand for client state, TanStack Query for server state
|
|
304
|
+
- React Hook Form + Zod validation
|
|
305
|
+
- Testing Library + user-event
|
|
306
|
+
- Type-safe routing with React Router
|
|
307
|
+
|
|
308
|
+
**What you'll learn:**
|
|
309
|
+
- Modern React patterns (hooks, composition)
|
|
310
|
+
- State management (Zustand vs Redux)
|
|
311
|
+
- Form handling best practices
|
|
312
|
+
- Common gotchas (infinite re-renders, missing dependencies)
|
|
313
|
+
|
|
314
|
+
[→ View React Example](examples/typescript-react/CODEBASE_ESSENTIALS.md)
|
|
315
|
+
|
|
316
|
+
#### TypeScript/Vue SPA
|
|
317
|
+
|
|
318
|
+
**Stack:** Vue 3 Composition API + TypeScript + Pinia + Vite + Vitest + Tailwind
|
|
319
|
+
|
|
320
|
+
**Key patterns:**
|
|
321
|
+
- Script setup + typed props + composables
|
|
322
|
+
- Pinia stores for state management
|
|
323
|
+
- Typed API client integration
|
|
324
|
+
- Router guards for authentication
|
|
325
|
+
- Component testing with @vue/test-utils
|
|
326
|
+
|
|
327
|
+
**What you'll learn:**
|
|
328
|
+
- Modern Vue 3 Composition API patterns
|
|
329
|
+
- Full TypeScript type safety
|
|
330
|
+
- Common gotchas (reactive destructuring, Vitest hanging)
|
|
331
|
+
- Why Pinia over Vuex, Vite over Webpack
|
|
332
|
+
|
|
333
|
+
[→ View Vue Example](examples/typescript-vue/CODEBASE_ESSENTIALS.md)
|
|
334
|
+
|
|
335
|
+
### Fullstack Examples
|
|
336
|
+
|
|
337
|
+
#### TypeScript/Next.js 14
|
|
338
|
+
|
|
339
|
+
**Stack:** Next.js 14 App Router + TypeScript + Prisma + NextAuth.js + PostgreSQL
|
|
340
|
+
|
|
341
|
+
**Key patterns:**
|
|
342
|
+
- Server Components (default) + Client Components (opt-in)
|
|
343
|
+
- Server Actions for mutations (no API routes)
|
|
344
|
+
- Prisma ORM with type-safe queries
|
|
345
|
+
- NextAuth.js OAuth + sessions
|
|
346
|
+
- E2E testing with Playwright
|
|
347
|
+
|
|
348
|
+
**What you'll learn:**
|
|
349
|
+
- Next.js App Router paradigm (Server vs Client)
|
|
350
|
+
- Server Actions for type-safe mutations
|
|
351
|
+
- Prisma schema + migrations
|
|
352
|
+
- Common gotchas (hydration mismatch, missing revalidation)
|
|
353
|
+
|
|
354
|
+
[→ View Next.js Example](examples/typescript-nextjs/CODEBASE_ESSENTIALS.md)
|
|
355
|
+
|
|
356
|
+
[→ View Rust Example](examples/rust-actix/CODEBASE_ESSENTIALS.md)
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## How It Works
|
|
361
|
+
|
|
362
|
+
### The Workflow (Read → Plan → Implement → Validate → Document)
|
|
363
|
+
|
|
364
|
+
#### 1. START: Read Context
|
|
365
|
+
```
|
|
366
|
+
At session start, AI reads:
|
|
367
|
+
- CODEBASE_ESSENTIALS.md (patterns)
|
|
368
|
+
- Relevant skill for the task
|
|
369
|
+
- Recent changelog (history)
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
#### 2. PLAN: Check Skills
|
|
373
|
+
```
|
|
374
|
+
Trigger words map to skills:
|
|
375
|
+
"refactor" → code-refactoring skill
|
|
376
|
+
"update dependencies" → dependency-updates skill
|
|
377
|
+
"add feature" → feature-implementation skill
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
#### 3. IMPLEMENT: Code + Tests
|
|
381
|
+
```
|
|
382
|
+
Follow documented patterns
|
|
383
|
+
Write tests alongside code
|
|
384
|
+
Use project conventions
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
#### 4. VALIDATE: Run Tests
|
|
388
|
+
```
|
|
389
|
+
Run validation matrix commands
|
|
390
|
+
All tests must pass
|
|
391
|
+
No errors allowed
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
#### 5. DOCUMENT: Update Changelog
|
|
395
|
+
```
|
|
396
|
+
Add session entry
|
|
397
|
+
Update ESSENTIALS if patterns changed
|
|
398
|
+
Link to specific lines
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
#### 6. CONFIRM: Only End After Validation
|
|
402
|
+
```
|
|
403
|
+
Report what was built/fixed
|
|
404
|
+
Report test results
|
|
405
|
+
Confirm docs updated
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Installation Options
|
|
411
|
+
|
|
412
|
+
### Option 1: Interactive Setup (New Projects)
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
./scripts/setup.sh
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
**Prompts for:**
|
|
419
|
+
- Primary language (TypeScript/Python/Rust/Go)
|
|
420
|
+
- Framework (Vue/React/Django/FastAPI/etc)
|
|
421
|
+
- Testing tools (Vitest/Jest/pytest/cargo test)
|
|
422
|
+
- Package manager (npm/pip/cargo/go mod)
|
|
423
|
+
|
|
424
|
+
**Generates:**
|
|
425
|
+
- CODEBASE_ESSENTIALS.md with validation commands
|
|
426
|
+
- AGENTS.md with workflow instructions
|
|
427
|
+
- Custom agents configured for your stack
|
|
428
|
+
- Universal skills installed
|
|
429
|
+
|
|
430
|
+
### Option 2: Codebase Scanner (Existing Projects)
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
./scripts/migrate-existing.sh
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
**Automatically detects:**
|
|
437
|
+
- Tech stack from package files
|
|
438
|
+
- Test commands from package.json/Makefile/CI
|
|
439
|
+
- Project structure
|
|
440
|
+
- Key dependencies
|
|
441
|
+
|
|
442
|
+
**Generates:**
|
|
443
|
+
- Draft CODEBASE_ESSENTIALS.md (70% complete)
|
|
444
|
+
- TODO sections for manual patterns
|
|
445
|
+
- Validation matrix
|
|
446
|
+
- Changelog initialized
|
|
447
|
+
|
|
448
|
+
**Time saved:** ~3-4 hours of manual documentation
|
|
449
|
+
|
|
450
|
+
### Option 3: Manual Setup
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
# Copy templates
|
|
454
|
+
cp templates/CODEBASE_ESSENTIALS.template.md CODEBASE_ESSENTIALS.md
|
|
455
|
+
cp templates/AGENTS.template.md AGENTS.md
|
|
456
|
+
cp -r templates/agents/ .github/agents/
|
|
457
|
+
|
|
458
|
+
# Customize for your project
|
|
459
|
+
# Fill in {{PLACEHOLDERS}}
|
|
460
|
+
# Add your patterns and conventions
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## Examples
|
|
466
|
+
|
|
467
|
+
### Example Projects
|
|
468
|
+
|
|
469
|
+
Included in `examples/` directory:
|
|
470
|
+
|
|
471
|
+
- **python-django/** - Backend API with PostgreSQL
|
|
472
|
+
- **typescript-react/** - Frontend SPA with Vite
|
|
473
|
+
- **rust-actix/** - Systems programming example
|
|
474
|
+
|
|
475
|
+
Each example shows:
|
|
476
|
+
- Completed CODEBASE_ESSENTIALS.md
|
|
477
|
+
- Custom skills for that stack
|
|
478
|
+
- Validation commands
|
|
479
|
+
- Real patterns from production code
|
|
480
|
+
|
|
481
|
+
---
|
|
482
|
+
|
|
483
|
+
## Customization Guide
|
|
484
|
+
|
|
485
|
+
### Adapting for Your Stack
|
|
486
|
+
|
|
487
|
+
**1. Update Validation Commands**
|
|
488
|
+
|
|
489
|
+
Edit CODEBASE_ESSENTIALS.md:
|
|
490
|
+
```markdown
|
|
491
|
+
**Validation Commands:**
|
|
492
|
+
```bash
|
|
493
|
+
# Your test framework
|
|
494
|
+
cargo test # Rust
|
|
495
|
+
go test ./... # Go
|
|
496
|
+
mvn test # Java/Maven
|
|
497
|
+
bundle exec rspec # Ruby/RSpec
|
|
498
|
+
```
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
**2. Customize Agent Review Criteria**
|
|
502
|
+
|
|
503
|
+
Edit `.github/agents/architect.agent.md`:
|
|
504
|
+
```markdown
|
|
505
|
+
### Project-Specific Rules:
|
|
506
|
+
- All database queries must use ORM
|
|
507
|
+
- API responses must match OpenAPI schema
|
|
508
|
+
- Components must be accessible (WCAG AA)
|
|
509
|
+
- Errors must use structured logging
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
**3. Create Custom Skills**
|
|
513
|
+
|
|
514
|
+
Use skill-creator skill:
|
|
515
|
+
```bash
|
|
516
|
+
@Developer create a skill for our deployment workflow
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
Or manually:
|
|
520
|
+
```bash
|
|
521
|
+
cp .github/skills/_skill-template .github/skills/my-workflow
|
|
522
|
+
# Edit SKILL.md with your steps
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
**4. Add Your Patterns**
|
|
526
|
+
|
|
527
|
+
Update CODEBASE_ESSENTIALS.md:
|
|
528
|
+
```markdown
|
|
529
|
+
## Authentication Pattern
|
|
530
|
+
|
|
531
|
+
**Always use:** JWT tokens in HttpOnly cookies
|
|
532
|
+
|
|
533
|
+
**Example:**
|
|
534
|
+
```typescript
|
|
535
|
+
// ✅ Correct
|
|
536
|
+
const token = req.cookies.access_token
|
|
537
|
+
|
|
538
|
+
// ❌ Wrong
|
|
539
|
+
const token = req.headers.authorization
|
|
540
|
+
```
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
---
|
|
544
|
+
|
|
545
|
+
## OpenSpec Integration (Recommended)
|
|
546
|
+
|
|
547
|
+
**For teams and major features, we recommend using OpenSpec for spec-driven development.**
|
|
548
|
+
|
|
549
|
+
### What is OpenSpec?
|
|
550
|
+
|
|
551
|
+
OpenSpec is a specification-driven development tool that helps manage:
|
|
552
|
+
- Breaking changes and API contracts
|
|
553
|
+
- Architecture decisions with proposals
|
|
554
|
+
- Feature planning with structured tasks
|
|
555
|
+
- Change tracking and archiving
|
|
556
|
+
|
|
557
|
+
### How it integrates with Knowledge System
|
|
558
|
+
|
|
559
|
+
1. **During `init`:** You'll be asked if you want to use OpenSpec - if yes, it's **automatically installed**
|
|
560
|
+
2. **During `scan`:** OpenSpec directories are automatically detected
|
|
561
|
+
3. **In templates:** CODEBASE_ESSENTIALS.md includes an OpenSpec section
|
|
562
|
+
4. **In skills:** The feature-implementation skill covers OpenSpec workflows
|
|
563
|
+
|
|
564
|
+
### When to use OpenSpec proposals
|
|
565
|
+
|
|
566
|
+
| Change Type | Create Proposal? |
|
|
567
|
+
|-------------|------------------|
|
|
568
|
+
| New features or capabilities | ✅ Yes |
|
|
569
|
+
| Breaking changes (API, schema) | ✅ Yes |
|
|
570
|
+
| Architecture changes | ✅ Yes |
|
|
571
|
+
| Bug fixes, typos, formatting | ❌ No |
|
|
572
|
+
| Non-breaking dependency updates | ❌ No |
|
|
573
|
+
|
|
574
|
+
### Quick Start with OpenSpec
|
|
575
|
+
|
|
576
|
+
```bash
|
|
577
|
+
# Install OpenSpec CLI
|
|
578
|
+
npm install -g openspec
|
|
579
|
+
|
|
580
|
+
# Initialize in your project
|
|
581
|
+
openspec init
|
|
582
|
+
|
|
583
|
+
# Create a proposal for a new feature
|
|
584
|
+
openspec create add-user-profiles
|
|
585
|
+
|
|
586
|
+
# Validate before implementing
|
|
587
|
+
openspec validate add-user-profiles --strict
|
|
588
|
+
|
|
589
|
+
# After deployment, archive the change
|
|
590
|
+
openspec archive add-user-profiles --yes
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
**Learn more:** [OpenSpec Documentation](https://github.com/your-org/openspec)
|
|
594
|
+
|
|
595
|
+
---
|
|
596
|
+
|
|
597
|
+
## Philosophy
|
|
598
|
+
|
|
599
|
+
### Why This Approach Works
|
|
600
|
+
|
|
601
|
+
**1. Single Source of Truth**
|
|
602
|
+
- CODEBASE_ESSENTIALS.md prevents pattern drift
|
|
603
|
+
- One place to update when patterns change
|
|
604
|
+
- AI and humans read the same reference
|
|
605
|
+
|
|
606
|
+
**2. Automated Enforcement**
|
|
607
|
+
- Custom agents enforce patterns automatically
|
|
608
|
+
- Instant feedback loop
|
|
609
|
+
- Consistent standards across all changes
|
|
610
|
+
|
|
611
|
+
**3. Knowledge Preservation**
|
|
612
|
+
- Changelog captures what changed and why
|
|
613
|
+
- Patterns documented as they're discovered
|
|
614
|
+
- Historical context prevents repeating mistakes
|
|
615
|
+
|
|
616
|
+
**4. Gradual Adoption**
|
|
617
|
+
- Start with scanner-generated draft
|
|
618
|
+
- Add patterns as you discover them
|
|
619
|
+
- System grows with your project
|
|
620
|
+
|
|
621
|
+
**5. Framework-Agnostic**
|
|
622
|
+
- Core workflow works for any stack
|
|
623
|
+
- Template variables adapt to your tools
|
|
624
|
+
- Universal skills apply everywhere
|
|
625
|
+
|
|
626
|
+
---
|
|
627
|
+
|
|
628
|
+
## FAQ
|
|
629
|
+
|
|
630
|
+
**Q: Does this replace human code review?**
|
|
631
|
+
A: No, it complements it. Agents handle mechanical checks (style, patterns, DRY), freeing humans to focus on architecture and business logic.
|
|
632
|
+
|
|
633
|
+
**Q: Will this slow down development?**
|
|
634
|
+
A: Initially adds ~10 minutes per feature for documentation. Saves hours debugging pattern inconsistencies later. Net positive after first week.
|
|
635
|
+
|
|
636
|
+
**Q: What if my project uses multiple languages?**
|
|
637
|
+
A: Create separate validation commands per language. Example: `pytest` for Python backend, `npm test` for TypeScript frontend.
|
|
638
|
+
|
|
639
|
+
**Q: Can I use this without AI assistants?**
|
|
640
|
+
A: Yes! The documentation and workflow benefit human developers too. Think of it as "docs that AI can also read."
|
|
641
|
+
|
|
642
|
+
**Q: How do I update the system as my project evolves?**
|
|
643
|
+
A: Update CODEBASE_ESSENTIALS.md when patterns change. Agents automatically enforce the updated patterns. Add changelog entry documenting the evolution.
|
|
644
|
+
|
|
645
|
+
**Q: What if validation fails?**
|
|
646
|
+
A: Don't merge! Fix the issues, re-run validation, update changelog with what broke and how you fixed it. This prevents regressions.
|
|
647
|
+
|
|
648
|
+
---
|
|
649
|
+
|
|
650
|
+
## Contributing
|
|
651
|
+
|
|
652
|
+
We welcome contributions!
|
|
653
|
+
|
|
654
|
+
**Areas for improvement:**
|
|
655
|
+
- Additional language support (Java, C#, PHP, etc.)
|
|
656
|
+
- Framework-specific examples
|
|
657
|
+
- CI/CD integration guides
|
|
658
|
+
- VS Code extension for scaffolding
|
|
659
|
+
- Skill marketplace/discovery
|
|
660
|
+
|
|
661
|
+
**To contribute:**
|
|
662
|
+
1. Fork the repository
|
|
663
|
+
2. Create feature branch
|
|
664
|
+
3. Follow the knowledge system workflow (dogfooding!)
|
|
665
|
+
4. Submit PR with changelog entry
|
|
666
|
+
|
|
667
|
+
---
|
|
668
|
+
|
|
669
|
+
## License
|
|
670
|
+
|
|
671
|
+
MIT License - See [LICENSE](LICENSE) for details.
|
|
672
|
+
|
|
673
|
+
**TL;DR:** Free to use, modify, distribute. Attribution appreciated but not required.
|
|
674
|
+
|
|
675
|
+
---
|
|
676
|
+
|
|
677
|
+
## Credits
|
|
678
|
+
|
|
679
|
+
Originally developed for [gnwebsite](https://github.com/arpa73/gnwebsite), a fullstack Django/Vue project.
|
|
680
|
+
|
|
681
|
+
**Lessons learned from:**
|
|
682
|
+
- 20+ AI-assisted development sessions
|
|
683
|
+
- 450+ tests written using the system
|
|
684
|
+
- Multiple refactorings without regressions
|
|
685
|
+
- Production deployment validation
|
|
686
|
+
|
|
687
|
+
**Built with:**
|
|
688
|
+
- Markdown for maximum portability
|
|
689
|
+
- Bash scripts for zero dependencies
|
|
690
|
+
- Templates for easy customization
|
|
691
|
+
- Real production patterns
|
|
692
|
+
|
|
693
|
+
---
|
|
694
|
+
|
|
695
|
+
## Support
|
|
696
|
+
|
|
697
|
+
**Documentation:**
|
|
698
|
+
- [Customization Guide](docs/customization-guide.md) - Adapt for your tech stack
|
|
699
|
+
- [Migration Guide](docs/migration-guide.md) - Add to existing projects
|
|
700
|
+
- [Philosophy](docs/philosophy.md) - Why this approach works
|
|
701
|
+
|
|
702
|
+
**Examples:**
|
|
703
|
+
- [Python/Django](examples/python-django/) - REST API patterns
|
|
704
|
+
- [TypeScript/Vue](examples/typescript-vue/) - SPA patterns
|
|
705
|
+
- [Rust/Actix](examples/rust-actix/) - Type-safe web API patterns
|
|
706
|
+
|
|
707
|
+
**Questions?**
|
|
708
|
+
- Open an issue
|
|
709
|
+
- Check examples/ directory for your stack
|
|
710
|
+
- Read docs/philosophy.md for design rationale
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
714
|
+
**Start building better code with AI assistants that actually understand your codebase.** 🚀
|