x-ipe 1.0.14__py3-none-any.whl → 1.0.16__py3-none-any.whl

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.
Files changed (23) hide show
  1. x_ipe/app.py +42 -0
  2. x_ipe/resources/copilot-instructions.md +3 -0
  3. x_ipe/resources/skills/project-quality-board-management/SKILL.md +641 -0
  4. x_ipe/resources/skills/project-quality-board-management/templates/quality-report.md +276 -0
  5. x_ipe/resources/skills/task-board-management/SKILL.md +6 -6
  6. x_ipe/resources/skills/task-board-management/templates/task-board.md +1 -1
  7. x_ipe/resources/skills/task-execution-guideline/SKILL.md +13 -6
  8. x_ipe/resources/skills/task-execution-guideline/templates/task-board.md +1 -1
  9. x_ipe/resources/skills/task-execution-guideline/templates/task-record.yaml +2 -2
  10. x_ipe/resources/skills/task-type-code-refactor-v2/SKILL.md +456 -0
  11. x_ipe/resources/skills/task-type-code-refactor-v2/references/examples.md +303 -0
  12. x_ipe/resources/skills/task-type-improve-code-quality-before-refactoring/SKILL.md +490 -0
  13. x_ipe/resources/skills/task-type-improve-code-quality-before-refactoring/references/examples.md +310 -0
  14. x_ipe/resources/skills/task-type-refactoring-analysis/SKILL.md +516 -0
  15. x_ipe/resources/skills/task-type-refactoring-analysis/references/examples.md +178 -0
  16. x_ipe/services/ideas_service.py +87 -0
  17. x_ipe/static/css/workplace.css +40 -0
  18. x_ipe/static/js/features/workplace.js +187 -6
  19. {x_ipe-1.0.14.dist-info → x_ipe-1.0.16.dist-info}/METADATA +1 -1
  20. {x_ipe-1.0.14.dist-info → x_ipe-1.0.16.dist-info}/RECORD +23 -15
  21. {x_ipe-1.0.14.dist-info → x_ipe-1.0.16.dist-info}/WHEEL +0 -0
  22. {x_ipe-1.0.14.dist-info → x_ipe-1.0.16.dist-info}/entry_points.txt +0 -0
  23. {x_ipe-1.0.14.dist-info → x_ipe-1.0.16.dist-info}/licenses/LICENSE +0 -0
x_ipe/app.py CHANGED
@@ -968,6 +968,48 @@ def register_ideas_routes(app):
968
968
  return jsonify(result)
969
969
  return jsonify(result), 400
970
970
 
971
+ @app.route('/api/ideas/rename-file', methods=['POST'])
972
+ def rename_idea_file():
973
+ """
974
+ POST /api/ideas/rename-file
975
+
976
+ Rename a file within x-ipe-docs/ideas/.
977
+
978
+ Request body:
979
+ - path: string - Current file path (relative to project root)
980
+ - new_name: string - New file name (with extension)
981
+
982
+ Response:
983
+ - success: true/false
984
+ - old_path: string
985
+ - new_path: string
986
+ - new_name: string
987
+ """
988
+ project_root = app.config.get('PROJECT_ROOT', os.getcwd())
989
+ service = IdeasService(project_root)
990
+
991
+ if not request.is_json:
992
+ return jsonify({
993
+ 'success': False,
994
+ 'error': 'JSON required'
995
+ }), 400
996
+
997
+ data = request.get_json()
998
+ path = data.get('path')
999
+ new_name = data.get('new_name')
1000
+
1001
+ if not path or not new_name:
1002
+ return jsonify({
1003
+ 'success': False,
1004
+ 'error': 'path and new_name are required'
1005
+ }), 400
1006
+
1007
+ result = service.rename_file(path, new_name)
1008
+
1009
+ if result['success']:
1010
+ return jsonify(result)
1011
+ return jsonify(result), 400
1012
+
971
1013
  @app.route('/api/ideas/delete', methods=['POST'])
