specweave 0.26.4 → 0.26.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CLAUDE.md +154 -4
  2. package/bin/specweave.js +15 -0
  3. package/dist/plugins/specweave-github/lib/completion-calculator.js +2 -2
  4. package/dist/plugins/specweave-github/lib/completion-calculator.js.map +1 -1
  5. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts +28 -1
  6. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -1
  7. package/dist/plugins/specweave-github/lib/github-feature-sync.js +191 -19
  8. package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -1
  9. package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts +3 -0
  10. package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts.map +1 -1
  11. package/dist/plugins/specweave-github/lib/user-story-issue-builder.js +25 -2
  12. package/dist/plugins/specweave-github/lib/user-story-issue-builder.js.map +1 -1
  13. package/dist/src/cli/commands/archive.d.ts +10 -0
  14. package/dist/src/cli/commands/archive.d.ts.map +1 -0
  15. package/dist/src/cli/commands/archive.js +78 -0
  16. package/dist/src/cli/commands/archive.js.map +1 -0
  17. package/dist/src/cli/commands/init.js +2 -2
  18. package/dist/src/cli/commands/init.js.map +1 -1
  19. package/dist/src/cli/helpers/init/initial-increment-generator.d.ts.map +1 -1
  20. package/dist/src/cli/helpers/init/initial-increment-generator.js +48 -8
  21. package/dist/src/cli/helpers/init/initial-increment-generator.js.map +1 -1
  22. package/dist/src/core/increment/increment-reopener.d.ts.map +1 -1
  23. package/dist/src/core/increment/increment-reopener.js +13 -14
  24. package/dist/src/core/increment/increment-reopener.js.map +1 -1
  25. package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
  26. package/dist/src/core/increment/metadata-manager.js +19 -0
  27. package/dist/src/core/increment/metadata-manager.js.map +1 -1
  28. package/dist/src/core/increment/status-change-sync-trigger.d.ts +85 -0
  29. package/dist/src/core/increment/status-change-sync-trigger.d.ts.map +1 -0
  30. package/dist/src/core/increment/status-change-sync-trigger.js +137 -0
  31. package/dist/src/core/increment/status-change-sync-trigger.js.map +1 -0
  32. package/dist/src/core/increment/sync-circuit-breaker.d.ts +64 -0
  33. package/dist/src/core/increment/sync-circuit-breaker.d.ts.map +1 -0
  34. package/dist/src/core/increment/sync-circuit-breaker.js +95 -0
  35. package/dist/src/core/increment/sync-circuit-breaker.js.map +1 -0
  36. package/dist/src/core/living-docs/living-docs-sync.d.ts +12 -0
  37. package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
  38. package/dist/src/core/living-docs/living-docs-sync.js +157 -24
  39. package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
  40. package/dist/src/init/repo/types.d.ts +1 -1
  41. package/package.json +2 -2
  42. package/plugins/specweave/agents/pm/AGENT.md +13 -7
  43. package/plugins/specweave/commands/sync-diagnostics.md +227 -0
  44. package/plugins/specweave/hooks/docs-changed.sh.backup +79 -0
  45. package/plugins/specweave/hooks/human-input-required.sh.backup +75 -0
  46. package/plugins/specweave/hooks/post-first-increment.sh.backup +61 -0
  47. package/plugins/specweave/hooks/post-increment-change.sh.backup +98 -0
  48. package/plugins/specweave/hooks/post-increment-completion.sh.backup +231 -0
  49. package/plugins/specweave/hooks/post-increment-planning.sh.backup +1048 -0
  50. package/plugins/specweave/hooks/post-increment-status-change.sh.backup +147 -0
  51. package/plugins/specweave/hooks/post-spec-update.sh.backup +158 -0
  52. package/plugins/specweave/hooks/post-user-story-complete.sh.backup +179 -0
  53. package/plugins/specweave/hooks/pre-command-deduplication.sh.backup +83 -0
  54. package/plugins/specweave/hooks/pre-implementation.sh.backup +67 -0
  55. package/plugins/specweave/hooks/pre-task-completion.sh.backup +194 -0
  56. package/plugins/specweave/hooks/pre-tool-use.sh.backup +133 -0
  57. package/plugins/specweave/hooks/user-prompt-submit.sh +20 -8
  58. package/plugins/specweave/hooks/user-prompt-submit.sh.backup +386 -0
  59. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +19 -0
  60. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -1
  61. package/plugins/specweave/skills/brownfield-analyzer/SKILL.md +267 -868
  62. package/plugins/specweave/skills/increment-planner/SKILL.md +379 -1245
  63. package/plugins/specweave/skills/role-orchestrator/SKILL.md +293 -969
  64. package/plugins/specweave-ado/hooks/post-living-docs-update.sh.backup +353 -0
  65. package/plugins/specweave-ado/hooks/post-task-completion.sh.backup +172 -0
  66. package/plugins/specweave-ado/lib/ado-multi-project-sync.js +1 -0
  67. package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
  68. package/plugins/specweave-docs/skills/technical-writing/SKILL.md +333 -839
  69. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +1080 -0
  70. package/plugins/specweave-github/hooks/post-task-completion.sh.backup +258 -0
  71. package/plugins/specweave-github/lib/completion-calculator.js +1 -1
  72. package/plugins/specweave-github/lib/completion-calculator.ts +2 -2
  73. package/plugins/specweave-github/lib/github-feature-sync.js +152 -18
  74. package/plugins/specweave-github/lib/github-feature-sync.ts +225 -22
  75. package/plugins/specweave-github/lib/user-story-issue-builder.js +21 -1
  76. package/plugins/specweave-github/lib/user-story-issue-builder.ts +31 -3
  77. package/plugins/specweave-jira/hooks/post-task-completion.sh.backup +172 -0
  78. package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
  79. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +981 -0
  80. package/plugins/specweave-release/hooks/post-task-completion.sh.backup +110 -0
  81. package/plugins/specweave-testing/skills/tdd-expert/SKILL.md +269 -749
  82. package/plugins/specweave-testing/skills/unit-testing-expert/SKILL.md +318 -810
