Skip to content

Add guidelines for C# development and MAUI patterns#9

Merged
aaronpowell merged 4 commits into
github:mainfrom
webreidi:main
Jul 2, 2025
Merged

Add guidelines for C# development and MAUI patterns#9
aaronpowell merged 4 commits into
github:mainfrom
webreidi:main

Conversation

@webreidi
Copy link
Copy Markdown
Contributor

Additions for C#. I didn't have permission to create a branch, so trying this route.

Copilot AI review requested due to automatic review settings June 27, 2025 15:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds new guidance documents for C# and MAUI development patterns, and updates an existing Blazor guideline to reference the latest C# version.

  • Introduce dotnet-maui.md with MAUI code style, performance, caching, and architecture patterns.
  • Add csharp.md containing general C# best practices, naming, formatting, and project structure guidelines.
  • Update blazor.md to align C# version recommendation with other docs.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
instructions/dotnet-maui.md New MAUI-specific coding conventions and performance tips
instructions/csharp.md New comprehensive C# development guidelines
instructions/blazor.md Updated C# version recommendation in frontmatter
Comments suppressed due to low confidence (2)

instructions/csharp.md:1

  • Add an appliesTo field in the frontmatter (e.g., appliesTo: "**/*.cs") so that this guideline only applies to relevant C# files.
---

instructions/dotnet-maui.md:34

  • This lifecycle guideline is duplicated. Consider removing the redundant entry here to keep the list concise.
- Utilize MAUI's built-in features for component lifecycle (e.g. OnAppearing, OnDisappearing).

@aaronpowell
Copy link
Copy Markdown
Contributor

Can you run the update-readme.js script to ensure the readme is updated

@webreidi
Copy link
Copy Markdown
Contributor Author

webreidi commented Jul 1, 2025

Can you run the update-readme.js script to ensure the readme is updated

There might be something wrong with the script. It says "No new prompts to add." and it doesn't update the readme with the new instructions files.

@aaronpowell
Copy link
Copy Markdown
Contributor

Can you run the update-readme.js script to ensure the readme is updated

There might be something wrong with the script. It says "No new prompts to add." and it doesn't update the readme with the new instructions files.

Ah, yeah probably a bug. Let me get on that

@aaronpowell
Copy link
Copy Markdown
Contributor

I ran the update script locally and it produced an update:

diff --git a/README.md b/README.md
index 671ff90..22284e9 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,8 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for
 - [Bicep Code Best Practices](instructions/bicep-code-best-practices.md) - Infrastructure as Code with Bicep
 - [Blazor](instructions/blazor.md) - Blazor component and application patterns
 - [Cmake Vcpkg](instructions/cmake-vcpkg.md) - C++ project configuration and package management
