docs-manager-skill
Architecture: Coordination skill (Layer 2) - manages write → validate → index pipeline for single documents.
Scope: ONE document at a time (director handles multi-doc operations).
Workflow Coordination
- ALWAYS execute: write → validate → index (3-phase pipeline)
- NEVER skip validation unless explicitly requested
- ALWAYS update index after successful write+validate
Type Context Loading
- ALWAYS load type context before operations
- NEVER proceed without valid doc_type
Error Handling
- STOP immediately on validation errors
- REPORT all failures clearly
- ROLLBACK if index update fails (delete written file)
Operation Skills
- ALWAYS use operation skills (doc-writer, doc-validator, doc-lister)
- NEVER implement operations directly
For write/update:
doc_type OR auto-detect from path/content
context - Conversational context (what user wants)
template_data - Explicit template variables (optional)
skip_validation - Skip validation step (default: false)
skip_index - Skip index update (default: false)
For validate:
For index:
doc_type - Required
directory - Directory to index (default: parent of file_path)
Classify Document Type
- If doc_type provided: use it
- Else: invoke doc-classifier skill to auto-detect from path
Load Type Context
- Load schema.json, template.md, standards.md from types/{doc_type}/
- Build context bundle: conversational + type-specific + template_data
Invoke doc-writer Skill
- Pass: file_path, doc_type, context bundle
- Receive: written file path
Validate Document (unless skip_validation=true)
- Invoke doc-validator skill
- Pass: file_path, doc_type
- If validation fails: STOP, report errors
- If validation succeeds: continue
Update Index (unless skip_index=true)
- Determine directory from file_path
- Invoke index-updater.sh script
- Pass: directory, doc_type
Return Success
{
"status": "success",
"operation": "write",
"file_path": "docs/api/user-login/README.md",
"doc_type": "api",
"validation": "passed",
"index_updated": true
}
Operation: update
Same as write, but:
- Read existing file first
- Merge existing content with new context
- Bump version if version field exists
Operation: validate
Classify Document Type
- Auto-detect if not provided
Invoke doc-validator Skill
- Pass: file_path, doc_type
- Return validation results
Operation: index
- Invoke index-updater.sh
- Pass: directory, doc_type
- Return index update status
Failure:
{
"status": "error",
"operation": "write|update|validate|index",
"error": "Validation failed: missing required field 'endpoint'",
"file_path": "path/to/file",
"validation_errors": ["error1", "error2"]
}
Start:
🎯 STARTING: docs-manager-skill
Operation: write
File: docs/api/user-login/README.md
Doc Type: api
───────────────────────────────────────
During Execution:
Step 1/5: Classifying document type...
✅ Detected: api (confidence: 100, method: path)
Step 2/5: Loading type context...
✅ Loaded: schema.json, template.md, standards.md
Step 3/5: Writing document...
✅ Generated: docs/api/user-login/README.md
Step 4/5: Validating document...
✅ Validation passed (0 errors, 0 warnings)
Step 5/5: Updating index...
✅ Index updated: docs/api/README.md
Completion:
✅ COMPLETED: docs-manager-skill
Operation: write
File: docs/api/user-login/README.md
Artifacts:
- docs/api/user-login/README.md
- docs/api/README.md (index)
───────────────────────────────────────
Next: Document ready for review
Index Update Errors:
- Report error
- Document is still valid (validation passed)
- Suggest manual index update
Type Detection Errors:
- Cannot proceed without valid doc_type
- Suggest manual doc_type specification
- List available doc_types
Script Execution Errors:
- Report script path and error message
- Suggest checking script permissions
- Provide command to run script manually for debugging
1---2name: docs-manager-skill3description: Orchestrates complete single-document workflows with automatic validation and indexing in a write→validate→index pipeline4---5
6# docs-manager-skill
7
8<CONTEXT>
9**Purpose**: Orchestrate complete single-document workflows with automatic validation and indexing.
10
11**Architecture**: Coordination skill (Layer 2) - manages write → validate → index pipeline for single documents.
12
13**Scope**: ONE document at a time (director handles multi-doc operations).
14</CONTEXT>
15
16<CRITICAL_RULES>
171. **Single Document Focus**
18 - ALWAYS operate on exactly ONE document
19 - NEVER handle wildcards or patterns (that's docs-director-skill's job)
20
212. **Workflow Coordination**
22 - ALWAYS execute: write → validate → index (3-phase pipeline)
23 - NEVER skip validation unless explicitly requested
24 - ALWAYS update index after successful write+validate
25
263. **Type Context Loading**
27 - ALWAYS load type context before operations
28 - NEVER proceed without valid doc_type
29
304. **Error Handling**
31 - STOP immediately on validation errors
32 - REPORT all failures clearly
33 - ROLLBACK if index update fails (delete written file)
34
355. **Operation Skills**
36 - ALWAYS use operation skills (doc-writer, doc-validator, doc-lister)
37 - NEVER implement operations directly
38</CRITICAL_RULES>
39
40<INPUTS>
41**Required**:
42- `operation` - Operation type: "write", "update", "validate", "index"
43- `file_path` - Target document path
44
45**For write/update**:
46- `doc_type` OR auto-detect from path/content
47- `context` - Conversational context (what user wants)
48- `template_data` - Explicit template variables (optional)
49- `skip_validation` - Skip validation step (default: false)
50- `skip_index` - Skip index update (default: false)
51
52**For validate**:
53- `doc_type` OR auto-detect
54
55**For index**:
56- `doc_type` - Required
57- `directory` - Directory to index (default: parent of file_path)
58</INPUTS>
59
60<WORKFLOW>
61## Operation: write
62
631. **Classify Document Type**
64 - If doc_type provided: use it
65 - Else: invoke doc-classifier skill to auto-detect from path
66
672. **Load Type Context**
68 - Load schema.json, template.md, standards.md from types/{doc_type}/
69 - Build context bundle: conversational + type-specific + template_data
70
713. **Invoke doc-writer Skill**
72 - Pass: file_path, doc_type, context bundle
73 - Receive: written file path
74
754. **Validate Document** (unless skip_validation=true)
76 - Invoke doc-validator skill
77 - Pass: file_path, doc_type
78 - If validation fails: STOP, report errors
79 - If validation succeeds: continue
80
815. **Update Index** (unless skip_index=true)
82 - Determine directory from file_path
83 - Invoke index-updater.sh script
84 - Pass: directory, doc_type
85
866. **Return Success**
87 ```json
88 {
89 "status": "success",
90 "operation": "write",
91 "file_path": "docs/api/user-login/README.md",
92 "doc_type": "api",
93 "validation": "passed",
94 "index_updated": true
95 }
96 ```
97
98## Operation: update
99
100Same as write, but:
101- Read existing file first
102- Merge existing content with new context
103- Bump version if version field exists
104
105## Operation: validate
106
1071. **Classify Document Type**
108 - Auto-detect if not provided
109
1102. **Invoke doc-validator Skill**
111 - Pass: file_path, doc_type
112 - Return validation results
113
114## Operation: index
115
1161. **Invoke index-updater.sh**
117 - Pass: directory, doc_type
118 - Return index update status
119</WORKFLOW>
120
121<COMPLETION_CRITERIA>
122- Document written successfully (for write/update)
123- Validation passed (unless skipped)
124- Index updated (unless skipped)
125- All operation skills invoked correctly
126- Clear success/failure status returned
127</COMPLETION_CRITERIA>
128
129<OUTPUTS>
130**Success**:
131```json
132{
133 "status": "success",
134 "operation": "write|update|validate|index",
135 "file_path": "path/to/file",
136 "doc_type": "api",
137 "validation": "passed|skipped|failed",
138 "index_updated": true|false,
139 "artifacts": ["README.md", "endpoint.json"]
140}
141```
142
143**Failure**:
144```json
145{
146 "status": "error",
147 "operation": "write|update|validate|index",
148 "error": "Validation failed: missing required field 'endpoint'",
149 "file_path": "path/to/file",
150 "validation_errors": ["error1", "error2"]
151}
152```
153</OUTPUTS>
154
155<DOCUMENTATION>
156Output structured messages:
157
158**Start**:
159```
160🎯 STARTING: docs-manager-skill
161Operation: write
162File: docs/api/user-login/README.md
163Doc Type: api
164───────────────────────────────────────
165```
166
167**During Execution**:
168```
169Step 1/5: Classifying document type...
170 ✅ Detected: api (confidence: 100, method: path)
171
172Step 2/5: Loading type context...
173 ✅ Loaded: schema.json, template.md, standards.md
174
175Step 3/5: Writing document...
176 ✅ Generated: docs/api/user-login/README.md
177
178Step 4/5: Validating document...
179 ✅ Validation passed (0 errors, 0 warnings)
180
181Step 5/5: Updating index...
182 ✅ Index updated: docs/api/README.md
183```
184
185**Completion**:
186```
187✅ COMPLETED: docs-manager-skill
188Operation: write
189File: docs/api/user-login/README.md
190Artifacts:
191 - docs/api/user-login/README.md
192 - docs/api/README.md (index)
193───────────────────────────────────────
194Next: Document ready for review
195```
196</DOCUMENTATION>
197
198<ERROR_HANDLING>
199**Validation Errors**:
200- Stop pipeline immediately
201- Report all validation errors
202- Do NOT update index
203- Do NOT delete written file (user may want to fix manually)
204
205**Index Update Errors**:
206- Report error
207- Document is still valid (validation passed)
208- Suggest manual index update
209
210**Type Detection Errors**:
211- Cannot proceed without valid doc_type
212- Suggest manual doc_type specification
213- List available doc_types
214
215**Script Execution Errors**:
216- Report script path and error message
217- Suggest checking script permissions
218- Provide command to run script manually for debugging
219</ERROR_HANDLING>