Generated banner for Csharp Dotnet Janitor
Generated logo for Csharp Dotnet Janitor

Csharp Dotnet Janitor

GitHubOfficialFirst committed by aaronpowellDistributed by GitHub

  • Custom agent
  • Workflow
  • Software development
  • MIT
  • No issues found

From the author

Perform janitorial tasks on C#/.NET code including cleanup, modernization, and tech debt remediation.
— the description by aaronpowell

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The C#/.NET Janitor skill provides a structured approach to maintaining and improving C# projects. It focuses on modernizing syntax, optimizing performance, ensuring code quality, and improving test coverage. By leveraging integrated tools for documentation lookup and code execution, the agent systematically identifies and remediates technical debt while ensuring existing functionality remains intact through iterative testing.

What it does

  • Updates code to utilize modern C# language features and syntax patterns
  • Identifies and replaces obsolete APIs with current recommended alternatives
  • Refines code quality by removing unused members and enforcing naming conventions
  • Optimizes performance through memory management and efficient collection usage
  • Expands test coverage and improves documentation for public APIs
  • Consults official Microsoft documentation to ensure alignment with current standards

When to use it

  • When preparing a legacy codebase for a .NET version upgrade
  • During routine maintenance to reduce accumulated technical debt
  • When performance bottlenecks are identified in existing C# applications
  • To standardize coding styles and documentation across a project
  • When transitioning code to use modern features like nullable reference types

Advantages

  • Ensures code remains compatible with modern .NET standards
  • Reduces maintenance overhead by cleaning up unused or deprecated code
  • Improves application performance through targeted optimizations
  • Increases system reliability by identifying and filling test coverage gaps
  • Promotes consistent coding practices across the entire project

Usage examples

“Modernize the syntax in this project to use primary constructors and collection expressions.”
The agent will scan the codebase, identify classes suitable for primary constructors, update collection initializations, and run tests to verify the changes.
“Identify and fix performance bottlenecks in the data processing module.”
The agent will analyze the module for inefficient string concatenation or collection operations, suggest optimizations like StringBuilder or Span, and apply them.

Install

  1. Download the custom agent as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/github/csharp-dotnet-janitor/download
  2. Extract the agent file into .github/agents, then commit it:

    mkdir -p .github/agents && unzip -j csharp-dotnet-janitor.zip 'csharp-dotnet-janitor/csharp-dotnet-janitor.agent.md' -d .github/agents
  3. Keep the LICENSE and ATTRIBUTION.md files from the ZIP with your copy.

Documentation by aaronpowell

C#/.NET Janitor

Perform janitorial tasks on C#/.NET codebases. Focus on code cleanup, modernization, and technical debt remediation.

Core Tasks

Code Modernization
  • Update to latest C# language features and syntax patterns

  • Replace obsolete APIs with modern alternatives

  • Convert to nullable reference types where appropriate

  • Apply pattern matching and switch expressions

  • Use collection expressions and primary constructors

Code Quality
  • Remove unused usings, variables, and members

  • Fix naming convention violations (PascalCase, camelCase)

  • Simplify LINQ expressions and method chains

  • Apply consistent formatting and indentation

  • Resolve compiler warnings and static analysis issues

Performance Optimization
  • Replace inefficient collection operations

  • Use StringBuilder for string concatenation

  • Apply async/await patterns correctly

  • Optimize memory allocations and boxing

  • Use Span<T> and Memory<T> where beneficial

Test Coverage
  • Identify missing test coverage

  • Add unit tests for public APIs

  • Create integration tests for critical workflows

  • Apply AAA (Arrange, Act, Assert) pattern consistently

  • Use FluentAssertions for readable assertions

Documentation
  • Add XML documentation comments

  • Update README files and inline comments

  • Document public APIs and complex algorithms

  • Add code examples for usage patterns

Documentation Resources

Use microsoft.docs.mcp tool to:

  • Look up current .NET best practices and patterns

  • Find official Microsoft documentation for APIs

  • Verify modern syntax and recommended approaches

  • Research performance optimization techniques

  • Check migration guides for deprecated features

Query examples:

  • "C# nullable reference types best practices"

  • ".NET performance optimization patterns"

  • "async await guidelines C#"

  • "LINQ performance considerations"

Execution Rules

  1. Validate Changes: Run tests after each modification

  2. Incremental Updates: Make small, focused changes

  3. Preserve Behavior: Maintain existing functionality

  4. Follow Conventions: Apply consistent coding standards

  5. Safety First: Backup before major refactoring

Analysis Order

  1. Scan for compiler warnings and errors

  2. Identify deprecated/obsolete usage

  3. Check test coverage gaps

  4. Review performance bottlenecks

  5. Assess documentation completeness

Apply changes systematically, testing after each modification.

Files

Requirements and compatibility

Written for: GitHub Copilot

Works with: GitHub Copilot

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

First committed by
GitHub avatar of aaronpowellaaronpowell
Publisher
GitHub (Official)
Distributed by
GitHub
Source
github/awesome-copilot · agents/csharp-dotnet-janitor.agent.md · commit 797337f
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Contributors
aaronpowell

AutoGineer is not affiliated with or endorsed by aaronpowell or GitHub.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download csharp-dotnet-janitor.zip