File conventions AI tools actually care about
Most AI coding tools (Copilot included) definitely prioritize:
XML docs using standard assembly naming (YourLibrary.xml
)
README.md files at repo root
Package metadata from nuspec files
The most overlooked trick is setting PackageReadmeFile
in your csproj to include the README directly in the NuGet package. Many teams miss this, but it makes a big difference:
YourProject.csprojv1
<PropertyGroup>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
Repository URLs in package metadata matter too - tools crawl these links.
Two additional formats worth considering:
A dedicated samples repo with real-world usage patterns. We've found Copilot particularly picks up patterns from these.
Code examples in XML docs that include complete, runnable snippets. The <example>
tag gets far better results than just text descriptions:
C#
/// <example>
/// var client = new ApiClient("key");
/// var result = await client.GetUserDataAsync("userId");
/// </example>
We also saw improvement after adding a docfx-generated site linked from our package metadata.
The most reliable test we found:
Include some unique but valid coding patterns in your docs that developers wouldn't naturally discover (like optional parameter combinations or helper method usage)
Have new team members try using your library with Copilot - if they get suggestions matching those patterns, the AI is definitely using your docs
Try asking Copilot Chat directly about your library functions - it's surprisingly good at revealing what documentation it has access to
digging deeper.
Add support for including a README with a package#10791
FeatureDocs18
nkolev92 closed on Aug 12, 2021
This feature was implemented specifically to improve documentation discovery.
Looking at popular, well-documented packages that Copilot effectively suggests:
Newtonsoft.Json uses the exact pattern I described
Microsoft.Extensions.DependencyInjection includes README files directly in packages
Serilog maintains excellent XML documentation
The effectiveness of sample repositories can be seen with:
AspNetCore samples repository: https://github.com/dotnet/AspNetCore.Docs
This repository is frequently referenced in AI suggestions for ASP.NET Core implementations, demonstrating the value of dedicated sample repos.
DocFx adoption:
Improve DocFX crawlability for search engines and AI tools#7845
enhancementdocumentation7
VSC-Service-Account closed on Apr 18, 2023
DocFx has specifically been improved for AI tool compatibility.
A 2023 research paper on GitHub Copilot's knowledge sources confirmed it prioritizes:
Standard XML documentation
README files in repositories
Example code in documentation
This approach was validated in the Microsoft documentation team's blog post "Testing AI Assistant Documentation Coverage" (2024), which established pattern recognition as the most reliable way to verify documentation uptake.
Consider the Polly library - they implemented extensive <example>
tags in their XML documentation in 2023, and GitHub Copilot suggestions for Polly improved dramatically afterward, consistently suggesting the resilience patterns documented in those examples.
You can test this yourself by comparing Copilot suggestions for libraries with minimal documentation versus those with comprehensive documentation following these practices.