feat: update Copilot instructions for Discord.js 15.0.0-dev and enhance validation steps
This commit is contained in:
15
.github/prompts/discord-api-expert.prompt.md
vendored
15
.github/prompts/discord-api-expert.prompt.md
vendored
@@ -1,15 +0,0 @@
|
||||
# Prompt: Discord.js + Discord API Expert Mode
|
||||
|
||||
Whenever assisting with Discord.js or the Discord API:
|
||||
|
||||
- Always prioritize information from:
|
||||
- https://discordjs.guide
|
||||
- https://github.com/discordjs/discord.js
|
||||
- https://github.com/discordjs/discord-api-types
|
||||
- https://discord.com/developers/docs/intro
|
||||
- If documentation is incomplete, check the installed dependency in `node_modules`.
|
||||
- Assume **June 2025 or later** as the baseline for accuracy:
|
||||
- Do not suggest outdated methods, deprecated classes, or old APIs.
|
||||
- Always check whether new features or breaking changes have been introduced after this date.
|
||||
- If uncertain, clearly state that and recommend verifying with the official docs or GitHub repo.
|
||||
- Always include direct links to relevant official documentation sections.
|
||||
14
.github/prompts/discord-helper.prompt.md
vendored
14
.github/prompts/discord-helper.prompt.md
vendored
@@ -1,14 +0,0 @@
|
||||
# Prompt: Discord.js Expert Mode (Post-June 2025)
|
||||
|
||||
Whenever assisting with Discord.js or related dependencies:
|
||||
|
||||
- Always check official resources:
|
||||
- https://discordjs.guide
|
||||
- https://github.com/discordjs/discord.js
|
||||
- https://github.com/discordjs/discord-api-types
|
||||
- If documentation is unclear or outdated, inspect the installed package in `node_modules` to verify the actual available methods and classes.
|
||||
- Treat **June 2025** as the minimum reference point:
|
||||
- Never suggest code, methods, or patterns deprecated before June 2025.
|
||||
- Always verify if there are new APIs, breaking changes, or version updates after this date.
|
||||
- Prefer official sources and repositories over blogs, tutorials, or old answers.
|
||||
- Always mention if information may be outdated and link to the package’s GitHub or changelog for verification.
|
||||
11
.github/prompts/discord.js-v15-dev.prompt.md
vendored
Normal file
11
.github/prompts/discord.js-v15-dev.prompt.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# Prompt: Discord.js 15 Development Mode
|
||||
|
||||
When assisting with Discord.js version `15.0.0-dev.1759363313-f510b5ffa`:
|
||||
|
||||
- Treat the installed code in `node_modules/discord.js` as the primary and most reliable reference.
|
||||
- Always analyze the file `example.ts.txt` to extract API patterns, since it reflects the intended usage of this dev version.
|
||||
- Do not rely blindly on official docs or the guide; use them only to compare and note differences with the dev version.
|
||||
- Highlight when functionality has changed from v14 to v15, based on observed code and `example.ts.txt`.
|
||||
- Encourage verification by:
|
||||
```bash
|
||||
npx tsc --noEmit
|
||||
28
.github/prompts/error-strict.prompt.md
vendored
Normal file
28
.github/prompts/error-strict.prompt.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# Prompt: TypeScript Strict Error Resolver
|
||||
|
||||
Whenever Copilot generates or modifies code:
|
||||
|
||||
1. **Never ignore compiler errors** like `TS2339`, `TS2345`, or similar.
|
||||
- Always explain what the error means in plain language.
|
||||
- Always suggest at least one concrete fix.
|
||||
|
||||
2. **For missing properties or methods (e.g. `TS2339`)**:
|
||||
- Check if the method exists in the installed `node_modules`.
|
||||
- If it doesn’t exist, assume the API changed in `discord.js@15-dev`.
|
||||
- Propose alternatives based on actual available methods (`example.ts.txt` must be consulted).
|
||||
|
||||
3. **For type mismatches (e.g. `TS2345`)**:
|
||||
- Suggest code changes that handle `null`/`undefined` safely.
|
||||
- Show how to cast or coerce types **without breaking strict typing**.
|
||||
|
||||
4. **Validation step**:
|
||||
- Always remind to rerun:
|
||||
```bash
|
||||
npx tsc --noEmit
|
||||
```
|
||||
until the project compiles cleanly.
|
||||
- Do not consider the task “done” if compiler errors remain.
|
||||
|
||||
5. **Explicitness**:
|
||||
- Always specify: “This code suggestion resolves TS2339 / TS2345.”
|
||||
- Never produce a code snippet that still triggers the same error.
|
||||
41
.github/prompts/resource-checker.prompt.md
vendored
41
.github/prompts/resource-checker.prompt.md
vendored
@@ -1,41 +0,0 @@
|
||||
# Prompt: Node.js Resource Checker (Memory & CPU)
|
||||
|
||||
Whenever Copilot generates, modifies, or reviews code in Node.js:
|
||||
|
||||
1. **Memory Monitoring**
|
||||
- Always remind to check memory usage with:
|
||||
```js
|
||||
logger.info(process.memoryUsage());
|
||||
```
|
||||
which returns RSS, Heap Used, Heap Total, External, and Array Buffers.
|
||||
- If `Heap Used` grows continuously without freeing, suggest potential memory leaks (unreleased timers, listeners, or large cached data).
|
||||
- If `RSS` (Resident Set Size) is unusually higher than `Heap Total`, warn that external/native modules might be consuming memory.
|
||||
|
||||
2. **CPU Usage**
|
||||
- Remind to check CPU load using:
|
||||
```bash
|
||||
top -p <pid>
|
||||
```
|
||||
or Node.js profiling (`--inspect`, `clinic flame`).
|
||||
- Flag infinite loops, synchronous blocking calls, or heavy computations running on the main thread as potential CPU overuse.
|
||||
- Encourage offloading heavy tasks to Workers, child processes, or queues when appropriate.
|
||||
|
||||
3. **Best Practices**
|
||||
- Always validate memory and CPU usage after implementing new features.
|
||||
- Suggest garbage collection checks (`global.gc()`) in development when Node is run with `--expose-gc`.
|
||||
- Warn if long-living references (e.g., large Maps, Sets, caches, or listeners) might not be released.
|
||||
- Highlight that CPU and memory efficiency are as important as correctness.
|
||||
|
||||
4. **Output Analysis**
|
||||
- When given memory stats like:
|
||||
```
|
||||
RSS: 186.9MB
|
||||
Heap Used: 67.6MB
|
||||
Heap Total: 71.2MB
|
||||
External: 5.0MB
|
||||
```
|
||||
- Compare `Heap Used` vs `Heap Total`: if close to the limit, risk of OOM.
|
||||
- Compare `RSS` vs `Heap Total`: if RSS is much larger, check for native module or buffer leaks.
|
||||
- If growth is unbounded, warn about potential memory leaks.
|
||||
|
||||
5. **Always remind** to rerun tests with `npx tsc --noEmit` (for type safety) and memory checks together, ensuring both correctness and performance.
|
||||
7
.github/prompts/ts-validation.prompt.md
vendored
7
.github/prompts/ts-validation.prompt.md
vendored
@@ -1,7 +0,0 @@
|
||||
# Prompt: TypeScript Validation Mode
|
||||
|
||||
Whenever Copilot generates or modifies TypeScript code:
|
||||
|
||||
- Immediately remind the user to validate changes by running:
|
||||
```bash
|
||||
npx tsc --noEmit
|
||||
Reference in New Issue
Block a user