metacoding 1.0.0 → 1.1.1

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 (49) hide show
  1. package/CHANGELOG.md +79 -42
  2. package/LICENSE +1 -1
  3. package/lib/commands/init.d.ts.map +1 -1
  4. package/lib/commands/init.js +1 -1
  5. package/lib/commands/init.js.map +1 -1
  6. package/lib/services/template-manager.d.ts +4 -1
  7. package/lib/services/template-manager.d.ts.map +1 -1
  8. package/lib/services/template-manager.js +129 -10
  9. package/lib/services/template-manager.js.map +1 -1
  10. package/lib/services/vscode.js +1 -1
  11. package/lib/services/vscode.js.map +1 -1
  12. package/package.json +12 -4
  13. package/templates/general/code-review.instructions.md +265 -0
  14. package/templates/general/{files/copilot-instructions.md.template → copilot-instructions.md} +97 -140
  15. package/templates/{python/files → general}/docs-update.instructions.md +45 -32
  16. package/templates/general/release.instructions.md +242 -0
  17. package/templates/general/test-runner.instructions.md +188 -0
  18. package/templates/node/nodejs.coding.instructions.md +249 -0
  19. package/templates/node/nodejs.docs.instructions.md +234 -0
  20. package/templates/node/nodejs.testing.instructions.md +373 -0
  21. package/templates/python/python.coding.instructions.md +339 -0
  22. package/templates/python/python.docs.instructions.md +1147 -0
  23. package/templates/python/python.testing.instructions.md +1074 -0
  24. package/templates/react/react.coding.instructions.md +695 -0
  25. package/templates/react/react.docs.instructions.md +427 -0
  26. package/templates/react/react.testing.instructions.md +193 -0
  27. package/templates/react/test-runner.instructions.md +135 -0
  28. package/templates/typescript/template.json +16 -0
  29. package/templates/typescript/typescript.coding.instructions.md +368 -0
  30. package/templates/typescript/typescript.docs.instructions.md +734 -0
  31. package/templates/typescript/typescript.testing.instructions.md +740 -0
  32. package/templates/general/files/code-review.instructions.md +0 -111
  33. package/templates/general/files/docs-update.instructions.md +0 -203
  34. package/templates/general/files/release.instructions.md +0 -72
  35. package/templates/general/files/test-runner.instructions.md +0 -107
  36. package/templates/node/files/code-review.instructions.md +0 -222
  37. package/templates/node/files/copilot-instructions.md.template +0 -391
  38. package/templates/node/files/docs-update.instructions.md +0 -203
  39. package/templates/node/files/release.instructions.md +0 -72
  40. package/templates/node/files/test-runner.instructions.md +0 -108
  41. package/templates/python/files/code-review.instructions.md +0 -215
  42. package/templates/python/files/copilot-instructions.md.template +0 -418
  43. package/templates/python/files/release.instructions.md +0 -72
  44. package/templates/python/files/test-runner.instructions.md +0 -108
  45. package/templates/react/files/code-review.instructions.md +0 -160
  46. package/templates/react/files/copilot-instructions.md.template +0 -472
  47. package/templates/react/files/docs-update.instructions.md +0 -203
  48. package/templates/react/files/release.instructions.md +0 -72
  49. package/templates/react/files/test-runner.instructions.md +0 -108
