agentleFS
lepocolepoco/wpfui/.github/copilot-instructions.md

wpfui

Copilot instructions9.7k starsChanged 4 years agoMITView on GitHub

You are an AI coding agent helping build WPF-UI, a modern WPF library implementing Microsoft Fluent UI design. This is an open-source library used by thousands of developers. Focus on the Wpf.Ui library itself, not the Gallery demo application. Multi-targeting: netstandard2.0/2.1, net462/472, net6.0/8.0/9.0 (see Directory.Build.props) Central Package Management: Directory.Packages.props - NEVER add package versions to .csproj files </project_structure> Solution filters: - Wpf.Ui.Library.slnf - Library projects only - Wpf.Ui.Gallery.slnf - Gallery demo app Testing: - XUnit v3 for unit tests (tests/Wpf.Ui.UnitTests/)…

We split this copilot-instructions.md into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    NEVER assume library availability - always check Directory.Packages.props or .csproj first before using any external types.

    line 30
  2. Distinctive:

    Never add comments that restate what code does

    line 41
  3. Very specific:

    When writing code, follow the best practices described below.

    line 77
  4. Very specific:

    Use modern C# syntax for .NET 10.

    line 79
  5. Distinctive:

    When creating a sample page in WPF, use MVVM from the Community Toolkit.

    line 98
  6. Distinctive:

    When we write integration tests, we write them as shown below.

    line 158

≈ “Common” is an estimate: at least 1 in 5 of the 3,669 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

You are an AI coding agent helping build WPF-UI, a modern WPF library implementing Microsoft Fluent UI design. This is an open-source library used by thousands of developers. Focus on the Wpf.Ui library itself, not the Gallery demo application.

<project_structure> Core library location: src/Wpf.Ui/

  • Controls/ - NavigationView, TitleBar, FluentWindow, Button, Card, etc.
  • Appearance/ - ApplicationThemeManager, ApplicationAccentColorManager
  • Win32/ and Interop/ - Native Windows API wrappers
  • Services - NavigationService, SnackbarService, ContentDialogService, TaskBarService

Multi-targeting: netstandard2.0/2.1, net462/472, net6.0/8.0/9.0 (see Directory.Build.props) Central Package Management: Directory.Packages.props - NEVER add package versions to .csproj files </project_structure>

<build_and_test> Build library: dotnet build src/Wpf.Ui/Wpf.Ui.csproj

Solution filters:

  • Wpf.Ui.Library.slnf - Library projects only
  • Wpf.Ui.Gallery.slnf - Gallery demo app

Testing:

  • XUnit v3 for unit tests (tests/Wpf.Ui.UnitTests/)
  • AwesomeAssertions for assertions (FluentAssertions successor)
  • FlaUI for UI automation (tests/Wpf.Ui.Gallery.IntegrationTests/)
  • NSubstitute for mocking </build_and_test>

<code_conventions> NEVER assume library availability - always check Directory.Packages.props or .csproj first before using any external types.

Modern C# (C# 13, LangVersion in Directory.Build.props):

  • Nullable reference types enabled
  • File-scoped namespaces
  • Target-typed new expressions
  • Pattern matching over type checks

Comments:

  • Public APIs: REQUIRED XML docs with <summary> and <example> showing XAML usage
  • Internal code: Avoid comments unless explaining Win32 interop/marshalling
  • Never add comments that restate what code does

Example: /// <summary> /// Creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address. /// </summary> /// <example> /// <code lang="xml"> /// <ui:Anchor NavigateUri="https://lepo.co/" /> /// </code> /// </example> public class Anchor : HyperlinkButton { } </code_conventions>

<windows_platform> This codebase heavily uses P/Invoke, marshalling, and Windows APIs. When working with TitleBar, window management (HWND, WndProc), system theme detection, or native controls - always search the codebase first or use Context7/Microsoft Docs. Do not assume standard WPF approaches work.

Key interop areas:

  • src/Wpf.Ui/Win32/ - Native methods, structs, enums
  • src/Wpf.Ui/Interop/ - Managed wrappers
  • src/Wpf.Ui/Controls/TitleBar/ - Snap layouts, DWM integration
  • src/Wpf.Ui/Appearance/ - System theme detection </windows_platform>

<tone_and_style> IMPORTANT: Never use emoticons or write excessive comments explaining what you are doing. IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do. IMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. </tone_and_style>

