Apply approved remediation actions from audit resolution. Implements config file updates, template syncs, and code fixes using appropriate domain/config agents. Use when audit findings have been approved for remediation and need implementation.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
ROOT AGENT ONLY - Called by /audit command after user approves fixes.
Purpose: Apply approved remediation actions to fix audit violations
Trigger: After user selects remediation options in resolution phase
Input:
remediation_plan[] - approved fixes from resolution phasetemplates - updated templates from template-update skillrepoType - repository type (library/consumer)Output:
applied_fixes[] - list of fixes applied successfullyfailed_fixes[] - list of fixes that failed with errorsfiles_modified[] - list of files changedsummary - remediation results for report1. Parse Remediation Plan
2. For Each Approved Remediation:
| Remediation Type | Agent/Skill | Action |
|---|---|---|
| Config file update | Domain-specific config agent | Apply template to config file, re-audit |
| Template sync | File write (templates/) | Copy updated template to correct location |
| Code fix | coder-agent | Apply code changes, validate syntax |
| File creation | template-based | Create file from template with vars |
3. Execute Fixes in Order
For each fix in remediation_plan:
a. Identify target file location
b. Determine remediation type
c. Apply fix using appropriate agent/tool
d. Validate fix was applied:
- File exists and contains expected content
- No syntax errors introduced
- Related configs still valid
e. Track result (success/failure/warning)
4. Handle Failures Gracefully
5. Track All Modifications
6. Return Summary
{
"applied_fixes": [
{
"type": "config",
"file": ".eslintrc.js",
"agent": "eslint-agent",
"status": "success"
}
],
"failed_fixes": [
{
"type": "code",
"file": "src/auth.ts",
"agent": "coder-agent",
"error": "Syntax validation failed: unexpected token"
}
],
"files_modified": 5,
"summary": "Applied 7/8 fixes. 1 fix failed - requires manual review."
}
Pattern:
Example:
Remediation: Fix .eslintrc.js
→ Spawn eslint-agent with template
→ Agent validates and applies
→ Agent audits result
→ Track: "config/.eslintrc.js: success"
Pattern:
Example:
Remediation: Sync TypeScript template
→ Copy plugins/metasaver-core/skills/config/workspace/typescript-configuration/templates/...
→ to packages/web/tsconfig.json
→ Track: "template-sync/tsconfig.json: success"
Pattern:
Example:
Remediation: Fix missing error handling in auth.ts
→ Spawn coder-agent with fix description
→ Agent modifies file
→ Validate TypeScript: pnpm tsc --noEmit
→ Track: "code/src/auth.ts: success" or "code/src/auth.ts: failed (error: ...)"
Pattern:
Example:
Remediation: Create missing src/index.ts
→ Load template from vitest-config skill
→ Substitute variables
→ Write to src/index.ts
→ Track: "file-creation/src/index.ts: success"
| Fix Type | Agent | When To Use |
|---|---|---|
| .eslintrc.js | eslint-agent | Config violations |
| .prettierrc | prettier-agent | Formatting violations |
| tsconfig.json | typescript-agent | TypeScript violations |
| vitest.config.ts | vitest-agent | Test config violations |
| tailwind.config.js | tailwind-agent | Tailwind violations |
| pnpm-workspace.yaml | pnpm-workspace-agent | Workspace violations |
| Code changes | coder-agent | Logic/syntax fixes |
| New files | coder-agent (with template) | File creation |
Critical Errors (STOP):
Non-Critical (CONTINUE):
User Review Required:
Before Starting:
During Execution:
After Completion:
Before This Skill:
audit-workflow - detects violationsremediation-options - presents user choicesThis Skill:
After This Skill:
repomix-cache-refresh - if files modifiedreport-phase - generates final reportSuccess Summary:
Remediation Execution Results
═══════════════════════════════════════
Applied Fixes (7):
✅ Config update: .eslintrc.js
✅ Config update: .prettierrc
✅ Template sync: tsconfig.json
✅ Code fix: src/auth.ts
✅ File creation: src/types/index.ts
✅ Config update: vitest.config.ts
✅ Template sync: tailwind.config.js
Failed Fixes (1):
❌ Code fix: src/service.ts
Error: Function signature mismatch with tests
Files Modified: 7
Next Steps:
1. Review failed fix manually
2. Run "pnpm audit" to verify
3. Push changes to review
| Setting | Value | Rationale |
|---|---|---|
| Model for agents | haiku | Fast execution for rule-based fixes |
| Validation on writes | Yes | Prevent invalid config files |
| Stop on first failure | No | Apply all fixable issues |
| Snapshot state before | Yes | Enable rollback if needed |
| Log all changes | Yes | Audit trail required |
{
"remediation_plan": [
{
"id": "fix-001",
"type": "config",
"configType": "eslint",
"file": ".eslintrc.js",
"action": "conform_to_template",
"template": "eslint-config-template-v1",
"priority": "high"
},
{
"id": "fix-002",
"type": "code",
"file": "src/auth.service.ts",
"description": "Add missing try-catch block in login method",
"priority": "high"
},
{
"id": "fix-003",
"type": "template-sync",
"file": "tsconfig.json",
"source": "plugins/metasaver-core/skills/.../tsconfig.template.json",
"priority": "medium"
},
{
"id": "fix-004",
"type": "file-creation",
"file": "src/types/auth.types.ts",
"template": "typescript-types-template",
"priority": "low"
}
],
"templates": {
"eslint-config-template-v1": {
/* template content */
},
"typescript-types-template": {
/* template content */
}
}
}
/audit command (after user approves fixes)/ms audit command (for complex audits)