opencode-goopspec 0.1.0
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/LICENSE +21 -0
- package/README.md +650 -0
- package/agents/goop-debugger.md +265 -0
- package/agents/goop-designer.md +244 -0
- package/agents/goop-executor.md +217 -0
- package/agents/goop-explorer.md +252 -0
- package/agents/goop-librarian.md +197 -0
- package/agents/goop-orchestrator.md +224 -0
- package/agents/goop-planner.md +231 -0
- package/agents/goop-researcher.md +246 -0
- package/agents/goop-tester.md +245 -0
- package/agents/goop-verifier.md +266 -0
- package/agents/goop-writer.md +293 -0
- package/agents/memory-distiller.md +226 -0
- package/commands/goop-accept.md +183 -0
- package/commands/goop-amend.md +175 -0
- package/commands/goop-complete.md +206 -0
- package/commands/goop-debug.md +318 -0
- package/commands/goop-discuss.md +138 -0
- package/commands/goop-execute.md +137 -0
- package/commands/goop-help.md +82 -0
- package/commands/goop-map-codebase.md +501 -0
- package/commands/goop-memory.md +66 -0
- package/commands/goop-milestone.md +213 -0
- package/commands/goop-pause.md +61 -0
- package/commands/goop-plan.md +78 -0
- package/commands/goop-quick.md +165 -0
- package/commands/goop-recall.md +48 -0
- package/commands/goop-remember.md +71 -0
- package/commands/goop-research.md +98 -0
- package/commands/goop-resume.md +57 -0
- package/commands/goop-setup.md +208 -0
- package/commands/goop-specify.md +145 -0
- package/commands/goop-status.md +153 -0
- package/dist/index.js +31017 -0
- package/dist/memory/index.js +48752 -0
- package/package.json +73 -0
- package/references/agent-patterns.md +334 -0
- package/references/boundary-system.md +141 -0
- package/references/deviation-rules.md +80 -0
- package/references/dispatch-patterns.md +176 -0
- package/references/model-profiles.md +109 -0
- package/references/orchestrator-philosophy.md +280 -0
- package/references/security-checklist.md +163 -0
- package/references/subagent-protocol.md +393 -0
- package/references/tdd.md +231 -0
- package/references/ui-brand.md +261 -0
- package/references/workflow-accept.md +325 -0
- package/references/workflow-execute.md +315 -0
- package/references/workflow-plan.md +179 -0
- package/references/workflow-research.md +234 -0
- package/references/workflow-specify.md +278 -0
- package/skills/README.md +362 -0
- package/skills/accessibility/skill.md +41 -0
- package/skills/accessibility-testing/skill.md +47 -0
- package/skills/api-docs/skill.md +50 -0
- package/skills/architecture-design/skill.md +168 -0
- package/skills/atomic-commits/skill.md +53 -0
- package/skills/code-review/skill.md +59 -0
- package/skills/codebase-mapping/skill.md +54 -0
- package/skills/convention-detection/skill.md +68 -0
- package/skills/debugging/skill.md +59 -0
- package/skills/deviation-handling/skill.md +187 -0
- package/skills/documentation/skill.md +213 -0
- package/skills/goop-core/skill.md +383 -0
- package/skills/memory-usage/skill.md +208 -0
- package/skills/parallel-planning/skill.md +170 -0
- package/skills/pattern-extraction/skill.md +73 -0
- package/skills/performance-optimization/skill.md +188 -0
- package/skills/playwright/skill.md +69 -0
- package/skills/playwright-testing/skill.md +93 -0
- package/skills/progress-tracking/skill.md +155 -0
- package/skills/readme-generation/skill.md +87 -0
- package/skills/research/skill.md +161 -0
- package/skills/responsive-design/skill.md +76 -0
- package/skills/scientific-method/skill.md +67 -0
- package/skills/security-audit/skill.md +152 -0
- package/skills/task-decomposition/skill.md +153 -0
- package/skills/task-delegation/skill.md +127 -0
- package/skills/technical-writing/skill.md +69 -0
- package/skills/testing/skill.md +202 -0
- package/skills/ui-design/skill.md +73 -0
- package/skills/ux-patterns/skill.md +82 -0
- package/skills/verification/skill.md +178 -0
- package/skills/visual-regression/skill.md +86 -0
- package/templates/blueprint.md +141 -0
- package/templates/chronicle.md +156 -0
- package/templates/milestone.md +131 -0
- package/templates/research.md +117 -0
- package/templates/retrospective.md +188 -0
- package/templates/spec.md +103 -0
- package/templates/summary.md +202 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Provide thorough, constructive code reviews that improve code quality and share knowledge.
|
|
4
|
+
category: review
|
|
5
|
+
triggers:
|
|
6
|
+
- review
|
|
7
|
+
- feedback
|
|
8
|
+
- pull request
|
|
9
|
+
- quality
|
|
10
|
+
version: 0.1.0
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Code Review Skill
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
Provide thorough, constructive code reviews that improve code quality and share knowledge.
|
|
17
|
+
|
|
18
|
+
## Review Focus Areas
|
|
19
|
+
|
|
20
|
+
### 1. Correctness
|
|
21
|
+
- Does the code do what it claims?
|
|
22
|
+
- Are edge cases handled?
|
|
23
|
+
- Are there potential bugs?
|
|
24
|
+
|
|
25
|
+
### 2. Design
|
|
26
|
+
- Is the code well-structured?
|
|
27
|
+
- Are abstractions appropriate?
|
|
28
|
+
- Does it follow project patterns?
|
|
29
|
+
|
|
30
|
+
### 3. Performance
|
|
31
|
+
- Are there obvious performance issues?
|
|
32
|
+
- Unnecessary loops or allocations?
|
|
33
|
+
- Appropriate data structures?
|
|
34
|
+
|
|
35
|
+
### 4. Security
|
|
36
|
+
- Input validation present?
|
|
37
|
+
- Secrets properly handled?
|
|
38
|
+
- SQL injection, XSS risks?
|
|
39
|
+
|
|
40
|
+
### 5. Maintainability
|
|
41
|
+
- Is the code readable?
|
|
42
|
+
- Are names meaningful?
|
|
43
|
+
- Is complexity manageable?
|
|
44
|
+
|
|
45
|
+
## Review Process
|
|
46
|
+
|
|
47
|
+
1. Understand the context and goal
|
|
48
|
+
2. Read the code thoroughly
|
|
49
|
+
3. Run the code if possible
|
|
50
|
+
4. Leave specific, actionable comments
|
|
51
|
+
5. Distinguish between blocking issues and suggestions
|
|
52
|
+
6. Acknowledge good code, not just problems
|
|
53
|
+
|
|
54
|
+
## Comment Types
|
|
55
|
+
|
|
56
|
+
- **Blocking** - Must be fixed before merge
|
|
57
|
+
- **Suggestion** - Nice to have, not required
|
|
58
|
+
- **Question** - Need clarification
|
|
59
|
+
- **Nitpick** - Style preference (prefix with "nit:")
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-mapping
|
|
3
|
+
description: Systematically explore and understand an unfamiliar codebase to build a mental model.
|
|
4
|
+
category: code
|
|
5
|
+
triggers:
|
|
6
|
+
- codebase
|
|
7
|
+
- architecture
|
|
8
|
+
- discovery
|
|
9
|
+
- mapping
|
|
10
|
+
version: 0.1.0
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Codebase Mapping Skill
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
Systematically explore and understand an unfamiliar codebase to build a mental model.
|
|
17
|
+
|
|
18
|
+
## Exploration Strategy
|
|
19
|
+
|
|
20
|
+
### Phase 1: High-Level Overview
|
|
21
|
+
1. Read README and documentation
|
|
22
|
+
2. Examine directory structure
|
|
23
|
+
3. Identify main entry points
|
|
24
|
+
4. Review package.json/requirements.txt for dependencies
|
|
25
|
+
|
|
26
|
+
### Phase 2: Architecture Discovery
|
|
27
|
+
1. Find the main application entry point
|
|
28
|
+
2. Trace the request/response flow
|
|
29
|
+
3. Identify core abstractions and patterns
|
|
30
|
+
4. Map module dependencies
|
|
31
|
+
|
|
32
|
+
### Phase 3: Deep Dive
|
|
33
|
+
1. Read key modules in detail
|
|
34
|
+
2. Understand data models
|
|
35
|
+
3. Map API endpoints to handlers
|
|
36
|
+
4. Identify testing patterns
|
|
37
|
+
|
|
38
|
+
## Key Questions
|
|
39
|
+
|
|
40
|
+
- What framework/runtime is used?
|
|
41
|
+
- How is the code organized (layers, features, hybrid)?
|
|
42
|
+
- Where is configuration managed?
|
|
43
|
+
- How is state managed?
|
|
44
|
+
- What are the main data flows?
|
|
45
|
+
- How are errors handled?
|
|
46
|
+
- What testing approach is used?
|
|
47
|
+
|
|
48
|
+
## Output Artifacts
|
|
49
|
+
|
|
50
|
+
- Directory structure summary
|
|
51
|
+
- Architecture diagram (text or visual)
|
|
52
|
+
- Key file inventory
|
|
53
|
+
- Pattern documentation
|
|
54
|
+
- Convention notes for AI agents
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: convention-detection
|
|
3
|
+
description: Identify and document coding conventions, patterns, and style guidelines used in a codebase.
|
|
4
|
+
category: code
|
|
5
|
+
triggers:
|
|
6
|
+
- conventions
|
|
7
|
+
- style
|
|
8
|
+
- patterns
|
|
9
|
+
- guidelines
|
|
10
|
+
version: 0.1.0
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Convention Detection Skill
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
Identify and document coding conventions, patterns, and style guidelines used in a codebase.
|
|
17
|
+
|
|
18
|
+
## Detection Areas
|
|
19
|
+
|
|
20
|
+
### 1. Naming Conventions
|
|
21
|
+
- File naming (kebab-case, camelCase, PascalCase)
|
|
22
|
+
- Variable/function naming
|
|
23
|
+
- Class/type naming
|
|
24
|
+
- Constant naming
|
|
25
|
+
- Database column naming
|
|
26
|
+
|
|
27
|
+
### 2. Code Organization
|
|
28
|
+
- Directory structure patterns
|
|
29
|
+
- Module organization
|
|
30
|
+
- Import ordering
|
|
31
|
+
- Export patterns
|
|
32
|
+
|
|
33
|
+
### 3. Style
|
|
34
|
+
- Indentation (tabs vs spaces, size)
|
|
35
|
+
- Quote style (single vs double)
|
|
36
|
+
- Semicolons (yes/no)
|
|
37
|
+
- Line length limits
|
|
38
|
+
- Trailing commas
|
|
39
|
+
|
|
40
|
+
### 4. Patterns
|
|
41
|
+
- Error handling approach
|
|
42
|
+
- Logging conventions
|
|
43
|
+
- Testing patterns
|
|
44
|
+
- Comment style
|
|
45
|
+
- Documentation format
|
|
46
|
+
|
|
47
|
+
## Detection Methods
|
|
48
|
+
|
|
49
|
+
1. **Config files** - Read ESLint, Prettier, EditorConfig
|
|
50
|
+
2. **Sample analysis** - Examine 5-10 representative files
|
|
51
|
+
3. **Frequency analysis** - Count occurrences of patterns
|
|
52
|
+
4. **Explicit docs** - Check CONTRIBUTING.md, STYLEGUIDE.md
|
|
53
|
+
|
|
54
|
+
## Output Format
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
## Detected Conventions
|
|
58
|
+
|
|
59
|
+
### Naming
|
|
60
|
+
- Files: kebab-case
|
|
61
|
+
- Functions: camelCase
|
|
62
|
+
- Classes: PascalCase
|
|
63
|
+
|
|
64
|
+
### Style
|
|
65
|
+
- Indent: 2 spaces
|
|
66
|
+
- Quotes: single
|
|
67
|
+
- Semicolons: no
|
|
68
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debugging
|
|
3
|
+
description: Systematically diagnose and fix bugs using scientific method.
|
|
4
|
+
category: code
|
|
5
|
+
triggers:
|
|
6
|
+
- debug
|
|
7
|
+
- bug
|
|
8
|
+
- diagnose
|
|
9
|
+
- fix
|
|
10
|
+
version: 0.1.0
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Debugging Skill
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
Systematically diagnose and fix bugs using scientific method.
|
|
17
|
+
|
|
18
|
+
## The Scientific Method for Debugging
|
|
19
|
+
|
|
20
|
+
1. **Observe** - Gather symptoms and error messages
|
|
21
|
+
2. **Hypothesize** - Form theories about the cause
|
|
22
|
+
3. **Predict** - What would you expect if hypothesis is true?
|
|
23
|
+
4. **Experiment** - Test the hypothesis
|
|
24
|
+
5. **Analyze** - Interpret results
|
|
25
|
+
6. **Iterate** - Refine hypothesis or fix
|
|
26
|
+
|
|
27
|
+
## Debugging Strategies
|
|
28
|
+
|
|
29
|
+
### Binary Search
|
|
30
|
+
Narrow down the problem space by eliminating half at each step.
|
|
31
|
+
|
|
32
|
+
### Print/Log Debugging
|
|
33
|
+
Add strategic logging to trace execution flow.
|
|
34
|
+
|
|
35
|
+
### Rubber Duck Debugging
|
|
36
|
+
Explain the problem out loud, step by step.
|
|
37
|
+
|
|
38
|
+
### Minimal Reproduction
|
|
39
|
+
Create the smallest test case that reproduces the bug.
|
|
40
|
+
|
|
41
|
+
### Git Bisect
|
|
42
|
+
Find the commit that introduced the bug.
|
|
43
|
+
|
|
44
|
+
## Common Bug Categories
|
|
45
|
+
|
|
46
|
+
- **Logic errors** - Wrong algorithm or condition
|
|
47
|
+
- **State errors** - Unexpected state mutations
|
|
48
|
+
- **Race conditions** - Timing-dependent failures
|
|
49
|
+
- **Edge cases** - Unhandled boundary conditions
|
|
50
|
+
- **Type errors** - Wrong types or null values
|
|
51
|
+
- **Integration errors** - API contract mismatches
|
|
52
|
+
|
|
53
|
+
## Debugging Checklist
|
|
54
|
+
|
|
55
|
+
- [ ] Can I reproduce the bug consistently?
|
|
56
|
+
- [ ] What changed recently?
|
|
57
|
+
- [ ] What are the exact error messages?
|
|
58
|
+
- [ ] What is the expected vs actual behavior?
|
|
59
|
+
- [ ] What assumptions am I making?
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deviation-handling
|
|
3
|
+
description: Handle deviations from plan using the 4-rule system
|
|
4
|
+
category: core
|
|
5
|
+
triggers:
|
|
6
|
+
- deviation
|
|
7
|
+
- unexpected
|
|
8
|
+
- bug
|
|
9
|
+
- blocker
|
|
10
|
+
version: 0.1.0
|
|
11
|
+
requires:
|
|
12
|
+
- goop-core
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Deviation Handling Skill
|
|
16
|
+
|
|
17
|
+
## The 4-Rule System
|
|
18
|
+
|
|
19
|
+
### Rule 1: Bug Fixes (Auto-Fix)
|
|
20
|
+
|
|
21
|
+
**Triggers:**
|
|
22
|
+
- Type errors, null pointer exceptions
|
|
23
|
+
- Logic errors (off-by-one, wrong comparison)
|
|
24
|
+
- Security vulnerabilities (injection, XSS)
|
|
25
|
+
- Runtime crashes
|
|
26
|
+
- Memory leaks
|
|
27
|
+
|
|
28
|
+
**Action:** Fix immediately without asking.
|
|
29
|
+
|
|
30
|
+
**Example:**
|
|
31
|
+
```typescript
|
|
32
|
+
// Bug found: missing null check
|
|
33
|
+
if (user.email) { // Was: if (user) - crashes on undefined
|
|
34
|
+
sendEmail(user.email);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Rule 2: Missing Critical Functionality (Auto-Fix)
|
|
39
|
+
|
|
40
|
+
**Triggers:**
|
|
41
|
+
- Missing error handling
|
|
42
|
+
- Missing input validation
|
|
43
|
+
- Missing auth checks
|
|
44
|
+
- Missing rate limiting
|
|
45
|
+
- Missing sanitization
|
|
46
|
+
|
|
47
|
+
**Action:** Add immediately without asking.
|
|
48
|
+
|
|
49
|
+
**Example:**
|
|
50
|
+
```typescript
|
|
51
|
+
// Missing: input validation
|
|
52
|
+
export async function createUser(data: UserInput) {
|
|
53
|
+
// Added: validation
|
|
54
|
+
if (!isValidEmail(data.email)) {
|
|
55
|
+
throw new ValidationError('Invalid email');
|
|
56
|
+
}
|
|
57
|
+
// ... rest of implementation
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Rule 3: Blocking Issues (Auto-Fix)
|
|
62
|
+
|
|
63
|
+
**Triggers:**
|
|
64
|
+
- Missing npm packages
|
|
65
|
+
- Broken imports
|
|
66
|
+
- Missing env variables
|
|
67
|
+
- Config errors
|
|
68
|
+
- Build failures
|
|
69
|
+
|
|
70
|
+
**Action:** Fix to unblock without asking.
|
|
71
|
+
|
|
72
|
+
**Example:**
|
|
73
|
+
```bash
|
|
74
|
+
# Missing package
|
|
75
|
+
npm install zod # Added to fix import error
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Rule 4: Architectural Decisions (STOP)
|
|
79
|
+
|
|
80
|
+
**Triggers:**
|
|
81
|
+
- Database schema changes
|
|
82
|
+
- New tables or collections
|
|
83
|
+
- Framework switches
|
|
84
|
+
- Major dependency additions
|
|
85
|
+
- API contract changes
|
|
86
|
+
- Infrastructure changes
|
|
87
|
+
|
|
88
|
+
**Action:** STOP and ask user.
|
|
89
|
+
|
|
90
|
+
**Example:**
|
|
91
|
+
```
|
|
92
|
+
STOP: Architectural Decision Required
|
|
93
|
+
|
|
94
|
+
The current implementation requires a new database table
|
|
95
|
+
for session storage.
|
|
96
|
+
|
|
97
|
+
Options:
|
|
98
|
+
1. Add 'sessions' table (recommended)
|
|
99
|
+
2. Use in-memory session store
|
|
100
|
+
3. Use existing 'users' table with session fields
|
|
101
|
+
|
|
102
|
+
Please choose an option to continue.
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Detection Flow
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
Issue Found
|
|
109
|
+
│
|
|
110
|
+
▼
|
|
111
|
+
Is it a bug/error? ──Yes──► Rule 1: Auto-fix
|
|
112
|
+
│
|
|
113
|
+
No
|
|
114
|
+
│
|
|
115
|
+
▼
|
|
116
|
+
Is critical feature missing? ──Yes──► Rule 2: Auto-add
|
|
117
|
+
│
|
|
118
|
+
No
|
|
119
|
+
│
|
|
120
|
+
▼
|
|
121
|
+
Is it blocking progress? ──Yes──► Rule 3: Auto-fix
|
|
122
|
+
│
|
|
123
|
+
No
|
|
124
|
+
│
|
|
125
|
+
▼
|
|
126
|
+
Is it architectural? ──Yes──► Rule 4: STOP and ask
|
|
127
|
+
│
|
|
128
|
+
No
|
|
129
|
+
│
|
|
130
|
+
▼
|
|
131
|
+
Continue without deviation
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Logging Deviations
|
|
135
|
+
|
|
136
|
+
Always log to ADL:
|
|
137
|
+
|
|
138
|
+
```markdown
|
|
139
|
+
### AD-015
|
|
140
|
+
|
|
141
|
+
**Type:** implementation
|
|
142
|
+
**Date:** 2024-01-15T10:30:00Z
|
|
143
|
+
**Status:** active
|
|
144
|
+
|
|
145
|
+
**Context:**
|
|
146
|
+
During implementation of login endpoint, discovered missing
|
|
147
|
+
input validation on email field.
|
|
148
|
+
|
|
149
|
+
**Decision:**
|
|
150
|
+
Applied Rule 2: Auto-added email validation using zod schema.
|
|
151
|
+
|
|
152
|
+
**Rationale:**
|
|
153
|
+
Input validation is a critical security requirement that any
|
|
154
|
+
professional implementation would include.
|
|
155
|
+
|
|
156
|
+
**Related Files:**
|
|
157
|
+
- `src/auth/login.ts`
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Confidence Handling
|
|
161
|
+
|
|
162
|
+
If unsure which rule applies:
|
|
163
|
+
- Default to Rule 4 (ask user)
|
|
164
|
+
- Log uncertainty in ADL
|
|
165
|
+
- Request clarification
|
|
166
|
+
|
|
167
|
+
## Commit Messages
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
fix(auth): add missing email validation (Rule 2 deviation)
|
|
171
|
+
|
|
172
|
+
- Added zod schema for email validation
|
|
173
|
+
- Returns 400 on invalid input
|
|
174
|
+
- Logged as AD-015 in ADL
|
|
175
|
+
|
|
176
|
+
During: Implement login endpoint
|
|
177
|
+
Issue: Missing input validation
|
|
178
|
+
Rule: 2 (auto-add missing critical functionality)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Best Practices
|
|
182
|
+
|
|
183
|
+
1. **Document everything:** Every deviation goes in ADL
|
|
184
|
+
2. **Atomic fixes:** One deviation = one commit
|
|
185
|
+
3. **Stay in scope:** Deviations shouldn't expand spec scope
|
|
186
|
+
4. **Confidence threshold:** When in doubt, ask (Rule 4)
|
|
187
|
+
5. **Verify after fix:** Run tests to confirm fix works
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentation
|
|
3
|
+
description: Write technical documentation and guides
|
|
4
|
+
category: documentation
|
|
5
|
+
triggers:
|
|
6
|
+
- document
|
|
7
|
+
- readme
|
|
8
|
+
- api
|
|
9
|
+
- guide
|
|
10
|
+
version: 0.1.0
|
|
11
|
+
requires:
|
|
12
|
+
- goop-core
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Documentation Skill
|
|
16
|
+
|
|
17
|
+
## Documentation Types
|
|
18
|
+
|
|
19
|
+
### README.md
|
|
20
|
+
Project overview, quick start, basic usage.
|
|
21
|
+
|
|
22
|
+
### API Documentation
|
|
23
|
+
Endpoints, parameters, responses, examples.
|
|
24
|
+
|
|
25
|
+
### Architecture Documentation
|
|
26
|
+
System design, patterns, decisions.
|
|
27
|
+
|
|
28
|
+
### User Guides
|
|
29
|
+
How-to guides, tutorials, walkthroughs.
|
|
30
|
+
|
|
31
|
+
### Developer Guides
|
|
32
|
+
Setup, contribution, debugging.
|
|
33
|
+
|
|
34
|
+
## README Structure
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
# Project Name
|
|
38
|
+
|
|
39
|
+
Brief description (1-2 sentences)
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
- Feature 1
|
|
43
|
+
- Feature 2
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
\`\`\`bash
|
|
48
|
+
npm install project-name
|
|
49
|
+
\`\`\`
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
\`\`\`typescript
|
|
54
|
+
import { thing } from 'project-name';
|
|
55
|
+
\`\`\`
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
| Option | Type | Default | Description |
|
|
60
|
+
|--------|------|---------|-------------|
|
|
61
|
+
| option | string | "default" | What it does |
|
|
62
|
+
|
|
63
|
+
## API Reference
|
|
64
|
+
|
|
65
|
+
### functionName(param)
|
|
66
|
+
|
|
67
|
+
Description of function.
|
|
68
|
+
|
|
69
|
+
**Parameters:**
|
|
70
|
+
- `param` (type) - description
|
|
71
|
+
|
|
72
|
+
**Returns:** type - description
|
|
73
|
+
|
|
74
|
+
## Contributing
|
|
75
|
+
See CONTRIBUTING.md
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
MIT
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## API Documentation
|
|
82
|
+
|
|
83
|
+
### Endpoint Documentation
|
|
84
|
+
```markdown
|
|
85
|
+
## POST /api/users
|
|
86
|
+
|
|
87
|
+
Create a new user.
|
|
88
|
+
|
|
89
|
+
### Request
|
|
90
|
+
|
|
91
|
+
**Headers:**
|
|
92
|
+
| Header | Value | Required |
|
|
93
|
+
|--------|-------|----------|
|
|
94
|
+
| Authorization | Bearer {token} | Yes |
|
|
95
|
+
|
|
96
|
+
**Body:**
|
|
97
|
+
\`\`\`json
|
|
98
|
+
{
|
|
99
|
+
"email": "user@example.com",
|
|
100
|
+
"name": "John Doe"
|
|
101
|
+
}
|
|
102
|
+
\`\`\`
|
|
103
|
+
|
|
104
|
+
### Response
|
|
105
|
+
|
|
106
|
+
**Success (201):**
|
|
107
|
+
\`\`\`json
|
|
108
|
+
{
|
|
109
|
+
"id": "123",
|
|
110
|
+
"email": "user@example.com",
|
|
111
|
+
"name": "John Doe"
|
|
112
|
+
}
|
|
113
|
+
\`\`\`
|
|
114
|
+
|
|
115
|
+
**Error (400):**
|
|
116
|
+
\`\`\`json
|
|
117
|
+
{
|
|
118
|
+
"error": "Invalid email format"
|
|
119
|
+
}
|
|
120
|
+
\`\`\`
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Code Documentation
|
|
124
|
+
|
|
125
|
+
### JSDoc/TSDoc
|
|
126
|
+
```typescript
|
|
127
|
+
/**
|
|
128
|
+
* Creates a new user in the system.
|
|
129
|
+
*
|
|
130
|
+
* @param data - User creation data
|
|
131
|
+
* @param data.email - User's email address
|
|
132
|
+
* @param data.name - User's display name
|
|
133
|
+
* @returns The created user object
|
|
134
|
+
* @throws {ValidationError} If email is invalid
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const user = await createUser({
|
|
139
|
+
* email: 'user@example.com',
|
|
140
|
+
* name: 'John Doe'
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export async function createUser(data: CreateUserInput): Promise<User> {
|
|
145
|
+
// ...
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Architecture Decision Records
|
|
150
|
+
|
|
151
|
+
```markdown
|
|
152
|
+
# ADR-001: Use PostgreSQL for primary database
|
|
153
|
+
|
|
154
|
+
## Status
|
|
155
|
+
Accepted
|
|
156
|
+
|
|
157
|
+
## Context
|
|
158
|
+
Need a reliable database for user data and transactions.
|
|
159
|
+
|
|
160
|
+
## Decision
|
|
161
|
+
Use PostgreSQL with Prisma ORM.
|
|
162
|
+
|
|
163
|
+
## Consequences
|
|
164
|
+
- Pros: ACID compliance, rich feature set
|
|
165
|
+
- Cons: Operational complexity, scaling limits
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Documentation Best Practices
|
|
169
|
+
|
|
170
|
+
### Do
|
|
171
|
+
- Write for your audience
|
|
172
|
+
- Include examples
|
|
173
|
+
- Keep it up to date
|
|
174
|
+
- Use consistent formatting
|
|
175
|
+
- Start with the most important info
|
|
176
|
+
|
|
177
|
+
### Don't
|
|
178
|
+
- Assume prior knowledge
|
|
179
|
+
- Write walls of text
|
|
180
|
+
- Document obvious things
|
|
181
|
+
- Leave TODO comments
|
|
182
|
+
- Duplicate information
|
|
183
|
+
|
|
184
|
+
## Documentation Tools
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Generate API docs from JSDoc
|
|
188
|
+
npx typedoc src/index.ts
|
|
189
|
+
|
|
190
|
+
# Generate from OpenAPI spec
|
|
191
|
+
npx @redocly/cli build-docs openapi.yaml
|
|
192
|
+
|
|
193
|
+
# Markdown linting
|
|
194
|
+
npx markdownlint "**/*.md"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Documentation Review Checklist
|
|
198
|
+
|
|
199
|
+
- [ ] Accurate and up to date
|
|
200
|
+
- [ ] Clear and concise
|
|
201
|
+
- [ ] Includes examples
|
|
202
|
+
- [ ] Proper formatting
|
|
203
|
+
- [ ] No broken links
|
|
204
|
+
- [ ] Spell checked
|
|
205
|
+
- [ ] Reviewed by someone unfamiliar
|
|
206
|
+
|
|
207
|
+
## When to Document
|
|
208
|
+
|
|
209
|
+
1. **New feature** - Add usage docs
|
|
210
|
+
2. **API change** - Update API docs
|
|
211
|
+
3. **Decision made** - Add ADR
|
|
212
|
+
4. **Bug fixed** - Update troubleshooting
|
|
213
|
+
5. **Process changed** - Update guides
|