The section below describes things you can do <capabilities> Provide resources: Share relevant documentation, tutorials, or tools that can help the user deepen their understanding. If the microsoft_docs_search and microsoft_docs_fetch tools are available, use them to verify and find the most current Microsoft documentation and ONLY share links that have been verified through these tools. If these tools are not available, provide general guidance about concepts and topics but DO NOT share specific links or URLs to avoid potential hallucination - instead, suggest that the user might want to install the Microsoft Learn MCP server from https://github.com/microsoftdocs/mcp for enhanced documentation search capabilities with verified links. </capabilities>

When writing code, follow the best practices described below. <code_style> Use modern C# syntax for .NET 10. When in doubt, use Context7 (resolve-library-id and get-library-docs) and Microsoft Docs (microsoft_docs_search and microsoft_docs_fetch). You can also use other MCP tools to find answers, e.g., search code with search or repository with githubRepo.

Working with Windows and WPF is complicated and requires knowledge of how the Windows operating system works, as well as details about Win32, marshalling, and other complexities. Always assume that you have incomplete information and that it is worth using Context7, Microsoft Docs, or searching the repository.

Remember to add summary docs with examples to each public class. Thousands of people use the framework and need proper instructions.

/// <summary>
/// Creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address.
/// </summary>
/// <example>
/// <code lang="xml">
/// &lt;ui:Anchor
///     NavigateUri="https://lepo.co/" /&gt;
/// </code>
/// </example>
public class Anchor : Wpf.Ui.Controls.HyperlinkButton;

When creating a sample page in WPF, use MVVM from the Community Toolkit. Divide classes into models, view models, and views, as shown below:

public partial class AnchorViewModel : ViewModel
{
    [ObservableProperty]
    private bool _isAnchorEnabled = true;
    [RelayCommand]
    private void OnAnchorCheckboxChecked(object sender)
    {
        if (sender is not CheckBox checkbox)
        {
            return;
        }
        IsAnchorEnabled = !(checkbox?.IsChecked ?? false);
    }
}
[GalleryPage("Button which opens a link.", SymbolRegular.CubeLink20)]
public partial class AnchorPage : INavigableView<AnchorViewModel>
{
    public AnchorViewModel ViewModel { get; init; }
    public AnchorPage(AnchorViewModel viewModel)
    {
        ViewModel = viewModel;
        DataContext = this;
        InitializeComponent();
    }
}
<Page
    x:Class="Wpf.Ui.Gallery.Views.Pages.BasicInput.AnchorPage"
    d:DataContext="{d:DesignInstance local:AnchorPage, IsDesignTimeCreatable=False}">
    <ui:Anchor
        Grid.Column="0"
        Content="WPF UI anchor"
        Icon="{ui:SymbolIcon Link24}"
        IsEnabled="{Binding ViewModel.IsAnchorEnabled, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:AnchorPage}, Mode=OneWay}"
        NavigateUri="https://lepo.co/" />
</Page>

</code_style>

We strive to write code that can be tested. To do this, we use XUnit v3, AwesomeAssertions (formerly FluentAssertions) and FlaUI. When we write unit tests, we write them as shown below.

<testing> ```csharp public sealed class TransitionAnimationProviderTests { [Fact] public void ApplyTransition_ReturnsFalse_WhenDurationIsLessThan10() { UIElement mockedUiElement = Substitute.For<UIElement>(); var result = TransitionAnimationProvider.ApplyTransition(mockedUiElement, Transition.FadeIn, -10); result.Should().BeFalse(); } } ```

When we write integration tests, we write them as shown below.

public sealed class TitleBarTests : UiTest
{
    [Fact]
    public async Task CloseButton_ShouldCloseWindow_WhenClicked()
    {
        Button? closeButton = FindFirst("TitleBarCloseButton").AsButton();

        closeButton.Should().NotBeNull("because CloseButton should be present in the main window title bar");
        closeButton.Click(moveMouse: false);

        await Wait(2);

        Application
            ?.HasExited.Should()
            .BeTrue("because the main window should be closed after clicking the close button");
    }
}
</testing>

Download now (ZIP)

Trending

Less talk lately.about the whole repository

Dec 2025: 1 mentionJan 2026: 1 mentionFeb 2026: 2 mentionsMar 2026: 0 mentionsApr 2026: 1 mentionMay 2026: 3 mentionsJun 2026: 11 mentionsJul 2026: 5 mentionsAug 2026: 9 mentionsSep 2026: 2 mentionsOct 2026: 4 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the lepoco/wpfui repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about lepoco/wpfui

The biggest 5 of 56 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 56

Talked about on GitHub, the web, Hacker News and Stack Overflow (56 times).

On GitHub · 50

45 more on GitHub

On the web · 3

On Hacker News · 2

On Stack Overflow · 1

  • Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.

    Of the Copilot instructions files we read, the 2,297 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.