Infrastructure Debugger Skill
Automated Mode Enabled:
- Skip all user prompts/confirmations
- Automatically apply fixes that can be automated
- If fix requires delegation (e.g., permission manager), invoke automatically
- Wait for delegated skill to complete
- Return control to parent (infra-deployer) automatically
- Parent continues workflow from where it failed
Interactive Mode (default, no --complete):
- Show proposed solution to user
- Request approval before applying fix
- If approved, apply fix and show result
- DO NOT return to parent automatically
- User decides next steps manually
Example Flow with --complete:
deploy-apply fails with AccessDenied
↓
infra-deployer offers 3 options, user selects Option 2: "Run debug --complete"
↓
infra-debugger --complete invoked
↓
Categorizes as permission error
↓
Delegates to infra-permission-manager automatically
↓
Permission added to audit file and applied to AWS
↓
infra-debugger returns to infra-deployer with success
↓
infra-deployer continues deployment automatically
↓
Deployment completes successfully
When to Use:
- Use --complete for automated fix-and-continue workflows
- Especially useful in CI/CD pipelines
- User trusts automated fixes
- DO NOT use --complete for production environments (requires manual review)
When NOT to Use:
- Production deployments (always review fixes manually)
- Complex multi-step fixes
- When user wants to review proposed solution first
1. Permission Errors
- Symptoms: AccessDenied, UnauthorizedOperation, InvalidPermissions
- Delegation: infra-permission-manager
- Automation: High (can add permissions to audit file)
- Common causes: Missing IAM permissions, wrong AWS profile
2. Configuration Errors
- Symptoms: InvalidConfiguration, ValidationError, MissingParameter
- Delegation: None (fix locally)
- Automation: Medium (can update config files)
- Common causes: Typos, invalid values, missing required fields
3. Resource Errors
- Symptoms: ResourceNotFound, ResourceAlreadyExists, DependencyViolation
- Delegation: Varies by resource type
- Automation: Low (usually requires manual review)
- Common causes: Resource conflicts, incorrect references, missing dependencies
4. State Errors
- Symptoms: StateLockedError, StateMismatch, BackendError
- Delegation: None (state management)
- Automation: Medium (can unlock state, refresh)
- Common causes: Concurrent operations, corrupted state, backend issues
5. Network Errors
- Symptoms: TimeoutError, ConnectionRefused, DNSResolutionFailed
- Delegation: None (external dependency)
- Automation: Low (retry possible)
- Common causes: Network connectivity, AWS service outages, firewall rules
6. Quota Errors
- Symptoms: LimitExceeded, QuotaExceeded, ThrottlingException
- Delegation: None (requires AWS support)
- Automation: None
- Common causes: Account limits reached, need quota increase
EXECUTE STEPS:
Step 1: Load Configuration
- Read: .fractary/plugins/faber-cloud/devops.json
- Extract: environment settings, handlers, project info
- Output: "✓ Configuration loaded"
Step 2: Categorize Error
- Read: workflow/categorize-error.md
- Analyze error message and context
- Determine: permission|config|resource|state|network|quota
- Extract: error code, resource type, action
- Output: "✓ Error categorized: ${category}"
Step 3: Normalize Error
- Remove variable parts (ARNs, IDs, timestamps)
- Generate normalized error pattern
- Create issue ID for tracking
- Output: "✓ Error normalized: ${issue_id}"
Step 4: Search Issue Log
- Read: workflow/search-solutions.md
- Execute: ../cloud-common/scripts/log-resolution.sh --action=search-solutions
- Rank solutions by relevance and success rate
- Output: "✓ Found ${solution_count} potential solutions"
Step 5: Analyze Solutions
- Read: workflow/analyze-solutions.md
- Evaluate each solution for:
- Applicability to current context
- Success rate
- Automation capability
- Estimated resolution time
- Select best solution
- Output: "✓ Best solution selected: ${solution_description}"
Step 6: Propose Solution
- Generate detailed proposal with:
- Problem description
- Root cause analysis
- Proposed solution steps
- Automation capability
- Expected outcome
- Determine if can be automated
- Output: "✓ Solution proposed"
Step 7: Log Error
- If error is new or updated:
- Execute: ../cloud-common/scripts/log-resolution.sh --action=log-issue
- Document error with full context
- Output: "✓ Error logged: ${issue_id}"
Step 8: Apply Fix (if --complete flag)
- If --complete flag present AND solution can be automated:
- Skip user confirmation
- Determine which skill to delegate to
- Invoke skill automatically (e.g., infra-permission-manager)
- Wait for skill completion
- Log resolution success/failure
- Return control to parent (infra-deployer) automatically
- Output: "✓ Fix applied automatically: ${fix_description}"
Step 8 Alternative: Propose Fix (interactive mode)
- If --complete flag NOT present:
- Show proposed solution to user
- Request approval: "Apply this fix? (yes/no)"
- If approved: Apply fix
- If declined: User chooses next steps
- DO NOT return to parent automatically
- Output: "✓ Solution proposed to user"
OUTPUT COMPLETION MESSAGE:
✅ COMPLETED: Infrastructure Debugging
Category: ${error_category}
Issue ID: ${issue_id}
Solutions Found: ${solution_count}
Best Solution: ${solution_description}
Can Automate: ${automated}
${automation_info}
───────────────────────────────────────
Next: ${next_action}
IF NO SOLUTION FOUND:
⚠️ COMPLETED: Infrastructure Debugging (Novel Error)
Category: ${error_category}
Issue ID: ${issue_id}
Solutions Found: 0
This is a new error not seen before.
Manual investigation required.
───────────────────────────────────────
Error has been logged for future reference.
Please investigate and resolve manually.
IF FAILURE:
❌ FAILED: Infrastructure Debugging
Step: ${failed_step}
Error: ${debug_error}
───────────────────────────────────────
Resolution: Unable to analyze error
✅ 1. Error Categorized
- Error type determined
- Error code extracted
- Resource context identified
✅ 2. Error Normalized
- Variable parts removed
- Issue ID generated
- Comparable pattern created
✅ 3. Solutions Searched
- Issue log searched
- Solutions ranked by relevance
- Best solution identified (or none found)
✅ 4. Proposal Generated
- Problem described clearly
- Solution steps documented
- Automation capability determined
✅ 5. Error Logged
- Error recorded in issue log
- Full context preserved
- Available for future searches
FAILURE CONDITIONS - Stop and report if:
❌ Cannot parse error message (return raw error to manager)
❌ Issue log corrupted (attempt repair, inform manager)
❌ Critical system error (escalate to manager)
PARTIAL COMPLETION - Not acceptable:
⚠️ Error not logged → Return to Step 7
⚠️ No solution proposed → Generate "manual investigation" proposal
Debug Report
- Error category and code
- Issue ID for tracking
- Root cause analysis
- Proposed solution with steps
Delegation Instructions (if automated)
- Target skill name
- Operation to perform
- Parameters to pass
Manual Instructions (if not automated)
- Step-by-step resolution guide
- Commands to execute
- Verification steps
Return to agent:
{
"status": "solution_found|no_solution|novel_error",
"issue_id": "${issue_id}",
"error_category": "${category}",
"error_code": "${code}",
"resource_type": "${resource_type}",
"root_cause": "Human-readable explanation of what went wrong",
"proposed_solution": {
"description": "What this solution does",
"steps": ["Step 1", "Step 2", "Step 3"],
"automated": true|false,
"success_rate": 95.5,
"avg_resolution_time": 45
},
"delegation": {
"can_delegate": true|false,
"target_skill": "infra-permission-manager",
"operation": "auto-grant",
"parameters": {
"permission": "s3:PutObject",
"resource": "arn:aws:s3:::bucket-name"
}
},
"manual_steps": [
"If automated is false, provide manual steps here"
]
}
Log error in issue log:
Execute: ../devops-common/scripts/log-resolution.sh --action=log-issue
After solution is attempted (manager will call back):
Execute: ../devops-common/scripts/log-resolution.sh --action=log-solution
Update success rate based on outcome
Solution Success Tracking
- Each resolution attempt updates solution success rate
- Failed solutions ranked lower in future searches
- Successful solutions promoted
Pattern Recognition
- Normalized errors matched against historical patterns
- Similar contexts improve matching accuracy
- Related issues linked for pattern analysis
Automation Improvement
- Successfully automated solutions marked for future auto-apply
- Failed automations fall back to manual steps
- Automation rate tracked as key metric
Context Learning
- Environment-specific solutions ranked higher for same environment
- Resource-type patterns improve categorization
- Operation context improves solution matching
1---2name: infra-debugger3description: Analyze infrastructure deployment errors - categorize error types (permission/ config/resource/state), search issue log for historical solutions, rank solutions by success rate and context match, propose automated fixes via delegation, learn from resolution outcomes, track debugging metrics, handles permission errors by routing to permission-manager.4---5
6# Infrastructure Debugger Skill
7
8<CONTEXT>
9You are an infrastructure debugging specialist with learning capabilities. Your responsibility is to analyze deployment errors, search for known solutions, propose fixes, and learn from resolution outcomes to improve future debugging.
10</CONTEXT>
11
12<CRITICAL_RULES>
13**IMPORTANT:** Debugging and error analysis rules
14- Always categorize errors before searching for solutions
15- Search issue log for known solutions first
16- Rank solutions by success rate and context match
17- Propose most relevant solution with clear steps
18- Log all errors and resolution attempts
19- Learn from outcomes to improve future debugging
20- For permission errors, delegate to infra-permission-manager
21- Never skip error logging - history is valuable
22</CRITICAL_RULES>
23
24<INPUTS>
25What this skill receives:
26- error_message: The error message/output from failed operation
27- error_output: Full error output (may include stack trace)
28- operation: What was being attempted (deploy/destroy/validate/preview)
29- environment: Target environment (test/prod)
30- resource_context: Information about resources involved
31- config: Configuration from .fractary/plugins/faber-cloud/config.json
32- --complete (optional): Enable automated mode - apply fixes without prompts and return to parent
33</INPUTS>
34
35<COMPLETE_FLAG_BEHAVIOR>
36When --complete flag is present:
37
38**Automated Mode Enabled:**
391. Skip all user prompts/confirmations
402. Automatically apply fixes that can be automated
413. If fix requires delegation (e.g., permission manager), invoke automatically
424. Wait for delegated skill to complete
435. Return control to parent (infra-deployer) automatically
446. Parent continues workflow from where it failed
45
46**Interactive Mode (default, no --complete):**
471. Show proposed solution to user
482. Request approval before applying fix
493. If approved, apply fix and show result
504. DO NOT return to parent automatically
515. User decides next steps manually
52
53**Example Flow with --complete:**
54```
55deploy-apply fails with AccessDenied
56 ↓
57infra-deployer offers 3 options, user selects Option 2: "Run debug --complete"
58 ↓
59infra-debugger --complete invoked
60 ↓
61Categorizes as permission error
62 ↓
63Delegates to infra-permission-manager automatically
64 ↓
65Permission added to audit file and applied to AWS
66 ↓
67infra-debugger returns to infra-deployer with success
68 ↓
69infra-deployer continues deployment automatically
70 ↓
71Deployment completes successfully
72```
73
74**When to Use:**
75- Use --complete for automated fix-and-continue workflows
76- Especially useful in CI/CD pipelines
77- User trusts automated fixes
78- DO NOT use --complete for production environments (requires manual review)
79
80**When NOT to Use:**
81- Production deployments (always review fixes manually)
82- Complex multi-step fixes
83- When user wants to review proposed solution first
84</COMPLETE_FLAG_BEHAVIOR>
85
86<ERROR_CATEGORIES>
87Errors are categorized into these types:
88
89**1. Permission Errors**
90- Symptoms: AccessDenied, UnauthorizedOperation, InvalidPermissions
91- Delegation: infra-permission-manager
92- Automation: High (can add permissions to audit file)
93- Common causes: Missing IAM permissions, wrong AWS profile
94
95**2. Configuration Errors**
96- Symptoms: InvalidConfiguration, ValidationError, MissingParameter
97- Delegation: None (fix locally)
98- Automation: Medium (can update config files)
99- Common causes: Typos, invalid values, missing required fields
100
101**3. Resource Errors**
102- Symptoms: ResourceNotFound, ResourceAlreadyExists, DependencyViolation
103- Delegation: Varies by resource type
104- Automation: Low (usually requires manual review)
105- Common causes: Resource conflicts, incorrect references, missing dependencies
106
107**4. State Errors**
108- Symptoms: StateLockedError, StateMismatch, BackendError
109- Delegation: None (state management)
110- Automation: Medium (can unlock state, refresh)
111- Common causes: Concurrent operations, corrupted state, backend issues
112
113**5. Network Errors**
114- Symptoms: TimeoutError, ConnectionRefused, DNSResolutionFailed
115- Delegation: None (external dependency)
116- Automation: Low (retry possible)
117- Common causes: Network connectivity, AWS service outages, firewall rules
118
119**6. Quota Errors**
120- Symptoms: LimitExceeded, QuotaExceeded, ThrottlingException
121- Delegation: None (requires AWS support)
122- Automation: None
123- Common causes: Account limits reached, need quota increase
124</ERROR_CATEGORIES>
125
126<WORKFLOW>
127**OUTPUT START MESSAGE:**
128```
129🔧 STARTING: Infrastructure Debugging
130Operation: ${operation}
131Environment: ${environment}
132Error: ${error_summary}
133───────────────────────────────────────
134```
135
136**EXECUTE STEPS:**
137
138**Step 1: Load Configuration**
139- Read: .fractary/plugins/faber-cloud/devops.json
140- Extract: environment settings, handlers, project info
141- Output: "✓ Configuration loaded"
142
143**Step 2: Categorize Error**
144- Read: workflow/categorize-error.md
145- Analyze error message and context
146- Determine: permission|config|resource|state|network|quota
147- Extract: error code, resource type, action
148- Output: "✓ Error categorized: ${category}"
149
150**Step 3: Normalize Error**
151- Remove variable parts (ARNs, IDs, timestamps)
152- Generate normalized error pattern
153- Create issue ID for tracking
154- Output: "✓ Error normalized: ${issue_id}"
155
156**Step 4: Search Issue Log**
157- Read: workflow/search-solutions.md
158- Execute: ../cloud-common/scripts/log-resolution.sh --action=search-solutions
159- Rank solutions by relevance and success rate
160- Output: "✓ Found ${solution_count} potential solutions"
161
162**Step 5: Analyze Solutions**
163- Read: workflow/analyze-solutions.md
164- Evaluate each solution for:
165 - Applicability to current context
166 - Success rate
167 - Automation capability
168 - Estimated resolution time
169- Select best solution
170- Output: "✓ Best solution selected: ${solution_description}"
171
172**Step 6: Propose Solution**
173- Generate detailed proposal with:
174 - Problem description
175 - Root cause analysis
176 - Proposed solution steps
177 - Automation capability
178 - Expected outcome
179- Determine if can be automated
180- Output: "✓ Solution proposed"
181
182**Step 7: Log Error**
183- If error is new or updated:
184 - Execute: ../cloud-common/scripts/log-resolution.sh --action=log-issue
185 - Document error with full context
186- Output: "✓ Error logged: ${issue_id}"
187
188**Step 8: Apply Fix (if --complete flag)**
189- If --complete flag present AND solution can be automated:
190 - Skip user confirmation
191 - Determine which skill to delegate to
192 - Invoke skill automatically (e.g., infra-permission-manager)
193 - Wait for skill completion
194 - Log resolution success/failure
195 - Return control to parent (infra-deployer) automatically
196- Output: "✓ Fix applied automatically: ${fix_description}"
197
198**Step 8 Alternative: Propose Fix (interactive mode)**
199- If --complete flag NOT present:
200 - Show proposed solution to user
201 - Request approval: "Apply this fix? (yes/no)"
202 - If approved: Apply fix
203 - If declined: User chooses next steps
204 - DO NOT return to parent automatically
205- Output: "✓ Solution proposed to user"
206
207**OUTPUT COMPLETION MESSAGE:**
208```
209✅ COMPLETED: Infrastructure Debugging
210Category: ${error_category}
211Issue ID: ${issue_id}
212Solutions Found: ${solution_count}
213Best Solution: ${solution_description}
214Can Automate: ${automated}
215${automation_info}
216───────────────────────────────────────
217Next: ${next_action}
218```
219
220**IF NO SOLUTION FOUND:**
221```
222⚠️ COMPLETED: Infrastructure Debugging (Novel Error)
223Category: ${error_category}
224Issue ID: ${issue_id}
225Solutions Found: 0
226
227This is a new error not seen before.
228Manual investigation required.
229───────────────────────────────────────
230Error has been logged for future reference.
231Please investigate and resolve manually.
232```
233
234**IF FAILURE:**
235```
236❌ FAILED: Infrastructure Debugging
237Step: ${failed_step}
238Error: ${debug_error}
239───────────────────────────────────────
240Resolution: Unable to analyze error
241```
242</WORKFLOW>
243
244<COMPLETION_CRITERIA>
245This skill is complete and successful when ALL verified:
246
247✅ **1. Error Categorized**
248- Error type determined
249- Error code extracted
250- Resource context identified
251
252✅ **2. Error Normalized**
253- Variable parts removed
254- Issue ID generated
255- Comparable pattern created
256
257✅ **3. Solutions Searched**
258- Issue log searched
259- Solutions ranked by relevance
260- Best solution identified (or none found)
261
262✅ **4. Proposal Generated**
263- Problem described clearly
264- Solution steps documented
265- Automation capability determined
266
267✅ **5. Error Logged**
268- Error recorded in issue log
269- Full context preserved
270- Available for future searches
271
272---
273
274**FAILURE CONDITIONS - Stop and report if:**
275❌ Cannot parse error message (return raw error to manager)
276❌ Issue log corrupted (attempt repair, inform manager)
277❌ Critical system error (escalate to manager)
278
279**PARTIAL COMPLETION - Not acceptable:**
280⚠️ Error not logged → Return to Step 7
281⚠️ No solution proposed → Generate "manual investigation" proposal
282</COMPLETION_CRITERIA>
283
284<OUTPUTS>
285After successful completion, return to agent:
286
2871. **Debug Report**
288 - Error category and code
289 - Issue ID for tracking
290 - Root cause analysis
291 - Proposed solution with steps
292
2932. **Delegation Instructions** (if automated)
294 - Target skill name
295 - Operation to perform
296 - Parameters to pass
297
2983. **Manual Instructions** (if not automated)
299 - Step-by-step resolution guide
300 - Commands to execute
301 - Verification steps
302
303Return to agent:
304```json
305{
306 "status": "solution_found|no_solution|novel_error",
307 "issue_id": "${issue_id}",
308 "error_category": "${category}",
309 "error_code": "${code}",
310 "resource_type": "${resource_type}",
311
312 "root_cause": "Human-readable explanation of what went wrong",
313
314 "proposed_solution": {
315 "description": "What this solution does",
316 "steps": ["Step 1", "Step 2", "Step 3"],
317 "automated": true|false,
318 "success_rate": 95.5,
319 "avg_resolution_time": 45
320 },
321
322 "delegation": {
323 "can_delegate": true|false,
324 "target_skill": "infra-permission-manager",
325 "operation": "auto-grant",
326 "parameters": {
327 "permission": "s3:PutObject",
328 "resource": "arn:aws:s3:::bucket-name"
329 }
330 },
331
332 "manual_steps": [
333 "If automated is false, provide manual steps here"
334 ]
335}
336```
337</OUTPUTS>
338
339<DELEGATION_PATTERNS>
340 <PERMISSION_ERROR>
341 When error_category == "permission":
342 Target: infra-permission-manager
343 Operation: auto-grant
344 Parameters: {
345 environment: ${environment},
346 permission: ${missing_permission},
347 resource: ${resource_arn}
348 }
349 </PERMISSION_ERROR>
350
351 <STATE_ERROR>
352 When error_category == "state":
353 Target: handler-iac-${iac_handler}
354 Operation: state-fix
355 Parameters: {
356 operation: "refresh|import|remove",
357 resource: ${resource_id}
358 }
359 </STATE_ERROR>
360
361 <CONFIG_ERROR>
362 When error_category == "config":
363 No automatic delegation - return manual steps
364 User must fix configuration issues
365 </CONFIG_ERROR>
366</DELEGATION_PATTERNS>
367
368<DOCUMENTATION>
369After analyzing error and proposing solution:
370
3711. Log error in issue log:
372 Execute: ../devops-common/scripts/log-resolution.sh --action=log-issue
373
3742. After solution is attempted (manager will call back):
375 Execute: ../devops-common/scripts/log-resolution.sh --action=log-solution
376 Update success rate based on outcome
377</DOCUMENTATION>
378
379<ERROR_HANDLING>
380 <ISSUE_LOG_NOT_FOUND>
381 Pattern: Issue log file doesn't exist
382 Action:
383 1. Initialize issue log from template
384 2. Continue with error logging
385 3. Note: First error logged
386 </ISSUE_LOG_NOT_FOUND>
387
388 <UNPARSEABLE_ERROR>
389 Pattern: Cannot extract meaningful information from error
390 Action:
391 1. Log raw error message
392 2. Categorize as "unknown"
393 3. Return to manager with request for manual investigation
394 </UNPARSEABLE_ERROR>
395
396 <MULTIPLE_MATCHING_SOLUTIONS>
397 Pattern: Multiple solutions with similar scores
398 Action:
399 1. Select solution with highest success rate
400 2. Include alternative solutions in proposal
401 3. Let manager/user choose if success rates similar
402 </MULTIPLE_MATCHING_SOLUTIONS>
403</ERROR_HANDLING>
404
405<LEARNING_MECHANISM>
406This skill learns from outcomes through:
407
4081. **Solution Success Tracking**
409 - Each resolution attempt updates solution success rate
410 - Failed solutions ranked lower in future searches
411 - Successful solutions promoted
412
4132. **Pattern Recognition**
414 - Normalized errors matched against historical patterns
415 - Similar contexts improve matching accuracy
416 - Related issues linked for pattern analysis
417
4183. **Automation Improvement**
419 - Successfully automated solutions marked for future auto-apply
420 - Failed automations fall back to manual steps
421 - Automation rate tracked as key metric
422
4234. **Context Learning**
424 - Environment-specific solutions ranked higher for same environment
425 - Resource-type patterns improve categorization
426 - Operation context improves solution matching
427</LEARNING_MECHANISM>
428
429<EXAMPLES>
430<example>
431Input: error_message="AccessDenied: User not authorized to perform s3:PutObject"
432Start: "🔧 STARTING: Infrastructure Debugging / Error: AccessDenied s3:PutObject"
433Process:
434 - Categorize: permission error
435 - Normalize: "accessdenied: user not authorized to perform s3:putobject"
436 - Search: Find 3 matching solutions
437 - Best solution: "Grant s3:PutObject permission" (95% success rate)
438 - Can automate: Yes, via infra-permission-manager
439Completion: "✅ COMPLETED: Infrastructure Debugging / Can Automate: Yes"
440Output: {
441 status: "solution_found",
442 error_category: "permission",
443 proposed_solution: {automated: true},
444 delegation: {target_skill: "infra-permission-manager", operation: "auto-grant"}
445}
446</example>
447
448<example>
449Input: error_message="Error: InvalidParameterValue: SecurityGroup sg-123 does not exist"
450Start: "🔧 STARTING: Infrastructure Debugging / Error: SecurityGroup does not exist"
451Process:
452 - Categorize: resource error
453 - Normalize: "invalidparametervalue: securitygroup does not exist"
454 - Search: Find 2 matching solutions
455 - Best solution: "Create security group first" (80% success rate)
456 - Can automate: No, requires infrastructure change
457Completion: "✅ COMPLETED: Infrastructure Debugging / Can Automate: No"
458Output: {
459 status: "solution_found",
460 error_category: "resource",
461 proposed_solution: {automated: false},
462 manual_steps: ["Create security group before deploying dependent resources"]
463}
464</example>
465
466<example>
467Input: error_message="Error: Some completely novel error never seen before"
468Start: "🔧 STARTING: Infrastructure Debugging / Error: Novel error"
469Process:
470 - Categorize: unknown
471 - Normalize: "some completely novel error never seen before"
472 - Search: No matching solutions found
473 - Log as new issue
474 - Propose manual investigation
475Completion: "⚠️ COMPLETED: Infrastructure Debugging (Novel Error) / Solutions Found: 0"
476Output: {
477 status: "novel_error",
478 error_category: "unknown",
479 manual_steps: ["Investigate error manually", "Document solution for future"]
480}
481</example>
482</EXAMPLES>