@@ -0,0 +1,265 @@
1
+ ---
2
+ description: 'Universal code review checklist for all project types'
3
+ applyTo: '**'
4
+ ---
5
+
6
+ # Universal Code Review Guidelines
7
+
8
+ ## Code Review Philosophy
9
+
10
+ Code reviews are essential for maintaining code quality, sharing knowledge, and ensuring consistency across all project types. This document provides universal guidelines that apply to all languages and frameworks, with specific details deferred to language-specific instruction files.
11
+
12
+ ## Language-Specific Review Guidelines
13
+
14
+ For detailed language-specific review criteria, refer to:
15
+
16
+ - **TypeScript/Node.js:** See `typescript.coding.instructions.md` for TypeScript-specific patterns and best practices
17
+ - **Python:** See `python.coding.instructions.md` for Python-specific patterns and conventions
18
+ - **React/Frontend:** See `react.coding.instructions.md` for React-specific patterns and component design
19
+
20
+ ## Functionality Assessment
21
+
22
+ ### Requirements and Logic
23
+
24
+ - **Requirements Compliance:** Does the code meet the specified requirements?
25
+ - **Business Logic:** Is the business logic correctly implemented and testable?
26
+ - **Edge Cases:** Are edge cases properly handled with appropriate error responses?
27
+ - **Error Scenarios:** How does the code behave with invalid inputs and failure conditions?
28
+ - **Integration Points:** Do integrations with other components work correctly?
29
+
30
+ ### Input Validation and Data Handling
31
+
32
+ - **Input Sanitization:** Are all inputs properly validated and sanitized?
33
+ - **Data Type Safety:** Are data types appropriate and consistently used?
34
+ - **Boundary Conditions:** Are boundary conditions handled correctly?
35
+ - **Null/Undefined Handling:** Are null/undefined values handled appropriately?
36
+
37
+ ## Code Quality and Readability
38
+
39
+ ### Naming and Structure
40
+
41
+ - **Naming Conventions:** Are variables, functions, and classes named clearly using language conventions?
42
+ - **Code Structure:** Is the code well-organized and logically structured?
43
+ - **Function Size:** Are functions focused and reasonably sized (language-specific guidelines)?
44
+ - **Complexity:** Is the code unnecessarily complex or could it be simplified?
45
+ - **Consistency:** Does the code follow established project patterns and conventions?
46
+
47
+ ### Documentation and Comments
48
+
49
+ - **Code Documentation:** Is the code self-documenting with appropriate language-specific documentation?
50
+ - **Comment Quality:** Are comments helpful and explain "why" not "what"?
51
+ - **API Documentation:** Are public APIs documented using language-appropriate standards?
52
+ - **Complex Logic:** Is complex business logic or algorithms explained with comments?
53
+
54
+ ## Performance Considerations
55
+
56
+ ### Algorithm and Data Structure Efficiency
57
+
58
+ - **Algorithm Choice:** Are appropriate algorithms and data structures used?
59
+ - **Time Complexity:** Is the time complexity appropriate for the expected data size?
60
+ - **Space Complexity:** Is memory usage efficient and appropriate?
61
+ - **Resource Management:** Are resources properly acquired and released?
62
+
63
+ ### Language-Specific Performance
64
+
65
+ - **Memory Management:** Are there potential memory leaks or excessive memory usage?
66
+ - **Async Operations:** Are async operations used appropriately for I/O-bound tasks?
67
+ - **Caching Opportunities:** Are caching opportunities identified and implemented correctly?
68
+ - **Database Efficiency:** Are database queries optimized and avoid N+1 problems?
69
+
70
+ ## Security Review
71
+
72
+ ### Input Security
73
+
74
+ - **Input Validation:** Are all inputs properly validated and sanitized?
75
+ - **Injection Prevention:** Are injection attacks (SQL, XSS, command injection) prevented?
76
+ - **Data Sanitization:** Is user input properly escaped and sanitized?
77
+
78
+ ### Authentication and Authorization
79
+
80
+ - **Authentication Checks:** Are authentication checks in place where needed?
81
+ - **Authorization Logic:** Are authorization checks appropriate for the functionality?
82
+ - **Permission Validation:** Are user permissions properly validated before actions?
83
+
84
+ ### Data Protection
85
+
86
+ - **Sensitive Data:** Is sensitive data properly protected and encrypted?
87
+ - **Data Exposure:** Are there any unintentional data exposure risks?
88
+ - **Logging Security:** Is sensitive information excluded from logs?
89
+ - **Communication Security:** Is data transmission properly secured?
90
+
91
+ ## Testing and Testability
92
+
93
+ ### Test Coverage and Quality
94
+
95
+ - **Test Coverage:** Are there sufficient tests for the new functionality?
96
+ - **Test Types:** Are appropriate test types used (unit, integration, end-to-end)?
97
+ - **Test Quality:** Are tests meaningful and test the right behaviors?
98
+ - **Edge Case Testing:** Do tests cover edge cases and error conditions?
99
+
100
+ ### Test Structure and Maintainability
101
+
102
+ - **Test Organization:** Are tests well-organized and follow project conventions?
103
+ - **Test Data:** Is test data realistic and properly managed?
104
+ - **Mock Strategy:** Are external dependencies properly mocked in unit tests?
105
+ - **Test Documentation:** Are complex test scenarios documented?
106
+
107
+ ## Error Handling and Logging
108
+
109
+ ### Error Management
110
+
111
+ - **Exception Handling:** Are exceptions handled appropriately using language conventions?
112
+ - **Error Messages:** Are error messages helpful for debugging and user-friendly when appropriate?
113
+ - **Error Propagation:** Is error propagation handled correctly through the call stack?
114
+ - **Graceful Degradation:** Does the system handle failures gracefully?
115
+
116
+ ### Logging and Monitoring
117
+
118
+ - **Logging Strategy:** Is appropriate logging in place for debugging and monitoring?
119
+ - **Log Levels:** Are appropriate log levels used (debug, info, warn, error)?
120
+ - **Structured Logging:** Is logging structured and searchable?
121
+ - **Performance Logging:** Are performance-critical paths properly instrumented?
122
+
123
+ ## Documentation and Maintenance
124
+
125
+ ### Code and API Documentation
126
+
127
+ - **Self-Documenting Code:** Is the code readable and self-explanatory?
128
+ - **Public API Documentation:** Are public APIs documented with language-appropriate standards?
129
+ - **Complex Logic Documentation:** Are complex algorithms and business rules documented?
130
+
131
+ ### Change Documentation
132
+
133
+ - **Breaking Changes:** Are breaking changes clearly identified and documented?
134
+ - **Migration Guides:** Are migration paths provided for breaking changes?
135
+ - **Changelog Updates:** Are user-facing changes documented in changelog?
136
+ - **Version Compatibility:** Is backward compatibility maintained where required?
137
+
138
+ ## Standards Compliance
139
+
140
+ ### Project Standards
141
+
142
+ - **Coding Standards:** Does the code follow project coding standards and conventions?
143
+ - **Architectural Patterns:** Are established architectural patterns followed?
144
+ - **Style Guidelines:** Does the code follow language-specific style guidelines?
145
+ - **Project Structure:** Are files organized according to project structure guidelines?
146
+
147
+ ### Dependencies and Configuration
148
+
149
+ - **Dependency Management:** Are new dependencies justified and properly managed?
150
+ - **Version Constraints:** Are dependency versions appropriately constrained?
151
+ - **Configuration Handling:** Are configuration changes handled appropriately?
152
+ - **Environment Compatibility:** Does the code work across supported environments?
153
+
154
+ ## Anti-Patterns and Code Smells
155
+
156
+ ### Universal Anti-Patterns
157
+
158
+ - **Deep Nesting:** Excessive conditional or exception nesting
159
+ - **God Objects:** Classes or functions with too many responsibilities
160
+ - **Magic Numbers/Strings:** Hardcoded values without explanation or configuration
161
+ - **Copy-Paste Code:** Duplicated code that should be refactored into shared utilities
162
+ - **Tight Coupling:** Components that are too dependent on each other
163
+
164
+ ### Resource and State Management
165
+
166
+ - **Memory Leaks:** Objects not properly cleaned up or disposed
167
+ - **Resource Leaks:** File handles, connections, or other resources not properly closed
168
+ - **State Mutation:** Inappropriate mutation of shared or immutable state
169
+ - **Global State Abuse:** Overuse of global variables or singleton patterns
170
+
171
+ ### Development Hygiene Issues
172
+
173
+ - **Temporary File Pollution:** Debug files, temp outputs, or experimental code left in repository
174
+ - **Console/Debug Output:** Debug statements or logging left in production code
175
+ - **Commented Code:** Large blocks of commented-out code without explanation
176
+ - **TODO/FIXME Accumulation:** Excessive TODO comments without associated issues
177
+
178
+ ## File and Repository Hygiene
179
+
180
+ ### Repository Cleanliness
181
+
182
+ - **File Organization:** Are files placed in appropriate directories according to project structure?
183
+ - **Temporary Files:** Are all temporary files, debug outputs, and experimental code removed?
184
+ - **Resource Cleanup:** Has development session cleanup been performed before commit?
185
+ - **Test Artifacts:** Are temporary test files moved to appropriate locations or removed?
186
+
187
+ ### Code Organization
188
+
189
+ - **Single Responsibility:** Does each file have a clear, single purpose?
190
+ - **Import Organization:** Are imports/includes organized according to language conventions?
191
+ - **Unused Code:** Is dead code and unused imports removed?
192
+ - **File Naming:** Do file names follow project conventions?
193
+
194
+ ## Review Process Guidelines
195
+
196
+ ### Providing Feedback
197
+
198
+ - **Constructive Approach:** Provide specific, actionable feedback
199
+ - **Explanation:** Explain reasoning behind suggested changes
200
+ - **Alternative Suggestions:** Offer alternative approaches when applicable
201
+ - **Positive Recognition:** Acknowledge well-written code and good practices
202
+ - **Focus on Code:** Keep feedback focused on code quality, not personal style
203
+
204
+ ### Prioritizing Issues
205
+
206
+ - **Critical Issues:** Security vulnerabilities, functional bugs, performance issues
207
+ - **Quality Issues:** Code organization, readability, maintainability
208
+ - **Style Issues:** Formatting, naming conventions, minor style inconsistencies
209
+ - **Suggestions:** Improvements that enhance but don't fix problems
210
+
211
+ ### Review Efficiency
212
+
213
+ - **Scope Management:** Keep reviews focused and appropriately sized
214
+ - **Context Understanding:** Understand the change context before reviewing
215
+ - **Tool Usage:** Use code review tools effectively
216
+ - **Time Management:** Balance thoroughness with review turnaround time
217
+
218
+ ## Automated Checks Integration
219
+
220
+ ### Pre-Review Automation
221
+
222
+ - **Linting:** Code passes language-specific linting rules
223
+ - **Formatting:** Code follows consistent formatting standards
224
+ - **Type Checking:** Static type checking passes (for typed languages)
225
+ - **Build Verification:** Code builds successfully
226
+ - **Test Execution:** All tests pass including new and existing ones
227
+
228
+ ### Security and Quality Automation
229
+
230
+ - **Security Scanning:** Automated security vulnerability scans pass
231
+ - **Dependency Auditing:** Dependency security audits pass
232
+ - **Code Coverage:** Test coverage meets minimum thresholds
233
+ - **Performance Benchmarks:** Performance regressions are identified
234
+
235
+ ## Cross-Platform and Environment Considerations
236
+
237
+ ### Compatibility Review
238
+
239
+ - **Platform Independence:** Code works across supported platforms
240
+ - **Environment Variables:** Environment-specific configuration is handled properly
241
+ - **Path Handling:** File paths are handled appropriately for different OS
242
+ - **Encoding Issues:** Text encoding is handled consistently
243
+
244
+ ### Deployment Considerations
245
+
246
+ - **Configuration Management:** Configuration changes are properly managed
247
+ - **Migration Requirements:** Database or data migrations are included if needed
248
+ - **Rollback Compatibility:** Changes support rollback procedures
249
+ - **Production Readiness:** Code is ready for production deployment
250
+
251
+ ## Knowledge Sharing and Learning
252
+
253
+ ### Educational Opportunities
254
+
255
+ - **Learning Moments:** Use reviews as teaching opportunities
256
+ - **Best Practice Sharing:** Share knowledge about best practices and patterns
257
+ - **Tool Knowledge:** Share knowledge about useful tools and techniques
258
+ - **Domain Knowledge:** Share business domain knowledge when relevant
259
+
260
+ ### Documentation and Process Improvement
261
+
262
+ - **Pattern Documentation:** Document new patterns discovered during review
263
+ - **Process Feedback:** Provide feedback on review process effectiveness
264
+ - **Guideline Updates:** Suggest updates to coding guidelines based on review findings
265
+ - **Tool Improvements:** Suggest improvements to review tools and automation
@@ -4,6 +4,9 @@ For more details, visit: https://code.visualstudio.com/docs/copilot/copilot-cust
4
4
 
