@paulduvall/claude-dev-toolkit 0.0.1-alpha.2 → 0.0.1-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -6
- package/commands/active/xarchitecture.md +393 -0
- package/commands/active/xconfig.md +127 -0
- package/commands/active/xdebug.md +130 -0
- package/commands/active/xdocs.md +178 -0
- package/commands/active/xgit.md +149 -0
- package/commands/active/xpipeline.md +152 -0
- package/commands/active/xquality.md +96 -0
- package/commands/active/xrefactor.md +198 -0
- package/commands/active/xrelease.md +142 -0
- package/commands/active/xsecurity.md +92 -0
- package/commands/active/xspec.md +174 -0
- package/commands/active/xtdd.md +151 -0
- package/commands/active/xtest.md +89 -0
- package/commands/experiments/xact.md +742 -0
- package/commands/experiments/xanalytics.md +113 -0
- package/commands/experiments/xanalyze.md +70 -0
- package/commands/experiments/xapi.md +161 -0
- package/commands/experiments/xatomic.md +112 -0
- package/commands/experiments/xaws.md +85 -0
- package/commands/experiments/xcicd.md +337 -0
- package/commands/experiments/xcommit.md +122 -0
- package/commands/experiments/xcompliance.md +182 -0
- package/commands/experiments/xconstraints.md +89 -0
- package/commands/experiments/xcoverage.md +90 -0
- package/commands/experiments/xdb.md +102 -0
- package/commands/experiments/xdesign.md +121 -0
- package/commands/experiments/xevaluate.md +111 -0
- package/commands/experiments/xfootnote.md +12 -0
- package/commands/experiments/xgenerate.md +117 -0
- package/commands/experiments/xgovernance.md +149 -0
- package/commands/experiments/xgreen.md +66 -0
- package/commands/experiments/xiac.md +118 -0
- package/commands/experiments/xincident.md +137 -0
- package/commands/experiments/xinfra.md +115 -0
- package/commands/experiments/xknowledge.md +115 -0
- package/commands/experiments/xmaturity.md +120 -0
- package/commands/experiments/xmetrics.md +118 -0
- package/commands/experiments/xmonitoring.md +128 -0
- package/commands/experiments/xnew.md +898 -0
- package/commands/experiments/xobservable.md +114 -0
- package/commands/experiments/xoidc.md +165 -0
- package/commands/experiments/xoptimize.md +115 -0
- package/commands/experiments/xperformance.md +112 -0
- package/commands/experiments/xplanning.md +131 -0
- package/commands/experiments/xpolicy.md +115 -0
- package/commands/experiments/xproduct.md +98 -0
- package/commands/experiments/xreadiness.md +75 -0
- package/commands/experiments/xred.md +55 -0
- package/commands/experiments/xrisk.md +128 -0
- package/commands/experiments/xrules.md +124 -0
- package/commands/experiments/xsandbox.md +120 -0
- package/commands/experiments/xscan.md +102 -0
- package/commands/experiments/xsetup.md +123 -0
- package/commands/experiments/xtemplate.md +116 -0
- package/commands/experiments/xtrace.md +212 -0
- package/commands/experiments/xux.md +171 -0
- package/commands/experiments/xvalidate.md +104 -0
- package/commands/experiments/xworkflow.md +113 -0
- package/hooks/README.md +231 -0
- package/hooks/file-logger.sh +98 -0
- package/hooks/lib/argument-parser.sh +422 -0
- package/hooks/lib/config-constants.sh +230 -0
- package/hooks/lib/context-manager.sh +549 -0
- package/hooks/lib/error-handler.sh +412 -0
- package/hooks/lib/execution-engine.sh +627 -0
- package/hooks/lib/file-utils.sh +375 -0
- package/hooks/lib/subagent-discovery.sh +465 -0
- package/hooks/lib/subagent-validator.sh +597 -0
- package/hooks/on-error-debug.sh +221 -0
- package/hooks/pre-commit-quality.sh +204 -0
- package/hooks/pre-write-security.sh +107 -0
- package/hooks/prevent-credential-exposure.sh +265 -0
- package/hooks/subagent-trigger-simple.sh +193 -0
- package/hooks/subagent-trigger.sh +253 -0
- package/lib/hook-installer-core.js +2 -2
- package/package.json +3 -1
- package/scripts/postinstall.js +28 -10
- package/templates/README.md +100 -0
- package/templates/basic-settings.json +30 -0
- package/templates/comprehensive-settings.json +206 -0
- package/templates/hybrid-hook-config.yaml +133 -0
- package/templates/security-focused-settings.json +62 -0
- package/templates/subagent-hooks.yaml +188 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Comprehensive development governance framework for policies, audits, and compliance
|
|
3
|
+
tags: [governance, policies, audits, compliance, controls, standards]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Manage development governance based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
First, examine current governance structure and documentation:
|
|
9
|
+
!find . -name "*policy*" -o -name "*governance*" -o -name "*compliance*" | head -10
|
|
10
|
+
!ls -la | grep -E "(POLICY|COMPLIANCE|GOVERNANCE)"
|
|
11
|
+
!find . -name "*.md" | grep -E "(policy|standard|procedure)" | head -5
|
|
12
|
+
|
|
13
|
+
Based on $ARGUMENTS, perform the appropriate governance operation:
|
|
14
|
+
|
|
15
|
+
## 1. Policy Management
|
|
16
|
+
|
|
17
|
+
If managing policies (--policy):
|
|
18
|
+
!find . -name "POLICY.md" -o -name "policies/" | head -3
|
|
19
|
+
!grep -r "policy" . --include="*.md" | head -5
|
|
20
|
+
|
|
21
|
+
Policy operations:
|
|
22
|
+
- Create new development policies
|
|
23
|
+
- Validate existing policy compliance
|
|
24
|
+
- Update policies based on requirements
|
|
25
|
+
- Track policy exceptions and approvals
|
|
26
|
+
- Enforce policy across projects
|
|
27
|
+
|
|
28
|
+
## 2. Governance Audit
|
|
29
|
+
|
|
30
|
+
If running audit (--audit):
|
|
31
|
+
!git log --since="30 days ago" --pretty=format:"%h %s" | head -10
|
|
32
|
+
!find . -name "*audit*" -o -name "*review*" | head -5
|
|
33
|
+
!ls -la .github/ 2>/dev/null || echo "No GitHub configuration found"
|
|
34
|
+
|
|
35
|
+
Audit activities:
|
|
36
|
+
- Review code quality standards compliance
|
|
37
|
+
- Check security policy adherence
|
|
38
|
+
- Validate development process maturity
|
|
39
|
+
- Assess risk management effectiveness
|
|
40
|
+
- Generate audit findings and recommendations
|
|
41
|
+
|
|
42
|
+
## 3. Compliance Assessment
|
|
43
|
+
|
|
44
|
+
If checking compliance (--compliance):
|
|
45
|
+
!grep -r "compliance" . --include="*.md" --include="*.yml" | head -5
|
|
46
|
+
!find . -name "*cert*" -o -name "*standard*" | head -3
|
|
47
|
+
|
|
48
|
+
Compliance checks:
|
|
49
|
+
- SOC 2 compliance validation
|
|
50
|
+
- ISO 27001 adherence assessment
|
|
51
|
+
- GDPR data protection compliance
|
|
52
|
+
- Industry-specific regulatory requirements
|
|
53
|
+
- Certification readiness evaluation
|
|
54
|
+
|
|
55
|
+
## 4. Controls Implementation
|
|
56
|
+
|
|
57
|
+
If managing controls (--controls):
|
|
58
|
+
!find . -name "*.yml" -o -name "*.yaml" | grep -E "(workflow|action|pipeline)" | head -5
|
|
59
|
+
!ls -la .github/workflows/ 2>/dev/null || echo "No CI/CD workflows found"
|
|
60
|
+
|
|
61
|
+
Governance controls:
|
|
62
|
+
- Implement automated compliance checks
|
|
63
|
+
- Set up governance monitoring
|
|
64
|
+
- Configure approval workflows
|
|
65
|
+
- Establish access controls
|
|
66
|
+
- Monitor control effectiveness
|
|
67
|
+
|
|
68
|
+
## 5. Standards Management
|
|
69
|
+
|
|
70
|
+
If managing standards (--standards):
|
|
71
|
+
!find . -name "*standard*" -o -name "*guideline*" | head -5
|
|
72
|
+
!python -m flake8 --version 2>/dev/null || echo "No Python linting standards"
|
|
73
|
+
!eslint --version 2>/dev/null || echo "No JavaScript linting standards"
|
|
74
|
+
|
|
75
|
+
Standards enforcement:
|
|
76
|
+
- Define coding standards
|
|
77
|
+
- Implement documentation standards
|
|
78
|
+
- Establish security standards
|
|
79
|
+
- Create architecture guidelines
|
|
80
|
+
- Monitor standards compliance
|
|
81
|
+
|
|
82
|
+
## 6. Review Processes
|
|
83
|
+
|
|
84
|
+
If managing reviews (--review):
|
|
85
|
+
!git log --grep="review" --oneline | head -5
|
|
86
|
+
!find . -name "CODEOWNERS" -o -name "*review*" | head -3
|
|
87
|
+
|
|
88
|
+
Review governance:
|
|
89
|
+
- Code review requirements and processes
|
|
90
|
+
- Architecture review checkpoints
|
|
91
|
+
- Security review mandatory gates
|
|
92
|
+
- Compliance review procedures
|
|
93
|
+
- Approval workflow management
|
|
94
|
+
|
|
95
|
+
## 7. Gap Analysis
|
|
96
|
+
|
|
97
|
+
If performing gap analysis (--gap-analysis):
|
|
98
|
+
!find . -name "*.md" | xargs grep -l "requirement" | head -5
|
|
99
|
+
!grep -r "TODO\|FIXME" . --include="*.py" --include="*.js" | wc -l
|
|
100
|
+
|
|
101
|
+
Identify gaps in:
|
|
102
|
+
- Policy coverage and implementation
|
|
103
|
+
- Compliance requirements fulfillment
|
|
104
|
+
- Control effectiveness
|
|
105
|
+
- Process maturity
|
|
106
|
+
- Documentation completeness
|
|
107
|
+
|
|
108
|
+
## 8. Metrics and Reporting
|
|
109
|
+
|
|
110
|
+
If generating reports (--metrics, --dashboard):
|
|
111
|
+
!git shortlog -sn --since="30 days ago" | head -10
|
|
112
|
+
!find . -name "*test*" | wc -l
|
|
113
|
+
!uptime
|
|
114
|
+
|
|
115
|
+
Governance metrics:
|
|
116
|
+
- Policy compliance rates
|
|
117
|
+
- Audit finding resolution time
|
|
118
|
+
- Control effectiveness measures
|
|
119
|
+
- Process maturity indicators
|
|
120
|
+
- Risk exposure levels
|
|
121
|
+
|
|
122
|
+
Think step by step about governance requirements and provide:
|
|
123
|
+
|
|
124
|
+
1. **Current State Assessment**:
|
|
125
|
+
- Existing governance structure
|
|
126
|
+
- Policy coverage and gaps
|
|
127
|
+
- Compliance status
|
|
128
|
+
- Control effectiveness
|
|
129
|
+
|
|
130
|
+
2. **Risk Analysis**:
|
|
131
|
+
- Governance risk exposure
|
|
132
|
+
- Compliance risks
|
|
133
|
+
- Process risks
|
|
134
|
+
- Technology risks
|
|
135
|
+
|
|
136
|
+
3. **Improvement Plan**:
|
|
137
|
+
- Priority governance actions
|
|
138
|
+
- Policy updates needed
|
|
139
|
+
- Control enhancements
|
|
140
|
+
- Process improvements
|
|
141
|
+
|
|
142
|
+
4. **Implementation Roadmap**:
|
|
143
|
+
- Phased implementation approach
|
|
144
|
+
- Resource requirements
|
|
145
|
+
- Timeline and milestones
|
|
146
|
+
- Success metrics
|
|
147
|
+
|
|
148
|
+
Generate comprehensive governance assessment with actionable recommendations for improving organizational governance maturity.
|
|
149
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Make failing tests pass following TDD Green phase principles with minimal implementation
|
|
3
|
+
tags: [tdd, testing, green-phase, minimal-implementation, specifications]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /xgreen — Make Tests Pass
|
|
7
|
+
|
|
8
|
+
Implement minimal code to make failing tests pass following TDD Green phase principles.
|
|
9
|
+
|
|
10
|
+
Think step by step:
|
|
11
|
+
1. Check for SpecDriven AI project structure and existing tests
|
|
12
|
+
2. Identify currently failing tests and their requirements
|
|
13
|
+
3. Guide minimal implementation to make tests pass
|
|
14
|
+
4. Verify all tests pass before proceeding to refactor phase
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
/xgreen --minimal # Implement just enough to pass
|
|
20
|
+
/xgreen --check # Verify tests pass
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Implementation Steps
|
|
24
|
+
|
|
25
|
+
When implementing code to make tests pass:
|
|
26
|
+
|
|
27
|
+
1. **For minimal implementation (--minimal)**:
|
|
28
|
+
- Check if SpecDriven AI project structure exists (specs/ directory)
|
|
29
|
+
- If not found, suggest running `!xsetup --env` to initialize
|
|
30
|
+
- Verify that failing tests exist in @specs/tests/
|
|
31
|
+
- If no tests found, suggest creating tests first with `/xred --spec <spec-id>`
|
|
32
|
+
- Run test suite to identify failing tests and their requirements
|
|
33
|
+
- Provide guidance on GREEN phase principles for minimal implementation
|
|
34
|
+
- After implementation, verify tests pass with detailed output
|
|
35
|
+
|
|
36
|
+
2. **For verification (--check)**:
|
|
37
|
+
- Run comprehensive test suite with detailed reporting
|
|
38
|
+
- Show test coverage information if available
|
|
39
|
+
- Provide clear pass/fail status for GREEN phase completion
|
|
40
|
+
- Guide next steps in TDD workflow based on results
|
|
41
|
+
|
|
42
|
+
3. **Error handling**:
|
|
43
|
+
- Validate project structure and test environment
|
|
44
|
+
- Handle cases where tests are already passing
|
|
45
|
+
- Provide clear feedback on test failures and requirements
|
|
46
|
+
- Suggest appropriate next steps based on current state
|
|
47
|
+
|
|
48
|
+
## GREEN Phase Principles
|
|
49
|
+
|
|
50
|
+
Guide implementation following these principles:
|
|
51
|
+
- Make tests pass with MINIMAL code only
|
|
52
|
+
- Don't worry about code quality or elegance yet
|
|
53
|
+
- Hardcode values if necessary to make tests pass
|
|
54
|
+
- Focus on making tests green, not perfect code
|
|
55
|
+
- Avoid adding extra functionality beyond test requirements
|
|
56
|
+
- Save optimization and refactoring for the next phase
|
|
57
|
+
|
|
58
|
+
## Expected Outputs
|
|
59
|
+
|
|
60
|
+
- Clear identification of failing tests and requirements
|
|
61
|
+
- Guidance for minimal implementation strategies
|
|
62
|
+
- Verification that all tests pass after implementation
|
|
63
|
+
- Test coverage reporting when available
|
|
64
|
+
- Next steps in TDD workflow (refactor or commit)
|
|
65
|
+
|
|
66
|
+
Use $ARGUMENTS to handle command-line parameters and `!` prefix for running test commands and coverage analysis.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Comprehensive Infrastructure as Code management with focus on AWS IAM, Terraform, CloudFormation, and infrastructure validation
|
|
3
|
+
tags: [infrastructure, terraform, cloudformation, iam, aws, security, compliance]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Manage Infrastructure as Code operations based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
First, examine the current IaC setup:
|
|
9
|
+
!find . -name "*.tf" -o -name "*.yml" -o -name "*.yaml" | grep -E "(terraform|cloudformation|infra)" | head -10
|
|
10
|
+
!ls -la terraform/ cloudformation/ infrastructure/ iac/ 2>/dev/null || echo "No IaC directories found"
|
|
11
|
+
!which terraform 2>/dev/null && terraform version || echo "Terraform not available"
|
|
12
|
+
!which aws 2>/dev/null && aws --version || echo "AWS CLI not available"
|
|
13
|
+
!docker --version 2>/dev/null || echo "Docker not available"
|
|
14
|
+
|
|
15
|
+
Based on $ARGUMENTS, perform the appropriate Infrastructure as Code operation:
|
|
16
|
+
|
|
17
|
+
## 1. Infrastructure Scanning and Discovery
|
|
18
|
+
|
|
19
|
+
If scanning infrastructure (--scan, --discover, --inventory):
|
|
20
|
+
!find . -name "*.tf" | head -10
|
|
21
|
+
!find . -name "*.yml" -o -name "*.yaml" | xargs grep -l "Resources\|AWSTemplateFormatVersion" 2>/dev/null | head -5
|
|
22
|
+
!aws sts get-caller-identity 2>/dev/null || echo "AWS credentials not configured"
|
|
23
|
+
!aws iam list-roles --max-items 5 2>/dev/null || echo "No AWS access or roles not accessible"
|
|
24
|
+
|
|
25
|
+
Scan and discover infrastructure:
|
|
26
|
+
- Analyze existing IaC files and configurations
|
|
27
|
+
- Discover cloud resources and dependencies
|
|
28
|
+
- Generate infrastructure inventory
|
|
29
|
+
- Detect configuration drift
|
|
30
|
+
- Map resource relationships
|
|
31
|
+
|
|
32
|
+
## 2. Terraform Operations
|
|
33
|
+
|
|
34
|
+
If managing Terraform (--terraform, --tf-validate, --tf-plan):
|
|
35
|
+
!terraform version 2>/dev/null || echo "Terraform not installed"
|
|
36
|
+
!ls -la *.tf terraform/ 2>/dev/null || echo "No Terraform files found"
|
|
37
|
+
!terraform init -backend=false 2>/dev/null || echo "Terraform not initialized"
|
|
38
|
+
!terraform validate 2>/dev/null || echo "Terraform validation failed"
|
|
39
|
+
|
|
40
|
+
Manage Terraform infrastructure:
|
|
41
|
+
- Validate and format Terraform configurations
|
|
42
|
+
- Plan and apply infrastructure changes
|
|
43
|
+
- Manage Terraform state and modules
|
|
44
|
+
- Handle provider configurations
|
|
45
|
+
- Perform terraform operations safely
|
|
46
|
+
|
|
47
|
+
## 3. CloudFormation Operations
|
|
48
|
+
|
|
49
|
+
If managing CloudFormation (--cloudformation, --cf-validate, --cf-deploy):
|
|
50
|
+
!find . -name "*.yml" -o -name "*.yaml" -o -name "*.json" | xargs grep -l "AWSTemplateFormatVersion" 2>/dev/null | head -5
|
|
51
|
+
!aws cloudformation validate-template --template-body file://template.yml 2>/dev/null || echo "No valid CloudFormation templates found"
|
|
52
|
+
!aws cloudformation list-stacks --stack-status-filter CREATE_COMPLETE UPDATE_COMPLETE 2>/dev/null | head -10 || echo "No CloudFormation access"
|
|
53
|
+
|
|
54
|
+
Manage CloudFormation infrastructure:
|
|
55
|
+
- Validate and lint CloudFormation templates
|
|
56
|
+
- Deploy and manage CloudFormation stacks
|
|
57
|
+
- Handle stack updates and rollbacks
|
|
58
|
+
- Manage nested stacks and dependencies
|
|
59
|
+
- Monitor stack events and status
|
|
60
|
+
|
|
61
|
+
## 4. IAM Security Management
|
|
62
|
+
|
|
63
|
+
If managing IAM (--iam-roles, --iam-policies, --iam-validate):
|
|
64
|
+
!find . -name "*.tf" -o -name "*.yml" -o -name "*.yaml" | xargs grep -l "iam\|IAM" 2>/dev/null | head -5
|
|
65
|
+
!aws iam list-roles --max-items 10 2>/dev/null || echo "IAM access not available"
|
|
66
|
+
!grep -r "aws_iam\|AWS::IAM" . --include="*.tf" --include="*.yml" --include="*.yaml" | head -5 2>/dev/null
|
|
67
|
+
|
|
68
|
+
Manage IAM security:
|
|
69
|
+
- Analyze and validate IAM roles and policies
|
|
70
|
+
- Check least privilege compliance
|
|
71
|
+
- Scan for overly permissive policies
|
|
72
|
+
- Validate IAM policy syntax and logic
|
|
73
|
+
- Assess security posture and risks
|
|
74
|
+
|
|
75
|
+
## 5. Security and Compliance Scanning
|
|
76
|
+
|
|
77
|
+
If performing security analysis (--security-scan, --compliance, --secrets-scan):
|
|
78
|
+
!pip install checkov 2>/dev/null || echo "Install checkov: pip install checkov"
|
|
79
|
+
!checkov -f . --framework terraform cloudformation 2>/dev/null || echo "Checkov not available"
|
|
80
|
+
!grep -r "password\|secret\|key" . --include="*.tf" --include="*.yml" --include="*.yaml" | grep -v "example\|template" | head -5 2>/dev/null
|
|
81
|
+
|
|
82
|
+
Perform security analysis:
|
|
83
|
+
- Scan for security vulnerabilities
|
|
84
|
+
- Check compliance with security standards
|
|
85
|
+
- Detect hardcoded secrets and credentials
|
|
86
|
+
- Validate encryption and security controls
|
|
87
|
+
- Generate security assessment reports
|
|
88
|
+
|
|
89
|
+
Think step by step about Infrastructure as Code requirements and provide:
|
|
90
|
+
|
|
91
|
+
1. **Current State Assessment**:
|
|
92
|
+
- Existing IaC tool usage and maturity
|
|
93
|
+
- Infrastructure security posture
|
|
94
|
+
- Compliance gaps and risks
|
|
95
|
+
- Resource organization and management
|
|
96
|
+
|
|
97
|
+
2. **IaC Strategy**:
|
|
98
|
+
- Tool selection and standardization
|
|
99
|
+
- Module and template design patterns
|
|
100
|
+
- State management and collaboration
|
|
101
|
+
- Security and compliance integration
|
|
102
|
+
|
|
103
|
+
3. **Implementation Plan**:
|
|
104
|
+
- IaC adoption and migration strategy
|
|
105
|
+
- CI/CD pipeline integration
|
|
106
|
+
- Testing and validation framework
|
|
107
|
+
- Team training and knowledge transfer
|
|
108
|
+
|
|
109
|
+
4. **Operational Excellence**:
|
|
110
|
+
- Monitoring and drift detection
|
|
111
|
+
- Cost optimization strategies
|
|
112
|
+
- Disaster recovery and backup
|
|
113
|
+
- Continuous security assessment
|
|
114
|
+
|
|
115
|
+
Generate comprehensive Infrastructure as Code management plan with security controls, compliance checks, automation strategies, and operational best practices.
|
|
116
|
+
|
|
117
|
+
If no specific operation is provided, perform IaC readiness assessment and recommend implementation strategy based on current infrastructure setup and organizational needs.
|
|
118
|
+
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Incident response automation, post-mortem analysis, and system reliability improvement through SpecDriven AI methodology
|
|
3
|
+
tags: [incident-response, monitoring, post-mortem, reliability, automation]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /xincident - Incident Response & Management
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
Automate incident response procedures, facilitate post-mortem analysis, and improve system reliability through SpecDriven AI methodology.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Incident Response
|
|
14
|
+
```bash
|
|
15
|
+
/xincident --respond <alert> # Automated incident response procedures
|
|
16
|
+
/xincident --triage <severity> # Triage and prioritize incidents
|
|
17
|
+
/xincident --escalate <level> # Escalation procedures and notifications
|
|
18
|
+
/xincident --status <incident-id> # Update incident status and timeline
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Communication & Coordination
|
|
22
|
+
```bash
|
|
23
|
+
/xincident --communicate <team> # Generate incident communication templates
|
|
24
|
+
/xincident --notify <stakeholders> # Notify relevant stakeholders
|
|
25
|
+
/xincident --updates <incident-id> # Create status updates for stakeholders
|
|
26
|
+
/xincident --bridge <participants> # Set up communication bridge
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Investigation & Analysis
|
|
30
|
+
```bash
|
|
31
|
+
/xincident --investigate <symptoms> # Guide investigation procedures
|
|
32
|
+
/xincident --timeline <incident-id> # Build incident timeline
|
|
33
|
+
/xincident --evidence <source> # Collect and preserve evidence
|
|
34
|
+
/xincident --root-cause <incident> # Root cause analysis framework
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Recovery & Mitigation
|
|
38
|
+
```bash
|
|
39
|
+
/xincident --recover <system> # System recovery procedures
|
|
40
|
+
/xincident --rollback <deployment> # Automated rollback procedures
|
|
41
|
+
/xincident --mitigate <impact> # Implement mitigation strategies
|
|
42
|
+
/xincident --validate <recovery> # Validate recovery success
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Post-Mortem & Learning
|
|
46
|
+
```bash
|
|
47
|
+
/xincident --postmortem <id> # Generate post-mortem template
|
|
48
|
+
/xincident --lessons <incident> # Capture lessons learned
|
|
49
|
+
/xincident --actions <findings> # Create action items from analysis
|
|
50
|
+
/xincident --improvement <area> # Process improvement recommendations
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Monitoring & Prevention
|
|
54
|
+
```bash
|
|
55
|
+
/xincident --metrics <timeframe> # Incident metrics and trends
|
|
56
|
+
/xincident --patterns <history> # Identify recurring patterns
|
|
57
|
+
/xincident --prevention <type> # Preventive measures recommendations
|
|
58
|
+
/xincident --readiness <team> # Assess incident response readiness
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Examples
|
|
62
|
+
|
|
63
|
+
### Respond to Production Alert
|
|
64
|
+
```bash
|
|
65
|
+
/xincident --respond "api-latency-high"
|
|
66
|
+
# Creates: incidents/2024-01-15-api-latency/response-plan.md with automated procedures
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Generate Post-Mortem Report
|
|
70
|
+
```bash
|
|
71
|
+
/xincident --postmortem "inc-2024-001"
|
|
72
|
+
# Creates: incidents/inc-2024-001/postmortem.md with timeline, root cause, and actions
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Escalate Critical Incident
|
|
76
|
+
```bash
|
|
77
|
+
/xincident --escalate "level-2"
|
|
78
|
+
# Generates: escalation notifications and procedures for level-2 incidents
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Analyze Incident Patterns
|
|
82
|
+
```bash
|
|
83
|
+
/xincident --patterns "last-quarter"
|
|
84
|
+
# Creates: reports/incident-patterns-q4.md with trend analysis and recommendations
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## SpecDriven AI Integration
|
|
88
|
+
|
|
89
|
+
### Incident Specifications
|
|
90
|
+
- Links incidents to specifications: `{#inc1a authority=system}`
|
|
91
|
+
- Traces failures to requirements
|
|
92
|
+
- Validates recovery against specifications
|
|
93
|
+
|
|
94
|
+
### Dual Coverage
|
|
95
|
+
- **Incident Coverage**: All critical systems have response procedures
|
|
96
|
+
- **Recovery Coverage**: All failure modes have documented recovery
|
|
97
|
+
|
|
98
|
+
### Traceability
|
|
99
|
+
- Links incidents to system specifications
|
|
100
|
+
- Traces post-mortem actions to requirements
|
|
101
|
+
- Connects patterns to architectural decisions
|
|
102
|
+
|
|
103
|
+
## Incident Response Framework
|
|
104
|
+
|
|
105
|
+
### Severity Levels
|
|
106
|
+
- **SEV-1**: Critical impact, immediate response required
|
|
107
|
+
- **SEV-2**: High impact, response within 1 hour
|
|
108
|
+
- **SEV-3**: Medium impact, response within 4 hours
|
|
109
|
+
- **SEV-4**: Low impact, response within 24 hours
|
|
110
|
+
|
|
111
|
+
### Response Phases
|
|
112
|
+
1. **Detection**: Alert generation and initial assessment
|
|
113
|
+
2. **Response**: Immediate containment and mitigation
|
|
114
|
+
3. **Recovery**: System restoration and validation
|
|
115
|
+
4. **Learning**: Post-mortem and improvement actions
|
|
116
|
+
|
|
117
|
+
### Communication Templates
|
|
118
|
+
- **Initial Alert**: Stakeholder notification template
|
|
119
|
+
- **Status Updates**: Regular progress communications
|
|
120
|
+
- **Resolution Notice**: Incident closure notification
|
|
121
|
+
- **Post-Mortem Summary**: Executive summary template
|
|
122
|
+
|
|
123
|
+
## Integration Points
|
|
124
|
+
|
|
125
|
+
- **Monitoring systems**: Alert integration and automation
|
|
126
|
+
- **Communication tools**: Slack, email, and PagerDuty integration
|
|
127
|
+
- **Documentation**: Links to system specifications and runbooks
|
|
128
|
+
- **JIRA/GitHub**: Issue tracking and action item management
|
|
129
|
+
- **CI/CD**: Automated rollback and deployment procedures
|
|
130
|
+
|
|
131
|
+
## Output Formats
|
|
132
|
+
|
|
133
|
+
- **Response procedures**: Step-by-step incident response guides
|
|
134
|
+
- **Communication templates**: Stakeholder notification templates
|
|
135
|
+
- **Post-mortem reports**: Structured analysis and learning documents
|
|
136
|
+
- **Metrics dashboards**: Incident trends and performance indicators
|
|
137
|
+
- **Action plans**: Improvement roadmaps and prevention strategies
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Manage infrastructure operations, container orchestration, cloud resources, and deployment automation
|
|
3
|
+
tags: [infrastructure, containers, kubernetes, cloud, terraform, monitoring, scaling]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Manage infrastructure operations and cloud resources based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
First, examine the current infrastructure setup:
|
|
9
|
+
!find . -name "*.tf" -o -name "*.yml" -o -name "*.yaml" | grep -E "(terraform|infra|k8s|docker)" | head -10
|
|
10
|
+
!ls -la docker-compose.yml Dockerfile terraform/ k8s/ infrastructure/ 2>/dev/null || echo "No infrastructure files found"
|
|
11
|
+
!which docker 2>/dev/null && docker --version || echo "Docker not available"
|
|
12
|
+
!which kubectl 2>/dev/null && kubectl version --client || echo "kubectl not available"
|
|
13
|
+
!which terraform 2>/dev/null && terraform version || echo "Terraform not available"
|
|
14
|
+
|
|
15
|
+
Based on $ARGUMENTS, perform the appropriate infrastructure operation:
|
|
16
|
+
|
|
17
|
+
## 1. Container Management
|
|
18
|
+
|
|
19
|
+
If managing containers (--containers, --docker, --kubernetes):
|
|
20
|
+
!docker ps 2>/dev/null || echo "Docker daemon not running"
|
|
21
|
+
!kubectl get nodes 2>/dev/null || echo "No Kubernetes cluster connection"
|
|
22
|
+
!ls -la docker-compose.yml 2>/dev/null || echo "No docker-compose.yml found"
|
|
23
|
+
|
|
24
|
+
Manage container infrastructure:
|
|
25
|
+
- Docker container orchestration
|
|
26
|
+
- Kubernetes cluster operations
|
|
27
|
+
- Container registry management
|
|
28
|
+
- Service mesh configuration
|
|
29
|
+
- Resource allocation and limits
|
|
30
|
+
|
|
31
|
+
## 2. Infrastructure as Code
|
|
32
|
+
|
|
33
|
+
If managing IaC (--terraform, --iac, --provision):
|
|
34
|
+
!find . -name "*.tf" | head -5
|
|
35
|
+
!terraform --version 2>/dev/null || echo "Terraform not installed"
|
|
36
|
+
!find . -name "*.yml" -o -name "*.yaml" | xargs grep -l "AWSTemplateFormatVersion\|Resources" 2>/dev/null | head -3
|
|
37
|
+
|
|
38
|
+
Manage infrastructure code:
|
|
39
|
+
- Terraform configuration and state
|
|
40
|
+
- CloudFormation template management
|
|
41
|
+
- Infrastructure provisioning automation
|
|
42
|
+
- Resource dependency management
|
|
43
|
+
- State management and locking
|
|
44
|
+
|
|
45
|
+
## 3. Monitoring and Observability
|
|
46
|
+
|
|
47
|
+
If setting up monitoring (--monitoring, --observability, --alerts):
|
|
48
|
+
!find . -name "*prometheus*" -o -name "*grafana*" | head -5
|
|
49
|
+
!ps aux | grep -E "(prometheus|grafana|jaeger)" | grep -v grep
|
|
50
|
+
!netstat -tuln 2>/dev/null | grep -E "(9090|3000|16686)" || echo "No monitoring services detected"
|
|
51
|
+
|
|
52
|
+
Configure monitoring infrastructure:
|
|
53
|
+
- Prometheus metrics collection
|
|
54
|
+
- Grafana dashboard setup
|
|
55
|
+
- Alert manager configuration
|
|
56
|
+
- Distributed tracing setup
|
|
57
|
+
- Log aggregation systems
|
|
58
|
+
|
|
59
|
+
## 4. Scaling and Performance
|
|
60
|
+
|
|
61
|
+
If configuring scaling (--scaling, --performance, --capacity):
|
|
62
|
+
!kubectl get hpa 2>/dev/null || echo "No HPA configured"
|
|
63
|
+
!find . -name "*.yml" -o -name "*.yaml" | xargs grep -l "autoscaling" 2>/dev/null | head -3
|
|
64
|
+
!docker stats --no-stream 2>/dev/null | head -5 || echo "No container stats available"
|
|
65
|
+
|
|
66
|
+
Implement scaling strategies:
|
|
67
|
+
- Horizontal Pod Autoscaling (HPA)
|
|
68
|
+
- Vertical Pod Autoscaling (VPA)
|
|
69
|
+
- Cluster autoscaling configuration
|
|
70
|
+
- Load balancer optimization
|
|
71
|
+
- Resource quota management
|
|
72
|
+
|
|
73
|
+
## 5. Security and Compliance
|
|
74
|
+
|
|
75
|
+
If managing security (--security, --compliance, --rbac):
|
|
76
|
+
!kubectl get networkpolicies 2>/dev/null || echo "No network policies found"
|
|
77
|
+
!find . -name "*.tf" | xargs grep -l "security_group\|iam_" 2>/dev/null | head -3
|
|
78
|
+
!kubectl get rbac 2>/dev/null || echo "No RBAC configured"
|
|
79
|
+
|
|
80
|
+
Implement security measures:
|
|
81
|
+
- Network policy configuration
|
|
82
|
+
- RBAC setup and management
|
|
83
|
+
- Security group rules
|
|
84
|
+
- Encryption at rest and in transit
|
|
85
|
+
- Compliance scanning and reporting
|
|
86
|
+
|
|
87
|
+
Think step by step about infrastructure requirements and provide:
|
|
88
|
+
|
|
89
|
+
1. **Infrastructure Assessment**:
|
|
90
|
+
- Current infrastructure state analysis
|
|
91
|
+
- Resource utilization evaluation
|
|
92
|
+
- Security posture assessment
|
|
93
|
+
- Compliance gap identification
|
|
94
|
+
|
|
95
|
+
2. **Architecture Strategy**:
|
|
96
|
+
- Scalability planning recommendations
|
|
97
|
+
- High availability design patterns
|
|
98
|
+
- Disaster recovery planning
|
|
99
|
+
- Multi-cloud considerations
|
|
100
|
+
|
|
101
|
+
3. **Implementation Plan**:
|
|
102
|
+
- Infrastructure as Code setup
|
|
103
|
+
- Container orchestration strategy
|
|
104
|
+
- Monitoring and observability integration
|
|
105
|
+
- Security controls implementation
|
|
106
|
+
|
|
107
|
+
4. **Operational Excellence**:
|
|
108
|
+
- Automation opportunities
|
|
109
|
+
- Cost optimization strategies
|
|
110
|
+
- Performance monitoring setup
|
|
111
|
+
- Incident response procedures
|
|
112
|
+
|
|
113
|
+
Generate comprehensive infrastructure configuration with security controls, monitoring setup, scaling strategies, and operational best practices.
|
|
114
|
+
|
|
115
|
+
If no specific operation is provided, perform infrastructure health assessment and recommend improvements based on current setup and industry best practices.
|