@paulduvall/claude-dev-toolkit 0.0.1-alpha.2 → 0.0.1-alpha.21
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/LICENSE +21 -0
- package/README.md +88 -37
- package/bin/claude-commands +307 -65
- package/commands/active/xarchitecture.md +393 -0
- package/commands/active/xconfig.md +127 -0
- package/commands/active/xcontinue.md +92 -0
- package/commands/active/xdebug.md +130 -0
- package/commands/active/xdocs.md +178 -0
- package/commands/active/xexplore.md +94 -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/active/xverify.md +80 -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/xdevcontainer.md +238 -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 +903 -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/.smellrc.example.json +19 -0
- package/hooks/README.md +263 -0
- package/hooks/check-commit-signing.py +127 -0
- package/hooks/check-complexity.py +38 -0
- package/hooks/check-security.py +37 -0
- package/hooks/claude-wrapper.sh +29 -0
- package/hooks/config.py +110 -0
- package/hooks/file-logger.sh +100 -0
- package/hooks/lib/argument-parser.sh +427 -0
- package/hooks/lib/config-constants.sh +230 -0
- package/hooks/lib/context-manager.sh +560 -0
- package/hooks/lib/error-handler.sh +423 -0
- package/hooks/lib/execution-engine.sh +444 -0
- package/hooks/lib/execution-results.sh +113 -0
- package/hooks/lib/execution-simulation.sh +114 -0
- package/hooks/lib/field-validators.sh +104 -0
- package/hooks/lib/file-utils.sh +398 -0
- package/hooks/lib/subagent-discovery.sh +468 -0
- package/hooks/lib/subagent-validator.sh +407 -0
- package/hooks/lib/validation-reporter.sh +134 -0
- package/hooks/on-error-debug.sh +226 -0
- package/hooks/pre-commit-quality.sh +204 -0
- package/hooks/pre-commit-test-runner.sh +132 -0
- package/hooks/pre-write-security.sh +115 -0
- package/hooks/prevent-credential-exposure.sh +279 -0
- package/hooks/security_bandit.py +177 -0
- package/hooks/security_checks.py +97 -0
- package/hooks/security_secrets.py +81 -0
- package/hooks/security_trojan.py +61 -0
- package/hooks/settings.example.json +52 -0
- package/hooks/smell_checks.py +238 -0
- package/hooks/smell_javascript.py +231 -0
- package/hooks/smell_python.py +110 -0
- package/hooks/smell_ruff.py +70 -0
- package/hooks/smell_types.py +72 -0
- package/hooks/subagent-trigger-simple.sh +202 -0
- package/hooks/subagent-trigger.sh +253 -0
- package/hooks/suppression.py +82 -0
- package/hooks/tab-color.sh +70 -0
- package/hooks/verify-before-edit.sh +135 -0
- package/lib/backup-restore-command.js +140 -0
- package/lib/base/base-command.js +252 -0
- package/lib/base/command-result.js +184 -0
- package/lib/config/constants.js +255 -0
- package/lib/config.js +48 -6
- package/lib/configure-command.js +428 -0
- package/lib/dependency-validator.js +64 -5
- package/lib/hook-installer-core.js +2 -2
- package/lib/installation-instruction-generator.js +213 -495
- package/lib/installer.js +134 -56
- package/lib/oidc-command.js +740 -0
- package/lib/services/backup-list-service.js +226 -0
- package/lib/services/backup-service.js +230 -0
- package/lib/services/command-installer-service.js +217 -0
- package/lib/services/logger-service.js +201 -0
- package/lib/services/package-manager-service.js +319 -0
- package/lib/services/platform-instruction-service.js +294 -0
- package/lib/services/recovery-instruction-service.js +348 -0
- package/lib/services/restore-service.js +221 -0
- package/lib/setup-command.js +359 -0
- package/lib/setup-wizard.js +155 -262
- package/lib/uninstall-command.js +100 -0
- package/lib/utils/claude-path-config.js +184 -0
- package/lib/utils/file-system-utils.js +152 -0
- package/lib/utils.js +8 -4
- package/lib/verify-command.js +430 -0
- package/package.json +7 -3
- package/scripts/postinstall.js +172 -157
- package/subagents/debug-specialist.md +7 -0
- package/templates/README.md +115 -0
- package/templates/basic-settings.json +30 -0
- package/templates/comprehensive-settings.json +57 -0
- package/templates/global-claude.md +344 -0
- package/templates/hybrid-hook-config.yaml +132 -0
- package/templates/security-focused-settings.json +62 -0
- package/templates/subagent-hooks.yaml +188 -0
- package/lib/package-manager-service.js +0 -270
- package/subagents/debug-context.md +0 -197
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate, validate, and test IAM policies with automated policy creation and best practices enforcement
|
|
3
|
+
tags: [iam, security, policies, aws, compliance, validation]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Manage IAM policies and security configurations based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
First, examine the current AWS and IAM setup:
|
|
9
|
+
!find . -name "*.tf" -o -name "*.yml" -o -name "*.yaml" | xargs grep -l "iam\|IAM" 2>/dev/null | head -5
|
|
10
|
+
!ls -la iam/ policies/ security/ terraform/ 2>/dev/null | head -3
|
|
11
|
+
!which aws 2>/dev/null && aws --version || echo "AWS CLI not available"
|
|
12
|
+
!aws sts get-caller-identity 2>/dev/null || echo "AWS credentials not configured"
|
|
13
|
+
|
|
14
|
+
Based on $ARGUMENTS, perform the appropriate IAM policy operation:
|
|
15
|
+
|
|
16
|
+
## 1. Policy Generation
|
|
17
|
+
|
|
18
|
+
If generating IAM policies (--generate, --service, --resource, --template):
|
|
19
|
+
!find . -name "*.json" | xargs grep -l "Version.*2012-10-17" 2>/dev/null | head -5
|
|
20
|
+
!aws iam list-roles --max-items 5 2>/dev/null || echo "IAM access not available"
|
|
21
|
+
!find . -name "*.tf" | xargs grep -l "aws_iam" 2>/dev/null | head -3
|
|
22
|
+
|
|
23
|
+
Generate IAM policies:
|
|
24
|
+
- Role-specific policy generation
|
|
25
|
+
- Service-based policy templates
|
|
26
|
+
- Resource-scoped policy creation
|
|
27
|
+
- Custom policy from specifications
|
|
28
|
+
- Template-based policy generation
|
|
29
|
+
|
|
30
|
+
## 2. Policy Validation
|
|
31
|
+
|
|
32
|
+
If validating policies (--validate, --lint, --syntax-check, --compliance):
|
|
33
|
+
!find . -name "*.json" -o -name "*.yml" -o -name "*.yaml" | head -10
|
|
34
|
+
!python -c "import json; print('JSON validation available')" 2>/dev/null || echo "Python JSON not available"
|
|
35
|
+
!which jq 2>/dev/null && echo "jq available for JSON processing" || echo "jq not available"
|
|
36
|
+
|
|
37
|
+
Validate policy configurations:
|
|
38
|
+
- JSON/YAML syntax validation
|
|
39
|
+
- Policy logic and structure checking
|
|
40
|
+
- Best practice compliance validation
|
|
41
|
+
- Security vulnerability detection
|
|
42
|
+
- Regulatory compliance assessment
|
|
43
|
+
|
|
44
|
+
## 3. Policy Testing and Simulation
|
|
45
|
+
|
|
46
|
+
If testing policies (--test, --simulate, --dry-run, --permissions-test):
|
|
47
|
+
!aws iam simulate-principal-policy --help 2>/dev/null | head -1 || echo "AWS IAM simulation not available"
|
|
48
|
+
!find . -name "*test*" | grep -i iam | head -3 2>/dev/null
|
|
49
|
+
!python -c "import boto3; print('AWS SDK available')" 2>/dev/null || echo "AWS SDK not available"
|
|
50
|
+
|
|
51
|
+
Test policy functionality:
|
|
52
|
+
- Policy simulation and evaluation
|
|
53
|
+
- Permission testing and verification
|
|
54
|
+
- Access control validation
|
|
55
|
+
- Scenario-based testing
|
|
56
|
+
- Integration testing with AWS services
|
|
57
|
+
|
|
58
|
+
## 4. Policy Analysis and Security
|
|
59
|
+
|
|
60
|
+
If analyzing policies (--analyze, --permissions, --vulnerabilities, --least-privilege):
|
|
61
|
+
!grep -r "\*" . --include="*.json" | grep -i "action\|resource" | head -5 2>/dev/null
|
|
62
|
+
!aws iam get-account-authorization-details 2>/dev/null | head -10 || echo "IAM account details not accessible"
|
|
63
|
+
!pip list | grep -E "(boto3|botocore)" 2>/dev/null || echo "AWS Python SDK not installed"
|
|
64
|
+
|
|
65
|
+
Analyze security posture:
|
|
66
|
+
- Permission scope and effectiveness analysis
|
|
67
|
+
- Overprivileged policy identification
|
|
68
|
+
- Least privilege compliance checking
|
|
69
|
+
- Security vulnerability assessment
|
|
70
|
+
- Policy optimization recommendations
|
|
71
|
+
|
|
72
|
+
## 5. Policy Management and Deployment
|
|
73
|
+
|
|
74
|
+
If managing policies (--deploy, --attach, --version, --rollback):
|
|
75
|
+
!aws iam list-policies --scope Local --max-items 5 2>/dev/null || echo "IAM policy listing not available"
|
|
76
|
+
!find . -name "*.tf" | xargs grep -l "aws_iam_policy" 2>/dev/null | head -3
|
|
77
|
+
!ls -la terraform/ cloudformation/ iac/ 2>/dev/null | head -3
|
|
78
|
+
|
|
79
|
+
Manage policy lifecycle:
|
|
80
|
+
- Policy deployment and attachment
|
|
81
|
+
- Version control and rollback
|
|
82
|
+
- Policy lifecycle management
|
|
83
|
+
- Automated policy updates
|
|
84
|
+
- Compliance monitoring and reporting
|
|
85
|
+
|
|
86
|
+
Think step by step about IAM policy requirements and provide:
|
|
87
|
+
|
|
88
|
+
1. **Security Assessment**:
|
|
89
|
+
- Current IAM policy configuration review
|
|
90
|
+
- Permission scope and access analysis
|
|
91
|
+
- Security vulnerability identification
|
|
92
|
+
- Compliance gap assessment
|
|
93
|
+
|
|
94
|
+
2. **Policy Strategy**:
|
|
95
|
+
- Least privilege principle implementation
|
|
96
|
+
- Role-based access control design
|
|
97
|
+
- Resource-specific permission scoping
|
|
98
|
+
- Conditional access policy creation
|
|
99
|
+
|
|
100
|
+
3. **Implementation Plan**:
|
|
101
|
+
- Policy generation and validation
|
|
102
|
+
- Testing and simulation framework
|
|
103
|
+
- Deployment and rollback procedures
|
|
104
|
+
- Monitoring and compliance tracking
|
|
105
|
+
|
|
106
|
+
4. **Security Optimization**:
|
|
107
|
+
- Policy optimization recommendations
|
|
108
|
+
- Security hardening measures
|
|
109
|
+
- Compliance alignment strategies
|
|
110
|
+
- Continuous security improvement
|
|
111
|
+
|
|
112
|
+
Generate comprehensive IAM policy management with security validation, compliance checking, testing framework, and deployment automation.
|
|
113
|
+
|
|
114
|
+
If no specific operation is provided, perform IAM security assessment and recommend policy improvements based on current configuration and security best practices.
|
|
115
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Product management and strategic planning tools for feature development and product lifecycle management
|
|
3
|
+
tags: [product-management, strategy, backlog, features, roadmap, metrics]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `/xproduct` - Product Management & Strategy
|
|
7
|
+
|
|
8
|
+
Product management and strategic planning tools for feature development and product lifecycle management.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
/xproduct --backlog # Manage product backlog with priorities
|
|
14
|
+
/xproduct --stories # Create and manage user stories
|
|
15
|
+
/xproduct --features # Feature flag management
|
|
16
|
+
/xproduct --feedback # Integrate user feedback
|
|
17
|
+
/xproduct --metrics # Track product KPIs
|
|
18
|
+
/xproduct --roadmap # Product roadmap planning
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Options
|
|
22
|
+
|
|
23
|
+
### `--backlog`
|
|
24
|
+
Manage and prioritize product backlog items.
|
|
25
|
+
|
|
26
|
+
**Examples:**
|
|
27
|
+
```bash
|
|
28
|
+
/xproduct --backlog # View current backlog
|
|
29
|
+
/xproduct --backlog --add "User authentication feature"
|
|
30
|
+
/xproduct --backlog --prioritize high
|
|
31
|
+
/xproduct --backlog --estimate
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### `--stories`
|
|
35
|
+
Create and manage user stories with acceptance criteria.
|
|
36
|
+
|
|
37
|
+
**Examples:**
|
|
38
|
+
```bash
|
|
39
|
+
/xproduct --stories # List all user stories
|
|
40
|
+
/xproduct --stories --create "As a user, I want to..."
|
|
41
|
+
/xproduct --stories --template
|
|
42
|
+
/xproduct --stories --acceptance
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### `--features`
|
|
46
|
+
Manage feature flags and feature rollouts.
|
|
47
|
+
|
|
48
|
+
**Examples:**
|
|
49
|
+
```bash
|
|
50
|
+
/xproduct --features # List all feature flags
|
|
51
|
+
/xproduct --features --create "new-dashboard"
|
|
52
|
+
/xproduct --features --toggle "beta-feature"
|
|
53
|
+
/xproduct --features --rollout 25
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### `--feedback`
|
|
57
|
+
Integrate and analyze user feedback.
|
|
58
|
+
|
|
59
|
+
**Examples:**
|
|
60
|
+
```bash
|
|
61
|
+
/xproduct --feedback # View feedback summary
|
|
62
|
+
/xproduct --feedback --collect
|
|
63
|
+
/xproduct --feedback --analyze
|
|
64
|
+
/xproduct --feedback --prioritize
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### `--metrics`
|
|
68
|
+
Track and analyze product KPIs and metrics.
|
|
69
|
+
|
|
70
|
+
**Examples:**
|
|
71
|
+
```bash
|
|
72
|
+
/xproduct --metrics # View metrics dashboard
|
|
73
|
+
/xproduct --metrics --kpi "user-retention"
|
|
74
|
+
/xproduct --metrics --funnel "conversion"
|
|
75
|
+
/xproduct --metrics --cohort
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### `--roadmap`
|
|
79
|
+
Create and manage product roadmaps.
|
|
80
|
+
|
|
81
|
+
**Examples:**
|
|
82
|
+
```bash
|
|
83
|
+
/xproduct --roadmap # View current roadmap
|
|
84
|
+
/xproduct --roadmap --quarter Q1
|
|
85
|
+
/xproduct --roadmap --milestone "v2.0"
|
|
86
|
+
/xproduct --roadmap --dependencies
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Integration
|
|
90
|
+
|
|
91
|
+
- **Specifications**: Links user stories to SpecDriven AI requirements
|
|
92
|
+
- **Testing**: Integrates with `/xtest` for feature validation
|
|
93
|
+
- **Analytics**: Works with `/xanalytics` for product insights
|
|
94
|
+
- **Planning**: Coordinates with `/xplanning` for development planning
|
|
95
|
+
|
|
96
|
+
## Output
|
|
97
|
+
|
|
98
|
+
Product management artifacts, roadmaps, user stories, and KPI reports.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# xreadiness - AI Development Readiness
|
|
2
|
+
|
|
3
|
+
Assess and improve AI development readiness across team, process, and technical dimensions.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
/xreadiness --assess # Run comprehensive readiness assessment
|
|
9
|
+
/xreadiness --baseline # Establish baseline metrics
|
|
10
|
+
/xreadiness --capabilities # Assess AI development capabilities
|
|
11
|
+
/xreadiness --gaps # Identify readiness gaps
|
|
12
|
+
/xreadiness --report # Generate readiness report
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Run full AI readiness assessment
|
|
19
|
+
/xreadiness --assess
|
|
20
|
+
|
|
21
|
+
# Establish baseline measurements
|
|
22
|
+
/xreadiness --baseline
|
|
23
|
+
|
|
24
|
+
# Evaluate current AI capabilities
|
|
25
|
+
/xreadiness --capabilities
|
|
26
|
+
|
|
27
|
+
# Identify improvement gaps
|
|
28
|
+
/xreadiness --gaps
|
|
29
|
+
|
|
30
|
+
# Generate executive readiness report
|
|
31
|
+
/xreadiness --report
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Expected Outputs
|
|
35
|
+
|
|
36
|
+
- **assess**: Readiness score (0-100) with specific improvement areas identified
|
|
37
|
+
- **baseline**: Baseline measurements for future comparison and progress tracking
|
|
38
|
+
- **capabilities**: Capability matrix showing strengths and development needs
|
|
39
|
+
- **gaps**: Prioritized list of gaps with remediation recommendations
|
|
40
|
+
- **report**: Executive summary with roadmap for AI readiness improvement
|
|
41
|
+
|
|
42
|
+
## Readiness Dimensions
|
|
43
|
+
|
|
44
|
+
### Technical Readiness
|
|
45
|
+
- SpecDriven AI implementation maturity
|
|
46
|
+
- Test automation and CI/CD pipeline quality
|
|
47
|
+
- Code quality and architectural compliance
|
|
48
|
+
- Security and compliance posture
|
|
49
|
+
|
|
50
|
+
### Process Readiness
|
|
51
|
+
- TDD adoption and discipline
|
|
52
|
+
- Specification management practices
|
|
53
|
+
- Development workflow optimization
|
|
54
|
+
- Quality assurance processes
|
|
55
|
+
|
|
56
|
+
### Team Readiness
|
|
57
|
+
- AI development skills and training
|
|
58
|
+
- Tool proficiency and adoption
|
|
59
|
+
- Collaboration and knowledge sharing
|
|
60
|
+
- Change management capability
|
|
61
|
+
|
|
62
|
+
## Readiness Levels
|
|
63
|
+
|
|
64
|
+
- **Level 1 (0-20)**: Basic - Ad-hoc development, minimal AI integration
|
|
65
|
+
- **Level 2 (21-40)**: Repeatable - Some AI practices, inconsistent application
|
|
66
|
+
- **Level 3 (41-60)**: Defined - Established AI processes, growing adoption
|
|
67
|
+
- **Level 4 (61-80)**: Managed - Mature AI practices, metrics-driven improvement
|
|
68
|
+
- **Level 5 (81-100)**: Optimizing - Advanced AI integration, continuous innovation
|
|
69
|
+
|
|
70
|
+
## Integration
|
|
71
|
+
|
|
72
|
+
- Works with `/xmaturity` for development maturity assessment
|
|
73
|
+
- Integrates with `/xspec` for SpecDriven AI methodology tracking
|
|
74
|
+
- Supports `/xobservable` for readiness metrics monitoring
|
|
75
|
+
- Links to `/xplanning` for readiness improvement roadmaps
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Write failing tests first following TDD Red phase principles with specification traceability
|
|
3
|
+
tags: [tdd, testing, red-phase, specifications, traceability]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /xred — Write Failing Tests First
|
|
7
|
+
|
|
8
|
+
Write failing tests for specifications following TDD Red phase principles.
|
|
9
|
+
|
|
10
|
+
Think step by step:
|
|
11
|
+
1. Check for SpecDriven AI project structure (specs/ directory)
|
|
12
|
+
2. Validate specification existence when using --spec option
|
|
13
|
+
3. Create failing tests with proper traceability to specifications
|
|
14
|
+
4. Verify tests fail for the right reason before proceeding
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
/xred --spec <spec-id> # Create test for specific requirement
|
|
20
|
+
/xred --component <name> # Create test for new component
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Implementation Steps
|
|
24
|
+
|
|
25
|
+
When creating failing tests:
|
|
26
|
+
|
|
27
|
+
1. **For specification-based tests (--spec)**:
|
|
28
|
+
- Check if SpecDriven AI project structure exists (specs/ directory)
|
|
29
|
+
- If not found, suggest running `!xsetup --env` to initialize
|
|
30
|
+
- Validate that the specified requirement exists in @specs/specifications/
|
|
31
|
+
- Read specification content to understand requirements
|
|
32
|
+
- Create or update test file with failing test linked to specification
|
|
33
|
+
- Verify test fails for correct reason (not due to syntax errors)
|
|
34
|
+
|
|
35
|
+
2. **For component tests (--component)**:
|
|
36
|
+
- Create basic test structure for new component
|
|
37
|
+
- Include import test and basic functionality test
|
|
38
|
+
- Ensure tests fail initially to satisfy TDD Red phase
|
|
39
|
+
- Provide guidance for next steps in TDD cycle
|
|
40
|
+
|
|
41
|
+
3. **Error handling**:
|
|
42
|
+
- Validate all required arguments are provided
|
|
43
|
+
- Check for existing tests to avoid duplicates
|
|
44
|
+
- Ensure proper test file structure and naming conventions
|
|
45
|
+
- Verify Python test execution environment is available
|
|
46
|
+
|
|
47
|
+
## Expected Outputs
|
|
48
|
+
|
|
49
|
+
- Test files in specs/tests/ directory with proper structure
|
|
50
|
+
- Failing tests that guide implementation requirements
|
|
51
|
+
- Clear traceability between tests and specifications
|
|
52
|
+
- Verification that tests fail for the right reasons
|
|
53
|
+
- Guidance for next steps in TDD workflow
|
|
54
|
+
|
|
55
|
+
Use $ARGUMENTS to handle command-line parameters and `!` prefix for any system commands needed for test execution verification.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Comprehensive risk assessment and mitigation across technical, security, and operational domains
|
|
3
|
+
tags: [risk, assessment, mitigation, security, operations, compliance, monitoring]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Identify, assess, and mitigate project risks based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
First, examine the project environment for risk indicators:
|
|
9
|
+
!find . -name "*.log" | head -5 2>/dev/null || echo "No log files found"
|
|
10
|
+
!git log --grep="fix\|bug\|error" --oneline | head -10 2>/dev/null || echo "No error patterns in git history"
|
|
11
|
+
!find . -name "requirements.txt" -o -name "package.json" -o -name "go.mod" | head -3
|
|
12
|
+
|
|
13
|
+
Based on $ARGUMENTS, perform the appropriate risk assessment operation:
|
|
14
|
+
|
|
15
|
+
## 1. Risk Assessment and Identification
|
|
16
|
+
|
|
17
|
+
If assessing risks (--assess, --identify):
|
|
18
|
+
!find . -name "*.py" -o -name "*.js" -o -name "*.ts" | wc -l
|
|
19
|
+
!grep -r "TODO\|FIXME\|HACK" . --include="*.py" --include="*.js" | wc -l 2>/dev/null || echo "0"
|
|
20
|
+
!docker --version 2>/dev/null || echo "Docker not available"
|
|
21
|
+
|
|
22
|
+
Identify and assess project risks:
|
|
23
|
+
- Analyze codebase for technical debt indicators
|
|
24
|
+
- Scan for security vulnerabilities and exposures
|
|
25
|
+
- Evaluate architectural and design risks
|
|
26
|
+
- Assess operational and process risks
|
|
27
|
+
- Identify compliance and regulatory risks
|
|
28
|
+
|
|
29
|
+
## 2. Technical Risk Analysis
|
|
30
|
+
|
|
31
|
+
If analyzing technical risks (--technical):
|
|
32
|
+
!find . -name "*.py" -exec grep -l "eval\|exec\|pickle" {} \; 2>/dev/null | head -5
|
|
33
|
+
!find . -name "package-lock.json" -o -name "requirements.txt" | head -2
|
|
34
|
+
!grep -r "password\|secret\|key" . --include="*.py" --include="*.js" | grep -v test | head -5 2>/dev/null
|
|
35
|
+
|
|
36
|
+
Analyze technical risk factors:
|
|
37
|
+
- Code quality and maintainability issues
|
|
38
|
+
- Dependency vulnerabilities and outdated packages
|
|
39
|
+
- Architecture scalability limitations
|
|
40
|
+
- Performance bottlenecks and resource constraints
|
|
41
|
+
- Integration complexity and failure points
|
|
42
|
+
|
|
43
|
+
## 3. Security Risk Assessment
|
|
44
|
+
|
|
45
|
+
If assessing security risks (--security):
|
|
46
|
+
!find . -name "*.py" -exec grep -l "subprocess\|os\.system\|shell=True" {} \; 2>/dev/null | head -5
|
|
47
|
+
!npm audit --audit-level high 2>/dev/null || python -m safety check 2>/dev/null || echo "No security scanners available"
|
|
48
|
+
!find . -name ".env*" -o -name "*secret*" -o -name "*key*" | head -5
|
|
49
|
+
|
|
50
|
+
Evaluate security risk exposure:
|
|
51
|
+
- Authentication and authorization vulnerabilities
|
|
52
|
+
- Data protection and privacy compliance gaps
|
|
53
|
+
- Input validation and injection attack vectors
|
|
54
|
+
- Dependency security vulnerabilities
|
|
55
|
+
- Infrastructure and deployment security risks
|
|
56
|
+
|
|
57
|
+
## 4. Operational Risk Evaluation
|
|
58
|
+
|
|
59
|
+
If evaluating operational risks (--operational):
|
|
60
|
+
!find . -name "Dockerfile" -o -name "docker-compose.yml" | head -3
|
|
61
|
+
!ls -la .github/workflows/ 2>/dev/null || echo "No CI/CD workflows found"
|
|
62
|
+
!find . -name "*backup*" -o -name "*disaster*" | head -3 2>/dev/null
|
|
63
|
+
|
|
64
|
+
Assess operational risk factors:
|
|
65
|
+
- Deployment and release process risks
|
|
66
|
+
- Infrastructure and service dependencies
|
|
67
|
+
- Monitoring and alerting coverage gaps
|
|
68
|
+
- Backup and recovery procedure adequacy
|
|
69
|
+
- Team knowledge and key person dependencies
|
|
70
|
+
|
|
71
|
+
## 5. Risk Mitigation Planning
|
|
72
|
+
|
|
73
|
+
If planning mitigation (--mitigate, --contingency):
|
|
74
|
+
!find . -name "*test*" | wc -l
|
|
75
|
+
!git log --since="30 days ago" --grep="fix\|patch" --oneline | wc -l 2>/dev/null || echo "0"
|
|
76
|
+
!find . -name "*monitor*" -o -name "*alert*" | head -3
|
|
77
|
+
|
|
78
|
+
Develop risk mitigation strategies:
|
|
79
|
+
- Preventive measures and controls
|
|
80
|
+
- Detection and monitoring capabilities
|
|
81
|
+
- Response and recovery procedures
|
|
82
|
+
- Risk transfer and insurance options
|
|
83
|
+
- Contingency planning and alternatives
|
|
84
|
+
|
|
85
|
+
## 6. Risk Monitoring and Tracking
|
|
86
|
+
|
|
87
|
+
If monitoring risks (--monitor, --track):
|
|
88
|
+
!ps aux | grep -E "(monitor|alert)" | head -3
|
|
89
|
+
!find . -name "*.log" -newer +7 2>/dev/null | head -5
|
|
90
|
+
!uptime
|
|
91
|
+
|
|
92
|
+
Monitor and track risk indicators:
|
|
93
|
+
- Automated risk detection and alerting
|
|
94
|
+
- Key risk indicator (KRI) monitoring
|
|
95
|
+
- Trend analysis and pattern recognition
|
|
96
|
+
- Risk register updates and maintenance
|
|
97
|
+
- Stakeholder reporting and communication
|
|
98
|
+
|
|
99
|
+
Think step by step about risk management requirements and provide:
|
|
100
|
+
|
|
101
|
+
1. **Risk Identification and Assessment**:
|
|
102
|
+
- Technical debt and code quality risks
|
|
103
|
+
- Security vulnerabilities and compliance gaps
|
|
104
|
+
- Operational process and infrastructure risks
|
|
105
|
+
- Business and market risks
|
|
106
|
+
|
|
107
|
+
2. **Risk Analysis and Prioritization**:
|
|
108
|
+
- Risk probability and impact evaluation
|
|
109
|
+
- Risk interdependencies and cascading effects
|
|
110
|
+
- Risk timeline and maturation analysis
|
|
111
|
+
- Cost-benefit analysis of mitigation options
|
|
112
|
+
|
|
113
|
+
3. **Mitigation Strategy Development**:
|
|
114
|
+
- Preventive controls and safeguards
|
|
115
|
+
- Detective monitoring and alerting
|
|
116
|
+
- Response procedures and recovery plans
|
|
117
|
+
- Risk transfer and acceptance decisions
|
|
118
|
+
|
|
119
|
+
4. **Risk Monitoring and Reporting**:
|
|
120
|
+
- Key risk indicator tracking
|
|
121
|
+
- Risk register maintenance
|
|
122
|
+
- Stakeholder communication
|
|
123
|
+
- Continuous risk assessment updates
|
|
124
|
+
|
|
125
|
+
Generate comprehensive risk assessment with prioritized mitigation strategies, monitoring procedures, and stakeholder reporting.
|
|
126
|
+
|
|
127
|
+
If no specific operation is provided, perform comprehensive risk scan and provide prioritized risk assessment with immediate action recommendations.
|
|
128
|
+
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# `/xrules` - Rules as Code
|
|
2
|
+
|
|
3
|
+
Define, validate, and enforce development rules and coding standards as executable code.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
/xrules --define <rule> # Define new rule
|
|
9
|
+
/xrules --validate # Check compliance
|
|
10
|
+
/xrules --enforce # Apply rules
|
|
11
|
+
/xrules --report # Generate report
|
|
12
|
+
/xrules --update <rule> # Update rule
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
### `--define <rule>`
|
|
18
|
+
Define a new development rule with enforcement criteria.
|
|
19
|
+
|
|
20
|
+
**Examples:**
|
|
21
|
+
```bash
|
|
22
|
+
/xrules --define "max-function-length"
|
|
23
|
+
/xrules --define "naming-conventions"
|
|
24
|
+
/xrules --define "security-standards"
|
|
25
|
+
/xrules --define "test-coverage-minimum"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### `--validate`
|
|
29
|
+
Check compliance against all defined rules.
|
|
30
|
+
|
|
31
|
+
**Examples:**
|
|
32
|
+
```bash
|
|
33
|
+
/xrules --validate # Check all rules
|
|
34
|
+
/xrules --validate --rule "max-function-length"
|
|
35
|
+
/xrules --validate --component auth
|
|
36
|
+
/xrules --validate --severity critical
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### `--enforce`
|
|
40
|
+
Apply rules and automatically fix violations where possible.
|
|
41
|
+
|
|
42
|
+
**Examples:**
|
|
43
|
+
```bash
|
|
44
|
+
/xrules --enforce # Enforce all rules
|
|
45
|
+
/xrules --enforce --rule "formatting"
|
|
46
|
+
/xrules --enforce --auto-fix
|
|
47
|
+
/xrules --enforce --dry-run
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### `--report`
|
|
51
|
+
Generate compliance reports and rule violation summaries.
|
|
52
|
+
|
|
53
|
+
**Examples:**
|
|
54
|
+
```bash
|
|
55
|
+
/xrules --report # Full compliance report
|
|
56
|
+
/xrules --report --rule "security-standards"
|
|
57
|
+
/xrules --report --format json
|
|
58
|
+
/xrules --report --trend
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `--update <rule>`
|
|
62
|
+
Update existing rule definitions and enforcement criteria.
|
|
63
|
+
|
|
64
|
+
**Examples:**
|
|
65
|
+
```bash
|
|
66
|
+
/xrules --update "max-function-length"
|
|
67
|
+
/xrules --update --threshold 50
|
|
68
|
+
/xrules --update --severity warning
|
|
69
|
+
/xrules --update --exception "legacy-code"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Common Rules
|
|
73
|
+
|
|
74
|
+
### Code Quality Rules
|
|
75
|
+
- **max-function-length**: Limit function length to promote readability
|
|
76
|
+
- **cyclomatic-complexity**: Control code complexity metrics
|
|
77
|
+
- **naming-conventions**: Enforce consistent naming patterns
|
|
78
|
+
- **documentation-required**: Require documentation for public APIs
|
|
79
|
+
|
|
80
|
+
### Security Rules
|
|
81
|
+
- **no-hardcoded-secrets**: Prevent credential exposure
|
|
82
|
+
- **dependency-security**: Check for vulnerable dependencies
|
|
83
|
+
- **input-validation**: Ensure proper input sanitization
|
|
84
|
+
- **authentication-required**: Enforce authentication patterns
|
|
85
|
+
|
|
86
|
+
### Testing Rules
|
|
87
|
+
- **test-coverage-minimum**: Require minimum test coverage percentage
|
|
88
|
+
- **test-naming**: Enforce test naming conventions
|
|
89
|
+
- **specification-traceability**: Ensure tests link to specifications
|
|
90
|
+
- **mock-usage**: Control test isolation and mocking
|
|
91
|
+
|
|
92
|
+
### Architecture Rules
|
|
93
|
+
- **layer-dependencies**: Enforce architectural boundaries
|
|
94
|
+
- **module-coupling**: Limit coupling between modules
|
|
95
|
+
- **design-patterns**: Enforce specific design patterns
|
|
96
|
+
- **api-versioning**: Ensure proper API versioning
|
|
97
|
+
|
|
98
|
+
## Integration
|
|
99
|
+
|
|
100
|
+
- **Quality**: Works with `/xquality` for automated enforcement
|
|
101
|
+
- **Testing**: Integrates with `/xtest` for test rule validation
|
|
102
|
+
- **Security**: Coordinates with `/xsecurity` for security rules
|
|
103
|
+
- **Specifications**: Links to `/xspec` for traceability rules
|
|
104
|
+
- **Governance**: Supports `/xgovernance` compliance workflows
|
|
105
|
+
|
|
106
|
+
## Rule Definition Format
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
rule:
|
|
110
|
+
name: "max-function-length"
|
|
111
|
+
description: "Functions should not exceed 50 lines"
|
|
112
|
+
severity: "warning"
|
|
113
|
+
enforcement: "automatic"
|
|
114
|
+
criteria:
|
|
115
|
+
max_lines: 50
|
|
116
|
+
exclude_patterns:
|
|
117
|
+
- "test_*"
|
|
118
|
+
- "*_fixture"
|
|
119
|
+
remediation: "Consider breaking large functions into smaller ones"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Output
|
|
123
|
+
|
|
124
|
+
Rule compliance reports, violation summaries, and automated fixes.
|