5
5
  Instructions are automatically included in every chat request and code completion suggestion.
6
6
  Keep instructions clear, specific, and actionable to maximize effectiveness.
7
+
8
+ This file contains universal workflow and development principles.
9
+ Language-specific coding standards are provided in separate instruction files.
7
10
  -->
8
11
 
9
12
  # Project Overview
@@ -32,45 +35,36 @@ Assume the role of a **senior, experienced {{PROJECT_DOMAIN}} developer** with e
32
35
  **Communication Style:**
33
36
 
34
37
  - **Always follow the mandatory development workflow** outlined in this document
38
+ - **Enforce documentation-first principle:** Require all documentation to be complete before any implementation work begins
39
+ - **Implement confirmation gates:** Wait for explicit user approval of plans, scope, and consequences before proceeding
35
40
  - Provide clear, concise, and actionable suggestions
36
41
  - Explain the reasoning behind recommendations
37
42
  - Offer alternative approaches when applicable
38
43
  - Flag potential issues or improvements proactively
39
44
  - **Enforce workflow completion before starting new tasks**
40
45
 
41
- # Coding Standards and Conventions
42
-
43
- ## Language and Framework Preferences
46
+ # Language-Specific Coding Standards
44
47
 
45
- - **Primary Language:** TypeScript for all code files
46
- - **Code Style:** Follow project's ESLint/Prettier configuration
47
- - **Target Compatibility:** [Specify target versions, e.g., "Node.js 18+, VS Code 1.74+"]
48
+ **Note:** This file focuses on universal workflow principles. For detailed language-specific coding standards, naming conventions, and best practices, refer to the appropriate language-specific instruction files:
48
49
 