@@ -5,335 +5,377 @@ description: Technical writing expert for API documentation, README files, tutor
5
5
 
6
6
  # Technical Writing Skill
7
7
 
8
- Expert in technical documentation, API reference writing, tutorials, and developer-focused content. Specializes in clear, concise, and comprehensive documentation that developers actually use.
8
+ **Self-contained technical documentation expertise for ANY user project.**
9
+
10
+ Expert in developer-focused documentation: READMEs, API references, tutorials, and changelogs.
11
+
12
+ ---
9
13
 
10
14
  ## Core Documentation Types
11
15
 
12
16
  ### 1. README Files
13
17
 
14
- **Essential Sections**:
15
-
18
+ **Essential Structure**:
16
19
  ```markdown
17
20
  # Project Name
18
21
 
19
- One-sentence description of what this project does.
22
+ One-sentence description.
20
23
 
21
24
  ## Features
22
-
23
25
  - Key feature 1
24
26
  - Key feature 2
25
- - Key feature 3
26
27
 
27
28
  ## Installation
28
-
29
29
  ```bash
30
30
  npm install project-name
31
31
  ```
32
32
 
33
33
  ## Quick Start
34
-
35
34
  ```javascript
36
35
  import { ProjectName } from 'project-name';
37
-
38
36
  const instance = new ProjectName();
39
- instance.doSomething();
40
37
  ```
41
38
 
42
39
  ## Usage
43
-
44
- ### Basic Example
45
-
46
- [Runnable code example]
47
-
48
- ### Advanced Example
49
-
50
- [More complex use case]
40
+ [Basic example]
51
41
 
52
42
  ## API Reference
53
-
54
- Link to detailed API docs or inline reference.
55
-
56
- ## Configuration
57
-
58
- Available options and their defaults.
43
+ [Link or inline reference]
59
44
 
60
45
  ## Contributing
61
-
62
- Link to CONTRIBUTING.md
46
+ [Link to CONTRIBUTING.md]
63
47
 
64
48
  ## License
65
-
66
- MIT (or your license)
49
+ MIT
67
50
  ```
68
51
 
69
52
  **Best Practices**:
70
- - **Lead with value**: What problem does this solve?
71
- - **Show, don't tell**: Code examples > long explanations
72
- - **Progressive disclosure**: Quick start → Advanced features
73
- - **Keep it updated**: Sync with actual code behavior
74
-
75
- **Examples**:
53
+ - Lead with value (what problem solved?)
54
+ - Code examples > long explanations
55
+ - Progressive disclosure (quick start → advanced)
56
+ - Keep updated with code
76
57
 
77
- **Bad README**:
78
- ```markdown
79
- # My Project
80
-
81
- This is a library.
82
-
83
- ## Installation
84
- npm install
58
+ ### 2. API Documentation
85
59
 
86
- ## Usage
87
- Use it in your code.
60
+ **Function/Method Documentation**:
61
+ ```typescript
62
+ /**
63
+ * Compress image with quality settings
64
+ *
65
+ * @param {string} input - Path to input image
66
+ * @param {CompressOptions} options - Compression options
67
+ * @param {number} options.quality - Quality 0-100 (default: 80)
68
+ * @param {string} options.format - Output format: jpeg|png|webp
69
+ *
70
+ * @returns {Promise<CompressResult>} Compression result with saved bytes
71
+ *
72
+ * @example
73
+ * const result = await compress('photo.jpg', { quality: 90 });
74
+ * console.log(`Saved ${result.savedBytes} bytes`);
75
+ */
88
76
  ```
89
77
 
90
- **Good README**:
78
+ **REST API Documentation**:
91
79
  ```markdown
92
- # Image Optimizer
80
+ ### POST /api/users
93
81
 
94
- Compress images up to 80% without visible quality loss. Supports JPEG, PNG, WebP.
82
+ Create a new user.
95
83
 
96
- ## Installation
84
+ **Request**:
85
+ ```json
86
+ {
87
+ "email": "user@example.com",
88
+ "name": "John Doe"
89
+ }
90
+ ```
97
91
 
98
- ```bash
99
- npm install image-optimizer
92
+ **Response** (201 Created):
93
+ ```json
94
+ {
95
+ "id": "uuid",
96
+ "email": "user@example.com",
97
+ "name": "John Doe",
98
+ "created": "2025-11-24T12:00:00Z"
99
+ }
100
100
  ```
101
101
 
102
- ## Quick Start
102
+ **Errors**:
103
+ - 400: Invalid email format
104
+ - 409: Email already exists
105
+ ```
103
106
 
104
- ```javascript
105
- import { optimize } from 'image-optimizer';
107
+ ### 3. Tutorials
106
108
 
107
- // Compress a single image
108
- const result = await optimize('input.jpg', {
109
- quality: 80,
110
- format: 'webp'
111
- });
112
- console.log(`Saved ${result.savedBytes} bytes`);
113
- ```
109
+ **Structure**:
110
+ ```markdown
111
+ # Tutorial: Build X in 10 Minutes
114
112
 
115
- ## Features
113
+ **You'll learn**:
114
+ - How to set up X
115
+ - Core concepts
116
+ - Build a working example
116
117
 
117
- - ✅ Lossless and lossy compression
118
- - Batch processing (parallel)
119
- - Format conversion (JPEG → WebP, PNG → AVIF)
120
- - ✅ Preserves EXIF metadata
121
- - ✅ CLI and Node.js API
118
+ **Prerequisites**:
119
+ - Node.js 18+
120
+ - Basic JavaScript knowledge
122
121
 
123
- ## CLI Usage
122
+ ## Step 1: Setup
124
123
 
125
124
  ```bash