972
1014
  def delete_idea_item():
973
1015
  """
@@ -79,6 +79,9 @@
79
79
  | Feature Closing | `task-type-feature-closing` | feature-stage | User Manual | No |
80
80
  | Bug Fix | `task-type-bug-fix` | Standalone | - | Yes |
81
81
  | Code Refactor | `task-type-code-refactor` | Standalone | - | Yes |
82
+ | Refactoring Analysis | `task-type-refactoring-analysis` | code-refactoring-stage | Improve Code Quality Before Refactoring | Yes |
83
+ | Improve Code Quality Before Refactoring | `task-type-improve-code-quality-before-refactoring` | code-refactoring-stage | Code Refactor V2 | Yes |
84
+ | Code Refactor V2 | `task-type-code-refactor-v2` | code-refactoring-stage | - | Yes |
82
85
  | Change Request | `task-type-change-request` | Standalone | Feature Refinement OR Feature Breakdown | Yes |
83
86
  | Project Initialization | `task-type-project-init` | Standalone | Dev Environment | No |
84
87
  | Dev Environment | `task-type-dev-environment` | Standalone | - | No |
@@ -0,0 +1,641 @@
1
+ ---
2
+ name: project-quality-board-management
3
+ description: Generate and manage project quality evaluation reports from feature perspective. Evaluates requirements, features, test coverage, and code alignment status with gap analysis. Generates consistent markdown reports to x-ipe-docs/planning folder. Triggers on requests like "evaluate project quality", "generate quality report", "assess code alignment".
4
+ ---
5
+
6
+ # Project Quality Board Management
7
+
8
+ ## Purpose
9
+
10
+ AI Agents follow this skill to generate and manage project-wide quality evaluation reports. This skill evaluates the project from a **feature perspective**, analyzing:
11
+
12
+ 1. **Requirements Alignment** - Do features match documented requirements?
13
+ 2. **Feature Coverage** - Are all features properly specified and implemented?
14
+ 3. **Test Coverage** - Is test coverage sufficient across features?
15
+ 4. **Code Alignment** - Does code implementation match specifications?
16
+
17
+ **Operations:**
18
+ 1. **Generate** quality evaluation report
19
+ 2. **Update** existing report with new evaluation
20
+ 3. **Query** quality status for specific features
21
+ 4. **Compare** quality between evaluation snapshots
22
+
23
+ ---
24
+
25
+ ## Important Notes
26
+
27
+ ### Skill Prerequisite
28
+ - If you HAVE NOT learned `task-execution-guideline` skill, please learn it first before executing this skill.
29
+ - Learn `task-type-refactoring-analysis` skill to understand `refactoring_suggestion` and `refactoring_principle` data models for integration.
30
+
31
+ **Important:** If Agent DO NOT have skill capability, can directly go to `.github/skills/` folder to learn skills. And SKILL.md file is the entry point to understand each skill.
32
+
33
+ ---
34
+
35
+ ## Report Output Location
36
+
37
+ Quality evaluation report is stored in:
38
+ ```
39
+ x-ipe-docs/planning/project-quality-evaluation.md
40
+ ```
41
+
42
+ Report header includes:
43
+ - **Project Version**: From `pyproject.toml` version field
44
+ - **Evaluated Date**: Timestamp of last evaluation
45
+
46
+ ---
47
+
48
+ ## Quality Evaluation Data Model
49
+
50
+ ```yaml
51
+ QualityEvaluation:
52
+ # Metadata
53
+ evaluation_id: QE-{YYYYMMDD}-{sequence}
54
+ generated_at: <ISO timestamp>
55
+ generated_by: <agent nickname>
56
+ scope: project | feature | module
57
+
58
+ # Summary Metrics
59
+ overall_score: <1-10>
60
+ health_status: healthy | attention_needed | critical
61
+
62
+ # Feature-Level Evaluations
63
+ features:
64
+ - feature_id: FEATURE-XXX
65
+ feature_name: "<name>"
66
+ status: aligned | needs_attention | critical | planned | not_evaluated
67
+
68
+ requirements_alignment:
69
+ status: aligned | needs_update | not_found | planned
70
+ requirement_docs: [<paths>]
71
+ gaps:
72
+ - type: undocumented | unimplemented | deviated
73
+ description: "<gap description>"
74
+ severity: high | medium | low
75
+
76
+ specification_alignment:
77
+ status: aligned | needs_update | not_found | planned
78
+ spec_doc: "<path>"
79
+ gaps:
80
+ - type: missing | outdated | incorrect
81
+ description: "<gap description>"
82
+ severity: high | medium | low
83
+
84
+ test_coverage:
85
+ status: sufficient | insufficient | no_tests
86
+ line_coverage: <XX%>
87
+ branch_coverage: <XX%>
88
+ critical_untested:
89
+ - area: "<untested area>"
90
+ risk: high | medium | low
91
+
92
+ code_alignment:
93
+ status: aligned | drifted | major_drift
94
+ implementation_files: [<paths>]
95
+ gaps:
96
+ - type: structure | behavior | interface
97
+ description: "<gap description>"
98
+ severity: high | medium | low
99
+
100
+ # Aggregated Gaps
101
+ priority_gaps:
102
+ high: [<gap references>]
103
+ medium: [<gap references>]
104
+ low: [<gap references>]
105
+
106
+ # Refactoring Suggestions (from task-type-refactoring-analysis)
107
+ refactoring_suggestions:
108
+ has_suggestions: true | false
109
+ source: "<evaluation_id or task_id that generated suggestions>"
110
+
111
+ suggestions:
112
+ - feature_id: FEATURE-XXX
113
+ summary: "<high-level description>"
114
+ goals:
115
+ - goal: "<specific improvement goal>"
116
+ priority: high | medium | low
117
+ rationale: "<why this goal matters>"
118
+ target_structure: "<description of desired structure>"
119
+
120
+ principles:
121
+ primary:
122
+ - principle: <SOLID | DRY | KISS | YAGNI | SoC | etc.>
123
+ rationale: "<why this principle applies>"
124
+ applications:
125
+ - area: "<code area>"
126
+ action: "<specific application>"
127
+ secondary:
128
+ - principle: <name>
129
+ rationale: "<supporting rationale>"
130
+ constraints:
131
+ - constraint: "<what to avoid or preserve>"
132
+ reason: "<why>"
133
+
134
+ # Recommendations
135
+ recommendations:
136
+ - priority: <1-N>
137
+ category: requirements | specification | testing | code | refactoring
138
+ action: "<recommended action>"
139
+ affected_features: [<feature_ids>]
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Operations
145
+
146
+ ### Operation 1: Generate Quality Report
147
+
148
+ **When:** Need to evaluate project quality
149
+ **Input:** Optional scope filter (all | feature_ids[] | module_paths[])
150
+
151
+ ```
152
+ 1. DETERMINE scope:
153
+ - Default: all features in project
154
+ - If feature_ids provided: filter to those features
155
+ - If module_paths provided: find features affecting those modules
156
+
157
+ 2. DISCOVER features:
158
+ FOR project scope:
159
+ - SCAN x-ipe-docs/requirements/FEATURE-* directories
160
+ - BUILD feature list with metadata
161
+
162
+ 3. FOR EACH feature:
163
+ a. EVALUATE requirements alignment (see Evaluation Procedures)
164
+ b. EVALUATE specification alignment
165
+ c. EVALUATE test coverage
166
+ d. EVALUATE code alignment
167
+ e. COLLECT violations per category (requirements, spec, test, code)
168
+ f. CALCULATE feature status and score
169
+
170
+ 4. AGGREGATE results:
171
+ - Calculate overall_score (weighted average, exclude planned features)
172
+ - Determine health_status
173
+ - Collect priority_gaps
174
+ - Generate recommendations
175
+
176
+ 5. GENERATE report following this structure:
177
+ a. Executive Summary (scores, key findings)
178
+ b. Evaluation Principles (thresholds/methods ONLY - no results)
179
+ c. Feature-by-Feature Evaluation (overview table)
180
+ d. Violation Details by Feature:
181
+ - FOR EACH feature with violations:
182
+ - Requirements Violations section
183
+ - Specification Violations section
184
+ - Test Coverage Violations section
185
+ - Code Alignment Violations section
186
+ e. Files Approaching Threshold
187
+ f. Priority Gaps Summary
188
+ g. Recommendations
189
+ h. Appendix (detailed metrics)
190
+
191
+ 6. SAVE report:
192
+ - Save to x-ipe-docs/planning/project-quality-evaluation.md
193
+ - Update version and evaluated date in header
194
+
195
+ 7. RETURN evaluation summary
196
+ ```
197
+
198
+ ### Report Structure Rules
199
+
200
+ ```
201
+ RULE 1: Evaluation Principles section
202
+ - MUST come BEFORE Feature-by-Feature Evaluation
203
+ - MUST only explain what principles are and thresholds
204
+ - MUST NOT contain any evaluation results or status
205
+
206
+ RULE 2: Violation Details section
207
+ - MUST be organized by feature
208
+ - EACH feature section MUST have 4 subsections:
209
+ - Requirements Violations
210
+ - Specification Violations
211
+ - Test Coverage Violations
212
+ - Code Alignment Violations
213
+ - ONLY show features that have violations
214
+ - Show "No violations" if a category is clean
215
+
216
+ RULE 3: Separation of concerns
217
+ - Principles = WHAT we evaluate and HOW (thresholds)
218
+ - Violations = RESULTS of evaluation per feature
219
+ ```
220
+
221
+ ### Operation 2: Update Existing Report
222
+
223
+ **When:** Need to re-evaluate specific features
224
+ **Input:** feature_ids to re-evaluate
225
+
226
+ ```
227
+ 1. LOAD latest report from quality-evaluation-latest.md
228
+ 2. FOR EACH feature_id:
229
+ - RE-EVALUATE all 4 perspectives
230
+ - UPDATE feature entry in report
231
+ 3. RE-CALCULATE aggregates (overall_score, health_status)
232
+ 4. UPDATE priority_gaps and recommendations
233
+ 5. SAVE as new timestamped report
234
+ 6. UPDATE quality-evaluation-latest.md
235
+ ```
236
+
237
+ ### Operation 3: Query Quality Status
238
+
239
+ **When:** Need to check quality for specific features
240
+ **Input:** feature_ids or query criteria
241
+
242
+ ```
243
+ 1. LOAD latest report
244
+ 2. FILTER features by criteria
245
+ 3. RETURN filtered evaluation data
246
+ ```
247
+
248
+ ### Operation 4: Compare Evaluations
249
+
250
+ **When:** Need to track quality changes over time
251
+ **Input:** Two evaluation_ids or "latest vs previous"
252
+
253
+ ```
254
+ 1. LOAD both evaluation reports
255
+ 2. FOR EACH feature in both:
256
+ - COMPARE status changes
257
+ - CALCULATE score deltas
258
+ - IDENTIFY new/resolved gaps
259
+ 3. GENERATE comparison summary:
260
+ - Improved features
261
+ - Degraded features
262
+ - New gaps introduced
263
+ - Gaps resolved
264
+ 4. RETURN comparison data
265
+ ```
266
+
267
+ ---
268
+
269
+ ## Evaluation Principles
270
+
271
+ ### Requirements Evaluation Principles
272
+
273
+ | Principle | Threshold | Description |
274
+ |-----------|-----------|-------------|
275
+ | Completeness | 100% | Every implemented feature must have documented requirements |
276
+ | Traceability | Required | Requirements should trace to features and code |
277
+ | Clarity | No ambiguity | Requirements should be specific and testable |
278
+ | Currency | < 30 days | Requirements updated within 30 days of code changes |
279
+
280
+ ### Specification Evaluation Principles
281
+
282
+ | Principle | Threshold | Description |
283
+ |-----------|-----------|-------------|
284
+ | API Documentation | Required | All public APIs must be documented |
285
+ | Behavior Specification | Required | Expected behaviors clearly defined |
286
+ | Edge Cases | Documented | Error handling and edge cases specified |
287
+ | Version Alignment | Match | Spec version should match implementation version |
288
+
289
+ ### Test Coverage Evaluation Principles
290
+
291
+ | Principle | Threshold | Description |
292
+ |-----------|-----------|-------------|
293
+ | Line Coverage | ≥ 80% | Minimum line coverage for production code |
294
+ | Branch Coverage | ≥ 70% | Minimum branch/decision coverage |
295
+ | Critical Path Coverage | 100% | Core business logic must be fully tested |
296
+ | Error Handler Coverage | ≥ 90% | Exception and error paths tested |
297
+ | Test Isolation | Required | Tests should not depend on external services |
298
+ | Mock External APIs | Required | External API calls must be mocked in tests |
299
+
300
+ ### Code Alignment Evaluation Principles
301
+
302
+ | Principle | Threshold | Description |
303
+ |-----------|-----------|-------------|
304
+ | **File Size** | ≤ 800 lines | Single file should not exceed 800 lines |
305
+ | **Function Size** | ≤ 50 lines | Single function should not exceed 50 lines |
306
+ | **Class Size** | ≤ 500 lines | Single class should not exceed 500 lines |
307
+ | **Cyclomatic Complexity** | ≤ 10 | Function complexity should be manageable |
308
+ | **SRP (Single Responsibility)** | 1 reason to change | Each module/class has one responsibility |
309
+ | **OCP (Open/Closed)** | Extensible | Open for extension, closed for modification |
310
+ | **LSP (Liskov Substitution)** | Substitutable | Subtypes must be substitutable for base types |
311
+ | **ISP (Interface Segregation)** | Focused | Clients shouldn't depend on unused interfaces |
312
+ | **DIP (Dependency Inversion)** | Abstracted | Depend on abstractions, not concretions |
313
+ | **DRY (Don't Repeat Yourself)** | No duplication | Avoid code duplication across modules |
314
+ | **KISS (Keep It Simple)** | Simple solutions | Prefer simple over complex implementations |
315
+ | **YAGNI** | No unused code | Don't implement features until needed |
316
+ | **Modular Design** | Cohesive modules | Code organized into focused, reusable modules |
317
+ | **Naming Conventions** | Consistent | Follow language-specific naming conventions |
318
+ | **Import Organization** | Grouped | Imports organized by type (stdlib, external, internal) |
319
+
320
+ ### KISS Principle Assessment
321
+
322
+ | Check | Threshold | Description |
323
+ |-------|-----------|-------------|
324
+ | Avoid Over-Engineering | No unnecessary abstractions | Don't add layers without clear benefit |
325
+ | Straightforward Logic | Linear flow preferred | Avoid convoluted control flow |
326
+ | Minimal Dependencies | Only necessary imports | Don't import unused libraries |
327
+ | Clear Intent | Self-documenting code | Code should express intent without excessive comments |
328
+ | Simple Data Structures | Use built-in types | Avoid custom types when built-ins suffice |
329
+
330
+ ### Modular Design Assessment
331
+
332
+ | Check | Threshold | Description |
333
+ |-------|-----------|-------------|
334
+ | **Module Cohesion** | High cohesion | Related functions grouped in same module |
335
+ | **Module Coupling** | Loose coupling | Modules minimize dependencies on each other |
336
+ | **Single Entry Point** | One public API | Each module has clear public interface |
337
+ | **Folder Structure** | Logical grouping | Files organized by feature or layer |
338
+ | **Reusability** | Portable modules | Modules can be reused in different contexts |
339
+ | **Testability** | Independently testable | Each module can be tested in isolation |
340
+
341
+ **Modular Design Patterns:**
342
+
343
+ | Pattern | When to Apply | Example |
344
+ |---------|---------------|---------|
345
+ | Feature Modules | Large files > 800 lines | Split `app.py` → `routes/api.py`, `routes/views.py` |
346
+ | Service Layer | Business logic mixed with routes | Extract to `services/` folder |
347
+ | Component Split | UI file > 500 lines | Split into sub-components |
348
+ | Utility Extraction | Repeated helper functions | Create `utils/` or `lib/` folder |
349
+
350
+ ### Code Smell Detection
351
+
352
+ | Smell | Detection Rule | Severity |
353
+ |-------|----------------|----------|
354
+ | God Class | Class > 500 lines OR > 20 methods | High |
355
+ | Long Method | Function > 50 lines | Medium |
356
+ | Large File | File > 800 lines | Medium |
357
+ | Deep Nesting | > 4 levels of indentation | Medium |
358
+ | Too Many Parameters | Function > 5 parameters | Low |
359
+ | Magic Numbers | Hardcoded values without constants | Low |
360
+ | Dead Code | Unused functions/variables | Low |
361
+ | Duplicate Code | Similar code blocks > 10 lines | Medium |
362
+
363
+ ---
364
+
365
+ ## Evaluation Procedures
366
+
367
+ ### Procedure: Evaluate Requirements Alignment
368
+
369
+ ```
370
+ 1. LOCATE requirement docs:
371
+ - x-ipe-docs/requirements/requirement-summary.md
372
+ - x-ipe-docs/requirements/requirement-details.md
373
+ - Any docs referencing feature
374
+
375
+ 2. FOR EACH requirement related to feature:
376
+ a. CHECK if requirement is documented
377
+ b. CHECK if requirement is implemented in code
378
+ c. IDENTIFY deviations between doc and implementation
379
+
380
+ 3. CLASSIFY gaps:
381
+ - undocumented: Implemented but not in requirements
382
+ - unimplemented: In requirements but not implemented
383
+ - deviated: Implementation differs from requirement
384
+
385
+ 4. ASSIGN severity:
386
+ - high: Core functionality affected
387
+ - medium: Secondary functionality affected
388
+ - low: Minor/edge cases
389
+ ```
390
+
391
+ ### Procedure: Evaluate Specification Alignment
392
+
393
+ ```
394
+ 1. LOCATE specification:
395
+ - x-ipe-docs/requirements/FEATURE-XXX/specification.md
396
+
397
+ 2. IF specification exists:
398
+ a. EXTRACT expected behaviors
399
+ b. COMPARE with actual implementation
400
+ c. IDENTIFY gaps (missing | outdated | incorrect)
401
+
402
+ 3. IF specification missing (empty feature folder):
403
+ a. CHECK if any related implementation exists in codebase
404
+ b. IF no implementation found:
405
+ - status: planned
406
+ - NOT a gap - just indicates future work needed
407
+ - Do NOT count as critical or high priority gap
408
+ c. IF implementation exists without specification:
409
+ - status: not_found
410
+ - Add gap: "Implementation exists but specification missing"
411
+ - severity: medium (documentation debt)
412
+ ```
413
+
414
+ ### Procedure: Evaluate Test Coverage
415
+
416
+ ```
417
+ 1. IDENTIFY test files for feature:
418
+ - tests/**/test_*{feature_name}*
419
+ - tests/**/*{feature_name}*_test.*
420
+
421
+ 2. RUN coverage analysis:
422
+ - Python: pytest --cov
423
+ - Node.js: npm test -- --coverage
424
+ - Go: go test -cover
425
+
426
+ 3. EXTRACT metrics:
427
+ - Line coverage %
428
+ - Branch coverage %
429
+ - Untested functions/areas
430
+
431
+ 4. IDENTIFY critical untested areas:
432
+ - Business logic paths
433
+ - Error handlers
434
+ - Edge cases
435
+
436
+ 5. DETERMINE status:
437
+ - sufficient: ≥80% line coverage, no critical gaps
438
+ - insufficient: <80% or has critical gaps
439
+ - no_tests: No test files found
440
+ ```
441
+
442
+ ### Procedure: Evaluate Code Alignment
443
+
444
+ ```
445
+ 1. LOCATE technical design:
446
+ - x-ipe-docs/requirements/FEATURE-XXX/technical-design.md
447
+
448
+ 2. IF technical design exists:
449
+ a. EXTRACT expected:
450
+ - File structure
451
+ - Component interfaces
452
+ - Data models
453
+ b. COMPARE with actual implementation
454
+ c. IDENTIFY gaps:
455
+ - structure: File/folder organization differs
456
+ - behavior: Logic differs from design
457
+ - interface: API/interface differs
458
+
459
+ 3. DETERMINE status:
460
+ - aligned: No significant gaps
461
+ - drifted: Minor gaps exist
462
+ - major_drift: Critical gaps exist
463
+ ```
464
+
465
+ ### Procedure: Generate Refactoring Suggestions
466
+
467
+ **Integrates with:** `task-type-refactoring-analysis` skill
468
+
469
+ ```
470
+ 1. ANALYZE gaps from all 4 perspectives:
471
+ - Collect all gaps with severity high/medium
472
+ - Group gaps by feature
473
+
474
+ 2. FOR EACH feature with gaps:
475
+ a. IDENTIFY applicable principles (from task-type-refactoring-analysis):
476
+ - Large files/classes → SRP, SOLID
477
+ - Duplicated code → DRY
478
+ - Complex logic → KISS
479
+ - Unused code → YAGNI
480
+ - Mixed concerns → SoC (Separation of Concerns)
481
+
482
+ b. FORMULATE goals based on gaps:
483
+ - requirements gaps → Suggest documentation sync or code alignment
484
+ - specification gaps → Suggest spec update or implementation fix
485
+ - test coverage gaps → Suggest test-first approach
486
+ - code alignment gaps → Suggest structural refactoring
487
+
488
+ c. DEFINE target structure:
489
+ - Describe desired code organization after fixes
490
+ - Note key structural changes needed
491
+
492
+ d. IDENTIFY constraints:
493
+ - Backward compatibility requirements
494
+ - API stability requirements
495
+ - Dependencies to preserve
496
+
497
+ 3. COMPILE refactoring_suggestion for feature:
498
+ summary: "<derived from gap analysis>"
499
+ goals:
500
+ - goal: "<specific goal from gap>"
501
+ priority: <based on gap severity>
502
+ rationale: "<from gap description>"
503
+ target_structure: "<desired end state>"
504
+
505
+ principles:
506
+ primary: [<principles with applications>]
507
+ secondary: [<supporting principles>]
508
+ constraints: [<identified constraints>]
509
+
510
+ 4. IF no gaps found for feature:
511
+ - Set has_suggestions: false for that feature
512
+ - Skip suggestion generation
513
+ ```
514
+
515
+ ---
516
+
517
+ ## Score Calculation
518
+
519
+ ### Feature Score (1-10)
520
+
521
+ ```
522
+ feature_score = weighted_average(
523
+ requirements_alignment: weight=0.25,
524
+ specification_alignment: weight=0.25,
525
+ test_coverage: weight=0.25,
526
+ code_alignment: weight=0.25
527
+ )
528
+
529
+ Status to score mapping:
530
+ - aligned/sufficient: 10
531
+ - planned: N/A (exclude from scoring - future work)
532
+ - needs_update/insufficient: 5
533
+ - not_found/no_tests/major_drift: 2
534
+ - critical: 1
535
+
536
+ Note: Features with status "planned" (empty folder, no implementation)
537
+ are EXCLUDED from overall score calculation as they represent future
538
+ work, not quality issues.
539
+ ```
540
+
541
+ ### Overall Score (1-10)
542
+
543
+ ```
544
+ overall_score = average(all feature_scores WHERE status != "planned")
545
+ ```
546
+
547
+ ### Health Status
548
+
549
+ ```
550
+ IF overall_score >= 8: healthy
551
+ ELSE IF overall_score >= 5: attention_needed
552
+ ELSE: critical
553
+ ```
554
+
555
+ ---
556
+
557
+ ## Report Template
558
+
559
+ The skill uses template at `templates/quality-report.md` for consistent report generation.
560
+
561
+ Template structure:
562
+ 1. Header with metadata
563
+ 2. Executive Summary
564
+ 3. Feature-by-Feature Evaluation
565
+ 4. Priority Gaps
566
+ 5. Recommendations
567
+ 6. Appendix (detailed data)
568
+
569
+ ---
570
+
571
+ ## Definition of Done (DoD)
572
+
573
+ | # | Checkpoint | Required |
574
+ |---|------------|----------|
575
+ | 1 | All features in scope evaluated | Yes |
576
+ | 2 | All 4 perspectives evaluated per feature | Yes |
577
+ | 3 | Gaps identified and prioritized | Yes |
578
+ | 4 | Overall score calculated | Yes |
579
+ | 5 | Report generated in correct location | Yes |
580
+ | 6 | Latest report link updated | Yes |
581
+
582
+ ---
583
+
584
+ ## Patterns
585
+
586
+ ### Pattern: First-Time Evaluation
587
+
588
+ **When:** No previous quality reports exist
589
+ **Then:**
590
+ ```
591
+ 1. Generate full project evaluation
592
+ 2. Set baseline metrics
593
+ 3. Create recommendations for initial improvements
594
+ 4. Flag features needing immediate attention
595
+ ```
596
+
597
+ ### Pattern: Post-Refactoring Evaluation
598
+
599
+ **When:** After code-refactoring-stage tasks complete
600
+ **Then:**
601
+ ```
602
+ 1. Load code_quality_evaluated from refactoring task
603
+ 2. Use as input for targeted re-evaluation
604
+ 3. Compare with pre-refactoring state
605
+ 4. Generate delta report showing improvements
606
+ ```
607
+
608
+ ---
609
+
610
+ ## Anti-Patterns
611
+
612
+ | Anti-Pattern | Why Bad | Do Instead |
613
+ |--------------|---------|------------|
614
+ | Skip features without specs | Miss coverage gaps | Evaluate, mark as not_found |
615
+ | Assume passing tests = quality | Tests may not cover all | Always check all 4 perspectives |
616
+ | Only evaluate after problems | Reactive, not proactive | Regular scheduled evaluations |
617
+ | Ignore low-severity gaps | They accumulate | Track all, prioritize by severity |
618
+
619
+ ---
620
+
621
+ ## Integration with Code Refactoring Stage
622
+
623
+ This skill integrates with the code-refactoring-stage workflow:
624
+
625
+ 1. **Before Refactoring Analysis**: Generate baseline quality report
626
+ 2. **After Improve Quality**: Generate comparison showing documentation alignment
627
+ 3. **After Code Refactor V2**: Generate final quality report showing improvements
628
+
629
+ ```
630
+ Quality Report (baseline)
631
+
632
+ task-type-refactoring-analysis
633
+
634
+ task-type-improve-code-quality-before-refactoring
635
+
636
+ Quality Report (mid-point)
637
+
638
+ task-type-code-refactor-v2
639
+
640
+ Quality Report (final) + Comparison
641
+ ```