csharp
Skill15 starsChanged 9 months agoMITView on GitHub
Google's official C# style guide. Covers naming conventions, formatting, LINQ, async/await, XML documentation, and .NET best practices.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- TheLunchTrae/claude-code-configstheir own version, first seen Nov 8, 2026
- ericwood8/skillstheir own version, first seen Nov 1, 2026
- G1Joshi/Agent-Skillstheir own version, first seen Oct 13, 2026
- EntitySystems/DysonHarnesstheir own version, first seen Oct 13, 2026
- jnotsknab/mux-swarmtheir own version, first seen Oct 11, 2026
- authdog/agent-skillstheir own version, first seen Sep 18, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- G1Joshi/Agent-Skills★ 15same name
- jnotsknab/mux-swarm★ 9same name
- EntitySystems/DysonHarness★ 4same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- kimtth/agent-skill-100-lines-or-less★ 2same name
- ericwood8/skills★ 1same name
- authdog/agent-skills★ 0same name
- TheLunchTrae/claude-code-configs★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository17 other files it gives its agents.
- angularjsSkill
- common-lispSkill
- cppSkill
- goSkill
- html-cssSkill
- javascriptSkill
- javaSkill
- jsonSkill
- markdownSkill
- objective-cSkill
- pythonSkill
- rSkill
- shellSkill
- google-styleguides-skillsSkill
- swiftSkill
- typescriptSkill
- vim-scriptSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Use
var: when type is obvious from right side - Distinctive: line 17
Prefer expression-bodied members: when concise
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Google C# Style Guide
Official Google C# coding standards for consistent, maintainable .NET code.
Golden Rules
- Follow .NET naming conventions — PascalCase for public members
- Use async/await for asynchronous operations
- LINQ for collections — prefer declarative over imperative
- XML documentation for public APIs
- Use
varwhen type is obvious from right side - Prefer expression-bodied members when concise
- Use nullable reference types (C# 8.0+)
Quick Reference
Naming Conventions
| Element | Convention | Example |
| Classes/Interfaces | PascalCase | UserService, IRepository |
| Methods | PascalCase | GetUserById |
| Properties | PascalCase | UserCount |
| Local variables | camelCase | userCount |
| Constants | PascalCase | MaxRetries |
| Private fields | _camelCase | _userId |
| Parameters | camelCase | userId |
| Enums | PascalCase | Direction |
Variables and Types
// ✓ CORRECT - use var when type is obvious
var users = new List<User>();
var count = users.Count;
// ✓ CORRECT - explicit type when not obvious
IEnumerable<User> result = GetUsers();
// ✓ CORRECT - nullable reference types (C# 8+)
string? optionalName = null;
string requiredName = "Alice";Properties and Fields
// ✓ CORRECT - auto-properties
public string Name { get; set; }
public int Count { get; private set; }
// ✓ CORRECT - private fields with underscore prefix
private readonly string _connectionString;
private int _retryCount;
// ✓ CORRECT - expression-bodied property
public string FullName => $"{FirstName} {LastName}";Methods and Expressions
// ✓ CORRECT - expression-bodied method
public string GetDisplayName() => $"{FirstName} {LastName}";
// ✓ CORRECT - traditional method body
public async Task<User> GetUserAsync(int id)
{
var user = await _repository.FindAsync(id);
return user ?? throw new NotFoundException(id);
}Async/Await
// ✓ CORRECT - async all the way
public async Task<IEnumerable<User>> GetActiveUsersAsync()
{
return await _db.Users
.Where(u => u.IsActive)
.ToListAsync();
}
// ✓ CORRECT - ConfigureAwait in library code
var result = await SomeAsyncMethod().ConfigureAwait(false);
// ✗ INCORRECT - blocking on async code
var result = SomeAsyncMethod().Result; // can deadlockLINQ
// ✓ CORRECT - LINQ for queries
var activeUsers = users
.Where(u => u.IsActive)
.OrderBy(u => u.LastName)
.Select(u => new UserDto(u.Id, u.Name))
.ToList();
// ✓ CORRECT - query syntax for complex joins
var result = from u in users
join r in roles on u.RoleId equals r.Id
where u.IsActive
select new { u.Name, r.Title };XML Documentation
// ✓ CORRECT - XML docs for public API
/// <summary>
/// Retrieves a user by their unique identifier.
/// </summary>
/// <param name="id">The user's unique ID.</param>
/// <returns>The user, or null if not found.</returns>
/// <exception cref="ArgumentException">Thrown when id is negative.</exception>
public Task<User?> GetUserByIdAsync(int id)
{
// ...
}Interfaces and Dependency Injection
// ✓ CORRECT - depend on interfaces
public class UserService
{
private readonly IUserRepository _repository;
public UserService(IUserRepository repository)
{
_repository = repository;
}
}Common Mistakes
| Mistake | Correct Approach |
Blocking on async (.Result, .Wait()) | Use async/await all the way |
| Missing XML docs on public API | Document with /// XML comments |
public fields | Use properties with get/set |
| Ignoring nullability | Enable <Nullable>enable</Nullable> |
| Imperative loops for collections | Use LINQ |
| Magic strings | Use nameof() or constants |
Catching Exception broadly | Catch specific exception types |
When to Use This Guide
- Writing new C# code
- Refactoring existing C#
- Code reviews
- Setting up
.editorconfigrules - Onboarding new team members
Install
npx skills add testdino-hq/google-styleguides-skills/csharpFull Guide
See csharp.md for complete details, examples, and edge cases.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

