Skip to content

Commit af51190

Browse files
committed
Refined copilot instructions.
1 parent 9c76d07 commit af51190

File tree

1 file changed

+79
-55
lines changed

1 file changed

+79
-55
lines changed

.github/copilot-instructions.md

Lines changed: 79 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,133 @@
11
# Copilot Instructions
22

3-
This project features an **ASP.NET Core** backend (REST API) and a **Svelte 5 TypeScript** frontend (SPA). All contributions should respect existing formatting and conventions specified in the project’s `.editorconfig`.
3+
This project features an **ASP.NET Core** backend (REST API) and a **Svelte 5 TypeScript** frontend (SPA). All contributions must respect existing formatting and conventions specified in the `.editorconfig` file.
44

55
---
66

77
## 1. General Coding Guidelines
88

9-
- **Maintain File Style & Minimal Diffs:**
10-
- Match the code style of the file. When unsure, use the style defined in the `.editorconfig`.
11-
- Keep diffs as small as possible. Preserve existing formatting, including extra spaces and comments.
9+
- **Code Style & Minimal Diffs:**
10+
- Match the file's existing style; use `.editorconfig` when unsure.
11+
- Preserve extra spaces, comments, and minimize diffs.
1212

13-
- **Complete, Clear, and Modern Code:**
14-
- Write complete code for every step—no placeholders or TODOs.
15-
- Prioritize readability by using modern language features, clear naming, and clean code practices.
16-
- It's acceptable to employ defensive coding practices when needed to handle unexpected scenarios gracefully.
13+
- **Modern Code Practices:**
14+
- Write complete, runnable code—no placeholders or TODOs.
15+
- Use modern language features, clear naming conventions, and defensive coding when necessary.
16+
- Follow SOLID, DRY, and clean code principles. Remove unused code.
1717

18-
- **Design Principles:**
19-
- Follow SOLID, DRY, and overall clean code principles.
20-
- Remove unused code; simplicity equals maintainability.
21-
22-
- **Behavioral Changes:**
23-
- Flag any user-visible changes and review them carefully.
18+
- **Behavior Management:**
19+
- Flag any user-visible changes for review.
20+
- Deliver exactly what’s requested—avoid adding unnecessary features unless explicitly instructed.
2421

2522
---
2623

2724
## 2. Frontend Guidelines (Svelte 5 / TypeScript SPA)
2825

