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
|
@@ -0,0 +1,744 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentation-management
|
|
3
|
+
description: Maintain AI-optimized documentation and organize codebase history for gnwebsite project. Use when updating docs, organizing changelog, improving readability for AI agents, or when documentation becomes too large. Covers changelog archiving, AI-friendly writing patterns, semantic structure, and knowledge retrieval optimization. Ensures documentation stays readable and discoverable for both humans and AI systems.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Documentation Management
|
|
7
|
+
|
|
8
|
+
Comprehensive guide for maintaining high-quality, AI-optimized documentation and managing growing codebase history in gnwebsite project.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
- User asks to "update documentation" or "organize the changelog"
|
|
13
|
+
- Changelog exceeds 1500 lines or 6 months of sessions
|
|
14
|
+
- Documentation becomes hard to navigate or retrieve information from
|
|
15
|
+
- After major architectural changes or refactors
|
|
16
|
+
- When implementing new patterns that should be documented
|
|
17
|
+
- Creating or updating technical documentation for AI consumption
|
|
18
|
+
- When you hear: "The changelog is too big" or "Make docs more readable"
|
|
19
|
+
|
|
20
|
+
## Core Principles
|
|
21
|
+
|
|
22
|
+
1. **AI-Optimized**: Write for both humans and AI retrieval systems
|
|
23
|
+
2. **Self-Contained**: Each section should work independently
|
|
24
|
+
3. **Explicit Context**: Never rely on implicit knowledge or visual cues
|
|
25
|
+
4. **Hierarchical**: Clear structure with semantic headings
|
|
26
|
+
5. **Discoverable**: Use consistent terminology for semantic search
|
|
27
|
+
6. **Archived**: Rotate old changelog entries to maintain readability
|
|
28
|
+
|
|
29
|
+
## Documentation Philosophy (From kapa.ai Best Practices)
|
|
30
|
+
|
|
31
|
+
### How AI Systems Process Documentation
|
|
32
|
+
|
|
33
|
+
AI agents use **Retrieval-Augmented Generation (RAG)** which works in three steps:
|
|
34
|
+
|
|
35
|
+
1. **Chunking**: Documents are divided into smaller, focused sections
|
|
36
|
+
2. **Retrieval**: Semantic search finds relevant chunks matching the query
|
|
37
|
+
3. **Generation**: LLM uses retrieved chunks to construct answers
|
|
38
|
+
|
|
39
|
+
**Critical implications:**
|
|
40
|
+
- ✅ Sections must be **self-contained** (can't assume linear reading)
|
|
41
|
+
- ✅ Context must be **explicit** (AI can't infer unstated information)
|
|
42
|
+
- ✅ Related info must be **proximate** (chunking may separate distant content)
|
|
43
|
+
- ✅ Terminology must be **consistent** (enables semantic discoverability)
|
|
44
|
+
|
|
45
|
+
## AI-Friendly Writing Patterns
|
|
46
|
+
|
|
47
|
+
### 1. Self-Contained Sections
|
|
48
|
+
|
|
49
|
+
**❌ Context-Dependent (Bad):**
|
|
50
|
+
```markdown
|
|
51
|
+
## Updating Webhook URLs
|
|
52
|
+
|
|
53
|
+
Now change the endpoint to your new URL and save the configuration.
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**✅ Self-Contained (Good):**
|
|
57
|
+
```markdown
|
|
58
|
+
## Updating Django Webhook URLs in gnwebsite
|
|
59
|
+
|
|
60
|
+
To update webhook endpoints in gnwebsite backend:
|
|
61
|
+
|
|
62
|
+
1. Navigate to Admin Panel → Webhooks
|
|
63
|
+
2. Select the webhook to modify
|
|
64
|
+
3. Change endpoint URL field to new address
|
|
65
|
+
4. Click "Save" to apply changes
|
|
66
|
+
|
|
67
|
+
**Location**: `/panel-0911/webhooks/`
|
|
68
|
+
**Model**: `jewelry_portfolio.models.WebhookConfig`
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Why**: AI retrieves sections based on relevance, not document order. Include essential context (what system, where to find, complete steps).
|
|
72
|
+
|
|
73
|
+
### 2. Explicit Terminology
|
|
74
|
+
|
|
75
|
+
**❌ Vague References (Bad):**
|
|
76
|
+
```markdown
|
|
77
|
+
## Configure Timeouts
|
|
78
|
+
|
|
79
|
+
Configure custom timeout settings through the admin panel.
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**✅ Explicit Product/Feature Names (Good):**
|
|
83
|
+
```markdown
|
|
84
|
+
## Configure Django API Timeouts in gnwebsite
|
|
85
|
+
|
|
86
|
+
Configure custom timeout settings for Django REST Framework endpoints:
|
|
87
|
+
|
|
88
|
+
- **Frontend API calls**: `axios` timeout in `frontend/src/api/index.ts`
|
|
89
|
+
- **Backend Gunicorn**: `timeout = 30` in `gunicorn.conf.py`
|
|
90
|
+
- **Nginx proxy**: `proxy_read_timeout 30s` in `nginx.conf`
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Why**: Product-specific terms improve semantic search. "Django" and "gnwebsite" create clear signals for retrieval.
|
|
94
|
+
|
|
95
|
+
### 3. Proximate Context
|
|
96
|
+
|
|
97
|
+
**❌ Scattered Information (Bad):**
|
|
98
|
+
```markdown
|
|
99
|
+
Authentication tokens expire after 24 hours by default.
|
|
100
|
+
|
|
101
|
+
The system provides several configuration options for different environments.
|
|
102
|
+
|
|
103
|
+
When implementing the login flow, ensure you handle this appropriately.
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**✅ Context Proximity (Good):**
|
|
107
|
+
```markdown
|
|
108
|
+
Authentication tokens expire after 24 hours by default. When implementing the
|
|
109
|
+
login flow in gnwebsite, handle token expiration by:
|
|
110
|
+
|
|
111
|
+
1. Refreshing tokens before 24-hour limit (recommended: 23 hours)
|
|
112
|
+
2. Implementing error handling for expired token responses (401 errors)
|
|
113
|
+
3. Redirecting to login on token expiration
|
|
114
|
+
|
|
115
|
+
**Configuration**: `SIMPLE_JWT['ACCESS_TOKEN_LIFETIME']` in `settings.py`
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Why**: Keeping constraints near implementation guidance ensures they stay together during chunking.
|
|
119
|
+
|
|
120
|
+
### 4. Text Equivalents for Visuals
|
|
121
|
+
|
|
122
|
+
**❌ Visual-Dependent (Bad):**
|
|
123
|
+
```markdown
|
|
124
|
+
See the diagram below for the complete API workflow:
|
|
125
|
+
|
|
126
|
+

|
|
127
|
+
|
|
128
|
+
Follow these steps to implement the integration.
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**✅ Text-Based Alternative (Good):**
|
|
132
|
+
```markdown
|
|
133
|
+
## gnwebsite OpenAPI Client Generation Workflow
|
|
134
|
+
|
|
135
|
+
The backend → frontend API sync follows this workflow:
|
|
136
|
+
|
|
137
|
+
1. **Update Backend**: Modify Django models/serializers/views
|
|
138
|
+
2. **Run Tests**: `docker-compose exec backend pytest jewelry_portfolio/ -x`
|
|
139
|
+
3. **Generate Schema**: `python manage.py spectacular --file openapi_schema.json`
|
|
140
|
+
4. **Generate Client**: `npx @openapitools/openapi-generator-cli generate ...`
|
|
141
|
+
5. **Type Check**: `cd frontend && npm run type-check`
|
|
142
|
+
6. **Update Services**: Modify service wrappers to use new types
|
|
143
|
+
7. **Test Frontend**: `npm run test:run`
|
|
144
|
+
8. **Commit Both**: `git add backend/openapi_schema.json frontend/src/api/generated/`
|
|
145
|
+
|
|
146
|
+

|
|
147
|
+
_Visual representation of the workflow steps above_
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Why**: AI can't parse images. Text-based workflows are fully discoverable.
|
|
151
|
+
|
|
152
|
+
### 5. Error Messages with Context
|
|
153
|
+
|
|
154
|
+
**❌ Generic Troubleshooting (Bad):**
|
|
155
|
+
```markdown
|
|
156
|
+
## Connection Problems
|
|
157
|
+
|
|
158
|
+
If the connection fails, check your network settings.
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**✅ Specific Error Context (Good):**
|
|
162
|
+
```markdown
|
|
163
|
+
## Django Database Connection Errors in gnwebsite
|
|
164
|
+
|
|
165
|
+
### Error: "django.db.utils.OperationalError: could not connect to server"
|
|
166
|
+
|
|
167
|
+
**Cause**: PostgreSQL container not running or wrong credentials
|
|
168
|
+
|
|
169
|
+
**Solution**:
|
|
170
|
+
1. Check container status: `docker-compose ps`
|
|
171
|
+
2. Restart services: `docker-compose up -d`
|
|
172
|
+
3. Verify `DATABASE_URL` in `backend/.env`
|
|
173
|
+
4. Check PostgreSQL logs: `docker-compose logs backend`
|
|
174
|
+
|
|
175
|
+
### Error: "relation does not exist"
|
|
176
|
+
|
|
177
|
+
**Cause**: Missing migrations
|
|
178
|
+
|
|
179
|
+
**Solution**:
|
|
180
|
+
1. Run migrations: `docker-compose exec backend python manage.py migrate`
|
|
181
|
+
2. Verify migration files exist in `backend/jewelry_portfolio/migrations/`
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Why**: Users search by copying exact error messages. Including them improves discoverability.
|
|
185
|
+
|
|
186
|
+
### 6. Hierarchical Structure
|
|
187
|
+
|
|
188
|
+
**✅ Good Information Architecture:**
|
|
189
|
+
```markdown
|
|
190
|
+
# Django Authentication (Product Family)
|
|
191
|
+
## HttpOnly Cookie JWT Flow (Specific Feature)
|
|
192
|
+
### Setup Instructions (Functional Context)
|
|
193
|
+
#### Backend Configuration (Component)
|
|
194
|
+
#### Frontend Configuration (Component)
|
|
195
|
+
### Troubleshooting (Functional Context)
|
|
196
|
+
#### Token Expiration Issues (Specific Problem)
|
|
197
|
+
#### CORS Configuration (Specific Problem)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Why**: URL paths, document titles, and headings provide contextual metadata for retrieval.
|
|
201
|
+
|
|
202
|
+
## Changelog Management
|
|
203
|
+
|
|
204
|
+
### When to Archive
|
|
205
|
+
|
|
206
|
+
Archive changelog entries when:
|
|
207
|
+
- ✅ File exceeds **1500 lines** (currently at 1879 lines!)
|
|
208
|
+
- ✅ Sessions older than **6 months**
|
|
209
|
+
- ✅ Historical sessions not referenced in recent work
|
|
210
|
+
- ✅ Patterns documented in CODEBASE_ESSENTIALS.md
|
|
211
|
+
|
|
212
|
+
**Current status**: CODEBASE_CHANGELOG.md has 1879 lines → **Archive needed!**
|
|
213
|
+
|
|
214
|
+
### Archive Structure
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
docs/changelog/
|
|
218
|
+
├── 2026-Q1.md # Jan-Mar 2026
|
|
219
|
+
├── 2025-Q4.md # Oct-Dec 2025
|
|
220
|
+
├── 2025-Q3.md # Jul-Sep 2025
|
|
221
|
+
└── archive-index.md # Summary of all archived periods
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Archive Procedure
|
|
225
|
+
|
|
226
|
+
**Step 1: Create Archive File**
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# Create quarterly archive
|
|
230
|
+
mkdir -p docs/changelog
|
|
231
|
+
touch docs/changelog/2026-Q1.md
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Step 2: Move Old Sessions**
|
|
235
|
+
|
|
236
|
+
Identify sessions older than 3 months:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# Example: Moving sessions from Oct-Dec 2025 to archive
|
|
240
|
+
# Cut from CODEBASE_CHANGELOG.md, paste to docs/changelog/2025-Q4.md
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Archive file template**:
|
|
244
|
+
```markdown
|
|
245
|
+
# GN Website Changelog - 2025 Q4 (Oct-Dec)
|
|
246
|
+
|
|
247
|
+
Historical session notes from October-December 2025. For current patterns, see `CODEBASE_ESSENTIALS.md`.
|
|
248
|
+
|
|
249
|
+
**Archive Period**: October 1 - December 31, 2025
|
|
250
|
+
**Total Sessions**: 24
|
|
251
|
+
**Major Themes**: Authentication refactor, image optimization, tag system
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Session: [Title] (Dec 15, 2025)
|
|
256
|
+
[Full session content...]
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Session: [Title] (Dec 10, 2025)
|
|
261
|
+
[Full session content...]
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Step 3: Update Main Changelog Header**
|
|
265
|
+
|
|
266
|
+
```markdown
|
|
267
|
+
# GN Website Changelog
|
|
268
|
+
|
|
269
|
+
Historical session notes and detailed changes. For current patterns and invariants, see `CODEBASE_ESSENTIALS.md`.
|
|
270
|
+
|
|
271
|
+
**Recent Sessions**: Last 3 months (current file)
|
|
272
|
+
**Older Sessions**: See [docs/changelog/](docs/changelog/) for quarterly archives
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
[Keep only recent sessions here]
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Step 4: Create Archive Index**
|
|
280
|
+
|
|
281
|
+
```markdown
|
|
282
|
+
# Changelog Archive Index
|
|
283
|
+
|
|
284
|
+
Historical changelog organized by quarter. For current sessions, see main `CODEBASE_CHANGELOG.md`.
|
|
285
|
+
|
|
286
|
+
## 2026
|
|
287
|
+
|
|
288
|
+
### [Q1 (Jan-Mar)](2026-Q1.md)
|
|
289
|
+
- Dependency updates skill creation
|
|
290
|
+
- WYSIWYG image tracking
|
|
291
|
+
- Tag masonry performance optimization
|
|
292
|
+
- **Sessions**: 12
|
|
293
|
+
|
|
294
|
+
## 2025
|
|
295
|
+
|
|
296
|
+
### [Q4 (Oct-Dec)](2025-Q4.md)
|
|
297
|
+
- Privacy policy feature
|
|
298
|
+
- Pagination UI implementation
|
|
299
|
+
- Authentication refactor
|
|
300
|
+
- **Sessions**: 24
|
|
301
|
+
|
|
302
|
+
### [Q3 (Jul-Sep)](2025-Q3.md)
|
|
303
|
+
- Initial project setup
|
|
304
|
+
- Django + Vue architecture
|
|
305
|
+
- **Sessions**: 18
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Archiving Best Practices
|
|
309
|
+
|
|
310
|
+
**What to Archive:**
|
|
311
|
+
- ✅ Sessions older than 3-6 months
|
|
312
|
+
- ✅ Completed features fully documented elsewhere
|
|
313
|
+
- ✅ Historical debugging sessions
|
|
314
|
+
- ✅ Temporary workarounds that were replaced
|
|
315
|
+
|
|
316
|
+
**What NOT to Archive:**
|
|
317
|
+
- ❌ Sessions documenting current patterns
|
|
318
|
+
- ❌ Recent architectural decisions
|
|
319
|
+
- ❌ Frequently referenced sessions
|
|
320
|
+
- ❌ Last 3 months of work
|
|
321
|
+
|
|
322
|
+
**Archive Naming:**
|
|
323
|
+
- `YYYY-QN.md` for quarterly archives (e.g., `2026-Q1.md`)
|
|
324
|
+
- `YYYY-MM.md` for monthly archives if needed (high activity periods)
|
|
325
|
+
- `archive-index.md` for searchable summary
|
|
326
|
+
|
|
327
|
+
## Documentation Update Workflow
|
|
328
|
+
|
|
329
|
+
### After Implementing Features
|
|
330
|
+
|
|
331
|
+
1. **Update CODEBASE_ESSENTIALS.md** if patterns changed:
|
|
332
|
+
```markdown
|
|
333
|
+
## Critical Patterns & Invariants
|
|
334
|
+
- **New Pattern**: Description with examples
|
|
335
|
+
- Link to reference implementation
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
2. **Add Changelog Entry** (MANDATORY for significant changes):
|
|
339
|
+
```markdown
|
|
340
|
+
## Session: [Brief Title] (MMM D, YYYY)
|
|
341
|
+
|
|
342
|
+
**Goal**: One sentence description
|
|
343
|
+
|
|
344
|
+
**Changes**:
|
|
345
|
+
- [file/path.ts](file/path.ts#L123): What changed and why
|
|
346
|
+
|
|
347
|
+
**Validation**:
|
|
348
|
+
- ✅ Backend tests: X passed
|
|
349
|
+
- ✅ Frontend tests: X passed
|
|
350
|
+
|
|
351
|
+
**Key Learning**: Pattern or gotcha for future reference
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
3. **Create Detailed Docs** for complex features:
|
|
355
|
+
```bash
|
|
356
|
+
docs/
|
|
357
|
+
├── components/COMPONENT_NAME.md
|
|
358
|
+
├── patterns/PATTERN_NAME.md
|
|
359
|
+
├── guides/GUIDE_NAME.md
|
|
360
|
+
└── incidents/INCIDENT_NAME.md
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Documentation File Structure
|
|
364
|
+
|
|
365
|
+
```
|
|
366
|
+
docs/
|
|
367
|
+
├── README.md # Documentation index
|
|
368
|
+
├── architecture/ # System design docs
|
|
369
|
+
│ ├── OVERVIEW.md
|
|
370
|
+
│ └── DATA_FLOW.md
|
|
371
|
+
├── components/ # Component-specific docs
|
|
372
|
+
│ ├── TURBULENT_DISSOLVE_IMAGE.md
|
|
373
|
+
│ └── PAGINATION_CONTROLS.md
|
|
374
|
+
├── deployment/ # Deployment guides
|
|
375
|
+
│ ├── RAILWAY.md
|
|
376
|
+
│ └── PRODUCTION.md
|
|
377
|
+
├── guides/ # How-to guides
|
|
378
|
+
│ ├── DEVELOPER_CHECKLIST.md
|
|
379
|
+
│ ├── TESTING_STRATEGY.md
|
|
380
|
+
│ └── AI_AGENT_PERCEPTION.md
|
|
381
|
+
├── incidents/ # Problem + solution docs
|
|
382
|
+
│ └── RAILWAY_DYNAMIC_IMPORT_FAILURE.md
|
|
383
|
+
├── patterns/ # Reusable patterns
|
|
384
|
+
│ ├── TWO_STAGE_UPLOAD_TESTING.md
|
|
385
|
+
│ └── UNIFIED_IMAGE_ARRAY_REFACTOR.md
|
|
386
|
+
├── planning/ # Planning documents
|
|
387
|
+
│ └── FEATURE_ROADMAP.md
|
|
388
|
+
├── privacy/ # Legal/compliance docs
|
|
389
|
+
│ └── privacy_and_cookie_policy.md
|
|
390
|
+
├── reference/ # API references
|
|
391
|
+
│ └── MAILERLITE_INTEGRATION.md
|
|
392
|
+
├── reviews/ # Code review guidelines
|
|
393
|
+
│ └── PULL_REQUEST_TEMPLATE.md
|
|
394
|
+
└── changelog/ # Archived changelogs
|
|
395
|
+
├── archive-index.md
|
|
396
|
+
├── 2026-Q1.md
|
|
397
|
+
└── 2025-Q4.md
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Documentation Quality Checklist
|
|
401
|
+
|
|
402
|
+
Before finalizing any documentation:
|
|
403
|
+
|
|
404
|
+
### Structure
|
|
405
|
+
- [ ] Uses semantic headings (H1 → H2 → H3, no skips)
|
|
406
|
+
- [ ] Each section is self-contained
|
|
407
|
+
- [ ] Related information is proximate (same section/paragraph)
|
|
408
|
+
- [ ] Hierarchical structure reflects logical relationships
|
|
409
|
+
|
|
410
|
+
### Content
|
|
411
|
+
- [ ] Includes explicit product/feature names (gnwebsite, Django, Vue)
|
|
412
|
+
- [ ] No reliance on visual layout or positioning
|
|
413
|
+
- [ ] Error messages quoted exactly with solutions
|
|
414
|
+
- [ ] Prerequisites stated explicitly (no assumptions)
|
|
415
|
+
- [ ] Text alternatives for any diagrams/images
|
|
416
|
+
|
|
417
|
+
### Discoverability
|
|
418
|
+
- [ ] Consistent terminology throughout
|
|
419
|
+
- [ ] Keywords appear in headings and first paragraph
|
|
420
|
+
- [ ] Cross-links to related documentation
|
|
421
|
+
- [ ] Examples include actual code/commands
|
|
422
|
+
|
|
423
|
+
### AI Optimization
|
|
424
|
+
- [ ] Sections work when read in isolation
|
|
425
|
+
- [ ] No references like "as mentioned above" without repeating context
|
|
426
|
+
- [ ] Code examples include language identifiers (```python, ```typescript)
|
|
427
|
+
- [ ] File paths use absolute paths from project root
|
|
428
|
+
|
|
429
|
+
## Common Documentation Anti-Patterns
|
|
430
|
+
|
|
431
|
+
### ❌ Contextual Dependencies
|
|
432
|
+
|
|
433
|
+
**Bad**: "Now update the configuration we set up earlier."
|
|
434
|
+
|
|
435
|
+
**Good**: "Update the Django settings in `backend/gnwebsite_config/settings.py`..."
|
|
436
|
+
|
|
437
|
+
### ❌ Implicit Knowledge
|
|
438
|
+
|
|
439
|
+
**Bad**: "Run the standard Django commands."
|
|
440
|
+
|
|
441
|
+
**Good**:
|
|
442
|
+
```bash
|
|
443
|
+
# Apply database migrations
|
|
444
|
+
docker-compose exec backend python manage.py migrate
|
|
445
|
+
|
|
446
|
+
# Collect static files
|
|
447
|
+
docker-compose exec backend python manage.py collectstatic --noinput
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### ❌ Visual-Only Information
|
|
451
|
+
|
|
452
|
+
**Bad**: Tables with merged cells and complex layouts
|
|
453
|
+
|
|
454
|
+
**Good**: Structured lists with repeated context:
|
|
455
|
+
```markdown
|
|
456
|
+
### Django Environment Variables
|
|
457
|
+
|
|
458
|
+
**DATABASE_URL**
|
|
459
|
+
- Purpose: PostgreSQL connection string
|
|
460
|
+
- Format: `postgresql://user:pass@host:5432/dbname`
|
|
461
|
+
- Required: ✅ Production, ❌ Development (uses SQLite)
|
|
462
|
+
|
|
463
|
+
**SECRET_KEY**
|
|
464
|
+
- Purpose: Django cryptographic signing
|
|
465
|
+
- Format: 50+ character random string
|
|
466
|
+
- Required: ✅ Always
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### ❌ Scattered Prerequisites
|
|
470
|
+
|
|
471
|
+
**Bad**: Prerequisites in introduction, setup in middle, troubleshooting at end
|
|
472
|
+
|
|
473
|
+
**Good**: Self-contained sections with inline prerequisites:
|
|
474
|
+
```markdown
|
|
475
|
+
## Setting Up Django Webhooks in gnwebsite
|
|
476
|
+
|
|
477
|
+
**Prerequisites** (check before proceeding):
|
|
478
|
+
- ✅ Django admin access (`/panel-0911/`)
|
|
479
|
+
- ✅ Valid HTTPS endpoint with SSL certificate
|
|
480
|
+
- ✅ gnwebsite API credentials
|
|
481
|
+
|
|
482
|
+
**Steps**:
|
|
483
|
+
1. Navigate to Admin Panel → Settings → Webhooks
|
|
484
|
+
2. ...
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
## Template: Changelog Session Entry
|
|
488
|
+
|
|
489
|
+
```markdown
|
|
490
|
+
## Session: [Brief Descriptive Title] (MMM D, YYYY)
|
|
491
|
+
|
|
492
|
+
**Goal**: One-sentence description of what this session accomplished
|
|
493
|
+
|
|
494
|
+
**Problem** (if fixing a bug/issue):
|
|
495
|
+
Brief description of the problem that required fixing
|
|
496
|
+
|
|
497
|
+
**Changes**:
|
|
498
|
+
|
|
499
|
+
- [backend/path/to/file.py](backend/path/to/file.py#L123-L145): **CREATED/UPDATED/FIXED**
|
|
500
|
+
- What changed at this location
|
|
501
|
+
- Why it was necessary
|
|
502
|
+
- Key implementation details
|
|
503
|
+
|
|
504
|
+
- [frontend/src/path/to/component.vue](frontend/src/path/to/component.vue):
|
|
505
|
+
- What changed
|
|
506
|
+
- Pattern used (link to CODEBASE_ESSENTIALS.md if relevant)
|
|
507
|
+
|
|
508
|
+
**Validation**:
|
|
509
|
+
- ✅ Backend tests: X passed, Y skipped
|
|
510
|
+
- ✅ Frontend tests: X passed
|
|
511
|
+
- ✅ TypeScript: No errors
|
|
512
|
+
- ✅ Manual testing: Description of what was tested
|
|
513
|
+
|
|
514
|
+
**Key Learning**:
|
|
515
|
+
Pattern, gotcha, or insight that should be remembered for future work. This often becomes a candidate for CODEBASE_ESSENTIALS.md.
|
|
516
|
+
|
|
517
|
+
**References** (optional):
|
|
518
|
+
- Link to related OpenSpec proposals
|
|
519
|
+
- Link to detailed documentation in docs/
|
|
520
|
+
- Link to related incidents or patterns
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
## Template: Feature Documentation
|
|
524
|
+
|
|
525
|
+
```markdown
|
|
526
|
+
# [Feature Name]
|
|
527
|
+
|
|
528
|
+
Brief overview of what this feature does and why it exists.
|
|
529
|
+
|
|
530
|
+
## Overview
|
|
531
|
+
|
|
532
|
+
- **Purpose**: What problem does this solve?
|
|
533
|
+
- **Users**: Who uses this feature?
|
|
534
|
+
- **Location**: Where in the app is this feature?
|
|
535
|
+
|
|
536
|
+
## Architecture
|
|
537
|
+
|
|
538
|
+
### Backend (Django)
|
|
539
|
+
|
|
540
|
+
**Models**: `jewelry_portfolio.models.FeatureName`
|
|
541
|
+
- Fields and relationships
|
|
542
|
+
- Key methods and their purpose
|
|
543
|
+
|
|
544
|
+
**API Endpoints**: `/api/feature/`
|
|
545
|
+
- GET: Retrieve feature data
|
|
546
|
+
- POST: Create new feature
|
|
547
|
+
- PUT/PATCH: Update feature
|
|
548
|
+
- DELETE: Remove feature
|
|
549
|
+
|
|
550
|
+
**Permissions**: `IsAdminOrReadOnly`
|
|
551
|
+
|
|
552
|
+
### Frontend (Vue 3)
|
|
553
|
+
|
|
554
|
+
**Views**:
|
|
555
|
+
- `FeatureView.vue` - Public view at `/feature`
|
|
556
|
+
- `FeatureForm.vue` - Admin editor at `/panel-0911/feature`
|
|
557
|
+
|
|
558
|
+
**Services**: `featureService.ts`
|
|
559
|
+
- API wrapper methods
|
|
560
|
+
- Type definitions
|
|
561
|
+
|
|
562
|
+
**Components**:
|
|
563
|
+
- `FeatureCard.vue` - Display component
|
|
564
|
+
- `FeatureEditor.vue` - Editing component
|
|
565
|
+
|
|
566
|
+
## Usage Examples
|
|
567
|
+
|
|
568
|
+
### Retrieving Feature Data
|
|
569
|
+
|
|
570
|
+
```typescript
|
|
571
|
+
import { featureService } from '@/services/featureService'
|
|
572
|
+
|
|
573
|
+
const data = await featureService.get()
|
|
574
|
+
console.log(data.value)
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### Admin Updates
|
|
578
|
+
|
|
579
|
+
```typescript
|
|
580
|
+
const updated = await featureService.update({
|
|
581
|
+
field: 'new value',
|
|
582
|
+
anotherField: 123
|
|
583
|
+
})
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
## Testing
|
|
587
|
+
|
|
588
|
+
### Backend Tests
|
|
589
|
+
|
|
590
|
+
Location: `backend/jewelry_portfolio/test_feature.py`
|
|
591
|
+
|
|
592
|
+
```bash
|
|
593
|
+
# Run feature tests
|
|
594
|
+
docker-compose exec backend pytest jewelry_portfolio/test_feature.py -v
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
Coverage:
|
|
598
|
+
- Model CRUD operations
|
|
599
|
+
- API permissions (public/admin)
|
|
600
|
+
- Serialization/validation
|
|
601
|
+
- Edge cases
|
|
602
|
+
|
|
603
|
+
### Frontend Tests
|
|
604
|
+
|
|
605
|
+
Location: `frontend/tests/feature.test.ts`
|
|
606
|
+
|
|
607
|
+
```bash
|
|
608
|
+
# Run feature tests
|
|
609
|
+
cd frontend && npm run test:run tests/feature.test.ts
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
Coverage:
|
|
613
|
+
- Component rendering
|
|
614
|
+
- API integration
|
|
615
|
+
- Error handling
|
|
616
|
+
- User interactions
|
|
617
|
+
|
|
618
|
+
## Common Patterns
|
|
619
|
+
|
|
620
|
+
### Pattern 1: [Name]
|
|
621
|
+
|
|
622
|
+
**When to use**: Description
|
|
623
|
+
|
|
624
|
+
**Example**:
|
|
625
|
+
```python
|
|
626
|
+
# Backend example
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
```typescript
|
|
630
|
+
// Frontend example
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
## Troubleshooting
|
|
634
|
+
|
|
635
|
+
### Error: "[Exact Error Message]"
|
|
636
|
+
|
|
637
|
+
**Cause**: What causes this error
|
|
638
|
+
|
|
639
|
+
**Solution**:
|
|
640
|
+
1. Step-by-step fix
|
|
641
|
+
2. With commands
|
|
642
|
+
3. And verification
|
|
643
|
+
|
|
644
|
+
## Related Documentation
|
|
645
|
+
|
|
646
|
+
- [CODEBASE_ESSENTIALS.md](../../CODEBASE_ESSENTIALS.md#relevant-section)
|
|
647
|
+
- [docs/patterns/RELATED_PATTERN.md](../patterns/RELATED_PATTERN.md)
|
|
648
|
+
- [OpenSpec: Feature Proposal](../../openspec/changes/feature-name/)
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
## Changelog Archiving Checklist
|
|
652
|
+
|
|
653
|
+
When archiving old changelog entries:
|
|
654
|
+
|
|
655
|
+
- [ ] Identify sessions older than 3-6 months
|
|
656
|
+
- [ ] Create quarterly archive file: `docs/changelog/YYYY-QN.md`
|
|
657
|
+
- [ ] Copy archive header template with period, session count, themes
|
|
658
|
+
- [ ] Move old sessions from CODEBASE_CHANGELOG.md to archive
|
|
659
|
+
- [ ] Update main changelog header with archive reference
|
|
660
|
+
- [ ] Create/update `docs/changelog/archive-index.md` with summary
|
|
661
|
+
- [ ] Verify links to archived sessions still work
|
|
662
|
+
- [ ] Test that recent sessions remain easily accessible
|
|
663
|
+
- [ ] Commit with message: `docs: archive changelog Q[N] YYYY (X sessions)`
|
|
664
|
+
|
|
665
|
+
## Integration with Other Skills
|
|
666
|
+
|
|
667
|
+
- **After features**: Use [feature-implementation](../feature-implementation/SKILL.md) → then update docs
|
|
668
|
+
- **Before archiving**: Check [developer-checklist](../developer-checklist/SKILL.md) for recent patterns
|
|
669
|
+
- **Creating skills**: Use [skill-creator](../skill-creator/SKILL.md) to convert docs into skills
|
|
670
|
+
|
|
671
|
+
## Related Files
|
|
672
|
+
|
|
673
|
+
- [CODEBASE_ESSENTIALS.md](../../../CODEBASE_ESSENTIALS.md) - Current patterns and invariants
|
|
674
|
+
- [CODEBASE_CHANGELOG.md](../../../CODEBASE_CHANGELOG.md) - Recent session history
|
|
675
|
+
- [docs/README.md](../../../docs/README.md) - Documentation index
|
|
676
|
+
- [AGENTS.md](../../../AGENTS.md) - AI agent workflow instructions
|
|
677
|
+
|
|
678
|
+
## Quick Reference
|
|
679
|
+
|
|
680
|
+
### Archive Changelog (When > 1500 lines)
|
|
681
|
+
|
|
682
|
+
```bash
|
|
683
|
+
# 1. Create archive directory
|
|
684
|
+
mkdir -p docs/changelog
|
|
685
|
+
|
|
686
|
+
# 2. Create quarterly archive
|
|
687
|
+
cat > docs/changelog/2026-Q1.md << 'EOF'
|
|
688
|
+
# GN Website Changelog - 2026 Q1 (Jan-Mar)
|
|
689
|
+
|
|
690
|
+
**Archive Period**: January 1 - March 31, 2026
|
|
691
|
+
**Total Sessions**: 12
|
|
692
|
+
**Major Themes**: Dependency management, image tracking, performance
|
|
693
|
+
|
|
694
|
+
---
|
|
695
|
+
|
|
696
|
+
[Move old sessions here]
|
|
697
|
+
EOF
|
|
698
|
+
|
|
699
|
+
# 3. Update main changelog header
|
|
700
|
+
# Remove old sessions (keep last 3 months)
|
|
701
|
+
|
|
702
|
+
# 4. Create/update index
|
|
703
|
+
cat > docs/changelog/archive-index.md << 'EOF'
|
|
704
|
+
# Changelog Archive Index
|
|
705
|
+
|
|
706
|
+
## 2026
|
|
707
|
+
### [Q1 (Jan-Mar)](2026-Q1.md) - 12 sessions
|
|
708
|
+
EOF
|
|
709
|
+
|
|
710
|
+
# 5. Commit
|
|
711
|
+
git add docs/changelog/ CODEBASE_CHANGELOG.md
|
|
712
|
+
git commit -m "docs: archive changelog Q1 2026 (12 sessions)"
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
### Create Feature Documentation
|
|
716
|
+
|
|
717
|
+
```bash
|
|
718
|
+
# Create component doc
|
|
719
|
+
cat > docs/components/COMPONENT_NAME.md << 'EOF'
|
|
720
|
+
# Component Name
|
|
721
|
+
|
|
722
|
+
Brief overview...
|
|
723
|
+
|
|
724
|
+
## Architecture
|
|
725
|
+
...
|
|
726
|
+
EOF
|
|
727
|
+
|
|
728
|
+
# Create pattern doc
|
|
729
|
+
cat > docs/patterns/PATTERN_NAME.md << 'EOF'
|
|
730
|
+
# Pattern Name
|
|
731
|
+
|
|
732
|
+
When to use this pattern...
|
|
733
|
+
EOF
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
### Update CODEBASE_ESSENTIALS.md
|
|
737
|
+
|
|
738
|
+
```markdown
|
|
739
|
+
## Critical Patterns & Invariants
|
|
740
|
+
- **New Pattern Name**: Description
|
|
741
|
+
- ✅ **DO:** Good practice
|
|
742
|
+
- ❌ **DON'T:** Anti-pattern
|
|
743
|
+
- **Reference**: [ComponentName.vue](path/to/file.vue)
|
|
744
|
+
```
|