49
- ## Code Quality Guidelines
50
+ - **TypeScript/Node.js Projects:** See `.github/instructions/languages/typescript.coding.instructions.md`
51
+ - **Python Projects:** See `.github/instructions/languages/python.coding.instructions.md`
52
+ - **React/Frontend Projects:** See `.github/instructions/languages/react.coding.instructions.md`
50
53
 
51
- - **Readability:** Write self-explanatory code with meaningful names
52
- - **Functions:** Keep functions focused and under 50 lines when possible
53
- - **Magic Numbers:** Use named constants or enums instead of magic numbers
54
- - **Error Handling:** Implement comprehensive error handling with proper logging
55
- - **Memory Management:** Ensure proper resource cleanup and disposal
56
- - **Async Patterns:** Use async/await for I/O operations, avoid blocking operations
54
+ These language-specific files contain comprehensive guidance on:
57
55
 
58
- ## Naming Conventions
56
+ - Language-specific coding standards and conventions
57
+ - Framework-specific patterns and best practices
58
+ - Performance optimization techniques
59
+ - Testing frameworks and patterns
60
+ - Security considerations for each language
61
+ - Common anti-patterns to avoid
59
62
 
60
- - **Files:** Use kebab-case for file names (e.g., `user-service.ts`)
61
- - **Classes:** PascalCase (e.g., `UserService`, `IUserRepository`)
62
- - **Functions/Methods:** camelCase (e.g., `getUserById`, `validateInput`)
63
- - **Variables:** camelCase (e.g., `userId`, `isValid`)
64
- - **Constants:** SCREAMING_SNAKE_CASE (e.g., `MAX_RETRY_ATTEMPTS`)
65
- - **Interfaces:** PascalCase with 'I' prefix (e.g., `IUserRepository`)
66
- - **Types:** PascalCase (e.g., `UserData`, `ConfigOptions`)
63
+ ## {{PROJECT_DOMAIN}} Development Focus
67
64
 
