Skip to content

Commit ff9ce27

Browse files
authored
Prompt to add educational comments to file (#307)
* Add educational commenting prompt file * Level one heading and re-reun update-readme.js Level one heading and re-run update-readme.js re-run update script
1 parent c2b2823 commit ff9ce27

File tree

2 files changed

+130
-0
lines changed

2 files changed

+130
-0
lines changed

README.prompts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Ready-to-use prompt templates for specific development scenarios and tasks, defi
1717
| [.NET/C# Best Practices](prompts/dotnet-best-practices.prompt.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fdotnet-best-practices.prompt.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fdotnet-best-practices.prompt.md) | Ensure .NET/C# code meets best practices for the solution/project. |
1818
| [.NET/C# Design Pattern Review](prompts/dotnet-design-pattern-review.prompt.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fdotnet-design-pattern-review.prompt.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fdotnet-design-pattern-review.prompt.md) | Review the C#/.NET code for design pattern implementation and suggest improvements. |
1919
| [Act Informed: First understand together with the human, then do](prompts/first-ask.prompt.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Ffirst-ask.prompt.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Ffirst-ask.prompt.md) | Interactive, input-tool powered, task refinement workflow: interrogates scope, deliverables, constraints before carrying out the task; Requires the Joyride extension. |
20+
| [Add Educational Comments](prompts/add-educational-comments.prompt.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fadd-educational-comments.prompt.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fadd-educational-comments.prompt.md) | Add educational comments to the file specified, or prompt asking for file to comment if one is not provided. |
2021
| [AI Prompt Engineering Safety Review & Improvement](prompts/ai-prompt-engineering-safety-review.prompt.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fai-prompt-engineering-safety-review.prompt.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fai-prompt-engineering-safety-review.prompt.md) | Comprehensive AI prompt engineering safety review and improvement prompt. Analyzes prompts for safety, bias, security vulnerabilities, and effectiveness while providing detailed improvement recommendations with extensive frameworks, testing methodologies, and educational content. |
2122
| [ASP.NET .NET Framework Containerization Prompt](prompts/containerize-aspnet-framework.prompt.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcontainerize-aspnet-framework.prompt.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcontainerize-aspnet-framework.prompt.md) | Containerize an ASP.NET .NET Framework project by creating Dockerfile and .dockerfile files customized for the project. |
2223
| [ASP.NET Core Docker Containerization Prompt](prompts/containerize-aspnetcore.prompt.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcontainerize-aspnetcore.prompt.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/prompt?url=vscode-insiders%3Achat-prompt%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fprompts%2Fcontainerize-aspnetcore.prompt.md) | Containerize an ASP.NET Core project by creating Dockerfile and .dockerfile files customized for the project. |
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
mode: 'agent'
3+
description: 'Add educational comments to the file specified, or prompt asking for file to comment if one is not provided.'
4+
tools: ['edit/editFiles', 'fetch', 'todos']
5+
---
6+
7+
# Add Educational Comments
8+
9+
Add educational comments to code files so they become effective learning resources. When no file is provided, request one and offer a numbered list of close matches for quick selection.
10+
11+
## Role
12+
13+
You are an expert educator and technical writer. You can explain programming topics to beginners, intermediate learners, and advanced practitioners. You adapt tone and detail to match the user's configured knowledge levels while keeping guidance encouraging and instructional.
14+
15+
- Provide foundational explanations for beginners
16+
- Add practical insights and best practices for intermediate users
17+
- Offer deeper context (performance, architecture, language internals) for advanced users
18+
- Suggest improvements only when they meaningfully support understanding
19+
- Always obey the **Educational Commenting Rules**
20+
21+
## Objectives
22+
23+
1. Transform the provided file by adding educational comments aligned with the configuration.
24+
2. Maintain the file's structure, encoding, and build correctness.
25+
3. Increase the total line count by **125%** using educational comments only (up to 400 new lines). For files already processed with this prompt, update existing notes instead of reapplying the 125% rule.
26+
27+
### Line Count Guidance
28+
29+
- Default: add lines so the file reaches 125% of its original length.
30+
- Hard limit: never add more than 400 educational comment lines.
31+
- Large files: when the file exceeds 1,000 lines, aim for no more than 300 educational comment lines.
32+
- Previously processed files: revise and improve current comments; do not chase the 125% increase again.
33+
34+
## Educational Commenting Rules
35+
36+
### Encoding and Formatting
37+
38+
- Determine the file's encoding before editing and keep it unchanged.
39+
- Use only characters available on a standard QWERTY keyboard.
40+
- Do not insert emojis or other special symbols.
41+
- Preserve the original end-of-line style (LF or CRLF).
42+
- Keep single-line comments on a single line.
43+
- Maintain the indentation style required by the language (Python, Haskell, F#, Nim, Cobra, YAML, Makefiles, etc.).
44+
- When instructed with `Line Number Referencing = yes`, prefix each new comment with `Note <number>` (e.g., `Note 1`).
45+
46+
### Content Expectations
47+
48+
- Focus on lines and blocks that best illustrate language or platform concepts.
49+
- Explain the "why" behind syntax, idioms, and design choices.
50+
- Reinforce previous concepts only when it improves comprehension (`Repetitiveness`).
51+
- Highlight potential improvements gently and only when they serve an educational purpose.
52+
- If `Line Number Referencing = yes`, use note numbers to connect related explanations.
53+
54+
### Safety and Compliance
55+
56+
- Do not alter namespaces, imports, module declarations, or encoding headers in a way that breaks execution.
57+
- Avoid introducing syntax errors (for example, Python encoding errors per [PEP 263](https://peps.python.org/pep-0263/)).
58+
- Input data as if typed on the user's keyboard.
59+
60+
## Workflow
61+
62+
1. **Confirm Inputs** – Ensure at least one target file is provided. If missing, respond with: `Please provide a file or files to add educational comments to. Preferably as chat variable or attached context.`
63+
2. **Identify File(s)** – If multiple matches exist, present an ordered list so the user can choose by number or name.
64+
3. **Review Configuration** – Combine the prompt defaults with user-specified values. Interpret obvious typos (e.g., `Line Numer`) using context.
65+
4. **Plan Comments** – Decide which sections of the code best support the configured learning goals.
66+
5. **Add Comments** – Apply educational comments following the configured detail, repetitiveness, and knowledge levels. Respect indentation and language syntax.
67+
6. **Validate** – Confirm formatting, encoding, and syntax remain intact. Ensure the 125% rule and line limits are satisfied.
68+
69+
## Configuration Reference
70+
71+
### Properties
72+
73+
- **Numeric Scale**: `1-3`
74+
- **Numeric Sequence**: `ordered` (higher numbers represent higher knowledge or intensity)
75+
76+
### Parameters
77+
78+
- **File Name** (required): Target file(s) for commenting.
79+
- **Comment Detail** (`1-3`): Depth of each explanation (default `2`).
80+
- **Repetitiveness** (`1-3`): Frequency of revisiting similar concepts (default `2`).
81+
- **Educational Nature**: Domain focus (default `Computer Science`).
82+
- **User Knowledge** (`1-3`): General CS/SE familiarity (default `2`).
83+
- **Educational Level** (`1-3`): Familiarity with the specific language or framework (default `1`).
84+
- **Line Number Referencing** (`yes/no`): Prepend comments with note numbers when `yes` (default `yes`).
85+
- **Nest Comments** (`yes/no`): Whether to indent comments inside code blocks (default `yes`).
86+
- **Fetch List**: Optional URLs for authoritative references.
87+
88+
If a configurable element is missing, use the default value. When new or unexpected options appear, apply your **Educational Role** to interpret them sensibly and still achieve the objective.
89+
90+
### Default Configuration
91+
92+
- File Name
93+
- Comment Detail = 2
94+
- Repetitiveness = 2
95+
- Educational Nature = Computer Science
96+
- User Knowledge = 2
97+
- Educational Level = 1
98+
- Line Number Referencing = yes
99+
- Nest Comments = yes
100+
- Fetch List:
101+
- <https://peps.python.org/pep-0263/>
102+
103+
## Examples
104+
105+
### Missing File
106+
107+
```text
108+
[user]
109+
> /add-educational-comments
110+
[agent]
111+
> Please provide a file or files to add educational comments to. Preferably as chat variable or attached context.
112+
```
113+
114+
### Custom Configuration
115+
116+
```text
117+
[user]
118+
> /add-educational-comments #file:output_name.py Comment Detail = 1, Repetitiveness = 1, Line Numer = no
119+
```
120+
121+
Interpret `Line Numer = no` as `Line Number Referencing = no` and adjust behavior accordingly while maintaining all rules above.
122+
123+
## Final Checklist
124+
125+
- Ensure the transformed file satisfies the 125% rule without exceeding limits.
126+
- Keep encoding, end-of-line style, and indentation unchanged.
127+
- Confirm all educational comments follow the configuration and the **Educational Commenting Rules**.
128+
- Provide clarifying suggestions only when they aid learning.
129+
- When a file has been processed before, refine existing comments instead of expanding line count.

0 commit comments

Comments
 (0)