@abarcenas/ai-workflow-template 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/agents/implementation-plan.agent.md +192 -0
- package/.github/agents/plan.agent.md +135 -0
- package/.github/agents/research-spike.agent.md +204 -0
- package/.github/instructions/agent-safety.instructions.md +98 -0
- package/.github/instructions/agent-skill.instructions.md +272 -0
- package/.github/instructions/agent.instructions.md +1068 -0
- package/.github/instructions/ai-prompt-engineering-safety.instructions.md +991 -0
- package/.github/instructions/angular.instructions.md +116 -0
- package/.github/instructions/context7.instructions.md +109 -0
- package/.github/instructions/go.instructions.md +374 -0
- package/.github/instructions/html-to-css-guide.instructions.md +104 -0
- package/.github/instructions/instructions.instructions.md +264 -0
- package/.github/instructions/markdown.instructions.md +51 -0
- package/.github/instructions/memory-bank.instructions.md +322 -0
- package/.github/instructions/nodejs-vitest.instructions.md +34 -0
- package/.github/instructions/playwright-typescript.instructions.md +88 -0
- package/.github/instructions/prompt.instructions.md +99 -0
- package/.github/instructions/security-owasp.instructions.md +59 -0
- package/.github/instructions/shell.instructions.md +132 -0
- package/.github/instructions/task-implementation.instructions.md +203 -0
- package/.github/instructions/typescript.instructions.md +114 -0
- package/.github/prompts/copilot-instructions-blueprint-generator.prompt.md +317 -0
- package/.github/prompts/documentation-writer.prompt.md +46 -0
- package/.github/prompts/editconfig.prompt.md +64 -0
- package/.github/prompts/playwright-explore.prompt.md +39 -0
- package/.github/prompts/playwright-generate-test.prompt.md +39 -0
- package/.github/skills/agent-governance/SKILL.md +572 -0
- package/.github/skills/boost-prompt/SKILL.md +25 -0
- package/.github/skills/chrome-devtools/SKILL.md +97 -0
- package/.github/skills/context-map/SKILL.md +57 -0
- package/.github/skills/conventional-commit/SKILL.md +72 -0
- package/.github/skills/create-readme/SKILL.md +21 -0
- package/.github/skills/editorconfig/SKILL.md +63 -0
- package/.github/skills/gh-cli/SKILL.md +2188 -0
- package/.github/skills/git-commit/SKILL.md +124 -0
- package/.github/skills/github-issues/SKILL.md +134 -0
- package/.github/skills/github-issues/references/templates.md +110 -0
- package/.github/skills/microsoft-docs/SKILL.md +114 -0
- package/.github/skills/playwright-explore-website/SKILL.md +17 -0
- package/.github/skills/playwright-generate-test/SKILL.md +17 -0
- package/.github/skills/polygot-test-agent/SKILL.md +171 -0
- package/.github/skills/polygot-test-agent/unit-test-genearation.prompt.md +155 -0
- package/.github/skills/prompt-builder/SKILL.md +159 -0
- package/.github/workflows/npm-publish.yml +25 -0
- package/README.md +111 -0
- package/package.json +32 -0
- package/scripts/bump-version.js +29 -0
- package/scripts/sync.js +122 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Shell scripting best practices and conventions for bash, sh, zsh, and other shells"
|
|
3
|
+
applyTo: "**/*.sh"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Shell Scripting Guidelines
|
|
7
|
+
|
|
8
|
+
Instructions for writing clean, safe, and maintainable shell scripts for bash, sh, zsh, and other shells.
|
|
9
|
+
|
|
10
|
+
## General Principles
|
|
11
|
+
|
|
12
|
+
- Generate code that is clean, simple, and concise
|
|
13
|
+
- Ensure scripts are easily readable and understandable
|
|
14
|
+
- Add comments where helpful for understanding how the script works
|
|
15
|
+
- Generate concise and simple echo outputs to provide execution status
|
|
16
|
+
- Avoid unnecessary echo output and excessive logging
|
|
17
|
+
- Use shellcheck for static analysis when available
|
|
18
|
+
- Assume scripts are for automation and testing rather than production systems unless specified otherwise
|
|
19
|
+
- Prefer safe expansions: double-quote variable references (`"$var"`), use `${var}` for clarity, and avoid `eval`
|
|
20
|
+
- Use modern Bash features (`[[ ]]`, `local`, arrays) when portability requirements allow; fall back to POSIX constructs only when needed
|
|
21
|
+
- Choose reliable parsers for structured data instead of ad-hoc text processing
|
|
22
|
+
|
|
23
|
+
## Error Handling & Safety
|
|
24
|
+
|
|
25
|
+
- Always enable `set -euo pipefail` to fail fast on errors, catch unset variables, and surface pipeline failures
|
|
26
|
+
- Validate all required parameters before execution
|
|
27
|
+
- Provide clear error messages with context
|
|
28
|
+
- Use `trap` to clean up temporary resources or handle unexpected exits when the script terminates
|
|
29
|
+
- Declare immutable values with `readonly` (or `declare -r`) to prevent accidental reassignment
|
|
30
|
+
- Use `mktemp` to create temporary files or directories safely and ensure they are removed in your cleanup handler
|
|
31
|
+
|
|
32
|
+
## Script Structure
|
|
33
|
+
|
|
34
|
+
- Start with a clear shebang: `#!/bin/bash` unless specified otherwise
|
|
35
|
+
- Include a header comment explaining the script's purpose
|
|
36
|
+
- Define default values for all variables at the top
|
|
37
|
+
- Use functions for reusable code blocks
|
|
38
|
+
- Create reusable functions instead of repeating similar blocks of code
|
|
39
|
+
- Keep the main execution flow clean and readable
|
|
40
|
+
|
|
41
|
+
## Working with JSON and YAML
|
|
42
|
+
|
|
43
|
+
- Prefer dedicated parsers (`jq` for JSON, `yq` for YAML—or `jq` on JSON converted via `yq`) over ad-hoc text processing with `grep`, `awk`, or shell string splitting
|
|
44
|
+
- When `jq`/`yq` are unavailable or not appropriate, choose the next most reliable parser available in your environment, and be explicit about how it should be used safely
|
|
45
|
+
- Validate that required fields exist and handle missing/invalid data paths explicitly (e.g., by checking `jq` exit status or using `// empty`)
|
|
46
|
+
- Quote jq/yq filters to prevent shell expansion and prefer `--raw-output` when you need plain strings
|
|
47
|
+
- Treat parser errors as fatal: combine with `set -euo pipefail` or test command success before using results
|
|
48
|
+
- Document parser dependencies at the top of the script and fail fast with a helpful message if `jq`/`yq` (or alternative tools) are required but not installed
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
#!/bin/bash
|
|
52
|
+
|
|
53
|
+
# ============================================================================
|
|
54
|
+
# Script Description Here
|
|
55
|
+
# ============================================================================
|
|
56
|
+
|
|
57
|
+
set -euo pipefail
|
|
58
|
+
|
|
59
|
+
cleanup() {
|
|
60
|
+
# Remove temporary resources or perform other teardown steps as needed
|
|
61
|
+
if [[ -n "${TEMP_DIR:-}" && -d "$TEMP_DIR" ]]; then
|
|
62
|
+
rm -rf "$TEMP_DIR"
|
|
63
|
+
fi
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
trap cleanup EXIT
|
|
67
|
+
|
|
68
|
+
# Default values
|
|
69
|
+
RESOURCE_GROUP=""
|
|
70
|
+
REQUIRED_PARAM=""
|
|
71
|
+
OPTIONAL_PARAM="default-value"
|
|
72
|
+
readonly SCRIPT_NAME="$(basename "$0")"
|
|
73
|
+
|
|
74
|
+
TEMP_DIR=""
|
|
75
|
+
|
|
76
|
+
# Functions
|
|
77
|
+
usage() {
|
|
78
|
+
echo "Usage: $SCRIPT_NAME [OPTIONS]"
|
|
79
|
+
echo "Options:"
|
|
80
|
+
echo " -g, --resource-group Resource group (required)"
|
|
81
|
+
echo " -h, --help Show this help"
|
|
82
|
+
exit 0
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
validate_requirements() {
|
|
86
|
+
if [[ -z "$RESOURCE_GROUP" ]]; then
|
|
87
|
+
echo "Error: Resource group is required"
|
|
88
|
+
exit 1
|
|
89
|
+
fi
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
main() {
|
|
93
|
+
validate_requirements
|
|
94
|
+
|
|
95
|
+
TEMP_DIR="$(mktemp -d)"
|
|
96
|
+
if [[ ! -d "$TEMP_DIR" ]]; then
|
|
97
|
+
echo "Error: failed to create temporary directory" >&2
|
|
98
|
+
exit 1
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
echo "============================================================================"
|
|
102
|
+
echo "Script Execution Started"
|
|
103
|
+
echo "============================================================================"
|
|
104
|
+
|
|
105
|
+
# Main logic here
|
|
106
|
+
|
|
107
|
+
echo "============================================================================"
|
|
108
|
+
echo "Script Execution Completed"
|
|
109
|
+
echo "============================================================================"
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# Parse arguments
|
|
113
|
+
while [[ $# -gt 0 ]]; do
|
|
114
|
+
case $1 in
|
|
115
|
+
-g|--resource-group)
|
|
116
|
+
RESOURCE_GROUP="$2"
|
|
117
|
+
shift 2
|
|
118
|
+
;;
|
|
119
|
+
-h|--help)
|
|
120
|
+
usage
|
|
121
|
+
;;
|
|
122
|
+
*)
|
|
123
|
+
echo "Unknown option: $1"
|
|
124
|
+
exit 1
|
|
125
|
+
;;
|
|
126
|
+
esac
|
|
127
|
+
done
|
|
128
|
+
|
|
129
|
+
# Execute main function
|
|
130
|
+
main "$@"
|
|
131
|
+
|
|
132
|
+
```
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/.copilot-tracking/changes/*.md"
|
|
3
|
+
description: "Instructions for implementing task plans with progressive tracking and change record - Brought to you by microsoft/edge-ai"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Task Plan Implementation Instructions
|
|
7
|
+
|
|
8
|
+
You will implement your specific task plan located in `.copilot-tracking/plans/**` and `.copilot-tracking/details/**`. Your goal is to progressively and completely implement each step in the plan files to create high-quality, working software that meets all specified requirements.
|
|
9
|
+
|
|
10
|
+
Implementation progress MUST be tracked in a corresponding changes files located in `.copilot-tracking/changes/**`.
|
|
11
|
+
|
|
12
|
+
## Core Implementation Process
|
|
13
|
+
|
|
14
|
+
### 1. Plan Analysis and Preparation
|
|
15
|
+
|
|
16
|
+
**MUST complete before starting implementation:**
|
|
17
|
+
|
|
18
|
+
- **MANDATORY**: Read and fully understand the complete plan file including scope, objectives, all phases, and every checklist item
|
|
19
|
+
- **MANDATORY**: Read and fully understand the corresponding changes file completely - if any parts are missing from context, read the entire file back in using `read_file`
|
|
20
|
+
- **MANDATORY**: Identify all referenced files mentioned in the plan and examine them for context
|
|
21
|
+
- **MANDATORY**: Understand current project structure and conventions
|
|
22
|
+
|
|
23
|
+
### 2. Systematic Implementation Process
|
|
24
|
+
|
|
25
|
+
**Implement each task in the plan systematically:**
|
|
26
|
+
|
|
27
|
+
1. **Process tasks in order** - Follow the plan sequence exactly, one task at a time
|
|
28
|
+
2. **MANDATORY before implementing any task:**
|
|
29
|
+
- **ALWAYS ensure implementation is associated with a specific task from the plan**
|
|
30
|
+
- **ALWAYS read the entire details section for that task from the associated details markdown file in `.copilot-tracking/details/**`\*\*
|
|
31
|
+
- **FULLY understand all implementation details before proceeding**
|
|
32
|
+
- Gather any additional required context as needed
|
|
33
|
+
|
|
34
|
+
3. **Implement the task completely with working code:**
|
|
35
|
+
- Follow existing code patterns and conventions from the workspace
|
|
36
|
+
- Create working functionality that meets all task requirements specified in the details
|
|
37
|
+
- Include proper error handling, documentation, and follow best practices
|
|
38
|
+
|
|
39
|
+
4. **Mark task complete and update changes tracking:**
|
|
40
|
+
- Update plan file: change `[ ]` to `[x]` for completed task
|
|
41
|
+
- **MANDATORY after completing EVERY task**: Update the changes file by appending to the appropriate Added, Modified, or Removed sections with relative file paths and one-sentence summary of what was implemented
|
|
42
|
+
- **MANDATORY**: If any changes diverge from the task plan and details, specifically call out within the relevant section that the change was made outside of the plan and include the specific reason
|
|
43
|
+
- If ALL tasks in a phase are complete `[x]`, mark the phase header as complete `[x]`
|
|
44
|
+
|
|
45
|
+
### 3. Implementation Quality Standards
|
|
46
|
+
|
|
47
|
+
**Every implementation MUST:**
|
|
48
|
+
|
|
49
|
+
- Follow existing workspace patterns and conventions (check `copilot/` folder for standards)
|
|
50
|
+
- Implement complete, working functionality that meets all task requirements
|
|
51
|
+
- Include appropriate error handling and validation
|
|
52
|
+
- Use consistent naming conventions and code structure from the workspace
|
|
53
|
+
- Add necessary documentation and comments for complex logic
|
|
54
|
+
- Ensure compatibility with existing systems and dependencies
|
|
55
|
+
|
|
56
|
+
### 4. Continuous Progress and Validation
|
|
57
|
+
|
|
58
|
+
**After implementing each task:**
|
|
59
|
+
|
|
60
|
+
1. Validate the changes made against the task requirements from the details file
|
|
61
|
+
2. Fix any problems before moving to the next task
|
|
62
|
+
3. **MANDATORY**: Update the plan file to mark completed tasks `[x]`
|
|
63
|
+
4. **MANDATORY after EVERY task completion**: Update the changes file by appending to Added, Modified, or Removed sections with relative file paths and one-sentence summary of what was implemented
|
|
64
|
+
5. Continue to the next unchecked task
|
|
65
|
+
|
|
66
|
+
**Continue until:**
|
|
67
|
+
|
|
68
|
+
- All tasks in the plan are marked complete `[x]`
|
|
69
|
+
- All specified files have been created or updated with working code
|
|
70
|
+
- All success criteria from the plan have been verified
|
|
71
|
+
|
|
72
|
+
### 5. Reference Gathering Guidelines
|
|
73
|
+
|
|
74
|
+
**When gathering external references:**
|
|
75
|
+
|
|
76
|
+
- Focus on practical implementation examples over theoretical documentation
|
|
77
|
+
- Validate that external sources contain actual usable patterns
|
|
78
|
+
- Adapt external patterns to match workspace conventions and standards
|
|
79
|
+
|
|
80
|
+
**When implementing from references:**
|
|
81
|
+
|
|
82
|
+
- Follow workspace patterns and conventions first, external patterns second
|
|
83
|
+
- Implement complete, working functionality rather than just examples
|
|
84
|
+
- Ensure all dependencies and configurations are properly integrated
|
|
85
|
+
- Ensure implementations work within the existing project structure
|
|
86
|
+
|
|
87
|
+
### 6. Completion and Documentation
|
|
88
|
+
|
|
89
|
+
**Implementation is complete when:**
|
|
90
|
+
|
|
91
|
+
- All plan tasks are marked complete `[x]`
|
|
92
|
+
- All specified files exist with working code
|
|
93
|
+
- All success criteria from the plan are verified
|
|
94
|
+
- No implementation errors remain
|
|
95
|
+
|
|
96
|
+
**Final step - update changes file with release summary:**
|
|
97
|
+
|
|
98
|
+
- Add Release Summary section only after ALL phases are marked complete `[x]`
|
|
99
|
+
- Document complete file inventory and overall implementation summary for release documentation
|
|
100
|
+
|
|
101
|
+
### 7. Problem Resolution
|
|
102
|
+
|
|
103
|
+
**When encountering implementation issues:**
|
|
104
|
+
|
|
105
|
+
- Document the specific problem clearly
|
|
106
|
+
- Try alternative approaches or search terms
|
|
107
|
+
- Use workspace patterns as fallback when external references fail
|
|
108
|
+
- Continue with available information rather than stopping completely
|
|
109
|
+
- Note any unresolved issues in the plan file for future reference
|
|
110
|
+
|
|
111
|
+
## Implementation Workflow
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
1. Read and fully understand plan file and all checklists completely
|
|
115
|
+
2. Read and fully understand changes file completely (re-read entire file if missing context)
|
|
116
|
+
3. For each unchecked task:
|
|
117
|
+
a. Read entire details section for that task from details markdown file
|
|
118
|
+
b. Fully understand all implementation requirements
|
|
119
|
+
c. Implement task with working code following workspace patterns
|
|
120
|
+
d. Validate implementation meets task requirements
|
|
121
|
+
e. Mark task complete [x] in plan file
|
|
122
|
+
f. Update changes file with Added, Modified, or Removed entries
|
|
123
|
+
g. Call out any divergences from plan/details within relevant sections with specific reasons
|
|
124
|
+
4. Repeat until all tasks complete
|
|
125
|
+
5. Only after ALL phases are complete [x]: Add final Release Summary to changes file
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Success Criteria
|
|
129
|
+
|
|
130
|
+
Implementation is complete when:
|
|
131
|
+
|
|
132
|
+
- ✅ All plan tasks are marked complete `[x]`
|
|
133
|
+
- ✅ All specified files contain working code
|
|
134
|
+
- ✅ Code follows workspace patterns and conventions
|
|
135
|
+
- ✅ All functionality works as expected within the project
|
|
136
|
+
- ✅ Changes file is updated after every task completion with Added, Modified, or Removed entries
|
|
137
|
+
- ✅ Changes file documents all phases with detailed release-ready documentation and final release summary
|
|
138
|
+
|
|
139
|
+
## Template Changes File
|
|
140
|
+
|
|
141
|
+
Use the following as a template for the changes file that tracks implementation progress for releases.
|
|
142
|
+
Replace `{{ }}` with appropriate values. Create this file in `./.copilot-tracking/changes/` with filename: `YYYYMMDD-task-description-changes.md`
|
|
143
|
+
|
|
144
|
+
**IMPORTANT**: Update this file after EVERY task completion by appending to Added, Modified, or Removed sections.
|
|
145
|
+
**MANDATORY**: Always include the following at the top of the changes file: `<!-- markdownlint-disable-file -->`
|
|
146
|
+
|
|
147
|
+
<!-- <changes-template> -->
|
|
148
|
+
|
|
149
|
+
```markdown
|
|
150
|
+
<!-- markdownlint-disable-file -->
|
|
151
|
+
|
|
152
|
+
# Release Changes: {{task name}}
|
|
153
|
+
|
|
154
|
+
**Related Plan**: {{plan-file-name}}
|
|
155
|
+
**Implementation Date**: {{YYYY-MM-DD}}
|
|
156
|
+
|
|
157
|
+
## Summary
|
|
158
|
+
|
|
159
|
+
{{Brief description of the overall changes made for this release}}
|
|
160
|
+
|
|
161
|
+
## Changes
|
|
162
|
+
|
|
163
|
+
### Added
|
|
164
|
+
|
|
165
|
+
- {{relative-file-path}} - {{one sentence summary of what was implemented}}
|
|
166
|
+
|
|
167
|
+
### Modified
|
|
168
|
+
|
|
169
|
+
- {{relative-file-path}} - {{one sentence summary of what was changed}}
|
|
170
|
+
|
|
171
|
+
### Removed
|
|
172
|
+
|
|
173
|
+
- {{relative-file-path}} - {{one sentence summary of what was removed}}
|
|
174
|
+
|
|
175
|
+
## Release Summary
|
|
176
|
+
|
|
177
|
+
**Total Files Affected**: {{number}}
|
|
178
|
+
|
|
179
|
+
### Files Created ({{count}})
|
|
180
|
+
|
|
181
|
+
- {{file-path}} - {{purpose}}
|
|
182
|
+
|
|
183
|
+
### Files Modified ({{count}})
|
|
184
|
+
|
|
185
|
+
- {{file-path}} - {{changes-made}}
|
|
186
|
+
|
|
187
|
+
### Files Removed ({{count}})
|
|
188
|
+
|
|
189
|
+
- {{file-path}} - {{reason}}
|
|
190
|
+
|
|
191
|
+
### Dependencies & Infrastructure
|
|
192
|
+
|
|
193
|
+
- **New Dependencies**: {{list-of-new-dependencies}}
|
|
194
|
+
- **Updated Dependencies**: {{list-of-updated-dependencies}}
|
|
195
|
+
- **Infrastructure Changes**: {{infrastructure-updates}}
|
|
196
|
+
- **Configuration Updates**: {{configuration-changes}}
|
|
197
|
+
|
|
198
|
+
### Deployment Notes
|
|
199
|
+
|
|
200
|
+
{{Any specific deployment considerations or steps}}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
<!-- </changes-template> -->
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Guidelines for TypeScript Development targeting TypeScript 5.x and ES2022 output"
|
|
3
|
+
applyTo: "**/*.ts"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TypeScript Development
|
|
7
|
+
|
|
8
|
+
> These instructions assume projects are built with TypeScript 5.x (or newer) compiling to an ES2022 JavaScript baseline. Adjust guidance if your runtime requires older language targets or down-level transpilation.
|
|
9
|
+
|
|
10
|
+
## Core Intent
|
|
11
|
+
|
|
12
|
+
- Respect the existing architecture and coding standards.
|
|
13
|
+
- Prefer readable, explicit solutions over clever shortcuts.
|
|
14
|
+
- Extend current abstractions before inventing new ones.
|
|
15
|
+
- Prioritize maintainability and clarity, short methods and classes, clean code.
|
|
16
|
+
|
|
17
|
+
## General Guardrails
|
|
18
|
+
|
|
19
|
+
- Target TypeScript 5.x / ES2022 and prefer native features over polyfills.
|
|
20
|
+
- Use pure ES modules; never emit `require`, `module.exports`, or CommonJS helpers.
|
|
21
|
+
- Rely on the project's build, lint, and test scripts unless asked otherwise.
|
|
22
|
+
- Note design trade-offs when intent is not obvious.
|
|
23
|
+
|
|
24
|
+
## Project Organization
|
|
25
|
+
|
|
26
|
+
- Follow the repository's folder and responsibility layout for new code.
|
|
27
|
+
- Use kebab-case filenames (e.g., `user-session.ts`, `data-service.ts`) unless told otherwise.
|
|
28
|
+
- Keep tests, types, and helpers near their implementation when it aids discovery.
|
|
29
|
+
- Reuse or extend shared utilities before adding new ones.
|
|
30
|
+
|
|
31
|
+
## Naming & Style
|
|
32
|
+
|
|
33
|
+
- Use PascalCase for classes, interfaces, enums, and type aliases; camelCase for everything else.
|
|
34
|
+
- Skip interface prefixes like `I`; rely on descriptive names.
|
|
35
|
+
- Name things for their behavior or domain meaning, not implementation.
|
|
36
|
+
|
|
37
|
+
## Formatting & Style
|
|
38
|
+
|
|
39
|
+
- Run the repository's lint/format scripts (e.g., `npm run lint`) before submitting.
|
|
40
|
+
- Match the project's indentation, quote style, and trailing comma rules.
|
|
41
|
+
- Keep functions focused; extract helpers when logic branches grow.
|
|
42
|
+
- Favor immutable data and pure functions when practical.
|
|
43
|
+
|
|
44
|
+
## Type System Expectations
|
|
45
|
+
|
|
46
|
+
- Avoid `any` (implicit or explicit); prefer `unknown` plus narrowing.
|
|
47
|
+
- Use discriminated unions for realtime events and state machines.
|
|
48
|
+
- Centralize shared contracts instead of duplicating shapes.
|
|
49
|
+
- Express intent with TypeScript utility types (e.g., `Readonly`, `Partial`, `Record`).
|
|
50
|
+
|
|
51
|
+
## Async, Events & Error Handling
|
|
52
|
+
|
|
53
|
+
- Use `async/await`; wrap awaits in try/catch with structured errors.
|
|
54
|
+
- Guard edge cases early to avoid deep nesting.
|
|
55
|
+
- Send errors through the project's logging/telemetry utilities.
|
|
56
|
+
- Surface user-facing errors via the repository's notification pattern.
|
|
57
|
+
- Debounce configuration-driven updates and dispose resources deterministically.
|
|
58
|
+
|
|
59
|
+
## Architecture & Patterns
|
|
60
|
+
|
|
61
|
+
- Follow the repository's dependency injection or composition pattern; keep modules single-purpose.
|
|
62
|
+
- Observe existing initialization and disposal sequences when wiring into lifecycles.
|
|
63
|
+
- Keep transport, domain, and presentation layers decoupled with clear interfaces.
|
|
64
|
+
- Supply lifecycle hooks (e.g., `initialize`, `dispose`) and targeted tests when adding services.
|
|
65
|
+
|
|
66
|
+
## External Integrations
|
|
67
|
+
|
|
68
|
+
- Instantiate clients outside hot paths and inject them for testability.
|
|
69
|
+
- Never hardcode secrets; load them from secure sources.
|
|
70
|
+
- Apply retries, backoff, and cancellation to network or IO calls.
|
|
71
|
+
- Normalize external responses and map errors to domain shapes.
|
|
72
|
+
|
|
73
|
+
## Security Practices
|
|
74
|
+
|
|
75
|
+
- Validate and sanitize external input with schema validators or type guards.
|
|
76
|
+
- Avoid dynamic code execution and untrusted template rendering.
|
|
77
|
+
- Encode untrusted content before rendering HTML; use framework escaping or trusted types.
|
|
78
|
+
- Use parameterized queries or prepared statements to block injection.
|
|
79
|
+
- Keep secrets in secure storage, rotate them regularly, and request least-privilege scopes.
|
|
80
|
+
- Favor immutable flows and defensive copies for sensitive data.
|
|
81
|
+
- Use vetted crypto libraries only.
|
|
82
|
+
- Patch dependencies promptly and monitor advisories.
|
|
83
|
+
|
|
84
|
+
## Configuration & Secrets
|
|
85
|
+
|
|
86
|
+
- Reach configuration through shared helpers and validate with schemas or dedicated validators.
|
|
87
|
+
- Handle secrets via the project's secure storage; guard `undefined` and error states.
|
|
88
|
+
- Document new configuration keys and update related tests.
|
|
89
|
+
|
|
90
|
+
## UI & UX Components
|
|
91
|
+
|
|
92
|
+
- Sanitize user or external content before rendering.
|
|
93
|
+
- Keep UI layers thin; push heavy logic to services or state managers.
|
|
94
|
+
- Use messaging or events to decouple UI from business logic.
|
|
95
|
+
|
|
96
|
+
## Testing Expectations
|
|
97
|
+
|
|
98
|
+
- Add or update unit tests with the project's framework and naming style.
|
|
99
|
+
- Expand integration or end-to-end suites when behavior crosses modules or platform APIs.
|
|
100
|
+
- Run targeted test scripts for quick feedback before submitting.
|
|
101
|
+
- Avoid brittle timing assertions; prefer fake timers or injected clocks.
|
|
102
|
+
|
|
103
|
+
## Performance & Reliability
|
|
104
|
+
|
|
105
|
+
- Lazy-load heavy dependencies and dispose them when done.
|
|
106
|
+
- Defer expensive work until users need it.
|
|
107
|
+
- Batch or debounce high-frequency events to reduce thrash.
|
|
108
|
+
- Track resource lifetimes to prevent leaks.
|
|
109
|
+
|
|
110
|
+
## Documentation & Comments
|
|
111
|
+
|
|
112
|
+
- Add JSDoc to public APIs; include `@remarks` or `@example` when helpful.
|
|
113
|
+
- Write comments that capture intent, and remove stale notes during refactors.
|
|
114
|
+
- Update architecture or design docs when introducing significant patterns.
|