68
- ## Code Organization
65
+ **Technology-Specific Guidelines:**
69
66
 
70
- - **Single Responsibility:** One class/interface per file
71
- - **Imports:** Group and order imports (external libraries, internal modules, relative imports)
72
- - **File Structure:** Organize files by feature or layer, not by file type
73
- - **Barrel Exports:** Use index.ts files for clean module exports
67
+ {{PROJECT_SPECIFIC_GUIDANCE}}
74
68
 
75
69
  # Project Structure Guidelines
76
70
 
@@ -86,12 +80,12 @@ Assume the role of a **senior, experienced {{PROJECT_DOMAIN}} developer** with e
86
80
  /src # All source code
87
81
  /components # Reusable components
88
82
  /services # Business logic and services
89
- /types # TypeScript type definitions
83
+ /types # Type definitions
90
84
  /utils # Utility functions
91
85
  /constants # Application constants
92
86
  /test # All test-related files
93
87
  /fixtures # Test fixtures and sample data
94
- /unit # Unit tests (*.test.ts)
88
+ /unit # Unit tests
95
89
  /integration # Integration tests
96
90
  /_meta # Development documentation
97
91
  /.github # GitHub-specific files (workflows, templates)
@@ -102,7 +96,7 @@ Assume the role of a **senior, experienced {{PROJECT_DOMAIN}} developer** with e
102
96
 
103
97
  - **Meta Documentation:** All development docs in `/_meta` folder
104
98
  - `project-task-list.md` - Current tasks and roadmap
105
- - `project-documentation.md` - General project documentation
99
+ - `system-documentation.md` - General system documentation
106
100
  - `architecture.md` - System architecture decisions
107
101
  - `api-design.md` - API design patterns and conventions
108
102
  - **Test Documentation:** All test docs in `/test` folder
@@ -130,12 +124,12 @@ Assume the role of a **senior, experienced {{PROJECT_DOMAIN}} developer** with e
130
124
 
131
125
  ## Core Development Practices
132
126
 
133
- - **TypeScript First:** Use TypeScript for all code files with strict type checking
127
+ - **Language Standards:** Follow language-specific coding standards defined in language instruction files
134
128
  - **Modular Design:** Follow separation of concerns and single responsibility principles
