fix-warnings
Batch-fix analyzer warnings with category filtering and interactive review options
What this skill does
# /dotnet:fix-warnings
Batch-fix analyzer warnings with category filtering, preview mode, and interactive review options.
## Arguments
Parse arguments from `$ARGUMENTS`:
| Flag | Description | Default |
|------|-------------|---------|
| `--category <cat>` | Fix specific category (see below) | All fixable |
| `--severity <level>` | Minimum severity (error, warning, suggestion, hidden) | warning |
| `--preview` | Show changes without applying | false |
| `--interactive` | Review each fix before applying | false |
| `--project <path>` | Target specific project (fuzzy matching) | All projects |
## Warning Categories
| Category | Description | Analyzer Prefix |
|----------|-------------|-----------------|
| `style` | Code style (IDE*) | IDE0001-IDE0999 |
| `quality` | Code quality (CA*) | CA1000-CA9999 |
| `naming` | Naming conventions | CA1700-CA1727, IDE1006 |
| `performance` | Performance issues | CA1800-CA1869 |
| `security` | Security concerns | CA2100-CA2399, CA3000-CA3147 |
| `reliability` | Reliability issues | CA2000-CA2099 |
| `usage` | API usage issues | CA2200-CA2249 |
| `nullable` | Nullable reference warnings | CS8600-CS8799 |
| `async` | Async/await issues | CA2007, CA2008, CS8892 |
## Workflow
### Step 1: Run Analyzers
Build with detailed diagnostics:
```bash
dotnet build --no-incremental -warnaserror:0 2>&1
```
Or use format for fixable warnings:
```bash
dotnet format analyzers --verify-no-changes --verbosity diagnostic
```
### Step 2: Parse and Categorize Warnings
Group warnings by:
- Category (style, quality, naming, etc.)
- Severity (error, warning, suggestion)
- File location
- Fixability (auto-fixable vs manual)
### Step 3: Present Summary
```text
Analyzer Warnings Summary
Category Count Auto-fixable
─────────────────────────────────────
Style 42 38
Quality 15 8
Naming 7 7
Nullable 23 12
Performance 3 1
─────────────────────────────────────
Total 90 66
Files affected: 28
Run with --preview to see specific warnings.
Run without flags to fix all auto-fixable warnings.
```
### Step 4: Preview Mode (--preview)
Show what would be changed:
```text
Preview: Warnings to Fix
IDE0008 (Style): Use explicit type instead of 'var' (12 occurrences)
- src/MyApp/Services/UserService.cs:42
- src/MyApp/Services/UserService.cs:56
- src/MyApp/Controllers/ApiController.cs:23
... and 9 more
CA1062 (Quality): Validate arguments of public methods (5 occurrences)
- src/MyApp/Services/DataService.cs:18
- src/MyApp/Handlers/CommandHandler.cs:31
... and 3 more
CS8618 (Nullable): Non-nullable field not initialized (8 occurrences)
- src/MyApp/Models/User.cs:12
- src/MyApp/Models/Order.cs:8
... and 6 more
Total: 66 auto-fixable warnings across 28 files
Run without --preview to apply fixes.
```
### Step 5: Apply Fixes
**Automatic Mode (default):**
```bash
# Fix all style warnings
dotnet format style
# Fix all analyzer warnings
dotnet format analyzers
# Fix whitespace
dotnet format whitespace
```
**Category-specific:**
```bash
# Fix only naming warnings
dotnet format analyzers --diagnostics=CA1700,CA1707,CA1708,CA1710,CA1711,CA1712,CA1713,CA1714,CA1715,CA1716,CA1717,CA1720,CA1721,CA1724,CA1725,CA1727,IDE1006
```
**Interactive Mode (--interactive):**
For each warning category:
```text
Fix IDE0008: Use explicit type instead of 'var'? (12 occurrences)
Example:
Before: var service = new UserService();
After: UserService service = new UserService();
Options:
1. Fix all 12 occurrences
2. Skip this rule
3. Review each occurrence individually
```
### Step 6: Validate
After fixes:
```bash
dotnet build --no-restore
```
Report any issues introduced by fixes.
## Output Format
**Summary Mode (no flags):**
```text
Fixing Analyzer Warnings...
Applied fixes:
Style (IDE*): 38 warnings fixed
Quality (CA*): 8 warnings fixed
Naming: 7 warnings fixed
Nullable: 12 warnings fixed
Remaining (not auto-fixable):
CA1062: 5 warnings - Validate arguments (manual review needed)
CA2000: 3 warnings - Dispose objects (manual review needed)
CS8604: 11 warnings - Possible null reference (context-dependent)
Files modified: 28
Build: Successful
Run with --category to fix specific categories.
Review remaining warnings manually or suppress with justification.
```
**Interactive Mode:**
```text
Fixing Warnings Interactively
[1/5] IDE0008: Use explicit type (12 occurrences)
Fix all? [Y/n/s(kip)/r(eview)]
> Y
Fixed 12 occurrences
[2/5] CA1707: Remove underscores from member names (3 occurrences)
Fix all? [Y/n/s(kip)/r(eview)]
> r
1. _myField -> MyField in User.cs:15
Fix? [y/n] > y
2. Get_Data() -> GetData() in DataService.cs:42
Fix? [y/n] > n (skip - intentional convention)
3. API_VERSION -> ApiVersion in Constants.cs:8
Fix? [y/n] > y
Fixed 2 of 3 occurrences
... (continues for each category)
Summary:
Fixed: 52 warnings
Skipped: 14 warnings (user choice)
Build: Successful
```
## Common Warning Fixes
| Warning | Auto-Fix | Manual Action |
|---------|----------|---------------|
| IDE0008 | Yes | Change `var` to explicit type |
| IDE0003 | Yes | Remove `this.` qualification |
| IDE0059 | Yes | Remove unnecessary assignment |
| CA1062 | Partial | Add null checks (context-dependent) |
| CA2000 | No | Add `using` or `.Dispose()` calls |
| CS8618 | Partial | Add `= null!` or `required` |
| CA1707 | Yes | Remove underscores |
| CA1716 | Yes | Rename to avoid keyword conflict |
## Examples
```bash
# Fix all auto-fixable warnings
/dotnet:fix-warnings
# Preview without fixing
/dotnet:fix-warnings --preview
# Fix only style warnings
/dotnet:fix-warnings --category style
# Fix only naming issues
/dotnet:fix-warnings --category naming
# Interactive mode - review each fix
/dotnet:fix-warnings --interactive
# Fix warnings in specific project
/dotnet:fix-warnings --project MyApp.Api
# Fix only errors and warnings (skip suggestions)
/dotnet:fix-warnings --severity warning
```
## Warnings That Cannot Be Auto-Fixed
Some warnings require manual review:
- **CA2000** (Dispose): Context-dependent object lifetime
- **CA1062** (Null check): May need different validation strategy
- **CA2007** (ConfigureAwait): Library vs app decision
- **CS8604** (Null flow): May need design change
For these, the command reports them but doesn't modify code.
## Integration with .editorconfig
Respects `.editorconfig` settings:
```ini
# These rules will be applied during fix
dotnet_style_var_for_built_in_types = false:warning
dotnet_naming_rule.public_members_must_be_capitalized.severity = warning
```
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.