Skip to content

Commit 5ea84bb

Browse files
authored
Merge branch 'main' into feat/localisation
2 parents fb2be27 + 1375fdb commit 5ea84bb

9 files changed

Lines changed: 587 additions & 5 deletions

File tree

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Validate README.md
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
paths:
7+
- "instructions/**"
8+
- "prompts/**"
9+
- "chatmodes/**"
10+
- "*.js"
11+
12+
jobs:
13+
validate-readme:
14+
permissions:
15+
pull-requests: write
16+
contents: read
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: "20"
28+
29+
- name: Update README.md
30+
run: node update-readme.js
31+
32+
- name: Check for README.md changes
33+
id: check-diff
34+
run: |
35+
if git diff --exit-code README.md; then
36+
echo "No changes to README.md after running update script."
37+
echo "status=success" >> $GITHUB_OUTPUT
38+
else
39+
echo "Changes detected in README.md after running update script."
40+
echo "status=failure" >> $GITHUB_OUTPUT
41+
echo "diff<<EOF" >> $GITHUB_OUTPUT
42+
git diff README.md >> $GITHUB_OUTPUT
43+
echo "EOF" >> $GITHUB_OUTPUT
44+
fi
45+
46+
- name: Comment on PR if README.md needs updating
47+
if: steps.check-diff.outputs.status == 'failure'
48+
uses: marocchino/sticky-pull-request-comment@v2
49+
with:
50+
header: readme-validation
51+
message: |
52+
## ⚠️ README.md needs to be updated
53+
54+
The `update-readme.js` script detected changes that need to be made to the README.md file.
55+
56+
Please run `node update-readme.js` locally and commit the changes before merging this PR.
57+
58+
<details>
59+
<summary>View diff</summary>
60+
61+
```diff
62+
${{ steps.check-diff.outputs.diff }}
63+
```
64+
</details>
65+
66+
- name: Fail workflow if README.md needs updating
67+
if: steps.check-diff.outputs.status == 'failure'
68+
run: |
69+
echo "❌ README.md needs to be updated. Please run 'node update-readme.js' locally and commit the changes."
70+
exit 1

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Your goal is to...
6161
2. **Create a new branch** for your contribution
6262
3. **Add your instruction or prompt file** following the guidelines above
6363
4. **Run the update script** (optional): `node update-readme.js` to update the README with your new file
64+
- A GitHub Actions workflow will verify that this step was performed correctly
65+
- If the README.md would be modified by running the script, the PR check will fail with a comment showing the required changes
6466
5. **Submit a pull request** with:
6567
- A clear title describing your contribution
6668
- A brief description of what your instruction/prompt does

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for
2828
- [Blazor](instructions/blazor.md) - Blazor component and application patterns
2929
- [Cmake Vcpkg](instructions/cmake-vcpkg.md) - C++ project configuration and package management
3030
- [Copilot Process tracking Instructions](instructions/copilot-thought-logging.instructions.md) - See process Copilot is following where you can edit this to reshape the interaction or save when follow up may be needed
31+
- [C# Development](instructions/csharp.md) - Guidelines for building C# applications
32+
- [Dotnet Maui](instructions/dotnet-maui.md) - MAUI component and application patterns
3133
- [Genaiscript](instructions/genaiscript.md) - AI-powered script generation guidelines
3234
- [Generate Modern Terraform Code For Azure](instructions/generate-modern-terraform-code-for-azure.md) - Guidelines for generating modern Terraform code for Azure
3335
- [Markdown](instructions/markdown.md) - Documentation and content creation standards
@@ -58,8 +60,10 @@ Ready-to-use prompt templates for specific development scenarios and tasks, defi
5860
- [Generate Specs as Issues](prompts/gen-specs-as-issues.prompt.md) - Convert requirements into GitHub issues
5961
- [My Issues](prompts/my-issues.prompt.md)
6062
- [My Pull Requests](prompts/my-pull-requests.prompt.md)
63+
- [C# Documentation Best Practices](prompts/csharp-docs.prompt.md) - Ensure that C# types are documented with XML comments and follow best practices for documentation.
6164

62-
65+
### FinOps
66+
- [Azure Cost Optimize](prompts/az-cost-optimize.prompt.md) - Analyze Azure resources used in the app (IaC files and/or resources in a target rg) and optimize costs - creating GitHub issues for identified optimizations.
6367

6468
> 💡 **Usage**: Use `/prompt-name` in VS Code chat, run `Chat: Run Prompt` command, or hit the run button while you have a prompt open.
6569

instructions/blazor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ applyTo: "**/*.razor, **/*.razor.cs, **/*.razor.css"
2323
- Use data binding effectively with @bind.
2424
- Leverage Dependency Injection for services in Blazor.
2525
- Structure Blazor components and services following Separation of Concerns.
26-
- Use C# 10+ features like record types, pattern matching, and global usings.
26+
- Always use the latest version C#, currently C# 13 features like record types, pattern matching, and global usings.
2727

2828
## Error Handling and Validation
2929

instructions/csharp.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
description: Guidelines for building C# applications
3+
---
4+
5+
# C# Development
6+
7+
## C# Instructions
8+
- Always use the latest version C#, currently C# 13 features.
9+
- Write clear and concise comments for each function.
10+
11+
## General Instructions
12+
- Make only high confidence suggestions when reviewing code changes.
13+
- Write code with good maintainability practices, including comments on why certain design decisions were made.
14+
- Handle edge cases and write clear exception handling.
15+
- For libraries or external dependencies, mention their usage and purpose in comments.
16+
17+
## Naming Conventions
18+
19+
- Follow PascalCase for component names, method names, and public members.
20+
- Use camelCase for private fields and local variables.
21+
- Prefix interface names with "I" (e.g., IUserService).
22+
23+
## Formatting
24+
25+
- Apply code-formatting style defined in `.editorconfig`.
26+
- Prefer file-scoped namespace declarations and single-line using directives.
27+
- Insert a newline before the opening curly brace of any code block (e.g., after `if`, `for`, `while`, `foreach`, `using`, `try`, etc.).
28+
- Ensure that the final return statement of a method is on its own line.
29+
- Use pattern matching and switch expressions wherever possible.
30+
- Use `nameof` instead of string literals when referring to member names.
31+
- Ensure that XML doc comments are created for any public APIs. When applicable, include `<example>` and `<code>` documentation in the comments.
32+
33+
## Project Setup and Structure
34+
35+
- Guide users through creating a new .NET project with the appropriate templates.
36+
- Explain the purpose of each generated file and folder to build understanding of the project structure.
37+
- Demonstrate how to organize code using feature folders or domain-driven design principles.
38+
- Show proper separation of concerns with models, services, and data access layers.
39+
- Explain the Program.cs and configuration system in ASP.NET Core 9 including environment-specific settings.
40+
41+
## Nullable Reference Types
42+
43+
- Declare variables non-nullable, and check for `null` at entry points.
44+
- Always use `is null` or `is not null` instead of `== null` or `!= null`.
45+
- Trust the C# null annotations and don't add null checks when the type system says a value cannot be null.
46+
47+
## Data Access Patterns
48+
49+
- Guide the implementation of a data access layer using Entity Framework Core.
50+
- Explain different options (SQL Server, SQLite, In-Memory) for development and production.
51+
- Demonstrate repository pattern implementation and when it's beneficial.
52+
- Show how to implement database migrations and data seeding.
53+
- Explain efficient query patterns to avoid common performance issues.
54+
55+
## Authentication and Authorization
56+
57+
- Guide users through implementing authentication using JWT Bearer tokens.
58+
- Explain OAuth 2.0 and OpenID Connect concepts as they relate to ASP.NET Core.
59+
- Show how to implement role-based and policy-based authorization.
60+
- Demonstrate integration with Microsoft Entra ID (formerly Azure AD).
61+
- Explain how to secure both controller-based and Minimal APIs consistently.
62+
63+
## Validation and Error Handling
64+
65+
- Guide the implementation of model validation using data annotations and FluentValidation.
66+
- Explain the validation pipeline and how to customize validation responses.
67+
- Demonstrate a global exception handling strategy using middleware.
68+
- Show how to create consistent error responses across the API.
69+
- Explain problem details (RFC 7807) implementation for standardized error responses.
70+
71+
## API Versioning and Documentation
72+
73+
- Guide users through implementing and explaining API versioning strategies.
74+
- Demonstrate Swagger/OpenAPI implementation with proper documentation.
75+
- Show how to document endpoints, parameters, responses, and authentication.
76+
- Explain versioning in both controller-based and Minimal APIs.
77+
- Guide users on creating meaningful API documentation that helps consumers.
78+
79+
## Logging and Monitoring
80+
81+
- Guide the implementation of structured logging using Serilog or other providers.
82+
- Explain the logging levels and when to use each.
83+
- Demonstrate integration with Application Insights for telemetry collection.
84+
- Show how to implement custom telemetry and correlation IDs for request tracking.
85+
- Explain how to monitor API performance, errors, and usage patterns.
86+
87+
## Testing
88+
89+
- Always include test cases for critical paths of the application.
90+
- Guide users through creating unit tests.
91+
- Do not emit "Act", "Arrange" or "Assert" comments.
92+
- Copy existing style in nearby files for test method names and capitalization.
93+
- Explain integration testing approaches for API endpoints.
94+
- Demonstrate how to mock dependencies for effective testing.
95+
- Show how to test authentication and authorization logic.
96+
- Explain test-driven development principles as applied to API development.
97+
98+
## Performance Optimization
99+
100+
- Guide users on implementing caching strategies (in-memory, distributed, response caching).
101+
- Explain asynchronous programming patterns and why they matter for API performance.
102+
- Demonstrate pagination, filtering, and sorting for large data sets.
103+
- Show how to implement compression and other performance optimizations.
104+
- Explain how to measure and benchmark API performance.
105+
106+
## Deployment and DevOps
107+
108+
- Guide users through containerizing their API using .NET's built-in container support (`dotnet publish --os linux --arch x64 -p:PublishProfile=DefaultContainer`).
109+
- Explain the differences between manual Dockerfile creation and .NET's container publishing features.
110+
- Explain CI/CD pipelines for NET applications.
111+
- Demonstrate deployment to Azure App Service, Azure Container Apps, or other hosting options.
112+
- Show how to implement health checks and readiness probes.
113+
- Explain environment-specific configurations for different deployment stages.

instructions/dotnet-maui.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
description: MAUI component and application patterns
3+
appliesTo: "**/*.xaml, **/*.cs"
4+
---
5+
6+
## MAUI Code Style and Structure
7+
8+
- Write idiomatic and efficient MAUI and C# code.
9+
- Follow .NET and MAUI conventions.
10+
- Prefer inline functions for smaller components but separate complex logic into code-behind or service classes.
11+
- Async/await should be used where applicable to ensure non-blocking UI operations.
12+
13+
## Naming Conventions
14+
15+
- Follow PascalCase for component names, method names, and public members.
16+
- Use camelCase for private fields and local variables.
17+
- Prefix interface names with "I" (e.g., IUserService).
18+
19+
## MAUI and .NET Specific Guidelines
20+
21+
- Utilize MAUI's built-in features for component lifecycle (e.g. OnAppearing, OnDisappearing).
22+
- Use data binding effectively with {Binding}.
23+
- Structure MAUI components and services following Separation of Concerns.
24+
- Always use the latest version C#, currently C# 13 features like record types, pattern matching, and global usings.
25+
26+
## Error Handling and Validation
27+
28+
- Implement proper error handling for MAUI pages and API calls.
29+
- Use logging for error tracking in the backend and consider capturing UI-level errors in MAUI with tools like MAUI Community Toolkit's Logger.
30+
- Implement validation using FluentValidation or DataAnnotations in forms.
31+
32+
## MAUI API and Performance Optimization
33+
34+
- Utilize MAUI's built-in features for component lifecycle (e.g. OnAppearing, OnDisappearing).
35+
- Use asynchronous methods (async/await) for API calls or UI actions that could block the main thread.
36+
- Optimize MAUI components by reducing unnecessary renders and using OnPropertyChanged() efficiently.
37+
- Minimize the component render tree by avoiding re-renders unless necessary, using BatchBegin() and BatchCommit() where appropriate.
38+
39+
## Caching Strategies
40+
41+
- Implement in-memory caching for frequently used data, especially for MAUI apps. Use IMemoryCache for lightweight caching solutions.
42+
- Consider Distributed Cache strategies (like Redis or SQL Server Cache) for larger applications that need shared state across multiple users or clients.
43+
- Cache API calls by storing responses to avoid redundant calls when data is unlikely to change, thus improving the user experience.
44+
45+
## State Management Libraries
46+
47+
- Use dependency injection and the .NET MAUI Community Toolkit for state sharing across components.
48+
49+
## API Design and Integration
50+
51+
- Use HttpClient or other appropriate services to communicate with external APIs or your own backend.
52+
- Implement error handling for API calls using try-catch and provide proper user feedback in the UI.
53+
54+
## Testing and Debugging
55+
56+
- Test components and services using xUnit, NUnit, or MSTest.
57+
- Use Moq or NSubstitute for mocking dependencies during tests.
58+
59+
## Security and Authentication
60+
61+
- Implement Authentication and Authorization in the MAUI app where necessary using OAuth or JWT tokens for API authentication.
62+
- Use HTTPS for all web communication and ensure proper CORS policies are implemented.
63+
64+
## API Documentation and Swagger
65+
66+
- Use Swagger/OpenAPI for API documentation for your backend API services.
67+
- Ensure XML documentation for models and API methods for enhancing Swagger documentation.

instructions/genaiscript.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ or answer questions about GenAIScript.
1010

1111
## Reference
1212

13-
- [GenAIScript docs](../../.genaiscript/docs/llms-full.txt)
14-
- [GenAIScript ambient type definitions](../../.genaiscript/genaiscript.d.ts)
13+
- [GenAIScript llms.txt](https://microsoft.github.io/genaiscript/llms.txt)
1514

1615
## Guidance for Code Generation
1716

1817
- you always generate TypeScript code using ESM models for Node.JS.
1918
- you prefer using APIs from GenAIScript 'genaiscript.d.ts' rather node.js. Avoid node.js imports.
2019
- you keep the code simple, avoid exception handlers or error checking.
2120
- you add TODOs where you are unsure so that the user can review them
22-
- you use the global types in genaiscript.d.ts are already loaded in the global context, no need to import them.
21+
- you use the global types in genaiscript.d.ts are already loaded in the global context, no need to import them.

0 commit comments

Comments
 (0)