135
129
  - **Error Handling:** Implement comprehensive error handling with proper logging and user feedback
136
130
  - **Resource Management:** Ensure proper cleanup of resources, event listeners, and disposables
137
131
  - **Temporary File Hygiene:** Clean up all temporary files, debug outputs, and experimental code after development sessions
138
- - **Performance:** Consider performance implications, especially for VS Code extensions (startup time, memory usage)
132
+ - **Performance:** Consider performance implications and optimization opportunities
139
133
  - **Security:** Follow secure coding practices, validate inputs, and sanitize outputs
140
134
 
141
135
  ## Testing Strategy
@@ -152,7 +146,7 @@ Assume the role of a **senior, experienced {{PROJECT_DOMAIN}} developer** with e
152
146
  ## Documentation Standards
153
147
 
154
148
  - **Documentation Architecture:** Maintain strict separation between system documentation (evergreen, no status indicators) and project management documentation (status tracking, temporal language)
155
- - **Code Documentation:** Use JSDoc comments for public APIs and complex logic
149
+ - **Code Documentation:** Use appropriate documentation standards for the project language (see language-specific instruction files)
156
150
  - **README Updates:** Keep main README.md current with project state and features using factual, present-tense language
157
151
  - **Changelog:** Maintain detailed CHANGELOG.md with all notable changes
158
152
  - **API Documentation:** Document all public APIs with examples and usage patterns
@@ -166,23 +160,6 @@ Assume the role of a **senior, experienced {{PROJECT_DOMAIN}} developer** with e
166
160
  - **Code Reviews:** All changes require review before merging
167
161
  - **Release Management:** Follow semantic versioning (SemVer) principles
168
162
 
169
- ## GitHub Release and Version Management
170
-
171
- - **Version Bumping:** Update version in package.json following semantic versioning
172
- - **README Version Badge:** Ensure version badges in README.md reflect current package.json version
173
- - **Changelog Updates:** Write concise, user-focused changelog entries in CHANGELOG.md
174
- - Group changes by type: Added, Changed, Deprecated, Removed, Fixed, Security
175
- - Include breaking changes prominently
176
- - Keep entries brief but descriptive (1-2 lines per change)
177
- - Reference issue/PR numbers when applicable
178
- - **Release Process:**
179
- 1. Update version in package.json
180
- 2. Update README.md badges and version references
181
- 3. Add entry to CHANGELOG.md with release date
182
- 4. Commit with message: `chore: bump version to vX.Y.Z`
183
- 5. Create GitHub release with tag matching package.json version
184
- 6. Release notes should summarize key changes from CHANGELOG.md
185
-
186
163
  ## Code Review Criteria
187
164
 
188
165
  When reviewing code or generating suggestions, consider:
@@ -204,7 +181,7 @@ When reviewing code or generating suggestions, consider:
204
181
  - Inconsistent error handling patterns
205
182
  - Missing or inadequate logging
206
183
  - Hardcoded configuration values
207
- - Synchronous operations that could block the main thread
184
+ - Blocking operations that could impact performance
208
185
 
209
186
  ## Suggested Improvements
210
187
 
@@ -217,90 +194,7 @@ When providing code suggestions, prioritize:
217
194
  5. **Testability:** Make code easier to test and debug
218
195
  6. **Consistency:** Align with existing codebase patterns and conventions
219
196
 
