Csharp Dotnet Janitor

Perform janitorial tasks on C#/.NET code including cleanup, modernization, and tech debt remediation.

Agentprogramming languagesMIT1 source files

Before you use this component

This is a third-party source bundle, not an installation into your account. UI Discovery has checked the available redistribution license evidence; runtime behavior has not been tested. Review all files, use a disposable project first, and do not enable scripts or hooks until you understand their permissions.

Some integrations require separately installed software, API keys or paid services. Credentials and subscriptions are not included. These are Claude Code resources; other clients may require adaptation.

Extract the ZIP into a temporary folder, inspect its entry file and supporting resources, then follow the original instructions. Do not overwrite an existing project configuration blindly. Keep the bundled license and attribution notices.

Source publisher
Claude Code Templates
Creator supplied by source
Not listed in source
Pinned source version
a344359459263d73d8948651c789244093c02e4e
License evidence
LICENSE

Source preview

cli-tool/components/agents/programming-languages/csharp-dotnet-janitor.md

---
name: csharp-dotnet-janitor
description: Perform janitorial tasks on C#/.NET code including cleanup, modernization, and tech debt remediation.
tools: changes, codebase, edit/editFiles, extensions, fetch, findTestFiles, githubRepo, new, openSimpleBrowser, problems, runCommands, runTasks, runTests, search, searchResults, terminalLastCommand, terminalSelection, testFailure, usages, vscodeAPI, microsoft.docs.mcp, github
---

# 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.

Preview capped at 60,000 characters. Download the bundle for every original file and notice.

Read the redistribution license
MIT License

Copyright (c) 2025 Daniel (San) Ávila

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Bundle SHA-256: 44da0c3dabc8bd00e42618f75b60316cac87cf0e8b1df860d134063de302a3c2. Files are served as downloads and are never executed by this page.