126
- image-optimizer input.jpg --quality 80 --format webp
125
+ npm create vite@latest my-project
126
+ cd my-project
127
+ npm install
127
128
  ```
128
129
 
129
- ## API
130
+ ## Step 2: Create Component
130
131
 
131
- ### `optimize(input, options)`
132
+ [Code with explanation]
132
133
 
133
- Compress a single image.
134
+ ## Step 3: Test It
134
135
 
135
- **Parameters**:
136
- - `input` (string): Path to input image
137
- - `options` (object):
138
- - `quality` (number, 0-100): Compression quality (default: 80)
139
- - `format` (string): Output format - `jpeg`, `png`, `webp` (default: auto-detect)
136
+ [How to run and verify]
140
137
 
141
- **Returns**: `Promise<OptimizeResult>`
138
+ ## Next Steps
142
139
 
143
- **Example**:
144
- ```javascript
145
- const result = await optimize('photo.jpg', { quality: 90 });
146
- ```
140
+ - Advanced feature 1
141
+ - Advanced feature 2
142
+ - Link to API docs
147
143
  ```
148
144
 
149
- ### 2. API Documentation
145
+ **Best Practices**:
146
+ - State prerequisites up front
147
+ - Break into small, testable steps
148
+ - Show expected output at each step
149
+ - Link to related docs
150
150
 
151
- #### RESTful API Documentation
151
+ ### 4. Changelogs
152
152
 
153
+ **Keep a Changelog Format** (keepachangelog.com):
153
154
  ```markdown
154
- # API Reference
155
+ # Changelog
155
156
 
156
- Base URL: `https://api.example.com/v1`
157
+ All notable changes to this project will be documented in this file.
157
158
 
158
- ## Authentication
159
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
160
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
159
161
 
160
- All requests require an API key in the header:
162
+ ## [Unreleased]
161
163
 
162
- ```bash
163
- Authorization: Bearer YOUR_API_KEY
164
- ```
164
+ ### Added
165
+ - New feature X for Y use case
165
166
 
166
- ## Endpoints
167
+ ### Changed
168
+ - Improved performance of Z by 40%
167
169
 
168
- ### Get User
170
+ ### Fixed
171
+ - Critical bug in authentication (CVE-2024-1234)
169
172
 
170
- Retrieve user details by ID.
173
+ ## [1.2.0] - 2025-11-24
171
174
 
172
- **Endpoint**: `GET /users/:id`
175
+ ### Added
176
+ - Real-time notifications via WebSocket
177
+ - Export to PDF functionality
173
178
 
174
- **Parameters**:
175
- - `id` (path parameter, required): User ID (UUID v4)
179
+ ### Changed
180
+ - Updated dependencies (React 19)
176
181
 
177
- **Headers**:
178
- - `Authorization: Bearer <token>` (required)
182
+ ### Deprecated
183
+ - `oldMethod()` - use `newMethod()` instead
179
184
 
180
- **Example Request**:
181
- ```bash
182
- curl -H "Authorization: Bearer abc123" \
183
- https://api.example.com/v1/users/550e8400-e29b-41d4-a716-446655440000
184
- ```
185
+ ### Removed
186
+ - Legacy API v1 endpoints
185
187
 
186
- **Success Response (200 OK)**:
187
- ```json
188
- {
189
- "id": "550e8400-e29b-41d4-a716-446655440000",
190
- "email": "user@example.com",
191
- "name": "John Doe",
192
- "created_at": "2024-01-15T10:30:00Z",
193
- "status": "active"
194
- }
195
- ```
188
+ ### Fixed
189
+ - Memory leak in image processing
190
+ - CORS issue with production domain
196
191
 
197
- **Error Responses**:
192
+ ### Security
193
+ - Fixed SQL injection vulnerability (CVE-2025-5678)
198
194
 
199
- **404 Not Found** - User does not exist
200
- ```json
201
- {
202
- "error": "USER_NOT_FOUND",
203
- "message": "No user found with ID 550e8400-e29b-41d4-a716-446655440000"
204
- }
205
- ```
195
+ ## [1.1.0] - 2025-11-01
206
196
 
207
- **401 Unauthorized** - Invalid or missing API key
208
- ```json
209
- {
210
- "error": "UNAUTHORIZED",
211
- "message": "Invalid API key"
212
- }
197
+ [Previous release notes]
213
198
  ```
214
199
 
215
- **Rate Limiting**:
216
- - 100 requests per minute per API key
217
- - Header `X-RateLimit-Remaining` shows remaining requests
218
- - Returns `429 Too Many Requests` when exceeded
200
+ **Categories**:
201
+ - **Added**: New features
202
+ - **Changed**: Changes in existing functionality
203
+ - **Deprecated**: Soon-to-be removed features
204
+ - **Removed**: Now removed features
205
+ - **Fixed**: Bug fixes
206
+ - **Security**: Vulnerability fixes
219
207
 
220
208
  ---
221
209
 
222
- ### Create User
210
+ ## Style Guide Essentials
223
211
 
224
- Create a new user account.
212
+ ### Voice & Tone
225
213
 
226
- **Endpoint**: `POST /users`
214
+ **Active Voice** (preferred):
215
+ - ✅ "The function returns an array"
216
+ - ❌ "An array is returned by the function"
227
217
 
228
- **Headers**:
229
- - `Content-Type: application/json` (required)
230
- - `Authorization: Bearer <token>` (required)
218
+ **Present Tense** (preferred):
219
+ - "The API validates input"
220
+ - "The API will validate input"
231
221
 
232
- **Request Body**:
233
- ```json
234
- {
235
- "email": "user@example.com", // required, valid email
236
- "name": "John Doe", // required, 1-100 chars
237
- "password": "SecurePass123!", // required, min 8 chars
238
- "role": "user" // optional, default: "user"
239
- }
240
- ```
222
+ **Second Person** (for tutorials):
223
+ - ✅ "You can configure the timeout"
224
+ - ❌ "Users can configure the timeout"
241
225
 
242
- **Validation Rules**:
243
- - Email must be unique
244
- - Password must contain: 8+ chars, 1 uppercase, 1 number, 1 special char
245
- - Role must be one of: `user`, `admin`, `moderator`
226
+ ### Clarity Rules
246
227
 
