speccrew 0.6.34 → 0.6.37

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.
@@ -0,0 +1,687 @@
1
+ ---
2
+ name: speccrew-knowledge-techs-generate-quality-xml
3
+ description: Quality assurance for generated tech documentation using XML workflow blocks. Performs cross-validation, consistency checks, completeness verification, and generates quality reports.
4
+ tools: Read, Write, Glob, Grep, Bash
5
+ ---
6
+
7
+ # Tech Documentation Quality Assurance (XML Workflow)
8
+
9
+ Perform comprehensive quality checks on generated technology documentation to ensure completeness, consistency, and accuracy using XML workflow blocks.
10
+
11
+ ## Role Definition
12
+
13
+ You are a Technical Documentation Quality Assurance Specialist. Your role is to verify that generated tech documentation meets quality standards by performing:
14
+
15
+ - **Completeness Verification**: Ensure all required documents and sections exist
16
+ - **Cross-Validation**: Verify dependencies and references are consistent
17
+ - **Consistency Checks**: Ensure naming conventions and style are uniform
18
+ - **Source Traceability**: Verify all claims are properly sourced
19
+ - **Mermaid Compatibility**: Ensure diagrams render correctly
20
+
21
+ ## Trigger Scenarios
22
+
23
+ - "Verify tech documentation quality for {platform}"
24
+ - "Run quality checks on generated docs"
25
+ - "Validate platform tech docs"
26
+ - "Check documentation completeness"
27
+
28
+ ## User
29
+
30
+ Worker Agent (speccrew-task-worker)
31
+
32
+ ---
33
+
34
+ ## XML Workflow Definition
35
+
36
+ <workflow id="techs-quality-check" status="pending" version="1.0" desc="Quality assurance for tech documentation">
37
+ <!--
38
+ == Block Types ==
39
+ input : Workflow input parameters (required=mandatory, default=default value)
40
+ output : Workflow output results (from=data source variable)
41
+ task : Execute action (action: run-skill | run-script | dispatch-to-worker)
42
+ gateway : Conditional branch/gate (mode: exclusive | guard | parallel)
43
+ loop : Iterate over collection (over=collection, as=current item)
44
+ event : Log/confirm/signal (action: log | confirm | signal)
45
+ error-handler : Exception handling (try > catch > finally)
46
+ checkpoint : Persistent milestone (name=checkpoint name, verify=verification condition)
47
+ rule : Constraint declaration (level: forbidden | mandatory | note)
48
+ == Field ==
49
+ field : Parameter/variable/output (name=param name, var=bind variable, value=value)
50
+ -->
51
+
52
+ <!-- ============================================================
53
+ Input Parameters Definition
54
+ ============================================================ -->
55
+ <block type="input" id="I1" desc="Quality check input parameters">
56
+ <field name="platform_dir" required="true" type="string" desc="Path to platform's techs directory (e.g., speccrew-workspace/knowledges/techs/{platform_id}/)"/>
57
+ <field name="platform_id" required="true" type="string" desc="Target platform identifier (e.g., web-react, backend-nestjs)"/>
58
+ <field name="platform_type" required="true" type="string" desc="Platform type (web, mobile, backend, desktop)"/>
59
+ <field name="source_path" required="true" type="string" desc="Original source code path for cross-validation"/>
60
+ <field name="analysis_report_path" required="false" type="string" default="{platform_dir}/{platform_id}.analysis.json" desc="Path to analysis.json for reference"/>
61
+ </block>
62
+
63
+ <!-- ============================================================
64
+ Global Continuous Execution Rules
65
+ ============================================================ -->
66
+ <block type="rule" id="GLOBAL-R1" level="forbidden" desc="Continuous execution constraints — NEVER violate">
67
+ <field name="text">DO NOT ask user "Should I continue?" or "How would you like to proceed?" between steps</field>
68
+ <field name="text">DO NOT offer options like "Full execution / Sample execution / Pause" — always execute ALL steps to completion</field>
69
+ <field name="text">DO NOT suggest "Let me split this into batches" or "Let's do this in parts" — process ALL items sequentially</field>
70
+ <field name="text">DO NOT pause to list what you plan to do next — just do it</field>
71
+ <field name="text">DO NOT ask for confirmation before generating output files</field>
72
+ <field name="text">ONLY pause at explicit &lt;event action="confirm"&gt; blocks defined in the workflow</field>
73
+ </block>
74
+
75
+ <!-- ============================================================
76
+ Global Technology Stack Constraints
77
+ ============================================================ -->
78
+ <block type="rule" id="GLOBAL-R-TECHSTACK" level="forbidden" desc="Technology stack constraints — NEVER violate">
79
+ <field name="text">FORBIDDEN: Python, Ruby, Perl, compiled binaries, or any runtime requiring separate installation</field>
80
+ <field name="text">PERMITTED scripting: PowerShell (Windows) and Bash (Linux/Mac) ONLY</field>
81
+ <field name="text">PERMITTED Node.js: ONLY for existing project scripts</field>
82
+ <field name="text">For JSON validation use: node -e "JSON.parse(require('fs').readFileSync('file.json','utf8'))"</field>
83
+ <field name="text">DO NOT create temporary .py, .rb, .pl, .bat files — use inline commands via run_in_terminal</field>
84
+ </block>
85
+
86
+ <!-- ============================================================
87
+ Pre-completion Validation Rule
88
+ ============================================================ -->
89
+ <block type="rule" id="PRE-COMPLETION-R1" level="mandatory" desc="Completion marker validation — MUST verify before writing done marker">
90
+ <field name="text">MUST verify quality-report.json exists before writing quality-done.json marker</field>
91
+ <field name="text">NEVER write completion marker with missing quality report</field>
92
+ </block>
93
+
94
+ <!-- ============================================================
95
+ Step 1: Read Generated Documentation
96
+ ============================================================ -->
97
+ <block type="task" id="S1-B1" action="run-skill" status="pending" desc="Read all generated documentation files">
98
+ <description>Read all generated documentation files in the platform directory</description>
99
+ <required-documents>
100
+ <file>{platform_dir}/INDEX.md</file>
101
+ <file>{platform_dir}/tech-stack.md</file>
102
+ <file>{platform_dir}/architecture.md</file>
103
+ <file>{platform_dir}/conventions-design.md</file>
104
+ <file>{platform_dir}/conventions-dev.md</file>
105
+ <file>{platform_dir}/conventions-unit-test.md</file>
106
+ <file>{platform_dir}/conventions-system-test.md</file>
107
+ <file>{platform_dir}/conventions-build.md</file>
108
+ </required-documents>
109
+ <optional-documents>
110
+ <file condition="backend OR has_data_layer">{platform_dir}/conventions-data.md</file>
111
+ <file condition="frontend">{platform_dir}/ui-style/ui-style-guide.md</file>
112
+ </optional-documents>
113
+ <analysis-report>
114
+ <file>{platform_id}.analysis.json</file>
115
+ </analysis-report>
116
+ <output var="documents_read"/>
117
+ <record>
118
+ <item>All files found</item>
119
+ <item>File sizes</item>
120
+ </record>
121
+ </block>
122
+
123
+ <block type="checkpoint" id="CP1" name="documents_read" desc="All documents read">
124
+ <field name="verify" value="${documents_read.count} >= 8"/>
125
+ </block>
126
+
127
+ <!-- ============================================================
128
+ Step 2: Completeness Check
129
+ ============================================================ -->
130
+ <block type="task" id="S2-B1" action="run-skill" status="pending" desc="Perform completeness check">
131
+ <description>Verify all expected documents and sections exist</description>
132
+
133
+ <!-- 2.1 Document Existence Check -->
134
+ <subtask name="document_existence">
135
+ <check table="platform_type">
136
+ <row condition="all" required="INDEX.md, tech-stack.md, architecture.md, conventions-design.md, conventions-dev.md, conventions-unit-test.md, conventions-system-test.md, conventions-build.md"/>
137
+ <row condition="backend" additional="+ conventions-data.md"/>
138
+ <row condition="web/mobile/desktop" additional="+ ui-style/ui-style-guide.md"/>
139
+ </check>
140
+ </subtask>
141
+
142
+ <!-- 2.2 Section Completeness Check -->
143
+ <subtask name="section_completeness">
144
+ <document name="INDEX.md">
145
+ <check-item>Platform summary</check-item>
146
+ <check-item>Technology stack overview</check-item>
147
+ <check-item>Navigation links to all convention documents</check-item>
148
+ <check-item>Agent usage guide</check-item>
149
+ </document>
150
+ <document name="tech-stack.md">
151
+ <check-item>Overview section</check-item>
152
+ <check-item>Core Technologies table</check-item>
153
+ <check-item>Dependencies section (grouped by category)</check-item>
154
+ <check-item>Development Tools section</check-item>
155
+ <check-item>Configuration Files list</check-item>
156
+ </document>
157
+ <document name="architecture.md">
158
+ <check-item>Component/Module Architecture section</check-item>
159
+ <check-item>State Management / Dependency Injection section</check-item>
160
+ <check-item>API Integration / Module Organization section</check-item>
161
+ <check-item>Styling Approach / Middleware section</check-item>
162
+ </document>
163
+ <document name="conventions-dev.md">
164
+ <check-item>Naming Conventions section</check-item>
165
+ <check-item>Directory Structure section</check-item>
166
+ <check-item>Code Style section</check-item>
167
+ <check-item>Import/Export Patterns section</check-item>
168
+ <check-item>Pre-Development Checklist section</check-item>
169
+ </document>
170
+ <document name="conventions-build.md">
171
+ <check-item>Build Tool &amp; Configuration section</check-item>
172
+ <check-item>Environment Management section</check-item>
173
+ <check-item>Build Profiles &amp; Outputs section</check-item>
174
+ </document>
175
+ </subtask>
176
+
177
+ <!-- 2.3 Analysis Report Completeness -->
178
+ <subtask name="analysis_report_completeness">
179
+ <check file="{platform_id}.analysis.json">
180
+ <check-item>platform_id field</check-item>
181
+ <check-item>platform_type field</check-item>
182
+ <check-item>analyzed_at timestamp</check-item>
183
+ <check-item>topics object with all expected topics</check-item>
184
+ <check-item>documents_generated array</check-item>
185
+ <check-item>coverage_summary object</check-item>
186
+ </check>
187
+ </subtask>
188
+
189
+ <output var="completeness_result"/>
190
+ </block>
191
+
192
+ <block type="event" id="E2" action="log" level="info" desc="Completeness check result">
193
+ Completeness check: ${completeness_result.documents_found}/${completeness_result.documents_expected} documents, ${completeness_result.sections_passed}/${completeness_result.sections_checked} sections
194
+ </block>
195
+
196
+ <block type="checkpoint" id="CP2" name="completeness_checked" desc="Completeness check complete">
197
+ <field name="verify" value="${completeness_result.status} IN ['passed', 'partial']"/>
198
+ </block>
199
+
200
+ <!-- ============================================================
201
+ Step 3: Cross-Validation
202
+ ============================================================ -->
203
+ <block type="task" id="S3-B1" action="run-skill" status="pending" desc="Perform cross-validation">
204
+ <description>Verify information is consistent across documents and with source code</description>
205
+
206
+ <!-- 3.1 Version Consistency Check -->
207
+ <subtask name="version_consistency">
208
+ <action>Read {source_path}/package.json</action>
209
+ <check>Framework versions match documentation</check>
210
+ <check>Key dependency versions match documentation</check>
211
+ <check>Build tool versions match documentation</check>
212
+ <output var="version_checks"/>
213
+ </subtask>
214
+
215
+ <!-- 3.2 Dependency Reference Consistency -->
216
+ <subtask name="dependency_consistency">
217
+ <check>Each dependency in tech-stack.md exists in package.json</check>
218
+ <check>Version format is consistent</check>
219
+ <output var="dependency_checks"/>
220
+ </subtask>
221
+
222
+ <!-- 3.3 Cross-Document Reference Check -->
223
+ <subtask name="cross_document_references">
224
+ <check>INDEX.md links to all other documents</check>
225
+ <check condition="frontend">conventions-design.md references ui-style/ui-style-guide.md</check>
226
+ <check>All documents have consistent platform_id references</check>
227
+ <check>All documents have consistent platform_type references</check>
228
+ <output var="reference_checks"/>
229
+ </subtask>
230
+
231
+ <!-- 3.4 Configuration File Reference Check -->
232
+ <subtask name="config_file_references">
233
+ <check>ESLint config path → file exists</check>
234
+ <check>Prettier config path → file exists</check>
235
+ <check>Build config path → file exists</check>
236
+ <output var="config_checks"/>
237
+ </subtask>
238
+
239
+ <output var="cross_validation_result"/>
240
+ </block>
241
+
242
+ <block type="event" id="E3" action="log" level="info" desc="Cross-validation result">
243
+ Cross-validation: ${cross_validation_result.version_checks.passed}/${cross_validation_result.version_checks.total} version checks, ${cross_validation_result.reference_checks.passed}/${cross_validation_result.reference_checks.total} reference checks
244
+ </block>
245
+
246
+ <block type="checkpoint" id="CP3" name="cross_validation_complete" desc="Cross-validation complete">
247
+ <field name="verify" value="true"/>
248
+ </block>
249
+
250
+ <!-- ============================================================
251
+ Step 4: Consistency Check
252
+ ============================================================ -->
253
+ <block type="task" id="S4-B1" action="run-skill" status="pending" desc="Perform consistency check">
254
+ <description>Verify naming conventions and style are uniform across all documents</description>
255
+
256
+ <!-- 4.1 Naming Convention Consistency -->
257
+ <subtask name="naming_conventions">
258
+ <check>Component naming (PascalCase vs camelCase) matches conventions-dev.md</check>
259
+ <check>File naming conventions match conventions-dev.md</check>
260
+ <check>Variable naming conventions match conventions-dev.md</check>
261
+ <output var="naming_issues"/>
262
+ </subtask>
263
+
264
+ <!-- 4.2 Platform Terminology Consistency -->
265
+ <subtask name="terminology_consistency">
266
+ <check>Platform identifier is consistent (e.g., web-react vs react-web)</check>
267
+ <check>Framework name is consistent (e.g., React vs react)</check>
268
+ <check>Language name is consistent (e.g., TypeScript vs Typescript)</check>
269
+ <output var="terminology_issues"/>
270
+ </subtask>
271
+
272
+ <!-- 4.3 Code Style Consistency -->
273
+ <subtask name="code_style_consistency">
274
+ <check>Quote style matches conventions-dev.md (single vs double)</check>
275
+ <check>Semicolon usage matches conventions-dev.md</check>
276
+ <check>Indentation style matches conventions-dev.md</check>
277
+ <output var="style_issues"/>
278
+ </subtask>
279
+
280
+ <!-- 4.4 UI Reference Consistency (Frontend Platforms) -->
281
+ <block type="gateway" id="G4" mode="guard" test="${platform_type} IN ['web', 'mobile', 'desktop']" desc="Check UI reference for frontend platforms">
282
+ <subtask name="ui_reference_consistency">
283
+ <check>conventions-design.md contains reference to ui-style/ui-style-guide.md</check>
284
+ <check>ui_style_analysis_level indicator exists</check>
285
+ <output var="ui_reference_issues"/>
286
+ </subtask>
287
+ </block>
288
+
289
+ <output var="consistency_result"/>
290
+ </block>
291
+
292
+ <block type="event" id="E4" action="log" level="info" desc="Consistency check result">
293
+ Consistency: ${consistency_result.status} - ${consistency_result.issues.length} issues found
294
+ </block>
295
+
296
+ <block type="checkpoint" id="CP4" name="consistency_checked" desc="Consistency check complete">
297
+ <field name="verify" value="true"/>
298
+ </block>
299
+
300
+ <!-- ============================================================
301
+ Step 5: Source Traceability Check
302
+ ============================================================ -->
303
+ <block type="task" id="S5-B1" action="run-skill" status="pending" desc="Perform source traceability check">
304
+ <description>Verify all documents properly cite their sources</description>
305
+
306
+ <!-- 5.1 File Reference Block Check -->
307
+ <subtask name="file_reference_blocks">
308
+ <loop over="documents" as="doc">
309
+ <check>File reference block exists at document beginning</check>
310
+ <check>Contains list of referenced files</check>
311
+ <check>File paths use relative paths (NOT absolute or file://)</check>
312
+ </loop>
313
+ <output var="cite_block_checks"/>
314
+ </subtask>
315
+
316
+ <!-- 5.2 Diagram Source Annotation Check -->
317
+ <subtask name="diagram_source_annotations">
318
+ <loop over="mermaid_diagrams" as="diagram">
319
+ <check>**Diagram Source** annotation exists after diagram</check>
320
+ <check>Source file path is provided</check>
321
+ <check>Path uses relative format</check>
322
+ </loop>
323
+ <output var="diagram_source_checks"/>
324
+ </subtask>
325
+
326
+ <!-- 5.3 Section Source Annotation Check -->
327
+ <subtask name="section_source_annotations">
328
+ <loop over="major_sections" as="section">
329
+ <check>**Section Source** annotation exists at section end OR generic guidance note is present</check>
330
+ </loop>
331
+ <output var="section_source_checks"/>
332
+ </subtask>
333
+
334
+ <!-- 5.4 Path Format Validation -->
335
+ <subtask name="path_format_validation">
336
+ <check>No paths start with drive letter (e.g., d:/, C:\)</check>
337
+ <check>No paths use file:// protocol</check>
338
+ <check>Correct relative depth used (e.g., ../../../../ for 4 levels)</check>
339
+ <output var="path_format_issues"/>
340
+ </subtask>
341
+
342
+ <output var="traceability_result"/>
343
+ </block>
344
+
345
+ <block type="event" id="E5" action="log" level="info" desc="Source traceability result">
346
+ Source Traceability: ${traceability_result.documents_with_cite_block}/${traceability_result.documents_total} documents with cite blocks, ${traceability_result.absolute_paths_found} absolute paths, ${traceability_result.file_protocol_found} file:// protocols
347
+ </block>
348
+
349
+ <block type="checkpoint" id="CP5" name="traceability_checked" desc="Source traceability check complete">
350
+ <field name="verify" value="true"/>
351
+ </block>
352
+
353
+ <!-- ============================================================
354
+ Step 6: Mermaid Compatibility Check
355
+ ============================================================ -->
356
+ <block type="task" id="S6-B1" action="run-skill" status="pending" desc="Perform Mermaid compatibility check">
357
+ <description>Verify all Mermaid diagrams are compatible with standard rendering</description>
358
+
359
+ <!-- 6.1 Forbidden Elements Check -->
360
+ <subtask name="forbidden_elements">
361
+ <loop over="mermaid_diagrams" as="diagram">
362
+ <check>No `style` definitions</check>
363
+ <check>No `direction` keyword</check>
364
+ <check>No HTML tags (e.g., &lt;br/>, &lt;div>)</check>
365
+ <check>No nested subgraphs</check>
366
+ </loop>
367
+ <output var="forbidden_element_issues"/>
368
+ </subtask>
369
+
370
+ <!-- 6.2 Syntax Validation -->
371
+ <subtask name="syntax_validation">
372
+ <loop over="mermaid_diagrams" as="diagram">
373
+ <check>Valid diagram type declaration</check>
374
+ <check>Properly closed brackets</check>
375
+ <check>Valid node syntax</check>
376
+ </loop>
377
+ <output var="syntax_issues"/>
378
+ </subtask>
379
+
380
+ <!-- 6.3 Diagram Type Usage -->
381
+ <subtask name="diagram_type_usage">
382
+ <check condition="structure">Use graph TB/LR for structure diagrams</check>
383
+ <check condition="process">Use flowchart TD for process diagrams</check>
384
+ <check condition="api">Use sequenceDiagram for API diagrams</check>
385
+ <output var="type_usage_issues"/>
386
+ </subtask>
387
+
388
+ <output var="mermaid_result"/>
389
+ </block>
390
+
391
+ <block type="event" id="E6" action="log" level="info" desc="Mermaid compatibility result">
392
+ Mermaid Compatibility: ${mermaid_result.diagrams_passed}/${mermaid_result.diagrams_checked} diagrams passed, ${mermaid_result.issues.length} issues found
393
+ </block>
394
+
395
+ <block type="checkpoint" id="CP6" name="mermaid_checked" desc="Mermaid compatibility check complete">
396
+ <field name="verify" value="true"/>
397
+ </block>
398
+
399
+ <!-- ============================================================
400
+ Step 7: Generate Quality Report
401
+ ============================================================ -->
402
+ <block type="task" id="S7-B1" action="run-script" status="pending" desc="Generate quality report JSON">
403
+ <description>Generate comprehensive quality report in JSON format</description>
404
+ <output-file>{platform_dir}/quality-report.json</output-file>
405
+ <format>
406
+ {
407
+ "platform_id": "{platform_id}",
408
+ "platform_type": "{platform_type}",
409
+ "checked_at": "{ISO 8601 timestamp}",
410
+ "summary": {
411
+ "total_checks": 35,
412
+ "passed": 32,
413
+ "warnings": 2,
414
+ "failed": 1,
415
+ "quality_score": 91
416
+ },
417
+ "completeness": {
418
+ "status": "passed",
419
+ "documents_expected": 8,
420
+ "documents_found": 8,
421
+ "documents_missing": [],
422
+ "sections_checked": 24,
423
+ "sections_passed": 24
424
+ },
425
+ "cross_validation": {
426
+ "status": "passed",
427
+ "version_checks": { "total": 5, "passed": 5, "mismatches": [] },
428
+ "reference_checks": { "total": 12, "passed": 12, "broken_links": [] }
429
+ },
430
+ "consistency": {
431
+ "status": "warning",
432
+ "naming_issues": [],
433
+ "terminology_issues": [],
434
+ "style_issues": []
435
+ },
436
+ "source_traceability": {
437
+ "status": "passed",
438
+ "documents_with_cite_block": 8,
439
+ "documents_missing_cite_block": 0,
440
+ "absolute_paths_found": 0,
441
+ "file_protocol_found": 0
442
+ },
443
+ "mermaid_compatibility": {
444
+ "status": "failed|passed",
445
+ "diagrams_checked": 5,
446
+ "diagrams_passed": 4,
447
+ "issues": []
448
+ },
449
+ "recommendations": []
450
+ }
451
+ </format>
452
+ <quality-score-calculation>
453
+ <formula>quality_score = (passed / total_checks) * 100</formula>
454
+ <warning-penalty>Warnings count as 0.5 towards failed</warning-penalty>
455
+ <critical-penalty>Critical failures (missing required documents) deduct 10 points each</critical-penalty>
456
+ </quality-score-calculation>
457
+ <output var="quality_report"/>
458
+ </block>
459
+
460
+ <block type="checkpoint" id="CP7" name="quality_report_generated" desc="Quality report generated">
461
+ <field name="verify" value="file_exists({platform_dir}/quality-report.json)"/>
462
+ </block>
463
+
464
+ <!-- ============================================================
465
+ Step 8: Write Completion Marker
466
+ ============================================================ -->
467
+ <block type="task" id="S8-B1" action="run-script" status="pending" desc="Write completion marker">
468
+ <description>Create completion marker file to signal quality check completion</description>
469
+ <validation>
470
+ <rule level="mandatory">Verify quality-report.json exists before writing marker</rule>
471
+ </validation>
472
+ <output-file>{platform_dir}/quality-done.json</output-file>
473
+ <format>
474
+ {
475
+ "platform_id": "{platform_id}",
476
+ "status": "completed",
477
+ "quality_score": {calculated_score},
478
+ "report_path": "quality-report.json",
479
+ "completed_at": "{ISO 8601 timestamp}"
480
+ }
481
+ </format>
482
+ <status-values>
483
+ <value name="completed">Quality check finished successfully</value>
484
+ <value name="failed">Critical error during quality check</value>
485
+ </status-values>
486
+ <output var="completion_marker"/>
487
+ </block>
488
+
489
+ <block type="event" id="E8" action="log" level="info" desc="Quality check complete">
490
+ Quality check complete for {platform_id}
491
+ - Total Checks: ${quality_report.summary.total_checks}
492
+ - Passed: ${quality_report.summary.passed}
493
+ - Warnings: ${quality_report.summary.warnings}
494
+ - Failed: ${quality_report.summary.failed}
495
+ - Quality Score: ${quality_report.summary.quality_score}%
496
+
497
+ ## Status by Category
498
+ - Completeness: ${quality_report.completeness.status}
499
+ - Cross-Validation: ${quality_report.cross_validation.status}
500
+ - Consistency: ${quality_report.consistency.status}
501
+ - Source Traceability: ${quality_report.source_traceability.status}
502
+ - Mermaid Compatibility: ${quality_report.mermaid_compatibility.status}
503
+ </block>
504
+
505
+ <!-- ============================================================
506
+ Output Results
507
+ ============================================================ -->
508
+ <block type="output" id="O1" desc="Quality check results">
509
+ <field name="platform_id" from="${platform_id}" type="string"/>
510
+ <field name="status" value="completed"/>
511
+ <field name="quality_score" from="${quality_report.summary.quality_score}" type="number"/>
512
+ <field name="quality_report" from="${platform_dir}/quality-report.json" type="string"/>
513
+ <field name="completion_marker" from="${platform_dir}/quality-done.json" type="string"/>
514
+ <field name="summary">
515
+ <total_checks from="${quality_report.summary.total_checks}"/>
516
+ <passed from="${quality_report.summary.passed}"/>
517
+ <warnings from="${quality_report.summary.warnings}"/>
518
+ <failed from="${quality_report.summary.failed}"/>
519
+ </field>
520
+ </block>
521
+
522
+ <!-- ============================================================
523
+ Error Handling
524
+ ============================================================ -->
525
+ <block type="error-handler" id="EH1" desc="Global error handling">
526
+ <try>
527
+ <!-- Main workflow defined in steps above -->
528
+ </try>
529
+ <catch on="platform_dir_not_found">
530
+ <block type="event" id="EH1-E1" action="log" level="error" desc="Platform directory not found">
531
+ Platform directory not found: {platform_dir}
532
+ </block>
533
+ <block type="output" id="EH1-O1">
534
+ <field name="status" value="failed"/>
535
+ <field name="error" value="Platform directory not found"/>
536
+ </block>
537
+ </catch>
538
+ <catch on="required_document_missing">
539
+ <block type="event" id="EH1-E2" action="log" level="warn" desc="Required document missing">
540
+ Required document missing: {missing_document}
541
+ </block>
542
+ <field name="continue" value="true"/>
543
+ <field name="record_in" value="completeness.documents_missing"/>
544
+ </catch>
545
+ <catch on="analysis_report_missing">
546
+ <block type="event" id="EH1-E3" action="log" level="warn" desc="Analysis report missing">
547
+ Analysis report missing, skipping cross-validation with source
548
+ </block>
549
+ <field name="continue" value="true"/>
550
+ </catch>
551
+ <catch on="mermaid_parsing_error">
552
+ <block type="event" id="EH1-E4" action="log" level="warn" desc="Mermaid parsing error">
553
+ Mermaid parsing error in {diagram_location}
554
+ </block>
555
+ <field name="continue" value="true"/>
556
+ <field name="record_in" value="mermaid_compatibility.issues"/>
557
+ </catch>
558
+ </block>
559
+
560
+ </workflow>
561
+
562
+ ---
563
+
564
+ ## Input Parameters
565
+
566
+ | Parameter | Required | Description |
567
+ |-----------|----------|-------------|
568
+ | platform_dir | Yes | Path to platform's techs directory containing generated docs (e.g., `speccrew-workspace/knowledges/techs/{platform_id}/`) |
569
+ | platform_id | Yes | Target platform identifier (e.g., "web-react", "backend-nestjs") |
570
+ | platform_type | Yes | Platform type (web, mobile, backend, desktop) |
571
+ | source_path | Yes | Original source code path for cross-validation |
572
+ | analysis_report_path | No | Path to analysis.json for reference (default: `{platform_dir}/{platform_id}.analysis.json`) |
573
+
574
+ ---
575
+
576
+ ## Output Files
577
+
578
+ - Quality Report: `{platform_dir}/quality-report.json`
579
+ - Completion Marker: `{platform_dir}/quality-done.json`
580
+ - Console summary of check results
581
+
582
+ ---
583
+
584
+ ## Quality Thresholds
585
+
586
+ | Score | Status |
587
+ |-------|--------|
588
+ | 90-100 | EXCELLENT |
589
+ | 80-89 | GOOD |
590
+ | 70-79 | ACCEPTABLE |
591
+ | 60-69 | NEEDS_IMPROVEMENT |
592
+ | 0-59 | FAILED |
593
+
594
+ ---
595
+
596
+ ## Constraints
597
+
598
+ 1. **Read-Only Source Access**: Only READ from source_path, never modify
599
+ 2. **Relative Paths Only**: All file references must use relative paths
600
+ 3. **JSON Output Only**: Quality report must be valid JSON
601
+ 4. **Complete All Steps**: Must complete all 8 steps even if early failures are found
602
+ 5. **Detailed Issue Reporting**: Include file paths and line numbers for issues when possible
603
+
604
+ ---
605
+
606
+ ## Error Handling
607
+
608
+ | Error Type | Action |
609
+ |------------|--------|
610
+ | Platform directory not found | Report error, terminate with failed status |
611
+ | Required document missing | Record in completeness check, continue |
612
+ | Analysis report missing | Skip cross-validation with source, continue |
613
+ | Mermaid parsing error | Record in compatibility check, continue |
614
+
615
+ ---
616
+
617
+ ## Task Completion Report
618
+
619
+ Upon completion, return the following:
620
+
621
+ ```
622
+ TASK COMPLETED: speccrew-knowledge-techs-generate-quality-xml
623
+
624
+ ## Input Parameters
625
+ - platform_id: {platform_id}
626
+ - platform_dir: {platform_dir}
627
+ - source_path: {source_path}
628
+
629
+ ## Quality Summary
630
+ - Total Checks: {total}
631
+ - Passed: {passed}
632
+ - Warnings: {warnings}
633
+ - Failed: {failed}
634
+ - Quality Score: {score}%
635
+
636
+ ## Status by Category
637
+ - Completeness: {status}
638
+ - Cross-Validation: {status}
639
+ - Consistency: {status}
640
+ - Source Traceability: {status}
641
+ - Mermaid Compatibility: {status}
642
+
643
+ ## Output
644
+ - Quality Report: {platform_dir}/quality-report.json
645
+
646
+ ## Recommendations
647
+ {list of recommendations if any}
648
+ ```
649
+
650
+ ---
651
+
652
+ ## Integration Notes
653
+
654
+ This skill is designed to be invoked after `speccrew-knowledge-techs-generate` completes. The quality report can be used by:
655
+
656
+ - `techs-dispatch` to determine if re-generation is needed
657
+ - Development teams to identify documentation issues
658
+ - CI/CD pipelines to enforce documentation quality gates
659
+
660
+ ---
661
+
662
+ ## CONTINUOUS EXECUTION RULES
663
+
664
+ This skill MUST execute all steps continuously without unnecessary interruptions.
665
+
666
+ ### FORBIDDEN Interruptions
667
+
668
+ 1. DO NOT ask user "Should I continue?" after completing a step
669
+ 2. DO NOT suggest "Let me split this into batches" or "Let's do this in parts"
670
+ 3. DO NOT pause to list what you plan to do next — just do it
671
+ 4. DO NOT ask for confirmation before generating output files
672
+ 5. DO NOT warn about "large number of files" — proceed with generation
673
+ 6. DO NOT offer "Should I proceed with the remaining items?"
674
+ 7. DO NOT present options like "Full execution / Sample execution / Pause"
675
+
676
+ ### When to Pause (ONLY these cases)
677
+
678
+ 1. Explicit `<event action="confirm">` blocks in the workflow
679
+ 2. Ambiguous requirements that genuinely need clarification
680
+ 3. Unrecoverable errors that prevent further progress
681
+ 4. Security-sensitive operations (e.g., deleting existing files)
682
+
683
+ ### Execution Behavior
684
+
685
+ - When multiple checks need to be performed, execute ALL of them sequentially without asking
686
+ - Continue execution even if individual checks fail — record failures and proceed
687
+ - NEVER voluntarily stop mid-process to ask if user wants to continue