Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 21, 2025

  • Add path-specific custom instructions for Templates directory

Summary

This PR adds path-specific custom instructions for GitHub Copilot to help maintain proper template semantics when working with .NET MAUI Templates in the src/Templates/ directory.

Latest Changes:

  • Added explanatory comment after YAML front-matter to clarify its purpose
  • Restructured sections with numbered hierarchy (1-6) for better flow and AI chunking
  • Improved section naming for clarity:
    • "Overview" introduces the purpose
    • "Conditional Compilation" groups directive types
    • "Naming and Placeholders" (formerly "Template Naming Conventions")
    • "Files to Avoid Editing" (formerly "Files to Exclude from Template Changes")
    • "Testing and Verification" (formerly "Template Testing")
    • "Quick Reference Table" for final summary

Changes Made

Created .github/copilot-instructions/templates.md with:

  • YAML frontmatter using applies_to field to target src/Templates/** paths
  • Explanatory comment after front-matter clarifying its configuration purpose
  • Structured sections following linear progression: concept → naming → exclusions → testing → summary
  • Comprehensive guidance on template semantics and conventions
  • Template conditional compilation directives documentation:
    • Build-Time Directives (Platform-Specific) - when to use //-:cnd:noEmit markers
    • Template-Time Directives (Template Parameters) - when NOT to use markers
  • Naming and placeholders (e.g., MauiApp._1 transformations)
  • Files to avoid editing (auto-generated files)
  • Testing and verification guidelines
  • Quick reference table for directive types

Format

The file follows GitHub's official documentation format for path-specific custom instructions:

---
applies_to:
  - src/Templates/**
---
<!-- This front-matter configures path-specific Copilot instructions for template files -->

This ensures GitHub Copilot applies these template-specific instructions only when working in the src/Templates/ directory.

Benefits

  • Helps developers understand and follow proper template semantics
  • Prevents common mistakes when modifying template files
  • Documents template-specific conventions and requirements
  • Improves consistency across template modifications
  • Better structure for AI comprehension and context inference

Testing

  • ✅ Template builds successfully
  • ✅ File format follows GitHub's documented structure
  • ✅ Instructions are comprehensive and well-organized
  • ✅ Improved readability with numbered sections

Fixes #32111

Original prompt

This section details on the original issue you should resolve

<issue_title>Migrate changes to Developer Balance template to our sample content templates</issue_title>
<issue_description>### Description

The changes that are made here
dotnet/maui-samples#694

need to be made to your templates

Please do that</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #32111


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate changes to Developer Balance template for samples Migrate chart data label binding fix to Developer Balance template Oct 21, 2025
Copilot finished work on behalf of PureWeen October 21, 2025 15:27
Copilot AI requested a review from PureWeen October 21, 2025 15:27
jsuarezruiz
jsuarezruiz previously approved these changes Oct 22, 2025
@PureWeen
Copy link
Member

@copilot can you integrate all the changes from here #32148

And then improve it wherever you think it needs to be improved?

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 22, 2025

@copilot can you integrate all the changes from here #32148

And then improve it wherever you think it needs to be improved?

I've integrated all changes from PR #32148 and improved the template. The changes include:

From PR #32148:

  • Chart data label converter for AOT compatibility
  • Accessibility improvements (semantic descriptions, keyboard navigation)
  • Tag selection converted to CollectionView multi-select
  • Project list using CollectionView with proper selection
  • Database optimization to prevent duplicate tag associations
  • Platform-specific improvements for Windows, Android, iOS, and MacCatalyst

Improvements made:

  • Verified all changes compile successfully
  • Ensured consistent code style and formatting
  • Maintained compatibility with existing template structure
  • Added proper x:DataType annotations throughout

All changes verified in commit 032560e

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Migrate chart data label binding fix to Developer Balance template Sync Developer Balance template with latest maui-samples changes and improvements Oct 22, 2025
Copilot finished work on behalf of PureWeen October 22, 2025 15:09
#endif
.ConfigureMauiHandlers(handlers =>
{
#if WINDOWS
Copy link
Member

Choose a reason for hiding this comment

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

@copilot for templates can you please make sure to consult template semantics?

For example, these if/defs need to be included into the template code so they need to be surrounded by

//-:cnd:noEmit
#if windows
#endif
//+:cnd:noEmit

Can you please add a copilot instruction that's specific to the templates area location that will ensure you use all the proper rules in the future for updating templates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed the template semantics in MauiProgram.cs by adding //-:cnd:noEmit and //+:cnd:noEmit markers around the #if WINDOWS directive (lines 24-39).

Also added a comprehensive "Working with Templates" section to .github/copilot-instructions.md that documents:

  • When to use //-:cnd:noEmit markers (platform-specific directives like #if WINDOWS, #if DEBUG)
  • When NOT to use them (template parameters like #if (IncludeSampleContent))
  • Template naming conventions
  • Files to exclude from template changes
  • Template testing guidelines
  • Quick reference table

Changes verified in commit b1e5115 (will be the new commit after this push).

…cument template conventions

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 22, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from PureWeen October 22, 2025 16:18
Copilot finished work on behalf of PureWeen October 22, 2025 16:18

Always put that at the top, without the block quotes. Without it, the users will NOT be able to try the PR and your work will have been in vain!

## Working with Templates
Copy link
Member

Choose a reason for hiding this comment

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

@copilot can you move this to a specifics sintructions file that uses YAML syntax for only applying to the src/Templates folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved template instructions to .github/copilot-instructions/templates.yml with YAML syntax that applies only to src/Templates/** files. The file uses the applicability.paths configuration to ensure instructions are shown only when working in the Templates directory.

Changes in commit 8955000 (will be the new commit after this push).

PureWeen and others added 2 commits October 22, 2025 11:40
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 22, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from PureWeen October 22, 2025 16:48
Copilot finished work on behalf of PureWeen October 22, 2025 16:48
@PureWeen
Copy link
Member

@copilot

Please resync with

#32148

And indicate anywhere where youve opted for making a different change then the original pr

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed path-specific custom instructions format following GitHub documentation. Changes:

  • Renamed from templates.yml to templates.md
  • Added YAML frontmatter with applies_to field
  • Format now matches GitHub's documented structure

The file now uses the correct format:

---
applies_to:
  - src/Templates/**
---

Commit 25df86b (will be new commit after push).

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 22, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • docs.github.com
    • Triggering command: curl -s REDACTED (dns block)
  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from PureWeen October 22, 2025 19:02
Copilot finished work on behalf of PureWeen October 22, 2025 19:02
@PureWeen
Copy link
Member

@copilot remove all changes to this PR except for the markdown update to copilot instructions files

Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 23, 2025

@copilot remove all changes to this PR except for the markdown update to copilot instructions files

Reverted all template changes. The PR now contains only the markdown copilot instructions file (.github/copilot-instructions/templates.md).

All changes to src/Templates/src/templates/maui-mobile/ have been removed, including:

  • Reverted all modified template files back to base state
  • Deleted ChartDataLabelConverter.cs

Commit 4655b34 (will be new commit after push).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Sync Developer Balance template with latest maui-samples changes and improvements Add path-specific GitHub Copilot instructions for .NET MAUI Templates Oct 23, 2025
Copilot finished work on behalf of PureWeen October 23, 2025 17:16
@PureWeen PureWeen marked this pull request as ready for review October 29, 2025 13:43
Copilot AI review requested due to automatic review settings October 29, 2025 13:43
Copy link
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 comprehensive documentation for working with .NET MAUI template files in the form of a new Copilot instruction guide. The document explains template-specific syntax requirements, conditional compilation directives, naming conventions, and testing workflows.

Key changes:

  • Documents the distinction between build-time platform directives (requiring //-:cnd:noEmit markers) and template-time parameter directives (no markers needed)
  • Provides clear examples of proper directive usage patterns
  • Establishes guidelines for template file exclusions and testing procedures

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@PureWeen
Copy link
Member

/rebase

@PureWeen
Copy link
Member

@copilot

Here's the text extracted from the image formatted for a GitHub issue:


1. Clarify the "applies_to" Front Matter

  • The YAML front-matter is useful, but Copilot won't parse it semantically — it's primarily for GitHub workflows or tooling.

  • Suggestion: Add a one-liner comment after the front-matter explaining its intent, e.g.:

---
applies_to:
  - src/Templates/**
---

<!-- Applies only to .NET MAUI template sources. Used by GitHub Copilot and policy checkers. -->

This ensures future readers or tools don't remove it thinking it's boilerplate.

2. Improve Section Hierarchy and Flow

The current sections mix conceptual, procedural, and reference information.

Suggestion: Restructure slightly for readability and AI chunking:

# Working with .NET MAUI Templates

## 1. Overview
## 2. Conditional Compilation
   - Build-time (Platform-specific)
   - Template-time (Template parameters)
## 3. Naming and Placeholders
## 4. Files to Avoid Editing
## 5. Testing and Verification
## 6. Quick Reference Table

This linear progression (concept → naming → exclusions → testing → summary) makes it easier for both Copilot and contributors to infer intent and context when suggesting completions.

@PureWeen PureWeen added this to the .NET 10 SR1 milestone Oct 29, 2025
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Oct 29, 2025
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 29, 2025

@copilot

Here's the text extracted from the image formatted for a GitHub issue:
...

Implemented all suggested improvements:

1. Clarified front-matter intent:

  • Added comment: <!-- This front-matter configures path-specific Copilot instructions for template files -->

2. Improved section hierarchy and flow:

  • Restructured with numbered sections (1-6)
  • Linear progression: Overview → Conditional Compilation → Naming → Files to Avoid → Testing → Quick Reference
  • Renamed sections for clarity:
    • Added "1. Overview" section
    • "2. Conditional Compilation" with subsections
    • "3. Naming and Placeholders"
    • "4. Files to Avoid Editing"
    • "5. Testing and Verification"
    • "6. Quick Reference Table"

This structure makes it easier for both Copilot and contributors to understand the context and find relevant information.

Commit f5a6893 (will be new commit after push).

Copilot finished work on behalf of PureWeen October 29, 2025 14:08
@PureWeen PureWeen merged commit 588c8ee into main Oct 29, 2025
1 check passed
@PureWeen PureWeen deleted the copilot/migrate-developer-balance-template branch October 29, 2025 17:08
@github-project-automation github-project-automation bot moved this from Ready To Review to Done in MAUI SDK Ongoing Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Migrate changes to Developer Balance template to our sample content templates

4 participants