247
- **Example Request**:
248
- ```bash
249
- curl -X POST https://api.example.com/v1/users \
250
- -H "Content-Type: application/json" \
251
- -H "Authorization: Bearer abc123" \
252
- -d '{"email":"user@example.com","name":"John Doe","password":"SecurePass123!"}'
253
- ```
228
+ **Be Specific**:
229
+ - ✅ "Set timeout to 5000ms"
230
+ - "Set a reasonable timeout"
254
231
 
255
- **Success Response (201 Created)**:
256
- ```json
257
- {
258
- "id": "550e8400-e29b-41d4-a716-446655440000",
259
- "email": "user@example.com",
260
- "name": "John Doe",
261
- "role": "user",
262
- "created_at": "2024-01-15T10:30:00Z"
263
- }
232
+ **Avoid Jargon** (or explain it):
233
+ - ✅ "Idempotent (can be called multiple times safely)"
234
+ - ❌ "The endpoint is idempotent"
235
+
236
+ **Short Sentences**:
237
+ - "Install the package. Then import it."
238
+ - ❌ "After installing the package, you need to import it into your project."
239
+
240
+ ### Code Examples
241
+
242
+ **Show Complete Examples**:
243
+ ```javascript
244
+ // ✅ GOOD - Complete, runnable
245
+ import { connect } from 'database';
246
+
247
+ const db = await connect({
248
+ host: 'localhost',
249
+ port: 5432
250
+ });
251
+
252
+ const users = await db.query('SELECT * FROM users');
253
+ console.log(users);
264
254
  ```
265
255
 
266
- **Error Responses**:
256
+ ```javascript
257
+ // ❌ BAD - Incomplete
258
+ db.query('SELECT * FROM users');
259
+ ```
267
260
 
268
- **400 Bad Request** - Validation error
269
- ```json
270
- {
271
- "error": "VALIDATION_ERROR",
272
- "message": "Email already exists",
273
- "field": "email"
261
+ **Include Error Handling**:
262
+ ```javascript
263
+ // ✅ GOOD
264
+ try {
265
+ const result = await processImage('photo.jpg');
266
+ console.log('Success:', result);
267
+ } catch (error) {
268
+ console.error('Failed to process image:', error.message);
274
269
  }
275
270
  ```
276
271
 
277
- **422 Unprocessable Entity** - Password complexity
278
- ```json
279
- {
280
- "error": "INVALID_PASSWORD",
281
- "message": "Password must contain at least one special character",
282
- "field": "password"
283
- }
272
+ ---
273
+
274
+ ## Documentation Structure
275
+
276
+ ### Information Architecture
277
+
278
+ **Organize by User Journey**:
279
+ ```
280
+ docs/
281
+ ├── getting-started/
282
+ │ ├── installation.md
283
+ │ ├── quick-start.md
284
+ │ └── first-project.md
285
+ ├── guides/
286
+ │ ├── authentication.md
287
+ │ ├── deployment.md
288
+ │ └── troubleshooting.md
289
+ ├── api-reference/
290
+ │ ├── client.md
291
+ │ ├── server.md
292
+ │ └── types.md
293
+ └── examples/
294
+ ├── basic-crud.md
295
+ ├── real-time-updates.md
296
+ └── advanced-queries.md
284
297
  ```
298
+
299
+ **Progressive Disclosure**:
300
+ 1. **Getting Started**: Quickest path to value
301
+ 2. **Guides**: Task-oriented how-tos
302
+ 3. **API Reference**: Complete technical reference
303
+ 4. **Examples**: Real-world patterns
304
+
305
+ ### Navigation Best Practices
306
+
307
+ **Clear Hierarchy**:
308
+ - Use consistent heading levels (H1 → H2 → H3)
309
+ - Don't skip heading levels
310
+ - One H1 per page
311
+
312
+ **Cross-Linking**:
313
+ - Link to related docs
314
+ - Link to prerequisites
315
+ - Link to next steps
316
+
317
+ **Table of Contents** (for long pages):
318
+ ```markdown
319
+ ## Table of Contents
320
+
321
+ - [Installation](#installation)
322
+ - [Configuration](#configuration)
323
+ - [Usage](#usage)
324
+ - [Basic Example](#basic-example)
325
+ - [Advanced Example](#advanced-example)
326
+ - [API Reference](#api-reference)
285
327
  ```
286
328
 
287
- #### OpenAPI/Swagger Specification
329
+ ---
330
+
331
+ ## OpenAPI / Swagger
332
+
333
+ ### OpenAPI 3.0 Template
288
334
 
289
335
  ```yaml
290
336
  openapi: 3.0.0
291
337
  info:
292
- title: Example API
338
+ title: User API
293
339
  version: 1.0.0
294
- description: API for user management
340
+ description: User management API
295
341
 
296
342
  servers:
297
343
  - url: https://api.example.com/v1
298
344
 
299
345
  paths:
300
- /users/{id}:
346
+ /users:
301
347
  get:
302
- summary: Get user by ID
303
- description: Retrieve detailed user information
304
- operationId: getUser
305
- tags:
306
- - Users
307
- parameters:
308
- - name: id
309
- in: path
310
- required: true
311
- schema:
312
- type: string
313
- format: uuid
314
- description: User ID (UUID v4)
348
+ summary: List all users
315
349
  responses:
316
350
  '200':
317
- description: User found
351
+ description: Successful response
318
352
  content:
319
353
  application/json:
320
354
  schema:
321
- $ref: '#/components/schemas/User'
322
- '404':
323
- description: User not found
355
+ type: array
356
+ items:
357
+ $ref: '#/components/schemas/User'
358
+
359
+ post:
360
+ summary: Create user
361
+ requestBody:
362
+ required: true
363
+ content:
364
+ application/json:
365
+ schema:
366
+ $ref: '#/components/schemas/CreateUser'
367
+ responses:
368
+ '201':
369
+ description: User created
324
370
  content:
325
371
  application/json:
326
372
  schema:
327
- $ref: '#/components/schemas/Error'
373
+ $ref: '#/components/schemas/User'
328
374
 
329
375
  components:
330
376
  schemas:
331
377
  User:
332
378
  type: object
333
- required:
334
- - id
335
- - email
336
- - name
337
379
  properties:
338
380
  id:
339
381
  type: string
@@ -343,697 +385,149 @@ components:
343
385
  format: email
344
386
  name:
345
387
  type: string
346
- minLength: 1
347
- maxLength: 100
348
- created_at:
349
- type: string
350
- format: date-time
351
- status:
352
- type: string
353
- enum: [active, inactive, suspended]
354
388
 
355
- Error:
389
+ CreateUser:
356
390
  type: object
357
391
  required:
358
- - error
359
- - message
392
+ - email
393
+ - name
360
394
  properties:
361
- error:
362
- type: string
363
- message:
395
+ email:
364
396
  type: string
365
- field:
397
+ format: email
398
+ name:
366
399
  type: string
367
400
  ```
368
401
 
369
- ### 3. Tutorials and Guides
370
-
371
- **Structure**:
372
-
373
- ```markdown
374
- # Tutorial: Building Your First Widget
375
-
376
- **Estimated Time**: 20 minutes
377
- **Prerequisites**: Node.js 18+, npm 9+
378
- **What You'll Build**: A real-time notification widget
379
-
380
- ## What You'll Learn
381
-
382
- - How to initialize a widget instance
383
- - How to configure event handlers
384
- - How to style widgets with CSS
385
- - How to deploy to production
386
-
387
402
  ---
388
403
 
389
- ## Step 1: Installation
404
+ ## Documentation Maintenance
390
405
 
391
- Install the widget library:
392
-
393
- ```bash
394
- npm install widget-library
395
- ```
406
+ ### Versioning Strategy
396
407
 
397
- **Expected Output**:
408
+ **Version docs alongside code**:
398
409
  ```
399
- + widget-library@1.0.0
400
- added 1 package
410
+ docs/
411
+ ├── v1.0/
412
+ │ ├── api.md
413
+ │ └── guides.md
414
+ ├── v2.0/
415
+ │ ├── api.md
416
+ │ ├── guides.md
417
+ │ └── migration.md
418
+ └── latest/ → symlink to v2.0/
401
419
  ```
402
420
 
403
- ---
421
+ **Migration Guides**:
422
+ ```markdown
423
+ # Migrating from v1 to v2
404
424
 
405
- ## Step 2: Create Basic Widget
425
+ ## Breaking Changes
406
426
 
407
- Create a new file `widget.js`:
427
+ ### Authentication
408
428
 
429
+ **v1**:
409
430
  ```javascript
410
- import { Widget } from 'widget-library';
411
-
412
- const widget = new Widget({
413
- container: '#app',
414
- theme: 'light'
415
- });
416
-
417
- widget.render();
431
+ const api = new API({ token: 'abc123' });
418
432
  ```
419
433
 
420
- **What's Happening Here?**
421
- - `container`: CSS selector for mounting point
422
- - `theme`: Visual theme (light/dark)
423
- - `render()`: Displays the widget on the page
424
-
425
- **Try It**: Open `index.html` in a browser. You should see a blank widget.
426
-
427
- ---
428
-
429
- ## Step 3: Add Event Handlers
430
-
431
- Update `widget.js` to handle notifications:
432
-
434
+ **v2**:
433
435
  ```javascript
434
- widget.on('notification', (data) => {
435
- console.log('New notification:', data.message);
436
- });
437
-
438
- // Simulate a notification
439
- widget.notify({
440
- message: 'Hello, World!',
441
- type: 'info'
436
+ const api = new API({
437
+ auth: { bearer: 'abc123' }
442
438
  });
443
439
  ```
444
440
 
445
- **Expected Behavior**:
446
- - Console logs: "New notification: Hello, World!"
447
- - Widget displays a blue info box
448
-
449
- ---
450
-
451
- ## Step 4: Customize Styles
452
-
453
- Create `widget.css`:
454
-
455
- ```css
456
- .widget {
457
- border: 2px solid #3498db;
458
- border-radius: 8px;
459
- padding: 16px;
460
- }
461
-
462
- .widget-notification {
463
- background: #ecf0f1;
464
- color: #2c3e50;
465
- }
466
- ```
467
-
468
- **Result**: Widget now has rounded corners and custom colors.
469
-
470
- ---
471
-
472
- ## Troubleshooting
473
-
474
- **Problem**: Widget doesn't appear
475
- - ✅ Check that `#app` element exists in HTML
476
- - ✅ Verify `widget.render()` is called
477
- - ✅ Open browser console for errors
478
-
479
- **Problem**: Notifications don't show
480
- - ✅ Ensure event handler is registered before calling `notify()`
481
- - ✅ Check notification type is valid (`info`, `warning`, `error`)
482
-
483
- ---
484
-
485
- ## Next Steps
486
-
487
- - [Advanced Configuration](./advanced-config.md)
488
- - [Custom Themes](./themes.md)
489
- - [Production Deployment](./deployment.md)
490
-
491
- ---
492
-
493
- ## Complete Code
494
-
495
- ```javascript
496
- // widget.js
497
- import { Widget } from 'widget-library';
498
-
499
- const widget = new Widget({
500
- container: '#app',
501
- theme: 'light'
502
- });
503
-
504
- widget.on('notification', (data) => {
505
- console.log('New notification:', data.message);
506
- });
441
+ ### What Changed
442
+ - `token` parameter renamed to `auth.bearer`
443
+ - Supports multiple auth methods now
507
444
 
508
- widget.render();
445
+ ### Migration Steps
509
446
 
510
- widget.notify({
511
- message: 'Hello, World!',
512
- type: 'info'
513
- });
514
- ```
447
+ 1. Update API initialization
448
+ 2. Test authentication flow
449
+ 3. Update error handling (new error codes)
515
450
  ```
516
451
 
517
- **Tutorial Best Practices**:
518
- - **Show progress**: Step numbers, estimated time
519
- - **Explain why**: Don't just show code, explain reasoning
520
- - **Checkpoints**: "At this point, you should see..."
521
- - **Troubleshooting**: Anticipate common errors
522
- - **Complete examples**: Provide runnable code
523
-
524
- ### 4. Changelog Management
525
-
526
- **Keep a Changelog Format** (semantic versioning):
527
-
528
- ```markdown
529
- # Changelog
530
-
531
- All notable changes to this project will be documented in this file.
532
-
533
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
534
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
535
-
536
- ## [Unreleased]
537
-
538
- ### Added
539
- - Feature X for improved performance
540
- - New `debugMode` configuration option
541
-
542
- ### Changed
543
- - Updated default timeout from 5s to 10s
544
-
545
- ### Deprecated
546
- - `oldMethod()` will be removed in v3.0.0 (use `newMethod()` instead)
547
-
548
- ### Fixed
549
- - Bug where cache wasn't invalidated on updates
550
-
551
- ---
552
-
553
- ## [2.1.0] - 2024-01-15
452
+ ### Keep Docs Fresh
554
453
 
555
- ### Added
556
- - WebSocket support for real-time updates
557
- - TypeScript type definitions
558
- - Retry logic with exponential backoff
559
-
560
- ### Changed
561
- - **BREAKING**: `config.timeout` now in milliseconds (was seconds)
562
- - Improved error messages with context
454
+ **Automation**:
455
+ - Generate API docs from code (JSDoc, TypeDoc, OpenAPI)
456
+ - Auto-update version numbers in docs
457
+ - CI/CD checks for broken links
563
458
 
564
- ### Fixed
565
- - Memory leak in connection pool
566
- - Race condition in concurrent requests
459
+ **Review Checklist**:
460
+ - [ ] Code examples run without errors
461
+ - [ ] All links work (no 404s)
462
+ - [ ] Version numbers match package.json
463
+ - [ ] Screenshots show current UI
464
+ - [ ] Deprecation warnings added for old features
567
465
 
568
466
  ---
569
467
 
570
- ## [2.0.0] - 2023-12-01
468
+ ## Common Pitfalls
571
469
 
572
- ### Added
573
- - Complete rewrite with TypeScript
574
- - Plugin system for extensibility
470
+ **❌ Avoid**:
471
+ - Outdated examples (don't run)
472
+ - Missing prerequisites
473
+ - Incomplete code snippets
474
+ - Vague error messages ("something went wrong")
475
+ - Over-explaining obvious things
476
+ - Using future tense ("will do X")
575
477
 
576
- ### Removed
577
- - **BREAKING**: Removed deprecated `legacyMode` option
478
+ **✅ Do**:
479
+ - Test all code examples
480
+ - State prerequisites up front
481
+ - Show complete, runnable code
482
+ - Specific error messages with fixes
483
+ - Respect reader's intelligence
484
+ - Use present tense
578
485
 
579
486
  ---
580
487
 
581
- ## [1.5.2] - 2023-11-10
488
+ ## Quick Reference Templates
582
489
 
583
- ### Fixed
584
- - Security vulnerability in dependency (CVE-2023-XXXXX)
585
-
586
- ---
587
-
588
- ## [1.5.1] - 2023-11-05
589
-
590
- ### Fixed
591
- - Incorrect version number in package.json
592
- ```
593
-
594
- **Changelog Best Practices**:
595
- - **Categorize changes**: Added, Changed, Deprecated, Removed, Fixed, Security
596
- - **Link to issues**: `Fixed #123` links to GitHub issue
597
- - **Breaking changes**: Mark with **BREAKING** prefix
598
- - **Security fixes**: Separate category, include CVE if applicable
599
- - **Date format**: ISO 8601 (YYYY-MM-DD)
600
-
601
- ### 5. Code Comments and Inline Documentation
602
-
603
- **JSDoc Example**:
604
-
605
- ```typescript
490
+ ### Function Documentation
491
+ ```javascript
606
492
  /**
607
- * Compress an image file with optional format conversion.
608
- *
609
- * @param input - Path to input image file
610
- * @param options - Compression options
611
- * @returns Promise resolving to compression result
612
- *
613
- * @throws {ImageNotFoundError} If input file doesn't exist
614
- * @throws {UnsupportedFormatError} If format is not supported
493
+ * Brief description
615
494
  *
495
+ * @param {Type} paramName - Description
496
+ * @returns {Type} Description
497
+ * @throws {ErrorType} When/why
616
498
  * @example
617
- * ```typescript
618
- * const result = await compress('photo.jpg', {
619
- * quality: 80,
620
- * format: 'webp'
621
- * });
622
- * console.log(`Saved ${result.savedBytes} bytes`);
623
- * ```
624
- *
625
- * @see {@link https://docs.example.com/compression} for compression algorithm details
626
- */
627
- export async function compress(
628
- input: string,
629
- options: CompressOptions
630
- ): Promise<CompressResult> {
631
- // Implementation
632
- }
633
-
634
- /**
635
- * Options for image compression
499
+ * functionName(arg);
636
500
  */
637
- export interface CompressOptions {
638
- /**
639
- * Compression quality (0-100)
640
- * @default 80
641
- */
642
- quality?: number;
643
-
644
- /**
645
- * Output format
646
- * @default 'jpeg' (auto-detected from input)
647
- */
648
- format?: 'jpeg' | 'png' | 'webp' | 'avif';
649
-
650
- /**
651
- * Preserve EXIF metadata
652
- * @default true
653
- */
654
- preserveMetadata?: boolean;
655
- }
656
- ```
657
-
658
- **Python Docstrings (Google Style)**:
659
-
660
- ```python
661
- def compress_image(input_path, quality=80, format='jpeg'):
662
- """Compress an image file with optional format conversion.
663
-
664
- Args:
665
- input_path (str): Path to input image file.
666
- quality (int, optional): Compression quality (0-100). Defaults to 80.
667
- format (str, optional): Output format ('jpeg', 'png', 'webp').
668
- Defaults to 'jpeg'.
669
-
670
- Returns:
671
- CompressResult: Object containing output path and bytes saved.
672
-
673
- Raises:
674
- FileNotFoundError: If input_path doesn't exist.
675
- ValueError: If quality not in range 0-100.
676
- UnsupportedFormatError: If format is not supported.
677
-
678
- Examples:
679
- >>> result = compress_image('photo.jpg', quality=90, format='webp')
680
- >>> print(f"Saved {result.saved_bytes} bytes")
681
- Saved 1234567 bytes
682
-
683
- See Also:
684
- compress_batch: For compressing multiple images in parallel.
685
- """
686
- pass
687
- ```
688
-
689
- ## Style Guides
690
-
691
- ### 1. Microsoft Writing Style Guide Principles
692
-
693
- - **Concise**: Remove filler words ("basically", "simply", "just")
694
- - **Active voice**: "The function returns" > "The value is returned by"
695
- - **Present tense**: "The system validates" > "The system will validate"
696
- - **Second person**: "You can configure" > "Users can configure"
697
- - **Avoid jargon**: Define acronyms on first use
698
-
699
- **Examples**:
700
-
701
- ❌ **Bad**: "Basically, the API will simply return a JSON object containing all of the user data."
702
- ✅ **Good**: "The API returns a JSON object with user data."
703
-
704
- ❌ **Bad**: "The request is processed by the server, and then the response is sent."
705
- ✅ **Good**: "The server processes the request and sends a response."
706
-
707
- ### 2. Technical Terminology
708
-
709
- **Consistent Capitalization**:
710
- - API (not Api, api)
711
- - JavaScript (not Javascript, javascript)
712
- - TypeScript (not Typescript, typescript)
713
- - macOS (not MacOS, Mac OS)
714
- - Node.js (not NodeJS, nodejs)
715
-
716
- **Abbreviations**:
717
- - Define on first use: "Single Page Application (SPA)"
718
- - Use consistently: Either "HTTP" or "http", not both
719
-
720
- **Code Elements**:
721
- - Inline code: Use backticks - "The `setTimeout()` function..."
722
- - File names: Use backticks - "Edit `config.json`"
723
- - Commands: Use code blocks with language hint
724
-
725
- ### 3. Information Architecture
726
-
727
- **Progressive Disclosure**:
728
-
729
- ```
730
- Level 1: Overview (What & Why)
731
- ├─ Level 2: Quick Start (How - Minimal)
732
- ├─ Level 3: Tutorials (How - Detailed)
733
- ├─ Level 4: Reference (Comprehensive)
734
- └─ Level 5: Advanced Topics
735
- ```
736
-
737
- **Example Structure**:
738
-
739
- ```
740
- Documentation Root
741
- ├── Getting Started
742
- │ ├── Installation
743
- │ ├── Quick Start (5 min)
744
- │ └── Core Concepts
745
- ├── Tutorials
746
- │ ├── Tutorial 1: Basic Usage
747
- │ ├── Tutorial 2: Advanced Features
748
- │ └── Tutorial 3: Production Deployment
749
- ├── API Reference
750
- │ ├── Functions
751
- │ ├── Classes
752
- │ └── Types
753
- ├── How-To Guides
754
- │ ├── Authentication
755
- │ ├── Error Handling
756
- │ └── Performance Optimization
757
- └── Advanced
758
- ├── Architecture
759
- ├── Contributing
760
- └── Troubleshooting
761
501
  ```
762
502
 
763
- ## Documentation Tools
764
-
765
- ### 1. Markdown Variants
766
-
767
- **GitHub Flavored Markdown (GFM)**:
768
-
503
+ ### CLI Command Documentation
769
504
  ```markdown
770
- ## Task Lists
771
- - [x] Completed task
772
- - [ ] Pending task
505
+ ### command [options]
773
506
 
774
- ## Tables
775
- | Header 1 | Header 2 |
776
- |----------|----------|
777
- | Cell 1 | Cell 2 |
778
-
779
- ## Syntax Highlighting
780
- ```javascript
781
- const x = 10;
782
- ```
507
+ Description of what command does.
783
508
 
784
- ## Alerts (GitHub)
785
- > [!NOTE]
786
- > Useful information
787
-
788
- > [!WARNING]
789
- > Critical content
790
-
791
- > [!IMPORTANT]
792
- > Key information
793
- ```
794
-
795
- ### 2. Documentation Generators
796
-
797
- **TypeDoc (TypeScript)**:
798
-
799
- ```bash
800
- npm install --save-dev typedoc
801
-
802
- # Generate docs
803
- npx typedoc --out docs src/index.ts
804
- ```
805
-
806
- **Sphinx (Python)**:
807
-
808
- ```bash
809
- pip install sphinx
509
+ **Options**:
510
+ - `-f, --flag`: Description (default: value)
511
+ - `-o, --option <value>`: Description
810
512
 
811
- # Initialize
812
- sphinx-quickstart docs
813
-
814
- # Build
815
- cd docs && make html
816
- ```
817
-
818
- **JSDoc (JavaScript)**:
819
-
820
- ```bash
821
- npm install --save-dev jsdoc
822
-
823
- # Generate docs
824
- npx jsdoc -c jsdoc.json src/
825
- ```
826
-
827
- ### 3. Versioned Documentation (Docusaurus)
828
-
829
- ```bash
830
- npm run docusaurus docs:version 1.0.0
831
-
832
- # Creates:
833
- # - versioned_docs/version-1.0.0/
834
- # - versioned_sidebars/version-1.0.0-sidebars.json
835
- ```
836
-
837
- ## Best Practices
838
-
839
- ### 1. Write for Scanning, Not Reading
840
-
841
- **Use**:
842
- - Headings and subheadings
843
- - Bullet lists (not paragraphs)
844
- - Code examples (not long explanations)
845
- - Visual hierarchy (bold, italics, code blocks)
846
-
847
- **Example**:
848
-
849
- ❌ **Bad**:
850
- ```
851
- The configuration file is a JSON file that contains various options for
852
- the application. You can set the timeout option to control how long the
853
- application waits before timing out. The default value is 5000 milliseconds.
854
- ```
855
-
856
- ✅ **Good**:
857
- ```
858
- ## Configuration
859
-
860
- Edit `config.json`:
861
-
862
- ```json
863
- {
864
- "timeout": 5000 // milliseconds, default: 5000
865
- }
866
- ```
867
- ```
868
-
869
- ### 2. Show, Don't Tell
870
-
871
- ❌ **Bad**: "You can use the function to fetch user data."
872
- ✅ **Good**:
873
- ```javascript
874
- const user = await fetchUser('123');
875
- console.log(user.name); // "John Doe"
876
- ```
877
-
878
- ### 3. Provide Context
879
-
880
- ❌ **Bad**:
881
- ```javascript
882
- widget.setOption('cache', true);
883
- ```
884
-
885
- ✅ **Good**:
886
- ```javascript
887
- // Enable caching to reduce API calls by 80% (recommended for production)
888
- widget.setOption('cache', true);
889
- ```
890
-
891
- ### 4. Test Your Documentation
892
-
893
- - **Run examples**: Ensure all code snippets actually work
894
- - **Fresh eyes**: Ask someone unfamiliar with the project to follow docs
895
- - **Automated checks**: Lint markdown, validate links, test code snippets
896
-
897
- ### 5. Keep It Updated
898
-
899
- - **Deprecation warnings**: Document what's changing and when
900
- - **Migration guides**: Provide step-by-step upgrade instructions
901
- - **Version compatibility**: State which versions docs apply to
902
-
903
- ## Common Mistakes to Avoid
904
-
905
- ### 1. Assuming Knowledge
906
-
907
- ❌ **Bad**: "Just use the OAuth flow"
908
- ✅ **Good**: "Authenticate using OAuth 2.0 (see [tutorial](link))"
909
-
910
- ### 2. Implementation Over Outcome
911
-
912
- ❌ **Bad**: "This function uses a binary search algorithm"
913
- ✅ **Good**: "This function finds elements in O(log n) time"
914
-
915
- ### 3. Missing Error Cases
916
-
917
- ❌ **Bad**: Only documenting success responses
918
- ✅ **Good**: Document all HTTP status codes (200, 400, 401, 404, 500)
919
-
920
- ### 4. Outdated Examples
921
-
922
- ❌ **Bad**: Examples using deprecated APIs
923
- ✅ **Good**: Update examples with each release
924
-
925
- ### 5. No Searchability
926
-
927
- ❌ **Bad**: PDF documentation (not searchable)
928
- ✅ **Good**: HTML docs with search functionality (Algolia, local search)
929
-
930
- ## Templates
931
-
932
- ### API Endpoint Template
933
-
934
- ```markdown
935
- ### [HTTP Method] [Endpoint Path]
936
-
937
- [One-sentence description]
938
-
939
- **Endpoint**: `[METHOD] /path/:param`
940
-
941
- **Authentication**: [Required/Optional]
942
-
943
- **Parameters**:
944
- - `param1` (type, location): Description
945
-
946
- **Request Body** (if applicable):
947
- ```json
948
- {
949
- "field": "value"
950
- }
951
- ```
952
-
953
- **Success Response ([Status Code])**:
954
- ```json
955
- {
956
- "result": "data"
957
- }
958
- ```
959
-
960
- **Error Responses**:
961
- - **[Status Code]**: Description
962
- ```json
963
- {
964
- "error": "ERROR_CODE"
965
- }
966
- ```
967
-
968
- **Rate Limiting**: [Limits]
969
-
970
- **Example**:
513
+ **Examples**:
971
514
  ```bash
972
- curl [example command]
515
+ command --flag --option=value
973
516
  ```
974
517
  ```
975
518
 
976
- ### Tutorial Template
977
-
519
+ ### Error Documentation
978
520
  ```markdown
979
- # Tutorial: [Goal]
980
-
981
- **Time**: [Estimate]
982
- **Prerequisites**: [Requirements]
983
- **What You'll Build**: [Outcome]
984
-
985
- ## What You'll Learn
986
-
987
- - Bullet list
988
-
989
- ---
990
-
991
- ## Step 1: [Action]
521
+ ### Error: ECONNREFUSED
992
522
 
993
- [Instructions]
523
+ **Cause**: Cannot connect to database
994
524
 
995
- ```code
996
- [Example]
525
+ **Solutions**:
526
+ 1. Check database is running: `docker ps`
527
+ 2. Verify connection string in `.env`
528
+ 3. Check firewall allows port 5432
997
529
  ```
998
530
 
999
- **Expected Result**: [What should happen]
1000
-
1001
- ---
1002
-
1003
- [Repeat steps]
1004
-
1005
- ---
1006
-
1007
- ## Troubleshooting
1008
-
1009
- **Problem**: [Issue]
1010
- - ✅ Solution 1
1011
- - ✅ Solution 2
1012
-
1013
531
  ---
1014
532
 
1015
- ## Next Steps
1016
-
1017
- - [Related tutorial]
1018
- - [Advanced topic]
1019
- ```
1020
-
1021
- ## Resources
1022
-
1023
- - [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-guide/welcome/)
1024
- - [Google Developer Documentation Style Guide](https://developers.google.com/style)
1025
- - [Write the Docs](https://www.writethedocs.org/)
1026
- - [Keep a Changelog](https://keepachangelog.com/)
1027
-
1028
- ## Activation Keywords
1029
-
1030
- Ask me about:
1031
- - "How to write API documentation"
1032
- - "README best practices"
1033
- - "Technical writing style guide"
1034
- - "Changelog format and versioning"
1035
- - "Tutorial structure and examples"
1036
- - "OpenAPI/Swagger documentation"
1037
- - "JSDoc and code comments"
1038
- - "Developer documentation tips"
1039
- - "How to write clear technical docs"
533
+ **This skill is self-contained and works in ANY user project.**