specweave 0.23.18 → 0.24.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/.claude-plugin/marketplace.json +144 -45
- package/CLAUDE.md +137 -4
- package/dist/src/cli/helpers/ado-area-path-mapper.d.ts +89 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.d.ts.map +1 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.js +213 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.d.ts +29 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.d.ts.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.js +109 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado.js +2 -0
- package/dist/src/cli/helpers/issue-tracker/ado.js.map +1 -1
- package/dist/src/cli/helpers/smart-filter.d.ts +83 -0
- package/dist/src/cli/helpers/smart-filter.d.ts.map +1 -0
- package/dist/src/cli/helpers/smart-filter.js +265 -0
- package/dist/src/cli/helpers/smart-filter.js.map +1 -0
- package/dist/src/core/qa/quality-gate-decider.d.ts +1 -1
- package/dist/src/core/qa/quality-gate-decider.js +2 -2
- package/dist/src/core/qa/quality-gate-decider.js.map +1 -1
- package/dist/src/core/qa/risk-calculator.d.ts +2 -2
- package/dist/src/core/qa/risk-calculator.js +2 -2
- package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
- package/dist/src/core/repo-structure/repo-structure-manager.js +76 -43
- package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
- package/dist/src/core/validators/ac-presence-validator.d.ts +56 -0
- package/dist/src/core/validators/ac-presence-validator.d.ts.map +1 -0
- package/dist/src/core/validators/ac-presence-validator.js +149 -0
- package/dist/src/core/validators/ac-presence-validator.js.map +1 -0
- package/dist/src/integrations/ado/area-path-mapper.d.ts +137 -0
- package/dist/src/integrations/ado/area-path-mapper.d.ts.map +1 -0
- package/dist/src/integrations/ado/area-path-mapper.js +267 -0
- package/dist/src/integrations/ado/area-path-mapper.js.map +1 -0
- package/dist/src/integrations/jira/filter-processor.d.ts +126 -0
- package/dist/src/integrations/jira/filter-processor.d.ts.map +1 -0
- package/dist/src/integrations/jira/filter-processor.js +207 -0
- package/dist/src/integrations/jira/filter-processor.js.map +1 -0
- package/dist/src/integrations/jira/jira-client.d.ts +13 -0
- package/dist/src/integrations/jira/jira-client.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-client.js +33 -0
- package/dist/src/integrations/jira/jira-client.js.map +1 -1
- package/dist/src/utils/ac-embedder.d.ts +63 -0
- package/dist/src/utils/ac-embedder.d.ts.map +1 -0
- package/dist/src/utils/ac-embedder.js +217 -0
- package/dist/src/utils/ac-embedder.js.map +1 -0
- package/dist/src/utils/env-manager.d.ts +86 -0
- package/dist/src/utils/env-manager.d.ts.map +1 -0
- package/dist/src/utils/env-manager.js +188 -0
- package/dist/src/utils/env-manager.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave/agents/AGENTS-INDEX.md +1 -1
- package/plugins/specweave/agents/increment-quality-judge-v2/AGENT.md +9 -9
- package/plugins/specweave/commands/specweave-do.md +37 -0
- package/plugins/specweave/commands/specweave-done.md +159 -0
- package/plugins/specweave/commands/specweave-embed-acs.md +446 -0
- package/plugins/specweave/commands/specweave-next.md +148 -3
- package/plugins/specweave/commands/specweave-qa.md +2 -2
- package/plugins/specweave/hooks/pre-increment-start.sh +168 -0
- package/plugins/specweave/skills/SKILLS-INDEX.md +1 -1
- package/plugins/specweave-ado/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-ado/commands/specweave-ado-import-projects.md +331 -0
- package/plugins/specweave-alternatives/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-alternatives/commands/alternatives-analyze.md +336 -0
- package/plugins/specweave-alternatives/skills/architecture-alternatives/SKILL.md +651 -0
- package/plugins/specweave-alternatives/skills/bmad-method/SKILL.md +420 -0
- package/plugins/specweave-alternatives/skills/spec-kit-expert/SKILL.md +487 -0
- package/plugins/specweave-backend/commands/api-scaffold.md +80 -0
- package/plugins/specweave-backend/commands/crud-generate.md +109 -0
- package/plugins/specweave-backend/commands/migration-generate.md +139 -0
- package/plugins/specweave-confluent/commands/connector-deploy.md +154 -0
- package/plugins/specweave-confluent/commands/ksqldb-query.md +179 -0
- package/plugins/specweave-confluent/commands/schema-register.md +123 -0
- package/plugins/specweave-core/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-core/commands/architecture-review.md +288 -0
- package/plugins/specweave-core/commands/code-review.md +213 -0
- package/plugins/specweave-core/commands/refactor-plan.md +249 -0
- package/plugins/specweave-core/skills/code-quality/SKILL.md +157 -0
- package/plugins/specweave-core/skills/design-patterns/SKILL.md +244 -0
- package/plugins/specweave-core/skills/software-architecture/SKILL.md +83 -0
- package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +22 -0
- package/plugins/specweave-cost-optimizer/commands/cost-analyze.md +360 -0
- package/plugins/specweave-cost-optimizer/commands/cost-optimize.md +480 -0
- package/plugins/specweave-cost-optimizer/skills/aws-cost-expert/SKILL.md +416 -0
- package/plugins/specweave-cost-optimizer/skills/cloud-pricing/SKILL.md +325 -0
- package/plugins/specweave-cost-optimizer/skills/cost-optimization/SKILL.md +337 -0
- package/plugins/specweave-diagrams/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-diagrams/commands/diagrams-generate.md +168 -0
- package/plugins/specweave-docs/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-docs/commands/docs-generate.md +441 -0
- package/plugins/specweave-docs/commands/docs-init.md +334 -0
- package/plugins/specweave-docs/skills/docusaurus/SKILL.md +581 -0
- package/plugins/specweave-docs/skills/spec-driven-brainstorming/SKILL.md +689 -0
- package/plugins/specweave-docs/skills/technical-writing/SKILL.md +1039 -0
- package/plugins/specweave-docs-preview/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-figma/.claude-plugin/plugin.json +23 -0
- package/plugins/specweave-figma/commands/figma-import.md +690 -0
- package/plugins/specweave-figma/commands/figma-to-react.md +834 -0
- package/plugins/specweave-figma/commands/figma-tokens.md +815 -0
- package/plugins/specweave-frontend/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-frontend/agents/frontend-architect/AGENT.md +408 -0
- package/plugins/specweave-frontend/agents/frontend-architect/README.md +385 -0
- package/plugins/specweave-frontend/agents/frontend-architect/examples.md +590 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/component-template.tsx +152 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/hook-template.ts +311 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/page-template.tsx +228 -0
- package/plugins/specweave-frontend/commands/component-generate.md +510 -0
- package/plugins/specweave-frontend/commands/design-system-init.md +494 -0
- package/plugins/specweave-frontend/commands/frontend-scaffold.md +207 -0
- package/plugins/specweave-frontend/commands/nextjs-setup.md +396 -0
- package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +278 -0
- package/plugins/specweave-frontend/skills/frontend/SKILL.md +420 -0
- package/plugins/specweave-frontend/skills/nextjs/SKILL.md +546 -0
- package/plugins/specweave-github/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +212 -0
- package/plugins/specweave-infrastructure/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-jira/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-jira/commands/import-projects.js +183 -0
- package/plugins/specweave-jira/commands/import-projects.md +97 -0
- package/plugins/specweave-jira/commands/import-projects.ts +288 -0
- package/plugins/specweave-jira/commands/specweave-jira-import-projects.md +298 -0
- package/plugins/specweave-kafka/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-kafka-streams/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-kubernetes/commands/cluster-setup.md +262 -0
- package/plugins/specweave-kubernetes/commands/deployment-generate.md +242 -0
- package/plugins/specweave-kubernetes/commands/helm-scaffold.md +333 -0
- package/plugins/specweave-ml/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-mobile/commands/app-scaffold.md +233 -0
- package/plugins/specweave-mobile/commands/build-config.md +256 -0
- package/plugins/specweave-mobile/commands/screen-generate.md +289 -0
- package/plugins/specweave-n8n/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-payments/commands/stripe-setup.md +931 -0
- package/plugins/specweave-payments/commands/subscription-flow.md +1193 -0
- package/plugins/specweave-payments/commands/subscription-manage.md +386 -0
- package/plugins/specweave-payments/commands/webhook-setup.md +295 -0
- package/plugins/specweave-plugin-dev/.claude-plugin/plugin.json +13 -12
- package/plugins/specweave-plugin-dev/commands/plugin-create.md +333 -0
- package/plugins/specweave-plugin-dev/commands/plugin-publish.md +339 -0
- package/plugins/specweave-plugin-dev/commands/plugin-test.md +293 -0
- package/plugins/specweave-plugin-dev/skills/claude-sdk/SKILL.md +162 -0
- package/plugins/specweave-plugin-dev/skills/marketplace-publishing/SKILL.md +263 -0
- package/plugins/specweave-plugin-dev/skills/plugin-development/SKILL.md +316 -0
- package/plugins/specweave-release/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-release/commands/specweave-release-npm.md +110 -0
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +168 -0
- package/plugins/specweave-testing/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-testing/agents/qa-engineer/AGENT.md +818 -0
- package/plugins/specweave-testing/agents/qa-engineer/README.md +443 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/playwright-e2e-test.ts +470 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/test-data-factory.ts +507 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/vitest-unit-test.ts +400 -0
- package/plugins/specweave-testing/agents/qa-engineer/test-strategies.md +726 -0
- package/plugins/specweave-testing/commands/e2e-setup.md +1081 -0
- package/plugins/specweave-testing/commands/test-coverage.md +979 -0
- package/plugins/specweave-testing/commands/test-generate.md +1156 -0
- package/plugins/specweave-testing/commands/test-init.md +409 -0
- package/plugins/specweave-testing/skills/e2e-playwright/SKILL.md +769 -0
- package/plugins/specweave-testing/skills/tdd-expert/SKILL.md +934 -0
- package/plugins/specweave-testing/skills/unit-testing-expert/SKILL.md +1011 -0
- package/plugins/specweave-tooling/.claude-plugin/plugin.json +22 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-create.md +691 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-package.md +751 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-validate.md +858 -0
- package/plugins/specweave-ui/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-ui/commands/ui-automate.md +199 -0
- package/plugins/specweave-ui/commands/ui-inspect.md +70 -0
- package/plugins/specweave-ui/skills/browser-automation/SKILL.md +314 -0
- package/plugins/specweave-ui/skills/ui-testing/SKILL.md +716 -0
- package/plugins/specweave-ui/skills/visual-regression/SKILL.md +728 -0
- package/plugins/specweave/commands/check-hooks.md +0 -257
- package/plugins/specweave/commands/specweave-archive-increments.md +0 -82
- package/plugins/specweave-plugin-dev/skills/plugin-expert/SKILL.md +0 -1231
- /package/plugins/specweave/{agents/code-reviewer.md → skills/code-reviewer/SKILL.md} +0 -0
|
@@ -0,0 +1,1039 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: technical-writing
|
|
3
|
+
description: Technical writing expert for API documentation, README files, tutorials, changelog management, and developer documentation. Covers style guides, information architecture, versioning docs, OpenAPI/Swagger, and documentation-as-code. Activates for technical writing, API docs, README, changelog, tutorial writing, documentation, technical communication, style guide, OpenAPI, Swagger, developer docs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Technical Writing Skill
|
|
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.
|
|
9
|
+
|
|
10
|
+
## Core Documentation Types
|
|
11
|
+
|
|
12
|
+
### 1. README Files
|
|
13
|
+
|
|
14
|
+
**Essential Sections**:
|
|
15
|
+
|
|
16
|
+
```markdown
|
|
17
|
+
# Project Name
|
|
18
|
+
|
|
19
|
+
One-sentence description of what this project does.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- Key feature 1
|
|
24
|
+
- Key feature 2
|
|
25
|
+
- Key feature 3
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install project-name
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
import { ProjectName } from 'project-name';
|
|
37
|
+
|
|
38
|
+
const instance = new ProjectName();
|
|
39
|
+
instance.doSomething();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
### Basic Example
|
|
45
|
+
|
|
46
|
+
[Runnable code example]
|
|
47
|
+
|
|
48
|
+
### Advanced Example
|
|
49
|
+
|
|
50
|
+
[More complex use case]
|
|
51
|
+
|
|
52
|
+
## API Reference
|
|
53
|
+
|
|
54
|
+
Link to detailed API docs or inline reference.
|
|
55
|
+
|
|
56
|
+
## Configuration
|
|
57
|
+
|
|
58
|
+
Available options and their defaults.
|
|
59
|
+
|
|
60
|
+
## Contributing
|
|
61
|
+
|
|
62
|
+
Link to CONTRIBUTING.md
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
MIT (or your license)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**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**:
|
|
76
|
+
|
|
77
|
+
**Bad README**:
|
|
78
|
+
```markdown
|
|
79
|
+
# My Project
|
|
80
|
+
|
|
81
|
+
This is a library.
|
|
82
|
+
|
|
83
|
+
## Installation
|
|
84
|
+
npm install
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
Use it in your code.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Good README**:
|
|
91
|
+
```markdown
|
|
92
|
+
# Image Optimizer
|
|
93
|
+
|
|
94
|
+
Compress images up to 80% without visible quality loss. Supports JPEG, PNG, WebP.
|
|
95
|
+
|
|
96
|
+
## Installation
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm install image-optimizer
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Quick Start
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
import { optimize } from 'image-optimizer';
|
|
106
|
+
|
|
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
|
+
```
|
|
114
|
+
|
|
115
|
+
## Features
|
|
116
|
+
|
|
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
|
|
122
|
+
|
|
123
|
+
## CLI Usage
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
image-optimizer input.jpg --quality 80 --format webp
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## API
|
|
130
|
+
|
|
131
|
+
### `optimize(input, options)`
|
|
132
|
+
|
|
133
|
+
Compress a single image.
|
|
134
|
+
|
|
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)
|
|
140
|
+
|
|
141
|
+
**Returns**: `Promise<OptimizeResult>`
|
|
142
|
+
|
|
143
|
+
**Example**:
|
|
144
|
+
```javascript
|
|
145
|
+
const result = await optimize('photo.jpg', { quality: 90 });
|
|
146
|
+
```
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 2. API Documentation
|
|
150
|
+
|
|
151
|
+
#### RESTful API Documentation
|
|
152
|
+
|
|
153
|
+
```markdown
|
|
154
|
+
# API Reference
|
|
155
|
+
|
|
156
|
+
Base URL: `https://api.example.com/v1`
|
|
157
|
+
|
|
158
|
+
## Authentication
|
|
159
|
+
|
|
160
|
+
All requests require an API key in the header:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
Authorization: Bearer YOUR_API_KEY
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Endpoints
|
|
167
|
+
|
|
168
|
+
### Get User
|
|
169
|
+
|
|
170
|
+
Retrieve user details by ID.
|
|
171
|
+
|
|
172
|
+
**Endpoint**: `GET /users/:id`
|
|
173
|
+
|
|
174
|
+
**Parameters**:
|
|
175
|
+
- `id` (path parameter, required): User ID (UUID v4)
|
|
176
|
+
|
|
177
|
+
**Headers**:
|
|
178
|
+
- `Authorization: Bearer <token>` (required)
|
|
179
|
+
|
|
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
|
+
|
|
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
|
+
```
|
|
196
|
+
|
|
197
|
+
**Error Responses**:
|
|
198
|
+
|
|
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
|
+
```
|
|
206
|
+
|
|
207
|
+
**401 Unauthorized** - Invalid or missing API key
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"error": "UNAUTHORIZED",
|
|
211
|
+
"message": "Invalid API key"
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
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
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
### Create User
|
|
223
|
+
|
|
224
|
+
Create a new user account.
|
|
225
|
+
|
|
226
|
+
**Endpoint**: `POST /users`
|
|
227
|
+
|
|
228
|
+
**Headers**:
|
|
229
|
+
- `Content-Type: application/json` (required)
|
|
230
|
+
- `Authorization: Bearer <token>` (required)
|
|
231
|
+
|
|
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
|
+
```
|
|
241
|
+
|
|
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`
|
|
246
|
+
|
|
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
|
+
```
|
|
254
|
+
|
|
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
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Error Responses**:
|
|
267
|
+
|
|
268
|
+
**400 Bad Request** - Validation error
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"error": "VALIDATION_ERROR",
|
|
272
|
+
"message": "Email already exists",
|
|
273
|
+
"field": "email"
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
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
|
+
}
|
|
284
|
+
```
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
#### OpenAPI/Swagger Specification
|
|
288
|
+
|
|
289
|
+
```yaml
|
|
290
|
+
openapi: 3.0.0
|
|
291
|
+
info:
|
|
292
|
+
title: Example API
|
|
293
|
+
version: 1.0.0
|
|
294
|
+
description: API for user management
|
|
295
|
+
|
|
296
|
+
servers:
|
|
297
|
+
- url: https://api.example.com/v1
|
|
298
|
+
|
|
299
|
+
paths:
|
|
300
|
+
/users/{id}:
|
|
301
|
+
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)
|
|
315
|
+
responses:
|
|
316
|
+
'200':
|
|
317
|
+
description: User found
|
|
318
|
+
content:
|
|
319
|
+
application/json:
|
|
320
|
+
schema:
|
|
321
|
+
$ref: '#/components/schemas/User'
|
|
322
|
+
'404':
|
|
323
|
+
description: User not found
|
|
324
|
+
content:
|
|
325
|
+
application/json:
|
|
326
|
+
schema:
|
|
327
|
+
$ref: '#/components/schemas/Error'
|
|
328
|
+
|
|
329
|
+
components:
|
|
330
|
+
schemas:
|
|
331
|
+
User:
|
|
332
|
+
type: object
|
|
333
|
+
required:
|
|
334
|
+
- id
|
|
335
|
+
- email
|
|
336
|
+
- name
|
|
337
|
+
properties:
|
|
338
|
+
id:
|
|
339
|
+
type: string
|
|
340
|
+
format: uuid
|
|
341
|
+
email:
|
|
342
|
+
type: string
|
|
343
|
+
format: email
|
|
344
|
+
name:
|
|
345
|
+
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
|
+
|
|
355
|
+
Error:
|
|
356
|
+
type: object
|
|
357
|
+
required:
|
|
358
|
+
- error
|
|
359
|
+
- message
|
|
360
|
+
properties:
|
|
361
|
+
error:
|
|
362
|
+
type: string
|
|
363
|
+
message:
|
|
364
|
+
type: string
|
|
365
|
+
field:
|
|
366
|
+
type: string
|
|
367
|
+
```
|
|
368
|
+
|
|
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
|
+
---
|
|
388
|
+
|
|
389
|
+
## Step 1: Installation
|
|
390
|
+
|
|
391
|
+
Install the widget library:
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
npm install widget-library
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**Expected Output**:
|
|
398
|
+
```
|
|
399
|
+
+ widget-library@1.0.0
|
|
400
|
+
added 1 package
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## Step 2: Create Basic Widget
|
|
406
|
+
|
|
407
|
+
Create a new file `widget.js`:
|
|
408
|
+
|
|
409
|
+
```javascript
|
|
410
|
+
import { Widget } from 'widget-library';
|
|
411
|
+
|
|
412
|
+
const widget = new Widget({
|
|
413
|
+
container: '#app',
|
|
414
|
+
theme: 'light'
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
widget.render();
|
|
418
|
+
```
|
|
419
|
+
|
|
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
|
+
|
|
433
|
+
```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'
|
|
442
|
+
});
|
|
443
|
+
```
|
|
444
|
+
|
|
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
|
+
});
|
|
507
|
+
|
|
508
|
+
widget.render();
|
|
509
|
+
|
|
510
|
+
widget.notify({
|
|
511
|
+
message: 'Hello, World!',
|
|
512
|
+
type: 'info'
|
|
513
|
+
});
|
|
514
|
+
```
|
|
515
|
+
```
|
|
516
|
+
|
|
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
|
|
554
|
+
|
|
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
|
|
563
|
+
|
|
564
|
+
### Fixed
|
|
565
|
+
- Memory leak in connection pool
|
|
566
|
+
- Race condition in concurrent requests
|
|
567
|
+
|
|
568
|
+
---
|
|
569
|
+
|
|
570
|
+
## [2.0.0] - 2023-12-01
|
|
571
|
+
|
|
572
|
+
### Added
|
|
573
|
+
- Complete rewrite with TypeScript
|
|
574
|
+
- Plugin system for extensibility
|
|
575
|
+
|
|
576
|
+
### Removed
|
|
577
|
+
- **BREAKING**: Removed deprecated `legacyMode` option
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
581
|
+
## [1.5.2] - 2023-11-10
|
|
582
|
+
|
|
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
|
|
606
|
+
/**
|
|
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
|
|
615
|
+
*
|
|
616
|
+
* @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
|
|
636
|
+
*/
|
|
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
|
+
```
|
|
762
|
+
|
|
763
|
+
## Documentation Tools
|
|
764
|
+
|
|
765
|
+
### 1. Markdown Variants
|
|
766
|
+
|
|
767
|
+
**GitHub Flavored Markdown (GFM)**:
|
|
768
|
+
|
|
769
|
+
```markdown
|
|
770
|
+
## Task Lists
|
|
771
|
+
- [x] Completed task
|
|
772
|
+
- [ ] Pending task
|
|
773
|
+
|
|
774
|
+
## Tables
|
|
775
|
+
| Header 1 | Header 2 |
|
|
776
|
+
|----------|----------|
|
|
777
|
+
| Cell 1 | Cell 2 |
|
|
778
|
+
|
|
779
|
+
## Syntax Highlighting
|
|
780
|
+
```javascript
|
|
781
|
+
const x = 10;
|
|
782
|
+
```
|
|
783
|
+
|
|
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
|
|
810
|
+
|
|
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**:
|
|
971
|
+
```bash
|
|
972
|
+
curl [example command]
|
|
973
|
+
```
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
### Tutorial Template
|
|
977
|
+
|
|
978
|
+
```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]
|
|
992
|
+
|
|
993
|
+
[Instructions]
|
|
994
|
+
|
|
995
|
+
```code
|
|
996
|
+
[Example]
|
|
997
|
+
```
|
|
998
|
+
|
|
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
|
+
---
|
|
1014
|
+
|
|
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"
|