220
- # Task-Specific Instructions Files
221
-
222
- ## Using .instructions.md Files for Development Routines
223
-
224
- Create specialized `.instructions.md` files in `.github/instructions/` for common development tasks:
225
-
226
- ### Testing Instructions (`test-runner.instructions.md`)
227
-
228
- ```markdown
229
- ---
230
- description: "Instructions for running and maintaining tests"
231
- applyTo: "test/**/*.ts"
232
- ---
233
-
234
- # Test Execution Guidelines
235
-
236
- - Run all tests before committing changes
237
- - Ensure new features have corresponding unit tests
238
- - Update test fixtures when data structures change
239
- - Use descriptive test names that explain the scenario and expected outcome
240
- - Mock external dependencies in unit tests
241
- - Use realistic data in integration tests
242
- ```
243
-
244
- ### Release Management (`release.instructions.md`)
245
-
246
- ```markdown
247
- ---
248
- description: "Step-by-step release process automation"
249
- applyTo: "package.json"
250
- ---
251
-
252
- # Release Process Checklist
253
-
254
- 1. Verify all tests pass: `npm test`
255
- 2. Update version in package.json using semantic versioning
256
- 3. Update README.md version badges to match package.json
257
- 4. Add new entry to CHANGELOG.md with:
258
- - Release version and date
259
- - Grouped changes: Added, Changed, Fixed, etc.
260
- - Breaking changes highlighted
261
- 5. Commit with: `chore: bump version to vX.Y.Z`
262
- 6. Create GitHub release with tag matching version
263
- 7. Copy changelog entry to release notes
264
- ```
265
-
266
- ### Documentation Updates (`docs-update.instructions.md`)
267
-
268
- ```markdown
269
- ---
270
- description: "Guidelines for maintaining project documentation"
271
- applyTo: "**/*.md"
272
- ---
273
-
274
- # Documentation Maintenance
275
-
276
- - Keep README.md current with latest features and installation steps
277
- - Update JSDoc comments when changing public APIs
278
- - Record architectural decisions in /_meta folder
279
- - Ensure code examples in documentation are tested and working
280
- - Update CHANGELOG.md for all user-facing changes
281
- - Maintain consistent formatting and tone across all documentation
282
- ```
283
-
284
- ### Code Review (`code-review.instructions.md`)
285
-
286
- ```markdown
287
- ---
288
- description: "Automated code review checklist"
289
- applyTo: "**"
290
- ---
291
-
292
- # Code Review Focus Areas
293
-
294
- - Verify functionality and edge case handling
295
- - Check for performance implications and memory leaks
296
- - Ensure proper error handling and logging
297
- - Validate security best practices
298
- - Confirm test coverage for new features
299
- - Review for code consistency and maintainability
300
- - Check that breaking changes are documented
301
- ```
302
-
303
- ## Development Workflow
197
+ # Development Workflow
304
198
 
305
199
  ## Mandatory Development Process
306
200
 
@@ -312,22 +206,26 @@ applyTo: "**"
312
206
  - **Provide implementation outline:** Present the shortest possible outline of the implementation plan with key details
313
207
  - **Get explicit confirmation:** Wait for user confirmation before proceeding
314
208
  - **Clarify scope:** Ensure both parties understand what will be implemented and what won't
209
+ - **Document first, execute second:** No implementation work begins until all required documentation is complete
210
+ - **Mandatory confirmation gates:** User must explicitly approve the plan, scope, and consequences before any work begins
315
211
 
316
212
  ### Step 2: Task Management
317
213
 
318
- - **Update task list:** Add corresponding task(s) to `/_meta/project-task-list.md`
214
+ - **Document before executing:** Add corresponding task(s) to `/_meta/project-task-list.md` BEFORE any implementation work
319
215
  - **Set task status:** Mark tasks as "In Progress" with clear descriptions
320
216
  - **Break down complex tasks:** Split large tasks into smaller, manageable subtasks
321
217
  - **Estimate effort:** Provide realistic time/complexity estimates
218
+ - **Task documentation requirement:** Every task must be documented in the task list before work begins
322
219
 
323
220
  ### Step 3: Test-Driven Development (TDD)
324
221
 
325
- - **Document test cases first:** Write test cases in `/test/test-documentation.md`
326
- - **Define expected behavior:** Clearly specify inputs, outputs, and edge cases
327
- - **Implement tests:** Create actual test files that verify the documented behavior
222
+ - **Document test cases first:** Write test cases in `/test/test-documentation.md` BEFORE implementing any tests
223
+ - **Define expected behavior:** Clearly specify inputs, outputs, and edge cases in documentation
224
+ - **Only then implement tests:** Create actual test files after test cases are documented
328
225
  - **Verify test failure:** Run tests to confirm they fail appropriately (red phase)
329
- - **Only then implement:** Write the minimum code needed to make tests pass (green phase)
226
+ - **Then implement code:** Write the minimum code needed to make tests pass (green phase)
330
227
  - **Clean up test artifacts:** Remove temporary test files, move useful test data to `/test/fixtures/`
228
+ - **Test documentation requirement:** All test cases must be documented before any test code is written
331
229
 
332
230
  ### Step 4: Implementation and Verification
333
231
 
@@ -344,7 +242,7 @@ applyTo: "**"
344
242
  - **Update task status:** Mark completed tasks in `/_meta/project-task-list.md`
345
243
  - **Update test documentation:** Record test status in `/test/test-documentation.md`
346
244
  - **Update CHANGELOG.md:** Document user-facing changes
347
- - **Review code documentation:** Ensure JSDoc comments are current
245
+ - **Review code documentation:** Ensure code documentation is current
348
246
 