2926
- **Framework & Best Practices:**
30-
- Built with Svelte 5 in SPA mode using TypeScript and Tailwind CSS.
31-
- Adhere to modern ES6 best practices and the ESLint recommended configuration ([standardjs](https://standardjs.com)).
27+
- Use Svelte 5 in SPA mode with TypeScript and Tailwind CSS.
28+
- Follow modern ES6 best practices and the ESLint recommended configuration ([standardjs](https://standardjs.com)).
3229

3330
- **Architecture & Components:**
34-
- Utilize the Composite Component Pattern (similar to shadcn-svelte).
35-
- Organize code using vertical slices for features with a shared folder for common components.
36-
- **Avoid** using any server-side Svelte features.
37-
38-
- **UI, Accessibility, and Navigation:**
39-
- Ensure excellent keyboard navigation for all front-end interactions.
40-
- Leverage shadcn-svelte components, which are built on [bits-ui](https://bits-ui.com/docs/llms.txt).
41-
- Build forms using shadcn-svelte forms & superforms, and validate with class-validator.
42-
- For icons use lucide-svelte.
43-
- Follow mobile-first responsive design, semantic HTML, and secure WCAG 2.2 Level AA compliance.
44-
45-
- **Testing:**
31+
- Follow the Composite Component Pattern.
32+
- Organize code into vertical slices (e.g., features aligned with API controllers) and maintain shared components in a central folder.
33+
- Use **kebab-case** for filenames and directories (e.g., `components/event-overview.svelte`).
34+
- **Do NOT** use any server-side Svelte features.
35+
36+
- **UI, Accessibility & Testing:**
37+
- Ensure excellent keyboard navigation for all interactions.
38+
- Build forms with shadcn-svelte forms & superforms, and validate with class-validator.
39+
- Ensure semantic HTML, mobile-first design, and WCAG 2.2 Level AA compliance.
40+
- Use shadcn-svelte components (based on [bits-ui](https://bits-ui.com/docs/llms.txt)).
41+
42+
- **API Calls:**
43+
- Use TanStack Query for all API calls centralized in an `api.svelte.ts` file.
44+
- Leverage `@exceptionless/fetchclient` for network operations.
45+
46+
- **Testing Tools:**
4647
- Unit Testing: Vitest
4748
- Component Testing: Testing Library
4849
- E2E Testing: Playwright
4950

5051
- **Reference:**
51-
- Svelte 5 SPA guidelines: [https://svelte.dev/llms-full.txt](https://svelte.dev/llms-full.txt)
52+
- Svelte 5: [https://svelte.dev/llms-full.txt](https://svelte.dev/llms-full.txt)
5253

5354
---
5455

5556
## 3. Backend Guidelines (ASP.NET Core / C#)
5657

57-
- **Framework & Language Features:**
58-
- Developed with the latest ASP.NET Core and C#.
59-
- Enable Nullable Reference Types.
58+
- **Framework & Features:**
59+
- Use the latest ASP.NET Core with C# and enable Nullable Reference Types.
6060

61-
- **Coding Conventions & Best Practices:**
62-
- Follow guidelines from the `.editorconfig` and Microsoft's [coding conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions).
63-
- Adhere to Microsoft's best practices for ASP.NET Core development and [unit testing with xUnit](https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices).
61+
- **Conventions & Best Practices:**
62+
- Adhere to the `.editorconfig` file and Microsoft's [coding conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions).
63+
- Follow Microsoft's [unit testing best practices](https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices).
6464

65-
- **Architecture Considerations:**
66-
- Factor in the inherent challenges of distributed computing when designing features.
65+
- **Architectural Considerations:**
66+
- Design services with awareness of distributed computing challenges.
6767

6868
---
6969

70-
## 4. Performance
70+
## 4. Security Guidelines
7171

72-
- **Optimizations:**
73-
- Lazy load components when possible.
74-
- Optimize images and assets.
75-
- Employ effective caching strategies.
72+
- **Best Practices:**
73+
- Sanitize all user inputs and rigorously validate data.
74+
- Follow OWASP guidelines and implement a robust Content Security Policy.
75+
- Adopt Shift-Left security practices to identify vulnerabilities early.
7676

7777
---
7878

79-
## 5. Security
79+
## 5. Developer Planning & Reflection
8080

81-
- **Data Protection & Validation:**
82-
- Sanitize all user inputs and validate data rigorously.
83-
- Follow OWASP guidelines and implement a robust Content Security Policy.
84-
- Embrace Shift-Left security practices.
81+
- **Pre-Coding Reflection:**
82+
1. Identify the problem or feature you’re solving.
83+
2. Consider three possible approaches.
84+
3. Choose the simplest approach that satisfies all requirements.
85+
4. Clarify:
86+
- Can the solution be modularized into smaller functions?
87+
- Are there unnecessary abstractions?
88+
- Will the implementation be clear to a junior developer?
89+
90+
- **Post-Coding Reflection:**
91+
1. Review for refactor opportunities—can clarity or maintainability be improved?
92+
2. Identify potential edge cases or areas prone to bugs.
93+
3. Verify robust error handling and validation mechanisms.
8594

8695
---
8796

8897
## 6. Code Reviews
8998

9099
- **Focus Areas:**
91-
- Review for complexity, consistency, duplication, and adherence to best practices.
92-
- Verify robust error handling and the effectiveness of defensive coding when applied.
100+
- Ensure adherence to complexity, consistency, and clean code standards.
101+
- Validate robust error handling and defensive coding practices.
102+
- Check for duplication and maintainable solutions.
93103

94104
---
95105

96106
## 7. Debugging Guidelines
97107

98-
1. **Reproduce** the issue using minimal steps and code.
99-
2. **Understand** the core problem.
100-
3. **Hypothesize** the root cause.
101-
4. **Test & Verify** the solution.
102-
5. **Document** the fix and any adjustments made.
108+
1. **Reproduce** the issue with minimal steps and code.
109+
2. **Understand** the underlying problem thoroughly.
110+
3. **Form Hypotheses** about the cause.
111+
4. **Test & Verify** potential solutions.
112+
5. **Document** fixes and adjustments clearly for future reference.
103113

104114
---
105115

106-
## 8. Project Structure
116+
## 8. Developer Planning & Reflection
117+
118+
### Pre-Coding Reflection
119+
120+
Before implementing your solution, reflect on the following steps:
121+
122+
1. **Core Requirement:** Identify the problem or feature you need to implement.
123+
2. **Approach Comparison:** Consider three possible approaches to the implementation.
124+
3. **Simplicity First:** Choose the simplest approach that meets all requirements.
125+
4. **Clarifying Questions:** Ask:
126+
- Can this be split into smaller functions?
127+
- Are there unnecessary abstractions?
128+
- Will this be clear to a junior
129+
130+
## 9. Project Structure
107131

108132
```plaintext
109133
project-root/

0 commit comments

Comments
 (0)