ccjk 1.5.0 → 2.0.2
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/README.ja.md +249 -297
- package/README.ko.md +241 -290
- package/README.md +222 -364
- package/README.zh-CN.md +553 -295
- package/dist/chunks/claude-code-config-manager.mjs +7 -7
- package/dist/chunks/claude-code-incremental-manager.mjs +1 -1
- package/dist/chunks/codex-config-switch.mjs +3 -3
- package/dist/chunks/codex-provider-manager.mjs +1 -1
- package/dist/chunks/codex-uninstaller.mjs +2 -2
- package/dist/chunks/commands.mjs +1 -1
- package/dist/chunks/features.mjs +10 -10
- package/dist/chunks/simple-config.mjs +321 -389
- package/dist/chunks/smart-guide.mjs +234 -0
- package/dist/cli.mjs +1795 -433
- package/dist/i18n/locales/en/configuration.json +12 -1
- package/dist/i18n/locales/en/marketplace.json +84 -0
- package/dist/i18n/locales/en/menu.json +38 -1
- package/dist/i18n/locales/en/skills.json +140 -0
- package/dist/i18n/locales/en/smartGuide.json +49 -0
- package/dist/i18n/locales/en/subagent.json +69 -0
- package/dist/i18n/locales/en/superpowers.json +58 -0
- package/dist/i18n/locales/zh-CN/configuration.json +12 -1
- package/dist/i18n/locales/zh-CN/marketplace.json +84 -0
- package/dist/i18n/locales/zh-CN/menu.json +38 -1
- package/dist/i18n/locales/zh-CN/skills.json +140 -0
- package/dist/i18n/locales/zh-CN/smartGuide.json +49 -0
- package/dist/i18n/locales/zh-CN/subagent.json +69 -0
- package/dist/i18n/locales/zh-CN/superpowers.json +58 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +366 -7
- package/package.json +26 -27
- package/templates/common/skills/en/brainstorming.md +64 -0
- package/templates/common/skills/en/code-review.md +81 -0
- package/templates/common/skills/en/documentation-gen.md +808 -0
- package/templates/common/skills/en/executing-plans.md +75 -0
- package/templates/common/skills/en/git-commit.md +216 -0
- package/templates/common/skills/en/interview.md +223 -0
- package/templates/common/skills/en/migration-assistant.md +312 -0
- package/templates/common/skills/en/performance-profiling.md +576 -0
- package/templates/common/skills/en/pr-review.md +341 -0
- package/templates/common/skills/en/refactoring.md +384 -0
- package/templates/common/skills/en/security-audit.md +462 -0
- package/templates/common/skills/en/systematic-debugging.md +82 -0
- package/templates/common/skills/en/tdd-workflow.md +93 -0
- package/templates/common/skills/en/verification.md +81 -0
- package/templates/common/skills/en/workflow.md +370 -0
- package/templates/common/skills/en/writing-plans.md +78 -0
- package/templates/common/skills/zh-CN/documentation-gen.md +807 -0
- package/templates/common/skills/zh-CN/migration-assistant.md +318 -0
- package/templates/common/skills/zh-CN/performance-profiling.md +746 -0
- package/templates/common/skills/zh-CN/pr-review.md +341 -0
- package/templates/common/skills/zh-CN/refactoring.md +384 -0
- package/templates/common/skills/zh-CN/security-audit.md +462 -0
- package/templates/common/smart-guide/en/smart-guide.md +72 -0
- package/templates/common/smart-guide/zh-CN/smart-guide.md +72 -0
|
@@ -0,0 +1,808 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentation-gen
|
|
3
|
+
description: Automatic documentation generation for code and APIs
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
author: CCJK
|
|
6
|
+
category: docs
|
|
7
|
+
triggers:
|
|
8
|
+
- /docs
|
|
9
|
+
- /doc
|
|
10
|
+
- /document
|
|
11
|
+
- /readme
|
|
12
|
+
use_when:
|
|
13
|
+
- "User wants to generate documentation"
|
|
14
|
+
- "Code needs documentation"
|
|
15
|
+
- "User mentions README or docs"
|
|
16
|
+
- "API documentation needed"
|
|
17
|
+
auto_activate: true
|
|
18
|
+
priority: 6
|
|
19
|
+
difficulty: beginner
|
|
20
|
+
tags:
|
|
21
|
+
- documentation
|
|
22
|
+
- readme
|
|
23
|
+
- api-docs
|
|
24
|
+
- jsdoc
|
|
25
|
+
allowed-tools:
|
|
26
|
+
- Read
|
|
27
|
+
- Write
|
|
28
|
+
- Grep
|
|
29
|
+
- Glob
|
|
30
|
+
- LSP
|
|
31
|
+
context: inherit
|
|
32
|
+
user-invocable: true
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
# Documentation Generation Skill
|
|
36
|
+
|
|
37
|
+
## Overview
|
|
38
|
+
|
|
39
|
+
This skill provides comprehensive documentation generation capabilities for code, APIs, and projects. It helps create clear, maintainable documentation following industry best practices.
|
|
40
|
+
|
|
41
|
+
## Documentation Types
|
|
42
|
+
|
|
43
|
+
### 1. README.md Generation
|
|
44
|
+
|
|
45
|
+
Generate comprehensive project README files with:
|
|
46
|
+
|
|
47
|
+
- **Project Overview**: Clear description of what the project does
|
|
48
|
+
- **Installation Instructions**: Step-by-step setup guide
|
|
49
|
+
- **Usage Examples**: Practical code examples
|
|
50
|
+
- **API Reference**: Quick reference for main APIs
|
|
51
|
+
- **Contributing Guidelines**: How to contribute to the project
|
|
52
|
+
- **License Information**: Project licensing details
|
|
53
|
+
|
|
54
|
+
**Example Structure**:
|
|
55
|
+
```markdown
|
|
56
|
+
# Project Name
|
|
57
|
+
|
|
58
|
+
Brief description of the project.
|
|
59
|
+
|
|
60
|
+
## Features
|
|
61
|
+
|
|
62
|
+
- Feature 1
|
|
63
|
+
- Feature 2
|
|
64
|
+
- Feature 3
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
\`\`\`bash
|
|
69
|
+
npm install project-name
|
|
70
|
+
\`\`\`
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
\`\`\`javascript
|
|
75
|
+
import { feature } from 'project-name';
|
|
76
|
+
|
|
77
|
+
feature.doSomething();
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
## API Reference
|
|
81
|
+
|
|
82
|
+
### `feature.doSomething(options)`
|
|
83
|
+
|
|
84
|
+
Description of the method.
|
|
85
|
+
|
|
86
|
+
**Parameters:**
|
|
87
|
+
- `options` (Object): Configuration options
|
|
88
|
+
|
|
89
|
+
**Returns:** Description of return value
|
|
90
|
+
|
|
91
|
+
## Contributing
|
|
92
|
+
|
|
93
|
+
Please read CONTRIBUTING.md for details.
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
MIT License - see LICENSE file for details.
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 2. API Documentation
|
|
101
|
+
|
|
102
|
+
Generate detailed API documentation including:
|
|
103
|
+
|
|
104
|
+
- **Endpoint Descriptions**: Clear explanation of each endpoint
|
|
105
|
+
- **Request/Response Examples**: Sample requests and responses
|
|
106
|
+
- **Parameter Documentation**: All parameters with types and descriptions
|
|
107
|
+
- **Error Codes**: Possible error responses
|
|
108
|
+
- **Authentication**: Auth requirements and methods
|
|
109
|
+
|
|
110
|
+
**REST API Example**:
|
|
111
|
+
```markdown
|
|
112
|
+
## GET /api/users/:id
|
|
113
|
+
|
|
114
|
+
Retrieve a user by ID.
|
|
115
|
+
|
|
116
|
+
**Parameters:**
|
|
117
|
+
- `id` (string, required): User ID
|
|
118
|
+
|
|
119
|
+
**Response:**
|
|
120
|
+
\`\`\`json
|
|
121
|
+
{
|
|
122
|
+
"id": "123",
|
|
123
|
+
"name": "John Doe",
|
|
124
|
+
"email": "john@example.com"
|
|
125
|
+
}
|
|
126
|
+
\`\`\`
|
|
127
|
+
|
|
128
|
+
**Error Responses:**
|
|
129
|
+
- `404 Not Found`: User does not exist
|
|
130
|
+
- `401 Unauthorized`: Invalid authentication token
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 3. JSDoc/TSDoc Comments
|
|
134
|
+
|
|
135
|
+
Generate inline code documentation:
|
|
136
|
+
|
|
137
|
+
**Function Documentation**:
|
|
138
|
+
```typescript
|
|
139
|
+
/**
|
|
140
|
+
* Calculates the sum of two numbers.
|
|
141
|
+
*
|
|
142
|
+
* @param a - The first number
|
|
143
|
+
* @param b - The second number
|
|
144
|
+
* @returns The sum of a and b
|
|
145
|
+
* @throws {TypeError} If parameters are not numbers
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const result = add(5, 3);
|
|
150
|
+
* console.log(result); // 8
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
function add(a: number, b: number): number {
|
|
154
|
+
return a + b;
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Class Documentation**:
|
|
159
|
+
```typescript
|
|
160
|
+
/**
|
|
161
|
+
* Represents a user in the system.
|
|
162
|
+
*
|
|
163
|
+
* @class User
|
|
164
|
+
* @implements {IUser}
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* const user = new User('John', 'john@example.com');
|
|
169
|
+
* user.greet(); // "Hello, I'm John"
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
class User implements IUser {
|
|
173
|
+
/**
|
|
174
|
+
* Creates a new User instance.
|
|
175
|
+
*
|
|
176
|
+
* @param name - The user's name
|
|
177
|
+
* @param email - The user's email address
|
|
178
|
+
*/
|
|
179
|
+
constructor(
|
|
180
|
+
public name: string,
|
|
181
|
+
public email: string
|
|
182
|
+
) {}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Returns a greeting message.
|
|
186
|
+
*
|
|
187
|
+
* @returns A personalized greeting
|
|
188
|
+
*/
|
|
189
|
+
greet(): string {
|
|
190
|
+
return `Hello, I'm ${this.name}`;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### 4. Architecture Documentation
|
|
196
|
+
|
|
197
|
+
Document system architecture and design:
|
|
198
|
+
|
|
199
|
+
**Architecture Overview**:
|
|
200
|
+
```markdown
|
|
201
|
+
# System Architecture
|
|
202
|
+
|
|
203
|
+
## Overview
|
|
204
|
+
|
|
205
|
+
High-level description of the system architecture.
|
|
206
|
+
|
|
207
|
+
## Components
|
|
208
|
+
|
|
209
|
+
### Frontend
|
|
210
|
+
- **Technology**: React + TypeScript
|
|
211
|
+
- **State Management**: Redux Toolkit
|
|
212
|
+
- **Routing**: React Router
|
|
213
|
+
|
|
214
|
+
### Backend
|
|
215
|
+
- **Technology**: Node.js + Express
|
|
216
|
+
- **Database**: PostgreSQL
|
|
217
|
+
- **Cache**: Redis
|
|
218
|
+
|
|
219
|
+
### Infrastructure
|
|
220
|
+
- **Hosting**: AWS
|
|
221
|
+
- **CI/CD**: GitHub Actions
|
|
222
|
+
- **Monitoring**: DataDog
|
|
223
|
+
|
|
224
|
+
## Data Flow
|
|
225
|
+
|
|
226
|
+
\`\`\`mermaid
|
|
227
|
+
graph LR
|
|
228
|
+
A[Client] --> B[API Gateway]
|
|
229
|
+
B --> C[Backend Service]
|
|
230
|
+
C --> D[Database]
|
|
231
|
+
C --> E[Cache]
|
|
232
|
+
\`\`\`
|
|
233
|
+
|
|
234
|
+
## Security
|
|
235
|
+
|
|
236
|
+
- JWT-based authentication
|
|
237
|
+
- HTTPS encryption
|
|
238
|
+
- Rate limiting
|
|
239
|
+
- Input validation
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### 5. CHANGELOG Generation
|
|
243
|
+
|
|
244
|
+
Generate and maintain changelog files:
|
|
245
|
+
|
|
246
|
+
```markdown
|
|
247
|
+
# Changelog
|
|
248
|
+
|
|
249
|
+
All notable changes to this project will be documented in this file.
|
|
250
|
+
|
|
251
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
252
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
253
|
+
|
|
254
|
+
## [Unreleased]
|
|
255
|
+
|
|
256
|
+
### Added
|
|
257
|
+
- New feature X
|
|
258
|
+
- New feature Y
|
|
259
|
+
|
|
260
|
+
### Changed
|
|
261
|
+
- Updated dependency Z to v2.0
|
|
262
|
+
|
|
263
|
+
### Fixed
|
|
264
|
+
- Bug fix for issue #123
|
|
265
|
+
|
|
266
|
+
## [1.2.0] - 2026-01-10
|
|
267
|
+
|
|
268
|
+
### Added
|
|
269
|
+
- Feature A with comprehensive tests
|
|
270
|
+
- Feature B with documentation
|
|
271
|
+
|
|
272
|
+
### Changed
|
|
273
|
+
- Improved performance of module C
|
|
274
|
+
- Updated UI components
|
|
275
|
+
|
|
276
|
+
### Deprecated
|
|
277
|
+
- Old API endpoint /v1/users (use /v2/users instead)
|
|
278
|
+
|
|
279
|
+
### Removed
|
|
280
|
+
- Deprecated feature D
|
|
281
|
+
|
|
282
|
+
### Fixed
|
|
283
|
+
- Critical bug in authentication flow
|
|
284
|
+
- Memory leak in background service
|
|
285
|
+
|
|
286
|
+
### Security
|
|
287
|
+
- Patched vulnerability CVE-2026-1234
|
|
288
|
+
|
|
289
|
+
## [1.1.0] - 2025-12-15
|
|
290
|
+
|
|
291
|
+
...
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## Documentation Templates
|
|
295
|
+
|
|
296
|
+
### Project README Template
|
|
297
|
+
|
|
298
|
+
```markdown
|
|
299
|
+
# [Project Name]
|
|
300
|
+
|
|
301
|
+
[Badges: build status, coverage, version, license]
|
|
302
|
+
|
|
303
|
+
[Brief one-line description]
|
|
304
|
+
|
|
305
|
+
## Table of Contents
|
|
306
|
+
|
|
307
|
+
- [Features](#features)
|
|
308
|
+
- [Installation](#installation)
|
|
309
|
+
- [Quick Start](#quick-start)
|
|
310
|
+
- [Usage](#usage)
|
|
311
|
+
- [API Reference](#api-reference)
|
|
312
|
+
- [Configuration](#configuration)
|
|
313
|
+
- [Examples](#examples)
|
|
314
|
+
- [Contributing](#contributing)
|
|
315
|
+
- [Testing](#testing)
|
|
316
|
+
- [Changelog](#changelog)
|
|
317
|
+
- [License](#license)
|
|
318
|
+
|
|
319
|
+
## Features
|
|
320
|
+
|
|
321
|
+
- Feature 1: Description
|
|
322
|
+
- Feature 2: Description
|
|
323
|
+
- Feature 3: Description
|
|
324
|
+
|
|
325
|
+
## Installation
|
|
326
|
+
|
|
327
|
+
\`\`\`bash
|
|
328
|
+
# npm
|
|
329
|
+
npm install [package-name]
|
|
330
|
+
|
|
331
|
+
# yarn
|
|
332
|
+
yarn add [package-name]
|
|
333
|
+
|
|
334
|
+
# pnpm
|
|
335
|
+
pnpm add [package-name]
|
|
336
|
+
\`\`\`
|
|
337
|
+
|
|
338
|
+
## Quick Start
|
|
339
|
+
|
|
340
|
+
\`\`\`javascript
|
|
341
|
+
// Quick example to get started
|
|
342
|
+
import { feature } from '[package-name]';
|
|
343
|
+
|
|
344
|
+
const result = feature.doSomething();
|
|
345
|
+
console.log(result);
|
|
346
|
+
\`\`\`
|
|
347
|
+
|
|
348
|
+
## Usage
|
|
349
|
+
|
|
350
|
+
### Basic Usage
|
|
351
|
+
|
|
352
|
+
[Detailed usage instructions]
|
|
353
|
+
|
|
354
|
+
### Advanced Usage
|
|
355
|
+
|
|
356
|
+
[Advanced examples and patterns]
|
|
357
|
+
|
|
358
|
+
## API Reference
|
|
359
|
+
|
|
360
|
+
[Comprehensive API documentation]
|
|
361
|
+
|
|
362
|
+
## Configuration
|
|
363
|
+
|
|
364
|
+
[Configuration options and examples]
|
|
365
|
+
|
|
366
|
+
## Examples
|
|
367
|
+
|
|
368
|
+
[Multiple practical examples]
|
|
369
|
+
|
|
370
|
+
## Contributing
|
|
371
|
+
|
|
372
|
+
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
|
373
|
+
|
|
374
|
+
## Testing
|
|
375
|
+
|
|
376
|
+
\`\`\`bash
|
|
377
|
+
npm test
|
|
378
|
+
\`\`\`
|
|
379
|
+
|
|
380
|
+
## Changelog
|
|
381
|
+
|
|
382
|
+
See [CHANGELOG.md](CHANGELOG.md) for release history.
|
|
383
|
+
|
|
384
|
+
## License
|
|
385
|
+
|
|
386
|
+
[License Type] - see [LICENSE](LICENSE) file for details.
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### API Endpoint Documentation Template
|
|
390
|
+
|
|
391
|
+
```markdown
|
|
392
|
+
## [METHOD] /api/endpoint
|
|
393
|
+
|
|
394
|
+
[Brief description of what this endpoint does]
|
|
395
|
+
|
|
396
|
+
### Authentication
|
|
397
|
+
|
|
398
|
+
[Required/Optional] - [Auth type: Bearer token, API key, etc.]
|
|
399
|
+
|
|
400
|
+
### Request
|
|
401
|
+
|
|
402
|
+
**Headers:**
|
|
403
|
+
\`\`\`
|
|
404
|
+
Content-Type: application/json
|
|
405
|
+
Authorization: Bearer {token}
|
|
406
|
+
\`\`\`
|
|
407
|
+
|
|
408
|
+
**Parameters:**
|
|
409
|
+
- `param1` (type, required/optional): Description
|
|
410
|
+
- `param2` (type, required/optional): Description
|
|
411
|
+
|
|
412
|
+
**Body:**
|
|
413
|
+
\`\`\`json
|
|
414
|
+
{
|
|
415
|
+
"field1": "value1",
|
|
416
|
+
"field2": "value2"
|
|
417
|
+
}
|
|
418
|
+
\`\`\`
|
|
419
|
+
|
|
420
|
+
### Response
|
|
421
|
+
|
|
422
|
+
**Success (200 OK):**
|
|
423
|
+
\`\`\`json
|
|
424
|
+
{
|
|
425
|
+
"status": "success",
|
|
426
|
+
"data": {
|
|
427
|
+
"id": "123",
|
|
428
|
+
"result": "value"
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
\`\`\`
|
|
432
|
+
|
|
433
|
+
**Error Responses:**
|
|
434
|
+
|
|
435
|
+
- `400 Bad Request`: Invalid parameters
|
|
436
|
+
\`\`\`json
|
|
437
|
+
{
|
|
438
|
+
"status": "error",
|
|
439
|
+
"message": "Invalid parameter: param1"
|
|
440
|
+
}
|
|
441
|
+
\`\`\`
|
|
442
|
+
|
|
443
|
+
- `401 Unauthorized`: Authentication failed
|
|
444
|
+
- `404 Not Found`: Resource not found
|
|
445
|
+
- `500 Internal Server Error`: Server error
|
|
446
|
+
|
|
447
|
+
### Example
|
|
448
|
+
|
|
449
|
+
\`\`\`bash
|
|
450
|
+
curl -X POST https://api.example.com/api/endpoint \
|
|
451
|
+
-H "Content-Type: application/json" \
|
|
452
|
+
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
453
|
+
-d '{"field1": "value1", "field2": "value2"}'
|
|
454
|
+
\`\`\`
|
|
455
|
+
|
|
456
|
+
### Rate Limiting
|
|
457
|
+
|
|
458
|
+
- Rate limit: 100 requests per minute
|
|
459
|
+
- Rate limit header: `X-RateLimit-Remaining`
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Component Documentation Template
|
|
463
|
+
|
|
464
|
+
```markdown
|
|
465
|
+
# ComponentName
|
|
466
|
+
|
|
467
|
+
[Brief description of the component]
|
|
468
|
+
|
|
469
|
+
## Props
|
|
470
|
+
|
|
471
|
+
| Prop | Type | Default | Required | Description |
|
|
472
|
+
|------|------|---------|----------|-------------|
|
|
473
|
+
| prop1 | string | - | Yes | Description of prop1 |
|
|
474
|
+
| prop2 | number | 0 | No | Description of prop2 |
|
|
475
|
+
| onEvent | function | - | No | Callback function |
|
|
476
|
+
|
|
477
|
+
## Usage
|
|
478
|
+
|
|
479
|
+
\`\`\`tsx
|
|
480
|
+
import { ComponentName } from './ComponentName';
|
|
481
|
+
|
|
482
|
+
function App() {
|
|
483
|
+
return (
|
|
484
|
+
<ComponentName
|
|
485
|
+
prop1="value"
|
|
486
|
+
prop2={42}
|
|
487
|
+
onEvent={(data) => console.log(data)}
|
|
488
|
+
/>
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
\`\`\`
|
|
492
|
+
|
|
493
|
+
## Examples
|
|
494
|
+
|
|
495
|
+
### Basic Example
|
|
496
|
+
|
|
497
|
+
\`\`\`tsx
|
|
498
|
+
<ComponentName prop1="basic" />
|
|
499
|
+
\`\`\`
|
|
500
|
+
|
|
501
|
+
### Advanced Example
|
|
502
|
+
|
|
503
|
+
\`\`\`tsx
|
|
504
|
+
<ComponentName
|
|
505
|
+
prop1="advanced"
|
|
506
|
+
prop2={100}
|
|
507
|
+
onEvent={(data) => {
|
|
508
|
+
// Handle event
|
|
509
|
+
}}
|
|
510
|
+
/>
|
|
511
|
+
\`\`\`
|
|
512
|
+
|
|
513
|
+
## Styling
|
|
514
|
+
|
|
515
|
+
[CSS classes, styling options, theming]
|
|
516
|
+
|
|
517
|
+
## Accessibility
|
|
518
|
+
|
|
519
|
+
[ARIA attributes, keyboard navigation, screen reader support]
|
|
520
|
+
|
|
521
|
+
## Browser Support
|
|
522
|
+
|
|
523
|
+
- Chrome: ✓
|
|
524
|
+
- Firefox: ✓
|
|
525
|
+
- Safari: ✓
|
|
526
|
+
- Edge: ✓
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
### Function Documentation Template
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
/**
|
|
533
|
+
* [Brief one-line description]
|
|
534
|
+
*
|
|
535
|
+
* [Detailed description of what the function does, including any important
|
|
536
|
+
* behavior, side effects, or considerations]
|
|
537
|
+
*
|
|
538
|
+
* @param paramName - Description of the parameter
|
|
539
|
+
* @param options - Configuration options
|
|
540
|
+
* @param options.option1 - Description of option1
|
|
541
|
+
* @param options.option2 - Description of option2
|
|
542
|
+
*
|
|
543
|
+
* @returns Description of the return value
|
|
544
|
+
*
|
|
545
|
+
* @throws {ErrorType} Description of when this error is thrown
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* Basic usage:
|
|
549
|
+
* ```typescript
|
|
550
|
+
* const result = functionName('value');
|
|
551
|
+
* console.log(result); // Expected output
|
|
552
|
+
* ```
|
|
553
|
+
*
|
|
554
|
+
* @example
|
|
555
|
+
* Advanced usage with options:
|
|
556
|
+
* ```typescript
|
|
557
|
+
* const result = functionName('value', {
|
|
558
|
+
* option1: true,
|
|
559
|
+
* option2: 'custom'
|
|
560
|
+
* });
|
|
561
|
+
* ```
|
|
562
|
+
*
|
|
563
|
+
* @see {@link RelatedFunction} for related functionality
|
|
564
|
+
* @since 1.0.0
|
|
565
|
+
* @deprecated Use {@link NewFunction} instead
|
|
566
|
+
*/
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
## Best Practices
|
|
570
|
+
|
|
571
|
+
### 1. Clear and Concise Writing
|
|
572
|
+
|
|
573
|
+
- **Use Simple Language**: Avoid jargon unless necessary
|
|
574
|
+
- **Be Specific**: Provide concrete examples rather than abstract descriptions
|
|
575
|
+
- **Stay Focused**: Each section should have a single, clear purpose
|
|
576
|
+
- **Use Active Voice**: "The function returns" instead of "The value is returned"
|
|
577
|
+
|
|
578
|
+
### 2. Code Examples
|
|
579
|
+
|
|
580
|
+
- **Provide Working Examples**: All code examples should be runnable
|
|
581
|
+
- **Show Common Use Cases**: Cover the most frequent scenarios
|
|
582
|
+
- **Include Edge Cases**: Document unusual but important cases
|
|
583
|
+
- **Use Realistic Data**: Examples should reflect real-world usage
|
|
584
|
+
|
|
585
|
+
**Good Example**:
|
|
586
|
+
```typescript
|
|
587
|
+
// Good: Realistic, complete example
|
|
588
|
+
const user = await fetchUser('user-123');
|
|
589
|
+
if (user) {
|
|
590
|
+
console.log(`Welcome, ${user.name}!`);
|
|
591
|
+
}
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
**Bad Example**:
|
|
595
|
+
```typescript
|
|
596
|
+
// Bad: Abstract, incomplete example
|
|
597
|
+
const x = func(y);
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
### 3. Usage Instructions
|
|
601
|
+
|
|
602
|
+
- **Step-by-Step**: Break complex processes into clear steps
|
|
603
|
+
- **Prerequisites**: List requirements before instructions
|
|
604
|
+
- **Expected Outcomes**: Describe what should happen
|
|
605
|
+
- **Troubleshooting**: Include common issues and solutions
|
|
606
|
+
|
|
607
|
+
**Example**:
|
|
608
|
+
```markdown
|
|
609
|
+
## Installation
|
|
610
|
+
|
|
611
|
+
### Prerequisites
|
|
612
|
+
- Node.js 18 or higher
|
|
613
|
+
- npm 9 or higher
|
|
614
|
+
|
|
615
|
+
### Steps
|
|
616
|
+
|
|
617
|
+
1. Install the package:
|
|
618
|
+
\`\`\`bash
|
|
619
|
+
npm install package-name
|
|
620
|
+
\`\`\`
|
|
621
|
+
|
|
622
|
+
2. Import in your code:
|
|
623
|
+
\`\`\`typescript
|
|
624
|
+
import { feature } from 'package-name';
|
|
625
|
+
\`\`\`
|
|
626
|
+
|
|
627
|
+
3. Configure (optional):
|
|
628
|
+
\`\`\`typescript
|
|
629
|
+
feature.configure({ option: 'value' });
|
|
630
|
+
\`\`\`
|
|
631
|
+
|
|
632
|
+
### Verification
|
|
633
|
+
|
|
634
|
+
Run the following to verify installation:
|
|
635
|
+
\`\`\`bash
|
|
636
|
+
npm list package-name
|
|
637
|
+
\`\`\`
|
|
638
|
+
|
|
639
|
+
### Troubleshooting
|
|
640
|
+
|
|
641
|
+
**Issue**: Installation fails with EACCES error
|
|
642
|
+
**Solution**: Run with sudo or fix npm permissions
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
### 4. Keep Documentation Updated
|
|
646
|
+
|
|
647
|
+
- **Version Documentation**: Tag docs with version numbers
|
|
648
|
+
- **Update with Code Changes**: Update docs when code changes
|
|
649
|
+
- **Review Regularly**: Periodic documentation audits
|
|
650
|
+
- **Deprecation Notices**: Clearly mark deprecated features
|
|
651
|
+
|
|
652
|
+
### 5. Structure and Organization
|
|
653
|
+
|
|
654
|
+
- **Logical Flow**: Organize from simple to complex
|
|
655
|
+
- **Table of Contents**: For longer documents
|
|
656
|
+
- **Cross-References**: Link related sections
|
|
657
|
+
- **Consistent Formatting**: Use consistent markdown style
|
|
658
|
+
|
|
659
|
+
### 6. Accessibility
|
|
660
|
+
|
|
661
|
+
- **Alt Text for Images**: Describe diagrams and screenshots
|
|
662
|
+
- **Semantic Headings**: Use proper heading hierarchy
|
|
663
|
+
- **Code Block Labels**: Specify language for syntax highlighting
|
|
664
|
+
- **Link Text**: Use descriptive link text, not "click here"
|
|
665
|
+
|
|
666
|
+
## Output Formats
|
|
667
|
+
|
|
668
|
+
### 1. Markdown
|
|
669
|
+
|
|
670
|
+
Primary format for most documentation:
|
|
671
|
+
|
|
672
|
+
```markdown
|
|
673
|
+
# Heading 1
|
|
674
|
+
## Heading 2
|
|
675
|
+
### Heading 3
|
|
676
|
+
|
|
677
|
+
**Bold text**
|
|
678
|
+
*Italic text*
|
|
679
|
+
`inline code`
|
|
680
|
+
|
|
681
|
+
- Bullet list
|
|
682
|
+
- Item 2
|
|
683
|
+
|
|
684
|
+
1. Numbered list
|
|
685
|
+
2. Item 2
|
|
686
|
+
|
|
687
|
+
[Link text](https://example.com)
|
|
688
|
+
|
|
689
|
+

|
|
690
|
+
|
|
691
|
+
\`\`\`language
|
|
692
|
+
code block
|
|
693
|
+
\`\`\`
|
|
694
|
+
|
|
695
|
+
> Blockquote
|
|
696
|
+
|
|
697
|
+
| Table | Header |
|
|
698
|
+
|-------|--------|
|
|
699
|
+
| Cell | Cell |
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
### 2. HTML (via tools)
|
|
703
|
+
|
|
704
|
+
For web-based documentation:
|
|
705
|
+
|
|
706
|
+
```html
|
|
707
|
+
<!DOCTYPE html>
|
|
708
|
+
<html>
|
|
709
|
+
<head>
|
|
710
|
+
<title>API Documentation</title>
|
|
711
|
+
<style>
|
|
712
|
+
/* Documentation styles */
|
|
713
|
+
</style>
|
|
714
|
+
</head>
|
|
715
|
+
<body>
|
|
716
|
+
<nav><!-- Navigation --></nav>
|
|
717
|
+
<main>
|
|
718
|
+
<article>
|
|
719
|
+
<!-- Documentation content -->
|
|
720
|
+
</article>
|
|
721
|
+
</main>
|
|
722
|
+
</body>
|
|
723
|
+
</html>
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
### 3. JSDoc Comments
|
|
727
|
+
|
|
728
|
+
For inline code documentation:
|
|
729
|
+
|
|
730
|
+
```typescript
|
|
731
|
+
/**
|
|
732
|
+
* @module ModuleName
|
|
733
|
+
* @description Module description
|
|
734
|
+
*/
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* @typedef {Object} TypeName
|
|
738
|
+
* @property {string} prop1 - Description
|
|
739
|
+
* @property {number} prop2 - Description
|
|
740
|
+
*/
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* @function functionName
|
|
744
|
+
* @description Function description
|
|
745
|
+
* @param {string} param - Parameter description
|
|
746
|
+
* @returns {Promise<Result>} Return description
|
|
747
|
+
*/
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
## Workflow
|
|
751
|
+
|
|
752
|
+
### 1. Analyze Code
|
|
753
|
+
|
|
754
|
+
- Read source files to understand functionality
|
|
755
|
+
- Identify public APIs and interfaces
|
|
756
|
+
- Note important patterns and conventions
|
|
757
|
+
- Check for existing documentation
|
|
758
|
+
|
|
759
|
+
### 2. Generate Documentation
|
|
760
|
+
|
|
761
|
+
- Create appropriate documentation type
|
|
762
|
+
- Follow templates and best practices
|
|
763
|
+
- Include comprehensive examples
|
|
764
|
+
- Add cross-references
|
|
765
|
+
|
|
766
|
+
### 3. Review and Refine
|
|
767
|
+
|
|
768
|
+
- Verify accuracy of technical details
|
|
769
|
+
- Test all code examples
|
|
770
|
+
- Check for clarity and completeness
|
|
771
|
+
- Ensure consistent formatting
|
|
772
|
+
|
|
773
|
+
### 4. Integrate
|
|
774
|
+
|
|
775
|
+
- Place documentation in appropriate location
|
|
776
|
+
- Update table of contents and indexes
|
|
777
|
+
- Add to version control
|
|
778
|
+
- Notify team of updates
|
|
779
|
+
|
|
780
|
+
## Tips for Success
|
|
781
|
+
|
|
782
|
+
1. **Start with Why**: Explain the purpose before the details
|
|
783
|
+
2. **Show, Don't Just Tell**: Use examples liberally
|
|
784
|
+
3. **Think Like a User**: Write for your audience's knowledge level
|
|
785
|
+
4. **Be Consistent**: Use consistent terminology and formatting
|
|
786
|
+
5. **Keep It Current**: Documentation should match the code
|
|
787
|
+
6. **Make It Searchable**: Use clear headings and keywords
|
|
788
|
+
7. **Test Your Examples**: All code examples should work
|
|
789
|
+
8. **Get Feedback**: Have others review your documentation
|
|
790
|
+
|
|
791
|
+
## Common Pitfalls to Avoid
|
|
792
|
+
|
|
793
|
+
- **Assuming Knowledge**: Don't assume readers know context
|
|
794
|
+
- **Incomplete Examples**: Provide full, working examples
|
|
795
|
+
- **Outdated Information**: Keep docs in sync with code
|
|
796
|
+
- **Poor Organization**: Structure information logically
|
|
797
|
+
- **Missing Error Cases**: Document error handling
|
|
798
|
+
- **No Visual Aids**: Use diagrams where helpful
|
|
799
|
+
- **Inconsistent Style**: Maintain consistent formatting
|
|
800
|
+
|
|
801
|
+
## Resources
|
|
802
|
+
|
|
803
|
+
- [Markdown Guide](https://www.markdownguide.org/)
|
|
804
|
+
- [JSDoc Documentation](https://jsdoc.app/)
|
|
805
|
+
- [TypeDoc](https://typedoc.org/)
|
|
806
|
+
- [Keep a Changelog](https://keepachangelog.com/)
|
|
807
|
+
- [Semantic Versioning](https://semver.org/)
|
|
808
|
+
- [Write the Docs](https://www.writethedocs.org/)
|