warning-fixer
Skill96 starsChanged 16 days agoMITView on GitHub
Fix compiler warnings using proper null handling and senior developer practices. Use when asked to fix warnings in a file, clean up nullable warnings, or resolve CS warnings. Works one file at a time with test coverage.
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Test first: - Add/verify test cases before modifying code
- Distinctive: line 26
User approval required: - No changes without explicit approval
- Distinctive: line 27
Understand before fixing: - Read and comprehend the code first
- Distinctive: line 56
CRITICAL: Read the entire file before proposing fixes.
- Distinctive: line 214
Use TodoWrite to track:
- Distinctive: line 217
Test status (written/passing)
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Warning Fixer Skill
Fix C# compiler warnings properly - using guard clauses and validation, NOT the ! operator.
Why This Skill Exists
The ! (null-forgiving operator) is a common but wrong way to handle nullable warnings. It tells the compiler "trust me, this won't be null" - but if it IS null at runtime, you get a NullReferenceException. Using ! hides the warning without fixing the actual problem.
A senior developer fixes warnings properly by:
- Understanding WHY the compiler is warning
- Adding proper validation (guard clauses, null checks)
- Making the code actually safe, not just quiet
Core Principles (Non-Negotiable)
- NEVER use
!(null-forgiving operator) - This hides warnings, doesn't fix them - One file at a time - Methodical, reviewable changes
- One warning type at a time - Focused fixes
- Test first - Add/verify test cases before modifying code
- Don't change process flow - Conservative, behavior-preserving changes
- User approval required - No changes without explicit approval
- Understand before fixing - Read and comprehend the code first
Quick Reference - Warning Codes
| Code | Description | Proper Fix |
| CS8602 | Dereference of possibly null | Add null check or guard clause |
| CS8604 | Possible null reference argument | Validate before calling, throw if invalid |
| CS8600 | Converting null to non-nullable | Guard clause or make type nullable |
| CS8601 | Possible null reference assignment | Initialize properly or add validation |
| CS8625 | Cannot convert null literal | Use proper initialization |
| CS0219 | Variable never used | Remove the variable |
Workflow
Step 1: Identify Target File
User specifies file OR skill finds next file with warnings:
# Build and capture warnings for specific file
dotnet build cc-director.sln 2>&1 | grep "path/to/file.cs"
# Or find files with most warnings
dotnet build cc-director.sln 2>&1 | grep "warning CS" | cut -d'(' -f1 | sort | uniq -c | sort -rn | head -20Step 2: Read and Understand the File
CRITICAL: Read the entire file before proposing fixes. Understand:
- What the class/method does
- The data flow
- Why values might be null
Step 3: Categorize Warnings
Group warnings by code and pick ONE type to fix first:
# Count warnings by type in specific file
dotnet build cc-director.sln 2>&1 | grep "path/to/file.cs" | grep -oP "warning CS\d+" | sort | uniq -c | sort -rnStep 4: Analyze Test Coverage
- Find existing tests for the file
- Identify what behavior is covered
- For test files: the file IS the test coverage
Step 5: Present Fix Plan (APPROVAL CHECKPOINT)
Show the user:
- Which warnings are being fixed
- The proposed changes (BAD vs GOOD pattern)
- WHY this is the correct fix
Wait for explicit approval before making any changes.
Step 6: Implement Fix
After approval:
- Make the changes
- Build the solution:
dotnet build cc-director.sln - Run tests:
dotnet test src/CcDirector.Tests
Step 7: Verify
- Confirm warnings are gone
- Confirm tests still pass
- Report results to user
Fix Patterns
CS8602/CS8604 - Null Reference Warnings
BAD - Hiding with !:
DoSomething(parameter!);
var value = obj.Property!.Value;GOOD - For required inputs:
public void Execute(string input)
{
if (string.IsNullOrEmpty(input))
throw new ArgumentException("Input is required", nameof(input));
// Compiler now knows input is not null
Process(input);
}GOOD - For optional inputs:
// Use null coalescing with sensible default
var result = optionalValue ?? "default";
// Or early return
if (optionalValue == null)
return;GOOD - For properties that must be set:
public void Execute()
{
if (string.IsNullOrEmpty(Name))
throw new InvalidOperationException($"{nameof(Name)} must be set before calling Execute");
// Now safe to use Name
}CS8600/CS8601 - Null Assignment Warnings
BAD:
string value = GetPossiblyNull()!;GOOD - Make nullable if it can be null:
string? value = GetPossiblyNull();
if (value == null) return;GOOD - Validate and throw:
string value = GetPossiblyNull()
?? throw new InvalidOperationException("Value was unexpectedly null");CS0219 - Unused Variable
BAD:
var unused = SomeMethod();GOOD - Remove if truly unused:
SomeMethod();GOOD - Use discard if return value intentionally ignored:
_ = SomeMethod();Test Code Specific Patterns
For test assertions, add explicit null checks:
BAD:
Assert.Equal(expected, result!.Data!.Value);GOOD:
Assert.NotNull(result);
Assert.NotNull(result.Data);
Assert.Equal(expected, result.Data.Value);Commands Reference
# Build full solution
dotnet build cc-director.sln
# Build specific project to see its warnings
dotnet build src/CcDirector.Core/CcDirector.Core.csproj --no-incremental
# Run tests for specific project
dotnet test src/CcDirector.Tests
# Count warnings by type in solution
dotnet build cc-director.sln 2>&1 | grep -oP "warning CS\d+" | sort | uniq -c | sort -rn
# Find files with most warnings
dotnet build cc-director.sln 2>&1 | grep "warning CS" | cut -d'(' -f1 | sort | uniq -c | sort -rn | head -20Progress Tracking
Use TodoWrite to track:
- Which file is being fixed
- Which warning type is being addressed
- Test status (written/passing)
- Fix status (planned/approved/implemented/verified)
Example Session
User: /warning-fixer SessionManager.cs
Claude:
## Warning Analysis - SessionManager.cs
**Warnings Found:** 8
| Code | Count | Description |
|------|-------|-------------|
| CS8602 | 6 | Dereference of possibly null reference |
| CS8604 | 2 | Possible null reference argument |
**Test Coverage:** src/CcDirector.Tests/SessionManagerTests.cs
**Recommendation:** Fix CS8602 warnings first (most common)
### CS8602 Pattern Analysis
Line 48: `session.Buffer.DumpAll()`
- `Buffer` could be null
- Current code assumes it's populated
**Proposed Fix:**
```csharp
// BEFORE
var data = session.Buffer.DumpAll();
// AFTER
if (session.Buffer is null)
throw new InvalidOperationException($"Session {session.Id} has no buffer");
var data = session.Buffer.DumpAll();Approve this fix pattern? Reply "yes" to proceed.
---
**Skill Version:** 1.0
**Last Updated:** 2026-02-14
**Adapted from:** sampleWeb warning-fixer skill
**Key Principle:** Fix warnings properly, never hide them with `!`Other versions1 project uses a version of this.
Word for word · 1
- thefrederiksen/devthrottle★ 96100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
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 repository30 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- agent-expertSkill
- cc-settings-apiSkill
- cencon-generateSkill
- code-maintenanceSkill
- commitSkill
- dead-code-finderSkill
- deploy-hosted-gatewaySkill
- developer-agentSkill
- dev-throttleSkill
- document-featuresSkill
- enter-issueSkill
- fleet-commsSkill
- implementation-loopSkill
- move-sessionSkill
- playwright-cliSkill
- product-agentSkill
- qa-agentSkill
- read-issuesSkill
- release-managerSkill
- review-codeSkill
- shipSkill
- skill-managerSkill
- support-agentSkill
- terminologySkill
- test-managerSkill
- ui-testSkill
- update-docsSkill
- voice-reviewSkill
- wingman-brief-reviewerSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

