csharp
C# programming for .NET, ASP.NET Core, LINQ, async patterns, and Entity Framework. Use for .cs files.
Best use case
csharp is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
C# programming for .NET, ASP.NET Core, LINQ, async patterns, and Entity Framework. Use for .cs files.
Teams using csharp should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/csharp/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How csharp Compares
| Feature / Agent | csharp | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
C# programming for .NET, ASP.NET Core, LINQ, async patterns, and Entity Framework. Use for .cs files.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# C#
Modern C# development with .NET 8+, async patterns, and Entity Framework.
## When to Use
- Working with `.cs` files
- Building ASP.NET Core web APIs
- Unity game development
- Desktop apps with WPF/MAUI
## Quick Start
```csharp
public record User(string Id, string Name, string Email);
public class UserService
{
public async Task<User?> GetUserAsync(string id)
{
return await _repository.FindByIdAsync(id);
}
}
```
## Core Concepts
### Records & Nullable
```csharp
// Records for immutable data
public record User(string Id, string Name, string Email)
{
public string DisplayName => Name.ToUpperInvariant();
}
// With-expressions for copies
var updated = user with { Name = "New Name" };
// Nullable reference types
public User? FindUser(string id)
{
return users.FirstOrDefault(u => u.Id == id);
}
```
### Async/Await
```csharp
public async Task<List<User>> GetUsersAsync()
{
// Parallel async operations
var tasks = ids.Select(id => GetUserAsync(id));
var users = await Task.WhenAll(tasks);
return users.ToList();
}
// Async streams
public async IAsyncEnumerable<User> StreamUsersAsync()
{
await foreach (var user in _repository.GetAllAsync())
{
yield return user;
}
}
// Cancellation
public async Task<User> GetUserAsync(string id, CancellationToken ct)
{
return await _client.GetFromJsonAsync<User>($"/users/{id}", ct);
}
```
## Common Patterns
### LINQ
```csharp
// Query syntax
var adults = from user in users
where user.Age >= 18
orderby user.Name
select user;
// Method syntax (preferred)
var result = users
.Where(u => u.IsActive)
.OrderBy(u => u.Name)
.Select(u => new UserDto(u.Id, u.Name))
.ToList();
// Grouping
var byCountry = users
.GroupBy(u => u.Country)
.ToDictionary(g => g.Key, g => g.ToList());
```
### Pattern Matching
```csharp
string GetStatus(object obj) => obj switch
{
User { IsActive: true } => "Active user",
User { IsActive: false } => "Inactive user",
null => "No data",
_ => "Unknown"
};
// List patterns
if (numbers is [var first, _, var last])
{
Console.WriteLine($"First: {first}, Last: {last}");
}
```
## Best Practices
**Do**:
- Use `record` for DTOs and value objects
- Enable nullable reference types
- Use async/await for I/O operations
- Use dependency injection
**Don't**:
- Block async code with `.Result` or `.Wait()`
- Ignore cancellation tokens
- Use `dynamic` when type is known
- Create God classes
## Troubleshooting
| Error | Cause | Solution |
| ------------------------- | ----------------------- | --------------------------- |
| `NullReferenceException` | Accessing null | Enable nullable, use `?.` |
| `ObjectDisposedException` | Using disposed resource | Check lifetime, use `using` |
| `TaskCanceledException` | Operation cancelled | Handle or propagate |
## References
- [Microsoft .NET Docs](https://docs.microsoft.com/dotnet/)
- [C# Programming Guide](https://docs.microsoft.com/dotnet/csharp/)Related Skills
template
Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].
zsh
Zsh shell with oh-my-zsh. Use for terminal shell.
zed
Zed high-performance collaborative editor. Use for fast editing.
xcode
Xcode Apple development IDE with simulators. Use for iOS/macOS development.
webstorm
WebStorm JavaScript IDE with debugging. Use for web development.
webpack
Webpack module bundler with loaders and plugins. Use for bundling.
warp
Warp modern terminal with AI. Use for terminal work.
vscode
Visual Studio Code editor with extensions and debugging. Use for code editing.
vite
Vite fast build tool with HMR. Use for modern frontend builds.
visual-studio
Visual Studio IDE for Windows with debugging and profiling. Use for .NET development.
vim
Vim text editor with motions, macros, and plugins. Use for terminal editing.
turbopack
Turbopack Rust-powered bundler. Use for fast builds.