+- [C# Development](instructions/csharp.md) - Guidelines for building C# applications
+- [Dotnet Maui](instructions/dotnet-maui.md) - MAUI component and application patterns
 - [Genaiscript](instructions/genaiscript.md) - AI-powered script generation guidelines
 - [Generate Modern Terraform Code For Azure](instructions/generate-modern-terraform-code-for-azure.md) - Guidelines for generating modern Terraform code for Azure
 - [Markdown](instructions/markdown.md) - Documentation and content creation standards

Can you apply those?

I'll fix the output messaging separately.

@aaronpowell aaronpowell merged commit 6bb3368 into github:main Jul 2, 2025
ninihen1 added a commit to ninihen1/awesome-copilot that referenced this pull request Mar 6, 2026
…s, step numbering

- Add skills to docs/README.skills.md (fixes validate-readme CI check)
- Update cross-skill references to use flowstudio- prefix (github#1, github#4, github#7, github#9)
- Fix get_live_flow_run_action_outputs: returns array, index [0] (github#2, github#3)
- Renumber Step 6→5, Step 7→6 — remove gap in build workflow (github#8)
- Fix connectionName note: it's the key, not the GUID (github#10)
- Remove invalid arrow function from Filter array expression (github#11)
aaronpowell pushed a commit that referenced this pull request Mar 8, 2026
…te-build skills (#899)

* feat: add flowstudio-power-automate-debug and flowstudio-power-automate-build skills

Two companion skills for the FlowStudio Power Automate MCP server:

- flowstudio-power-automate-debug: Debug workflow for failed Power Automate cloud flow runs
- flowstudio-power-automate-build: Build & deploy flows from natural language descriptions

Both require a FlowStudio MCP subscription: https://flowstudio.app
These complement the existing flowstudio-power-automate-mcp skill (merged in PR #896).

* fix: address all review comments — README, cross-refs, response shapes, step numbering

- Add skills to docs/README.skills.md (fixes validate-readme CI check)
- Update cross-skill references to use flowstudio- prefix (#1, #4, #7, #9)
- Fix get_live_flow_run_action_outputs: returns array, index [0] (#2, #3)
- Renumber Step 6→5, Step 7→6 — remove gap in build workflow (#8)
- Fix connectionName note: it's the key, not the GUID (#10)
- Remove invalid arrow function from Filter array expression (#11)

* feat: add flowstudio-power-automate plugin bundling all 3 skills

Plugin bundles:
- flowstudio-power-automate-mcp (core connection & CRUD)
- flowstudio-power-automate-debug (debug failed runs)
- flowstudio-power-automate-build (build & deploy flows)

Install: copilot plugin install flowstudio-power-automate@awesome-copilot

Per @aaronpowell's suggestion in review.
@goldirana goldirana mentioned this pull request Apr 13, 2026
16 tasks
edburns added a commit to edburns/awesome-copilot that referenced this pull request May 23, 2026
### 16:37 Prompt

I have added `copilot-sdk-00` to this VS Code workspace. The `copilot-sdk-00/java` directory **is** the Copilot SDK for which this `copilot-sdk-java.instructions.md` is the instructions.

Do a deep read of the source code in `copilot-sdk-00/java`.

Do a deep read of the existing `copilot-sdk-java.instructions.md`.

Suggest any updates based on what should be changed in `copilot-sdk-java.instructions.md`, based on your findings.

### 16:51 Response

Now I have a comprehensive picture. Let me summarize the findings and suggest updates:

---

Based on my deep read of the Java SDK source code and the current copilot-sdk-java.instructions.md, here are the updates I'd suggest:

## Issues Found

### 1. Incorrect: `session.setModel()` documentation is slightly wrong
The instructions show `session.setModel(modelId)` — this is actually correct (it exists on CopilotSession), but the full signatures should be documented:
- `setModel(String model)`
- `setModel(String model, String reasoningEffort)`
- `setModel(String model, String reasoningEffort, ModelCapabilitiesOverride modelCapabilities)` *(since 1.3.0)*

### 2. Incorrect: `PreToolUseHookOutput` API
The instructions show:
```java
var decision = new PreToolUseHookOutput().setKind("allow");
```
But actually `PreToolUseHookOutput` is a **record** with static factory methods:
- `PreToolUseHookOutput.allow()`
- `PreToolUseHookOutput.deny()`
- `PreToolUseHookOutput.deny(String reason)`
- `PreToolUseHookOutput.ask()`

### 3. Missing: `CopilotClientOptions` fields not documented
These are in the source but not in the instructions:
- `setRemote(boolean)` — Mission Control integration
- `setTelemetry(TelemetryConfig)` — OpenTelemetry export *(since 1.2.0)*
- `setSessionIdleTimeoutSeconds(int)` — Idle timeout *(since 1.3.0)*
- `setExecutor(Executor)` — Custom thread pool
- `setTcpConnectionToken(String)` — TCP security token

### 4. Missing: `ToolDefinition.createSkipPermission()`
A third factory method exists *(since 1.2.0)* that skips the CLI permission request entirely. The instructions only mention `create()` and `createOverride()`.

### 5. Missing: Session listing with filters
The instructions show `client.listSessions()` but don't mention the overload with `SessionListFilter` that can filter by `cwd`, `gitRoot`, `repository`, and `branch`.

### 6. Missing: `session.log()` with URL
The instructions show `log(message, level, ephemeral)` but there's also a 4-param overload:
```java
session.log(String message, String level, Boolean ephemeral, String url)
```

### 7. Missing: MCP Server Configuration
The instructions mention `setMcpServers()` in the SessionConfig options list but don't show how to configure them. There are two types:
- `McpStdioServerConfig` — Local/stdio-based servers
- `McpHttpServerConfig` — HTTP/SSE remote servers

### 8. Missing: Cloud Sessions / Remote features
The `setRemote(boolean)` option on client options and per-session GitHub token support for cloud/content-exclusion scenarios.

### 9. Missing: `ModelCapabilitiesOverride`
Vision/image support can be controlled via model capabilities override, but this isn't documented.

### 10. Missing: `EventErrorPolicy` enum values
The instructions mention `EventErrorPolicy.SUPPRESS_AND_LOG_ERRORS` but don't list the other value: `PROPAGATE_AND_LOG_ERRORS` (which is the default).

### 11. Missing: `onLifecycle()` typed overload
There's also `onLifecycle(String eventType, SessionLifecycleHandler handler)` for filtering specific lifecycle events.

### 12. Minor: `send()` return type
`session.send()` returns `CompletableFuture<String>` (the message ID), which is worth mentioning since it can be used for correlation.

---

## Recommended Priority

**High priority** (incorrect info):
- Fix github#2 (`PreToolUseHookOutput` API)

**Medium priority** (missing important features):
- Add github#4 (`createSkipPermission`)
- Add github#7 (MCP server configuration examples)
- Add github#3 (missing client options)
- Add github#5 (session list filters)

**Low priority** (nice-to-have completeness):
- Expand github#1 (setModel overloads)
- Add github#6 (log with URL)
- Add github#9-12 (minor additions)

Would you like me to apply any or all of these updates to the file?

### 16:52 Prompt

Yes. Apply all of these.

### 16:54 Response

Created 12 todos

Now I have the full file. Let me apply all the changes:

Starting: *Fix PreToolUseHookOutput API (incorrect)* (1/12)

Replacing 84 lines with 199 lines in [](file:///e%3A/workareas/awesome-copilot-00/instructions/copilot-sdk-java.instructions.md)

```

```

Completed: *Fix PreToolUseHookOutput API (incorrect)* (1/12)

All 12 updates have been applied to copilot-sdk-java.instructions.md:

1. **Fixed** `PreToolUseHookOutput` — now uses correct static factory methods (`allow()`, `deny()`, `ask()`) instead of the incorrect `new PreToolUseHookOutput().setKind("allow")`
2. **Added** `ToolDefinition.createSkipPermission()` section (since 1.2.0)
3. **Added** 5 missing `CopilotClientOptions` fields: `remote`, `telemetry`, `sessionIdleTimeoutSeconds`, `executor`, `tcpConnectionToken`
4. **Added** `SessionListFilter` with `setRepository()`, `setBranch()`, `setCwd()`, `setGitRoot()`
5. **Expanded** `setModel()` to show all 3 overloads (model, reasoning effort, capabilities)
6. **Added** `log(message, level, ephemeral, url)` overload
7. **Added** full MCP server configuration section with `McpStdioServerConfig` and `McpHttpServerConfig` examples
8. **Added** `EventErrorPolicy` enum values with explanations
9. **Added** `onLifecycle(String eventType, handler)` filtered overload
10. **Added** note that `send()` returns `CompletableFuture<String>` (message ID for correlation)
11. **Added** `ModelCapabilitiesOverride` section with vision/limits configuration (since 1.3.0)
12. **Added** `remote` option for Mission Control / cloud session integration
13. **Bonus:** Expanded `SessionHooks` example to include all 5 hook types (`onPreToolUse`, `onPostToolUse`, `onUserPromptSubmitted`, `onSessionStart`, `onSessionEnd`)

Made changes.

### 16:54 Prompt

In the "## Core Principles" section. Add a bullet point that describes how `Optional` is used in the API.

### 16:58 Response

Searched for text `Optional` (`copilot-sdk-00` · `java/src/main/java/com/github/copilot/sdk/json/*.java`), 10 results

Searched for text `Optional` (`copilot-sdk-00` · `java/src/main/java/com/github/copilot/sdk/json/InfiniteSessionConfig.java`), 13 results

Replacing 7 lines with 8 lines in [](file:///e%3A/workareas/awesome-copilot-00/instructions/copilot-sdk-java.instructions.md)

```

```
Added the bullet point describing how `Optional<T>`, `OptionalInt`, and `OptionalDouble` are used on config class getters to distinguish "not set" from explicit values, while setters accept raw types and return `this` for fluent chaining.

Made changes.

### 16:58 Prompt

Consider this code from the Java README.

```java
public class CopilotSDK {
    public static void main(String[] args) throws Exception {
        var lastMessage = new String[]{null};

        // Create and start client
        try (var client = new CopilotClient()) {  // JDK 25+: comment out this line
        // JDK 25+: uncomment the following 3 lines for virtual thread support
        // var options = new CopilotClientOptions()
        //     .setExecutor(Executors.newVirtualThreadPerTaskExecutor());
        // try (var client = new CopilotClient(options)) {
            client.start().get();

            // Create a session
            var session = client.createSession(
                new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL).setModel("claude-sonnet-4.5")).get();

            // Handle assistant message events
            session.on(AssistantMessageEvent.class, msg -> {
                lastMessage[0] = msg.getData().content();
                System.out.println(lastMessage[0]);
            });

            // Handle session usage info events
            session.on(SessionUsageInfoEvent.class, usage -> {
                var data = usage.getData();
                System.out.println("\n--- Usage Metrics ---");
                System.out.println("Current tokens: " + data.currentTokens().intValue());
                System.out.println("Token limit: " + data.tokenLimit().intValue());
                System.out.println("Messages count: " + data.messagesLength().intValue());
            });

            // Send a message
            var completable = session.sendAndWait(new MessageOptions().setPrompt("What is 2+2?"));
            // and wait for completion
            completable.get();
        }

        boolean success = lastMessage[0] != null && lastMessage[0].contains("4");
        System.exit(success ? 0 : -1);
    }
}
```

I want to get across the very important JDK 25 comment. What's the best place to encode that knowledge in the instructions?
aaronpowell pushed a commit that referenced this pull request May 25, 2026
…tory in copilot-sdk (#1811)

* Prepare for archiving of copilot-sdk-java repo in favor of java directory in copilot-sdk

* Update README

* Update with latest `java` from `copilot-sdk`.

### 16:37 Prompt

I have added `copilot-sdk-00` to this VS Code workspace. The `copilot-sdk-00/java` directory **is** the Copilot SDK for which this `copilot-sdk-java.instructions.md` is the instructions.

Do a deep read of the source code in `copilot-sdk-00/java`.

Do a deep read of the existing `copilot-sdk-java.instructions.md`.

Suggest any updates based on what should be changed in `copilot-sdk-java.instructions.md`, based on your findings.

### 16:51 Response

Now I have a comprehensive picture. Let me summarize the findings and suggest updates:

---

Based on my deep read of the Java SDK source code and the current copilot-sdk-java.instructions.md, here are the updates I'd suggest:

## Issues Found

### 1. Incorrect: `session.setModel()` documentation is slightly wrong
The instructions show `session.setModel(modelId)` — this is actually correct (it exists on CopilotSession), but the full signatures should be documented:
- `setModel(String model)`
- `setModel(String model, String reasoningEffort)`
- `setModel(String model, String reasoningEffort, ModelCapabilitiesOverride modelCapabilities)` *(since 1.3.0)*

### 2. Incorrect: `PreToolUseHookOutput` API
The instructions show:
```java
var decision = new PreToolUseHookOutput().setKind("allow");
```
But actually `PreToolUseHookOutput` is a **record** with static factory methods:
- `PreToolUseHookOutput.allow()`
- `PreToolUseHookOutput.deny()`
- `PreToolUseHookOutput.deny(String reason)`
- `PreToolUseHookOutput.ask()`

### 3. Missing: `CopilotClientOptions` fields not documented
These are in the source but not in the instructions:
- `setRemote(boolean)` — Mission Control integration
- `setTelemetry(TelemetryConfig)` — OpenTelemetry export *(since 1.2.0)*
- `setSessionIdleTimeoutSeconds(int)` — Idle timeout *(since 1.3.0)*
- `setExecutor(Executor)` — Custom thread pool
- `setTcpConnectionToken(String)` — TCP security token

### 4. Missing: `ToolDefinition.createSkipPermission()`
A third factory method exists *(since 1.2.0)* that skips the CLI permission request entirely. The instructions only mention `create()` and `createOverride()`.

### 5. Missing: Session listing with filters
The instructions show `client.listSessions()` but don't mention the overload with `SessionListFilter` that can filter by `cwd`, `gitRoot`, `repository`, and `branch`.

### 6. Missing: `session.log()` with URL
The instructions show `log(message, level, ephemeral)` but there's also a 4-param overload:
```java
session.log(String message, String level, Boolean ephemeral, String url)
```

### 7. Missing: MCP Server Configuration
The instructions mention `setMcpServers()` in the SessionConfig options list but don't show how to configure them. There are two types:
- `McpStdioServerConfig` — Local/stdio-based servers
- `McpHttpServerConfig` — HTTP/SSE remote servers

### 8. Missing: Cloud Sessions / Remote features
The `setRemote(boolean)` option on client options and per-session GitHub token support for cloud/content-exclusion scenarios.

### 9. Missing: `ModelCapabilitiesOverride`
Vision/image support can be controlled via model capabilities override, but this isn't documented.

### 10. Missing: `EventErrorPolicy` enum values
The instructions mention `EventErrorPolicy.SUPPRESS_AND_LOG_ERRORS` but don't list the other value: `PROPAGATE_AND_LOG_ERRORS` (which is the default).

### 11. Missing: `onLifecycle()` typed overload
There's also `onLifecycle(String eventType, SessionLifecycleHandler handler)` for filtering specific lifecycle events.

### 12. Minor: `send()` return type
`session.send()` returns `CompletableFuture<String>` (the message ID), which is worth mentioning since it can be used for correlation.

---

## Recommended Priority

**High priority** (incorrect info):
- Fix #2 (`PreToolUseHookOutput` API)

**Medium priority** (missing important features):
- Add #4 (`createSkipPermission`)
- Add #7 (MCP server configuration examples)
- Add #3 (missing client options)
- Add #5 (session list filters)

**Low priority** (nice-to-have completeness):
- Expand #1 (setModel overloads)
- Add #6 (log with URL)
- Add #9-12 (minor additions)

Would you like me to apply any or all of these updates to the file?

### 16:52 Prompt

Yes. Apply all of these.

### 16:54 Response

Created 12 todos

Now I have the full file. Let me apply all the changes:

Starting: *Fix PreToolUseHookOutput API (incorrect)* (1/12)

Replacing 84 lines with 199 lines in [](file:///e%3A/workareas/awesome-copilot-00/instructions/copilot-sdk-java.instructions.md)

```

```

Completed: *Fix PreToolUseHookOutput API (incorrect)* (1/12)

All 12 updates have been applied to copilot-sdk-java.instructions.md:

1. **Fixed** `PreToolUseHookOutput` — now uses correct static factory methods (`allow()`, `deny()`, `ask()`) instead of the incorrect `new PreToolUseHookOutput().setKind("allow")`
2. **Added** `ToolDefinition.createSkipPermission()` section (since 1.2.0)
3. **Added** 5 missing `CopilotClientOptions` fields: `remote`, `telemetry`, `sessionIdleTimeoutSeconds`, `executor`, `tcpConnectionToken`
4. **Added** `SessionListFilter` with `setRepository()`, `setBranch()`, `setCwd()`, `setGitRoot()`
5. **Expanded** `setModel()` to show all 3 overloads (model, reasoning effort, capabilities)
6. **Added** `log(message, level, ephemeral, url)` overload
7. **Added** full MCP server configuration section with `McpStdioServerConfig` and `McpHttpServerConfig` examples
8. **Added** `EventErrorPolicy` enum values with explanations
9. **Added** `onLifecycle(String eventType, handler)` filtered overload
10. **Added** note that `send()` returns `CompletableFuture<String>` (message ID for correlation)
11. **Added** `ModelCapabilitiesOverride` section with vision/limits configuration (since 1.3.0)
12. **Added** `remote` option for Mission Control / cloud session integration
13. **Bonus:** Expanded `SessionHooks` example to include all 5 hook types (`onPreToolUse`, `onPostToolUse`, `onUserPromptSubmitted`, `onSessionStart`, `onSessionEnd`)

Made changes.

### 16:54 Prompt

In the "## Core Principles" section. Add a bullet point that describes how `Optional` is used in the API.

### 16:58 Response

Searched for text `Optional` (`copilot-sdk-00` · `java/src/main/java/com/github/copilot/sdk/json/*.java`), 10 results

Searched for text `Optional` (`copilot-sdk-00` · `java/src/main/java/com/github/copilot/sdk/json/InfiniteSessionConfig.java`), 13 results

Replacing 7 lines with 8 lines in [](file:///e%3A/workareas/awesome-copilot-00/instructions/copilot-sdk-java.instructions.md)

```

```
Added the bullet point describing how `Optional<T>`, `OptionalInt`, and `OptionalDouble` are used on config class getters to distinguish "not set" from explicit values, while setters accept raw types and return `this` for fluent chaining.

Made changes.

### 16:58 Prompt

Consider this code from the Java README.

```java
public class CopilotSDK {
    public static void main(String[] args) throws Exception {
        var lastMessage = new String[]{null};

        // Create and start client
        try (var client = new CopilotClient()) {  // JDK 25+: comment out this line
        // JDK 25+: uncomment the following 3 lines for virtual thread support
        // var options = new CopilotClientOptions()
        //     .setExecutor(Executors.newVirtualThreadPerTaskExecutor());
        // try (var client = new CopilotClient(options)) {
            client.start().get();

            // Create a session
            var session = client.createSession(
                new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL).setModel("claude-sonnet-4.5")).get();

            // Handle assistant message events
            session.on(AssistantMessageEvent.class, msg -> {
                lastMessage[0] = msg.getData().content();
                System.out.println(lastMessage[0]);
            });

            // Handle session usage info events
            session.on(SessionUsageInfoEvent.class, usage -> {
                var data = usage.getData();
                System.out.println("\n--- Usage Metrics ---");
                System.out.println("Current tokens: " + data.currentTokens().intValue());
                System.out.println("Token limit: " + data.tokenLimit().intValue());
                System.out.println("Messages count: " + data.messagesLength().intValue());
            });

            // Send a message
            var completable = session.sendAndWait(new MessageOptions().setPrompt("What is 2+2?"));
            // and wait for completion
            completable.get();
        }

        boolean success = lastMessage[0] != null && lastMessage[0].contains("4");
        System.exit(success ? 0 : -1);
    }
}
```

I want to get across the very important JDK 25 comment. What's the best place to encode that knowledge in the instructions?

* Apply review suggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants