From ai-tools
Diagnose and fix build errors using resource-aware parallel subagents with automatic framework detection
npx claudepluginhub waynebrantley/aitools --plugin ai-toolsThis skill uses the workspace's default tool permissions.
Systematically fix build errors using parallel subagents with intelligent coordination, resource-aware execution, and iterative verification.
preview.mjsscripts/adapters/base-adapter.mjsscripts/adapters/dotnet.mjsscripts/adapters/typescript.mjsscripts/detect-build-environment.mjsscripts/parse-build-output.mjsscripts/run-build.mjsscripts/run-final-build.mjsscripts/verify-fix.mjsscripts/verify-progress.mjstests/adapters/base-adapter.test.mjstests/adapters/dotnet.test.mjstests/adapters/typescript.test.mjstests/detect-build-environment.test.mjstests/parse-build-output.test.mjstests/run-all-tests.mjstests/verify-fix.test.mjsRetrieves texts, DMs, one-time codes, and inspects threads in ECC workflows. Provides evidence of exact sources checked for verification before replies.
Delivers expertise for HS tariff classification, customs documentation, duty optimization, restricted party screening, and trade compliance across jurisdictions.
Process documents with Nutrient API: convert formats (PDF, DOCX, XLSX, images), OCR scans (100+ languages), extract text/tables, redact PII, sign, fill forms.
Systematically fix build errors using parallel subagents with intelligent coordination, resource-aware execution, and iterative verification.
Supported Build Frameworks:
⚠️ ALL WARNINGS MUST BE FIXED - This is a ZERO-WARNING skill.
This skill enforces zero-warning builds to maintain code quality. "Not blocking build" is NOT an acceptable reason to leave warnings unfixed.
Framework-Specific Behavior:
Excluded .NET Warnings (ONLY these two):
NU1902: NuGet package vulnerability warnings (often cannot be immediately fixed due to upstream dependencies)DX1000: DevExpress evaluation license warnings (requires commercial license purchase)CRITICAL: If ANY other warning code appears (e.g., xUnit1026, CS0618, etc.), it MUST be fixed. Do NOT skip warnings just because they don't block the build.
If a warning cannot be fixed:
To exclude additional warning codes, modify the .NET adapter configuration.
IMPORTANT: Use the TodoWrite tool throughout this workflow to track progress and ensure ALL steps are completed. Create todos at the start and update them as you progress through each phase.
Before starting, create a comprehensive todo list:
Single Framework:
TodoWrite:
1. Detect build frameworks (pending)
2. Select framework(s) to fix (pending)
3. Run build discovery (pending)
4. Calculate parallelism (pending)
5. Fix files in parallel (pending)
6. Verify all files processed (pending)
7. Run final validation (pending)
Multiple Frameworks (use framework labels):
TodoWrite:
1. Detect build frameworks (pending)
2. Select framework(s) to fix (pending)
3. Run build discovery - ALL frameworks (pending)
4. Calculate parallelism (pending)
5. [.NET] Fix files in parallel (pending)
6. [TypeScript] Fix files in parallel (pending)
7. [.NET] Verify all files processed (pending)
8. [TypeScript] Verify all files processed (pending)
9. [.NET] Run final validation (pending)
10. [TypeScript] Run final validation (pending)
Mark each todo as in_progress when starting, and completed when finished. Add file-specific todos during the fixing phase.
Auto-detect build framework and run discovery:
node scripts/detect-build-environment.mjs # Detect framework
Output: JSON array of detection objects (stderr shows summary, stdout contains JSON)
Each detection object has this structure:
{
"framework": "typescript",
"displayName": "frontend (typescript)",
"buildType": "typescript",
"projectRoot": "/absolute/path/to/project",
"config": {
"packageManager": "pnpm",
...
}
}
IMPORTANT: Use these complete detection objects throughout the workflow - do NOT extract just the config property!
If multiple build frameworks are detected, prompt the user to select which to fix.
Selection Strategy:
A. If 2-4 frameworks detected - Use AskUserQuestion with multiSelect: true:
Which build frameworks would you like the doctor to look at?
Options:
B. If >4 frameworks detected - Show grouped, numbered list and ask for text response:
Display frameworks grouped by type:
Detected 6 build frameworks:
**TypeScript (3 projects):**
1. frontend (typescript) - pnpm
2. packages/ui (typescript) - pnpm
3. packages/utils (typescript) - pnpm
**.NET (3 projects):**
4. API.sln (dotnet)
5. Services.csproj (dotnet)
6. Tests.csproj (dotnet)
Which would you like the doctor to look at (or all)?
Store Selection: Keep the complete detection object(s) for the selected framework(s). Each object must include: framework, projectRoot, config, displayName, and buildType.
Processing Strategy:
Parallel-Framework Optimization (multiple frameworks selected):
Example: 16GB RAM with MAX_PARALLEL=4, .NET + TypeScript both build successfully:
Run build and validation for the selected framework(s):
# Pass the FULL detection object from step 1 (not just config property!)
# The detection object includes: framework, displayName, buildType, projectRoot, config
node scripts/run-build.mjs '<detection-object-json>'
IMPORTANT: The parameter must be the complete detection object from step 1, which includes:
framework: The framework identifier (e.g., "typescript", "dotnet")projectRoot: Absolute path to the project rootconfig: Framework-specific configurationdisplayName, buildType: Additional metadataIMPORTANT (Windows): When passing the detection object JSON, ensure all file paths use forward slashes (/), not backslashes (\). The detection script already normalizes paths, but if you reconstruct the JSON manually, use forward slashes to avoid JSON parse errors.
Example:
node scripts/run-build.mjs '{"framework":"typescript","displayName":"frontend (typescript)","buildType":"typescript","projectRoot":"C:/Projects/my-app","config":{"packageManager":"pnpm"}}'
Parse output to identify files with errors:
node scripts/parse-build-output.mjs table
Output: List of files sorted by error count (fix high-impact files first)
Determine optimal parallelism based on system resources and build framework:
# Auto-calculates based on:
# - TypeScript: 3GB per agent
# - .NET: 4GB per agent
node calculate-parallelism.mjs --mem-per-agent=<framework_value>
Uses calculate-parallelism skill for resource-aware execution (2-6 parallel agents).
CRITICAL: Process ALL files with errors, not just the first one!
TodoWrite Integration: When you receive the file list, create a todo for each file:
TodoWrite (add to existing list):
- Fix src/utils/helper.ts (12 errors) (pending)
- Fix src/components/Button.tsx (8 errors) (pending)
- Fix src/services/api.ts (5 errors) (pending)
... (one todo per file)
As you spawn subagents, mark files as in_progress. When verified, mark as completed.
Framework-Specific Workflow:
For each file:
node scripts/verify-fix.mjs {file} (checks individual file)IMPORTANT: Do NOT run dotnet build or any verification during the fixing phase!
Generate complete file list from initial build errors
Create todos for ALL files (add to TodoWrite)
Spawn fix subagents for ALL files (respecting MAX_PARALLEL limit):
Task: Fix all build errors in {filename}
Context:
- File: {path}
- Framework: .NET
- Issues: {compilation errors, warnings}
Requirements:
- Fix ALL issues in this file only
- Do NOT modify other files
- Do NOT run dotnet build to verify
- Follow project standards (check CLAUDE.md)
Success: All issues addressed in code
Mark todos as completed when subagent finishes (no verification yet)
Wait for ALL files to be fixed before verification
Proceed to Step 7 (Final Validation) for single build verification
Why this matters:
tsc --noEmit file.ts)dotnet build | grep for each file wastes time and resourcesVerify ALL files were processed:
node scripts/verify-progress.mjs initial-files.txt fixed-files.txt
If files remain, spawn subagents for remaining files.
For .NET projects: This step confirms all files were addressed. Do NOT run builds here - verification happens in step 7.
IMPORTANT: Run this as a single sequential command directly in the main agent. Do NOT spawn subagents or use the Task tool for this step.
Run complete validation after ALL files processed:
# Pass the same FULL detection object used in step 3
node scripts/run-final-build.mjs '<detection-object-json>'
Expected: All builds passing, zero type/lint errors.
Framework-Specific Behavior:
.NET Workflow Note: The discovery/fixing phase builds Debug configuration only (where most warnings appear). Final validation then builds both Debug and Release to confirm all configurations are clean.
If warnings remain after fixes:
CRITICAL: "Not blocking build" is NOT a valid reason to accept warnings. ALL warnings must be fixed or explicitly excluded.
run_in_background: true when spawning fix subagents. Always use foreground Task calls so you know exactly when each agent completes.Auto-detection via detect-build-environment.mjs:
TypeScript/JavaScript:
tsconfig.json or typescript in package.jsonnpm/pnpm/yarn run build**/*.ts, **/*.tsx, **/*.js, **/*.jsx.NET:
*.sln, *.slnx, or *.csproj files (prefer solution files)dotnet restore + dotnet build --configuration Debug (during discovery only)dotnet format --verify-no-changes (only if detected in GitHub workflows)**/*.cs, **/*.csproj, **/*.sln, **/*.slnxdotnet build during fixing phaseCRITICAL .NET Rules:
Key .NET Behaviors:
.sln or .slnx file exists, .csproj files are ignored (solution contains all projects)dotnet format is only run if detected in .github/workflows/**/*.yml filesBefore running the full skill, preview what would be detected and fixed:
# From skill directory
node preview.mjs [target-directory]
# Uses Git repository root if no directory specified
node preview.mjs
What it does:
Perfect for:
subagent_type="general-purpose"Phase 1 - Initial Planning:
1. Detect build frameworks (in_progress)
2. Select framework(s) to fix (pending)
3. Run build discovery (pending)
4. Calculate parallelism (pending)
5. Fix files in parallel (pending)
6. Verify all files processed (pending)
7. Run final validation (pending)
Phase 2a - During Parallel Fixing (Single Framework):
1. Detect build frameworks (completed)
2. Select framework(s) to fix (completed)
3. Run build discovery (completed)
4. Calculate parallelism (completed)
5. Fix src/utils/helper.ts (12 errors) (in_progress)
6. Fix src/components/Button.tsx (8 errors) (in_progress)
7. Fix src/services/api.ts (5 errors) (pending)
8. Fix src/hooks/useAuth.ts (3 errors) (pending)
9. Verify all files processed (pending)
10. Run final validation (pending)
Phase 2b - During Parallel Fixing (Multiple Frameworks, MAX_PARALLEL=4):
1. Detect build frameworks (completed)
2. Select framework(s) to fix (completed)
3. Run build discovery - ALL frameworks (completed)
4. Calculate parallelism (completed)
5. [.NET] Fix Services/AuthService.cs (8 warnings) (in_progress)
6. [.NET] Fix Controllers/UserController.cs (5 warnings) (in_progress)
7. [TypeScript] Fix src/utils/helper.ts (12 errors) (in_progress)
8. [TypeScript] Fix src/components/Button.tsx (8 errors) (in_progress)
9. [.NET] Fix Models/User.cs (3 warnings) (pending)
10. [TypeScript] Fix src/services/api.ts (5 errors) (pending)
... (frameworks interleaved, 4 total subagents running)
Phase 3 - Near Completion:
1-8. [All file fixes] (completed)
9. Verify all files processed (in_progress)
10. Run final validation (pending)
All scripts are in scripts/ directory and work cross-platform:
detect-build-environment.mjs - Auto-detect framework and config
node scripts/detect-build-environment.mjs [directory]
# Outputs JSON array (to stdout) of detection objects
# Each object has: framework, displayName, buildType, projectRoot, config
run-build.mjs - Run build + validation for discovery
node scripts/run-build.mjs '<detection-object-json>'
# Saves to build-output.txt and validate-output.txt
# Parameter must be the FULL detection object from detect-build-environment.mjs
parse-build-output.mjs - Parse and group errors by file
node scripts/parse-build-output.mjs [table|json]
# Outputs files sorted by error count
verify-fix.mjs - Verify single file fix
node scripts/verify-fix.mjs <file> [--json]
# Exit 0: fixed, 1: errors remain
verify-progress.mjs - Check all files processed
node scripts/verify-progress.mjs initial.txt fixed.txt
run-final-build.mjs - Final validation after all fixes
node scripts/run-final-build.mjs '<detection-object-json>'
# Parameter must be the same FULL detection object used throughout the workflow
# Automatically cleans up temporary files (build-output.txt, validate-output.txt)
Each fix subagent MUST:
node scripts/verify-fix.mjs {file} to validate the fix. Do NOT run eslint ., eslint src, tsc, or any whole-project commands. Always target the specific file being fixed. (.NET exception: skip verification during fixing phase)eslint ., eslint src, tsc) — always target the specific filedotnet build during .NET fixing phase (wait for final validation)CRITICAL: Do NOT work around script failures.
If any script in this skill produces no output, fails, or returns unexpected results:
If a script fails, ask the user how to proceed before continuing.
Subagent and Runtime Errors:
Skill succeeds ONLY when all checks pass with ZERO warnings (except explicitly excluded codes).
TypeScript/JavaScript:
tsc --noEmit passes with zero warnings (type checking)eslint --max-warnings=0 passes (linting, zero warnings)npm/pnpm/yarn run build passes with zero warnings (build).NET:
dotnet build passes with zero warnings (except NU1902 and DX1000 only)dotnet format --verify-no-changes passes (only if used in GitHub workflows)CRITICAL: If ANY warning code appears that is NOT in the exclusion list (NU1902, DX1000), the skill has NOT succeeded. Fix the warnings or document why they cannot be fixed and ask user for guidance.
Remember: Process ALL files with errors, not just the first one! Resource-aware execution ensures optimal performance without overwhelming the system.
Version: 1.0.0 License: MIT Author: Wayne Brantley