349
247
  ### Step 6: Version Control
350
248
 
@@ -362,6 +260,38 @@ applyTo: "**"
362
260
 
363
261
  ## Workflow Enforcement Rules
364
262
 
263
+ ### Documentation-First Principle
264
+
265
+ **MANDATORY: Document first, execute second for ALL development work.**
266
+
267
+ - **No Implementation Without Documentation:** Never begin any coding, testing, or implementation work until corresponding documentation is complete
268
+ - **Task Documentation Required:** Every task must be added to `/_meta/project-task-list.md` before work begins
269
+ - **Test Documentation Required:** All test cases must be documented in `/test/test-documentation.md` before writing any test code
270
+ - **Confirmation Gates:** User must explicitly confirm understanding of plan, scope, and consequences before proceeding
271
+ - **Examples of Required Documentation-First Workflow:**
272
+ - ✅ Correct: "I'll add this task to the task list, then document the test cases, then get your confirmation before implementing"
273
+ - ❌ Incorrect: "I'll implement this feature and update the documentation afterwards"
274
+ - ✅ Correct: "Let me document these test cases in test-documentation.md first, then implement the tests"
275
+ - ❌ Incorrect: "I'll write the tests now and document them later"
276
+
277
+ ### Single-Task Focus Enforcement
278
+
279
+ **MANDATORY: One change at a time - never mix tasks in one iteration.**
280
+
281
+ - **No Task Mixing:** Never work on two different tasks simultaneously or mix unrelated changes in one iteration
282
+ - **Scope Creep Management:** When additional requests arise during active work, use proper scope management:
283
+ - **Option A (Blocking):** If the new request blocks current work, write it as a subtask in `/_meta/project-task-list.md` and address it within current workflow
284
+ - **Option B (Non-blocking):** If the new request is unrelated, write it as a separate task and complete current workflow first
285
+ - **Task-Switching Prevention:** Politely but firmly redirect users who try to switch tasks mid-workflow
286
+ - **Enforcement Templates:**
287
+ - ✅ Correct response: "I've added that request to the task list. Let me complete the current workflow first, then we can address it as a separate task."
288
+ - ✅ Correct response: "That's a great idea! I'll add it as a subtask since it relates to our current work."
289
+ - ❌ Incorrect: "Sure, let me switch to that new request right now."
290
+ - **Examples of Proper Scope Management:**
291
+ - ✅ Good: "I notice you want to add authentication. I'll add that as a separate task and complete our current database setup first."
292
+ - ❌ Bad: "Let me add authentication while we're working on the database setup."
293
+ - ✅ Good: "I see this test failure requires fixing the validation logic. I'll add that as a subtask since it blocks our current work."
294
+
365
295
  ### Before Starting Any New Task
366
296
 
367
297
  ```
@@ -394,6 +324,33 @@ If a user requests to skip steps or start new work before completing the workflo
394
324
  3. **Offer to complete current workflow:** Help finish the current task properly first
395
325
  4. **Suggest task breakdown:** If the current task is too large, suggest breaking it down
396
326
 
327
+ #### Handling Scope Creep and Task Switching
328
+
329
+ When users request additional work or try to switch tasks during active development:
330
+
331
+ **For New Related Work:**
332
+
333
+ - Add as subtask to current task if it blocks progress
334
+ - Example: "I'll add that validation fix as a subtask since it's needed for our current feature"
335
+
336
+ **For New Unrelated Work:**
337
+
338
+ - Add to task list as separate task
339
+ - Politely redirect to complete current work first
340
+ - Example: "Great idea! I've added that to the task list. Let me finish the current database setup first, then we can tackle the UI updates as a separate task."
341
+
342
+ **If User Insists on Task Switching:**
343
+
344
+ - Gently remind about "one change at a time" principle
345
+ - Explain benefits of focused work
346
+ - Example: "I understand the urgency, but following our 'one change at a time' principle ensures we don't leave incomplete work. Let me finish this current task properly, then we can give full attention to your new request."
347
+
348
+ **Template Responses for Common Scenarios:**
349
+
350
+ - "I've noted that request in the task list. Completing our current workflow first ensures quality."
351
+ - "That's related to our current work, so I'll add it as a subtask to address now."
352
+ - "I see that's a separate concern. Let me add it to our task list and complete this workflow first."
353
+
397
354
  ## Benefits of This Workflow
398
355
 
399
356
  - **Higher code quality:** TDD ensures robust, well-tested code