@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,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Analyze development patterns, team productivity, and process health through comprehensive observability
|
|
3
|
+
tags: [observability, metrics, patterns, productivity, tracing, insights]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Analyze development observability and patterns based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
First, examine the project for observability indicators:
|
|
9
|
+
!find . -name "*.log" -o -name "*.json" | grep -E "(metric|trace|log)" | head -5
|
|
10
|
+
!git log --oneline --since="1 month ago" | wc -l
|
|
11
|
+
!find . -name "*test*" -type f | wc -l
|
|
12
|
+
!git branch -r | wc -l
|
|
13
|
+
|
|
14
|
+
Based on $ARGUMENTS, perform the appropriate observability analysis:
|
|
15
|
+
|
|
16
|
+
## 1. Development Metrics Collection
|
|
17
|
+
|
|
18
|
+
If collecting metrics (--metrics, --dashboard):
|
|
19
|
+
!git log --pretty=format:"%h %ad %s" --date=short --since="1 month ago" | head -10
|
|
20
|
+
!find . -name "*.py" -o -name "*.js" -o -name "*.ts" | xargs wc -l | tail -1
|
|
21
|
+
!git log --pretty=format:"%an" --since="1 month ago" | sort | uniq -c | sort -nr
|
|
22
|
+
|
|
23
|
+
Collect development metrics:
|
|
24
|
+
- Commit frequency and patterns
|
|
25
|
+
- Code churn and complexity trends
|
|
26
|
+
- Team collaboration indicators
|
|
27
|
+
- Feature delivery velocity
|
|
28
|
+
- Quality metrics evolution
|
|
29
|
+
|
|
30
|
+
## 2. Pattern Analysis
|
|
31
|
+
|
|
32
|
+
If analyzing patterns (--patterns, --behavior):
|
|
33
|
+
!git log --pretty=format:"%H %s" --since="1 month ago" | grep -i -E "(fix|bug|refactor|feature)" | wc -l
|
|
34
|
+
!find . -name "*test*" -type f -exec grep -l "describe\|it\|test" {} \; | wc -l
|
|
35
|
+
!git log --pretty=format:"%ad" --date=format:"%H" --since="1 month ago" | sort | uniq -c
|
|
36
|
+
|
|
37
|
+
Analyze development patterns:
|
|
38
|
+
- Code change patterns and hotspots
|
|
39
|
+
- Testing behavior and coverage trends
|
|
40
|
+
- Work time distribution analysis
|
|
41
|
+
- Collaboration and review patterns
|
|
42
|
+
- Technical debt accumulation
|
|
43
|
+
|
|
44
|
+
## 3. Performance Tracing
|
|
45
|
+
|
|
46
|
+
If tracing operations (--trace, --timing):
|
|
47
|
+
!ls -la .git/logs/refs/heads/ 2>/dev/null | head -5
|
|
48
|
+
!find . -name "*.log" | xargs grep -i "duration\|time\|performance" 2>/dev/null | head -5
|
|
49
|
+
!git log --pretty=format:"%H %ct" --since="1 week ago" | head -10
|
|
50
|
+
|
|
51
|
+
Trace development operations:
|
|
52
|
+
- TDD cycle timing analysis
|
|
53
|
+
- Build and test execution times
|
|
54
|
+
- Code review duration tracking
|
|
55
|
+
- Deployment frequency measurement
|
|
56
|
+
- Issue resolution time analysis
|
|
57
|
+
|
|
58
|
+
## 4. Team Productivity Analysis
|
|
59
|
+
|
|
60
|
+
If analyzing productivity (--productivity, --team):
|
|
61
|
+
!git shortlog -sn --since="1 month ago"
|
|
62
|
+
!git log --pretty=format:"%an %ad" --date=short --since="1 month ago" | sort | uniq -c
|
|
63
|
+
!find . -name "*.md" -o -name "*.txt" | xargs grep -l "TODO\|FIXME" | wc -l
|
|
64
|
+
|
|
65
|
+
Analyze team productivity:
|
|
66
|
+
- Individual contribution patterns
|
|
67
|
+
- Knowledge sharing indicators
|
|
68
|
+
- Documentation coverage trends
|
|
69
|
+
- Technical debt markers
|
|
70
|
+
- Skill development tracking
|
|
71
|
+
|
|
72
|
+
## 5. Process Health Assessment
|
|
73
|
+
|
|
74
|
+
If assessing process health (--health, --compliance):
|
|
75
|
+
!git log --grep="test" --oneline --since="1 month ago" | wc -l
|
|
76
|
+
!find . -name "*.yml" -o -name "*.yaml" | xargs grep -l "test\|ci\|cd" 2>/dev/null | wc -l
|
|
77
|
+
!git log --pretty=format:"%s" --since="1 month ago" | grep -E "^(feat|fix|docs|style|refactor|test|chore)" | wc -l
|
|
78
|
+
|
|
79
|
+
Assess process health:
|
|
80
|
+
- TDD adherence measurement
|
|
81
|
+
- CI/CD pipeline effectiveness
|
|
82
|
+
- Code review compliance
|
|
83
|
+
- Security practice adoption
|
|
84
|
+
- Documentation completeness
|
|
85
|
+
|
|
86
|
+
Think step by step about development observability requirements and provide:
|
|
87
|
+
|
|
88
|
+
1. **Current State Analysis**:
|
|
89
|
+
- Development velocity assessment
|
|
90
|
+
- Quality trend identification
|
|
91
|
+
- Team collaboration patterns
|
|
92
|
+
- Process adherence measurement
|
|
93
|
+
|
|
94
|
+
2. **Pattern Insights**:
|
|
95
|
+
- Code change hotspot analysis
|
|
96
|
+
- Testing behavior patterns
|
|
97
|
+
- Work distribution insights
|
|
98
|
+
- Productivity bottleneck identification
|
|
99
|
+
|
|
100
|
+
3. **Optimization Opportunities**:
|
|
101
|
+
- Process improvement recommendations
|
|
102
|
+
- Tool adoption suggestions
|
|
103
|
+
- Team efficiency enhancements
|
|
104
|
+
- Quality improvement strategies
|
|
105
|
+
|
|
106
|
+
4. **Monitoring Recommendations**:
|
|
107
|
+
- Key metrics to track continuously
|
|
108
|
+
- Alert threshold configurations
|
|
109
|
+
- Dashboard setup guidance
|
|
110
|
+
- Trend analysis automation
|
|
111
|
+
|
|
112
|
+
Generate comprehensive observability analysis with actionable insights, pattern identification, productivity recommendations, and monitoring setup guidance.
|
|
113
|
+
|
|
114
|
+
If no specific operation is provided, perform development health assessment and recommend observability improvements based on current patterns and industry best practices.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Automate AWS OIDC role creation for GitHub Actions with local policy discovery
|
|
3
|
+
tags: [aws, oidc, github-actions, security, automation]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Automate the creation of AWS OIDC roles for GitHub Actions with intelligent policy discovery from local aws_policies folders.
|
|
7
|
+
|
|
8
|
+
## Usage Examples
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# Basic usage with policy discovery
|
|
12
|
+
/xoidc --github-org myorg --github-repo myrepo
|
|
13
|
+
|
|
14
|
+
# With custom policies directory
|
|
15
|
+
/xoidc --github-org myorg --github-repo myrepo --policies-dir custom_policies
|
|
16
|
+
|
|
17
|
+
# Dry run validation
|
|
18
|
+
/xoidc --github-org myorg --github-repo myrepo --dry-run
|
|
19
|
+
|
|
20
|
+
# Full configuration
|
|
21
|
+
/xoidc --github-org myorg --github-repo myrepo --region us-west-2 --github-token $GITHUB_TOKEN
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Arguments
|
|
25
|
+
|
|
26
|
+
- `--github-org`: GitHub organization name (required)
|
|
27
|
+
- `--github-repo`: GitHub repository name (required)
|
|
28
|
+
- `--region`: AWS region (default: us-east-1)
|
|
29
|
+
- `--policies-dir`: Custom policies directory (default: aws_policies)
|
|
30
|
+
- `--stack-name`: Custom CloudFormation stack name
|
|
31
|
+
- `--dry-run`: Validate policies without deployment
|
|
32
|
+
- `--github-token`: GitHub PAT for repository variable setting
|
|
33
|
+
|
|
34
|
+
## Implementation
|
|
35
|
+
|
|
36
|
+
First, check for required dependencies and validate environment:
|
|
37
|
+
Check if AWS CLI is available. If not found, display error message.
|
|
38
|
+
Check if GitHub CLI is available. If not found, display warning about limited features.
|
|
39
|
+
|
|
40
|
+
Parse arguments from $ARGUMENTS and set defaults:
|
|
41
|
+
- GITHUB_ORG: Extract from --github-org parameter
|
|
42
|
+
- GITHUB_REPO: Extract from --github-repo parameter
|
|
43
|
+
- REGION: Extract from --region parameter or default to "us-east-1"
|
|
44
|
+
- POLICIES_DIR: Extract from --policies-dir parameter or default to "aws_policies"
|
|
45
|
+
- STACK_NAME: Extract from --stack-name parameter or generate from org/repo names
|
|
46
|
+
- DRY_RUN: Set to true if --dry-run flag is present
|
|
47
|
+
- GITHUB_TOKEN: Extract from --github-token parameter
|
|
48
|
+
|
|
49
|
+
Validate that required arguments are provided:
|
|
50
|
+
- Exit with error if --github-org is missing
|
|
51
|
+
- Exit with error if --github-repo is missing
|
|
52
|
+
|
|
53
|
+
## 1. Policy Discovery
|
|
54
|
+
|
|
55
|
+
Scan for AWS policies in the specified directory:
|
|
56
|
+
Display message indicating scanning for policies in the policies directory.
|
|
57
|
+
Check if the policies directory exists. If not found, display error and exit.
|
|
58
|
+
|
|
59
|
+
List discovered policy files:
|
|
60
|
+
Find all JSON files in the policies directory, excluding example files, and display them sorted.
|
|
61
|
+
|
|
62
|
+
Store policy files for processing:
|
|
63
|
+
Get list of policy files and validate that at least one policy file was found.
|
|
64
|
+
If no policy files found, display error and exit.
|
|
65
|
+
|
|
66
|
+
## 2. Policy Validation
|
|
67
|
+
|
|
68
|
+
Validate each policy file structure:
|
|
69
|
+
Display message indicating policy validation is starting.
|
|
70
|
+
For each policy file found:
|
|
71
|
+
- Display validation message with filename
|
|
72
|
+
- Validate JSON syntax using jq
|
|
73
|
+
- Check for required Version field (should be "2012-10-17")
|
|
74
|
+
- Validate Statement array exists and is properly formatted
|
|
75
|
+
- Check for overly permissive policies (wildcard actions or resources)
|
|
76
|
+
- Display warnings for any issues found but continue processing
|
|
77
|
+
|
|
78
|
+
## 3. Generate Trust Policy
|
|
79
|
+
|
|
80
|
+
Create trust policy for GitHub OIDC:
|
|
81
|
+
Display message indicating trust policy generation.
|
|
82
|
+
Create a trust policy JSON file with:
|
|
83
|
+
- Version "2012-10-17"
|
|
84
|
+
- Allow effect for GitHub OIDC provider
|
|
85
|
+
- Principal federated to GitHub Actions OIDC provider
|
|
86
|
+
- Action for AssumeRoleWithWebIdentity
|
|
87
|
+
- Conditions for audience and subject matching the specific GitHub org/repo
|
|
88
|
+
- Replace variables with actual GitHub org and repo names
|
|
89
|
+
|
|
90
|
+
## 4. Create CloudFormation Template
|
|
91
|
+
|
|
92
|
+
Generate CloudFormation template:
|
|
93
|
+
Display message indicating CloudFormation template creation.
|
|
94
|
+
Create a CloudFormation template with:
|
|
95
|
+
- AWSTemplateFormatVersion: '2010-09-09'
|
|
96
|
+
- Description for the GitHub OIDC Role
|
|
97
|
+
- Parameters for GitHubOrg and GitHubRepo
|
|
98
|
+
- GitHubOIDCProvider resource with proper thumbprint
|
|
99
|
+
- GitHubActionsRole resource with:
|
|
100
|
+
- Role name following pattern: GitHubActions-{org}-{repo}
|
|
101
|
+
- Trust policy referencing the OIDC provider
|
|
102
|
+
- Conditions for audience and subject validation
|
|
103
|
+
- Inline policies section populated from discovered policy files
|
|
104
|
+
- Output for the Role ARN
|
|
105
|
+
|
|
106
|
+
For each policy file found:
|
|
107
|
+
- Add as inline policy to the IAM role
|
|
108
|
+
- Use filename (without .json) as policy name
|
|
109
|
+
- Include full policy document content with proper indentation
|
|
110
|
+
|
|
111
|
+
Add outputs section with Role ARN for easy reference.
|
|
112
|
+
|
|
113
|
+
## 5. Deploy or Validate
|
|
114
|
+
|
|
115
|
+
Set stack name if not provided:
|
|
116
|
+
Generate stack name using pattern: gha-oidc-{github-org}-{github-repo}
|
|
117
|
+
|
|
118
|
+
If dry run mode is enabled:
|
|
119
|
+
- Display dry run message
|
|
120
|
+
- Validate CloudFormation template using AWS CLI
|
|
121
|
+
- Display validation success message
|
|
122
|
+
- List discovered policy files
|
|
123
|
+
- Exit without deploying
|
|
124
|
+
|
|
125
|
+
Deploy the CloudFormation stack:
|
|
126
|
+
- Display deployment message with stack name
|
|
127
|
+
- Use AWS CLI to deploy the CloudFormation template
|
|
128
|
+
- Include required capabilities for IAM resource creation
|
|
129
|
+
- Pass GitHub org and repo as parameters
|
|
130
|
+
- Use specified AWS region
|
|
131
|
+
|
|
132
|
+
Get the role ARN from the stack output:
|
|
133
|
+
- Query the deployed stack for outputs
|
|
134
|
+
- Extract the RoleArn output value
|
|
135
|
+
- Store for use in GitHub configuration
|
|
136
|
+
|
|
137
|
+
## 6. Configure GitHub Repository Variable
|
|
138
|
+
|
|
139
|
+
Set repository variable if GitHub token is provided:
|
|
140
|
+
If GitHub token is available and GitHub CLI is installed:
|
|
141
|
+
- Display configuration message
|
|
142
|
+
- Set GitHub token in environment
|
|
143
|
+
- Use GitHub CLI to set repository variable 'GHA_OIDC_ROLE_ARN'
|
|
144
|
+
- Display success message
|
|
145
|
+
|
|
146
|
+
If GitHub token is not provided:
|
|
147
|
+
- Display manual step instruction
|
|
148
|
+
- Show the Role ARN that needs to be set manually
|
|
149
|
+
|
|
150
|
+
## 7. Generate Usage Instructions
|
|
151
|
+
|
|
152
|
+
Display completion message and setup summary:
|
|
153
|
+
- Show success message: "🎉 OIDC Role Setup Complete!"
|
|
154
|
+
- Display divider line
|
|
155
|
+
- Show stack name, role ARN, and region
|
|
156
|
+
- List all policies that were applied
|
|
157
|
+
- Display GitHub Actions workflow usage example with:
|
|
158
|
+
- Job configuration with required permissions
|
|
159
|
+
- AWS credentials configuration step
|
|
160
|
+
- Role ARN variable reference
|
|
161
|
+
- Region configuration
|
|
162
|
+
- Show completion message
|
|
163
|
+
|
|
164
|
+
Clean up temporary files:
|
|
165
|
+
Remove temporary files created during the process (trust policy, CloudFormation template, backup files).
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Find and apply performance improvements, optimize workflows, and enhance resource utilization
|
|
3
|
+
tags: [optimization, performance, profiling, bottlenecks, efficiency, resource-management]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Analyze and optimize code performance, processes, and resources based on the arguments provided in $ARGUMENTS.
|
|
7
|
+
|
|
8
|
+
First, examine the project for optimization opportunities:
|
|
9
|
+
!find . -name "*.py" -o -name "*.js" -o -name "*.ts" | head -10
|
|
10
|
+
!ps aux | head -5
|
|
11
|
+
!df -h | head -5
|
|
12
|
+
!free -h 2>/dev/null || vm_stat 2>/dev/null || echo "Memory info not available"
|
|
13
|
+
|
|
14
|
+
Based on $ARGUMENTS, perform the appropriate optimization operation:
|
|
15
|
+
|
|
16
|
+
## 1. Code Performance Optimization
|
|
17
|
+
|
|
18
|
+
If optimizing code (--code, --algorithms):
|
|
19
|
+
!python -c "import cProfile; print('Profiling available')" 2>/dev/null || echo "Install profiling tools"
|
|
20
|
+
!find . -name "*.py" -exec grep -l "for.*in.*for" {} \; 2>/dev/null | head -5
|
|
21
|
+
!grep -r "SELECT.*FROM" . --include="*.py" --include="*.js" | head -5 2>/dev/null
|
|
22
|
+
|
|
23
|
+
Analyze and optimize code performance:
|
|
24
|
+
- Profile CPU-intensive functions and algorithms
|
|
25
|
+
- Identify nested loop inefficiencies
|
|
26
|
+
- Optimize database query patterns
|
|
27
|
+
- Reduce memory allocation overhead
|
|
28
|
+
- Implement caching strategies
|
|
29
|
+
|
|
30
|
+
## 2. Build and CI/CD Optimization
|
|
31
|
+
|
|
32
|
+
If optimizing processes (--build, --ci-cd):
|
|
33
|
+
!find . -name "Dockerfile" -o -name "docker-compose.yml" | head -3
|
|
34
|
+
!ls -la .github/workflows/ 2>/dev/null || echo "No CI/CD workflows found"
|
|
35
|
+
!npm list --depth=0 2>/dev/null | wc -l || echo "No npm dependencies"
|
|
36
|
+
|
|
37
|
+
Optimize development processes:
|
|
38
|
+
- Reduce build time through caching
|
|
39
|
+
- Parallelize test execution
|
|
40
|
+
- Optimize CI/CD pipeline stages
|
|
41
|
+
- Streamline deployment processes
|
|
42
|
+
- Reduce dependency installation time
|
|
43
|
+
|
|
44
|
+
## 3. Resource Utilization Optimization
|
|
45
|
+
|
|
46
|
+
If optimizing resources (--dependencies, --memory):
|
|
47
|
+
!find . -name "requirements.txt" -o -name "package.json" | head -2
|
|
48
|
+
!du -sh node_modules/ 2>/dev/null || echo "No node_modules directory"
|
|
49
|
+
!docker images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" 2>/dev/null | head -5
|
|
50
|
+
|
|
51
|
+
Optimize resource usage:
|
|
52
|
+
- Analyze and reduce dependency footprint
|
|
53
|
+
- Optimize memory usage patterns
|
|
54
|
+
- Minimize storage requirements
|
|
55
|
+
- Reduce network request overhead
|
|
56
|
+
- Optimize container image sizes
|
|
57
|
+
|
|
58
|
+
## 4. Performance Profiling and Analysis
|
|
59
|
+
|
|
60
|
+
If profiling performance (--profile, --benchmark):
|
|
61
|
+
!python -m cProfile -o profile.stats -c "import main" 2>/dev/null || echo "No main module for profiling"
|
|
62
|
+
!time python -c "print('Timing test')" 2>/dev/null || echo "Python not available"
|
|
63
|
+
!uptime
|
|
64
|
+
|
|
65
|
+
Execute performance analysis:
|
|
66
|
+
- Profile application bottlenecks
|
|
67
|
+
- Benchmark critical functions
|
|
68
|
+
- Identify performance hotspots
|
|
69
|
+
- Measure resource consumption
|
|
70
|
+
- Generate performance baselines
|
|
71
|
+
|
|
72
|
+
## 5. Database and Network Optimization
|
|
73
|
+
|
|
74
|
+
If optimizing data access (--database, --network):
|
|
75
|
+
!find . -name "*.sql" | head -5 2>/dev/null || echo "No SQL files found"
|
|
76
|
+
!grep -r "fetch\|request\|query" . --include="*.py" --include="*.js" | head -5 2>/dev/null
|
|
77
|
+
!netstat -an 2>/dev/null | head -5 || echo "Network stats not available"
|
|
78
|
+
|
|
79
|
+
Optimize data and network operations:
|
|
80
|
+
- Analyze and optimize database queries
|
|
81
|
+
- Implement connection pooling
|
|
82
|
+
- Reduce network request frequency
|
|
83
|
+
- Optimize data serialization
|
|
84
|
+
- Implement efficient caching strategies
|
|
85
|
+
|
|
86
|
+
Think step by step about optimization opportunities and provide:
|
|
87
|
+
|
|
88
|
+
1. **Performance Analysis**:
|
|
89
|
+
- Current performance baseline measurement
|
|
90
|
+
- Bottleneck identification and prioritization
|
|
91
|
+
- Resource utilization assessment
|
|
92
|
+
- Performance regression detection
|
|
93
|
+
|
|
94
|
+
2. **Optimization Strategy**:
|
|
95
|
+
- Code-level optimization opportunities
|
|
96
|
+
- Process improvement recommendations
|
|
97
|
+
- Resource allocation optimization
|
|
98
|
+
- Infrastructure efficiency improvements
|
|
99
|
+
|
|
100
|
+
3. **Implementation Plan**:
|
|
101
|
+
- Prioritized optimization actions
|
|
102
|
+
- Expected performance improvements
|
|
103
|
+
- Risk assessment and mitigation
|
|
104
|
+
- Validation and testing approach
|
|
105
|
+
|
|
106
|
+
4. **Monitoring and Validation**:
|
|
107
|
+
- Performance monitoring setup
|
|
108
|
+
- Optimization effectiveness measurement
|
|
109
|
+
- Continuous improvement recommendations
|
|
110
|
+
- Performance regression prevention
|
|
111
|
+
|
|
112
|
+
Generate comprehensive optimization plan with performance analysis, prioritized improvements, implementation guidance, and monitoring recommendations.
|
|
113
|
+
|
|
114
|
+
If no specific operation is provided, perform comprehensive performance assessment and recommend top optimization priorities based on impact and effort analysis.
|
|
115
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Identify and fix performance bottlenecks with profiling and optimization
|
|
3
|
+
tags: [performance, profiling, optimization]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Profile application performance and identify optimization opportunities.
|
|
7
|
+
|
|
8
|
+
Parse performance options from $ARGUMENTS (--profile, --benchmark, --memory, --cpu, or specific function/module names).
|
|
9
|
+
|
|
10
|
+
## 1. Initial Performance Check
|
|
11
|
+
|
|
12
|
+
Get system information:
|
|
13
|
+
!uname -a
|
|
14
|
+
!python --version 2>/dev/null || node --version 2>/dev/null
|
|
15
|
+
|
|
16
|
+
Check current resource usage:
|
|
17
|
+
!ps aux | grep -E "(python|node)" | head -5
|
|
18
|
+
!df -h | grep -v tmpfs
|
|
19
|
+
|
|
20
|
+
## 2. CPU Profiling
|
|
21
|
+
|
|
22
|
+
For Python projects:
|
|
23
|
+
!python -m cProfile -s cumtime main.py 2>/dev/null | head -30 || echo "Add cProfile to your main script"
|
|
24
|
+
|
|
25
|
+
For Node.js projects:
|
|
26
|
+
!node --prof app.js 2>/dev/null && node --prof-process isolate-*.log 2>/dev/null || echo "Use node --prof for profiling"
|
|
27
|
+
|
|
28
|
+
## 3. Memory Profiling
|
|
29
|
+
|
|
30
|
+
Check for memory leaks and usage patterns:
|
|
31
|
+
!ps aux | grep -E "(python|node)" | awk '{print $2, $3, $4, $11}'
|
|
32
|
+
|
|
33
|
+
For Python memory profiling:
|
|
34
|
+
!python -m memory_profiler main.py 2>/dev/null || echo "Install memory_profiler: pip install memory_profiler"
|
|
35
|
+
|
|
36
|
+
## 4. Database Performance
|
|
37
|
+
|
|
38
|
+
Look for slow queries:
|
|
39
|
+
!grep -i "slow query" *.log 2>/dev/null | head -10
|
|
40
|
+
!find . -name "*.py" -o -name "*.js" | xargs grep -n "SELECT.*FROM" | head -20
|
|
41
|
+
|
|
42
|
+
## 5. Code Analysis for Performance Issues
|
|
43
|
+
|
|
44
|
+
Check for common performance anti-patterns:
|
|
45
|
+
!grep -r -n "for.*in.*for.*in" . --include="*.py" 2>/dev/null | head -10
|
|
46
|
+
!grep -r -n "await.*forEach\|Promise\.all" . --include="*.js" 2>/dev/null | head -10
|
|
47
|
+
|
|
48
|
+
Think step by step about performance bottlenecks and provide:
|
|
49
|
+
|
|
50
|
+
1. Identification of top performance issues
|
|
51
|
+
2. Specific optimization recommendations
|
|
52
|
+
3. Code examples for fixes
|
|
53
|
+
4. Expected performance improvements
|
|
54
|
+
|
|
55
|
+
Generate performance report in this format:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
⚡ PERFORMANCE ANALYSIS
|
|
59
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
60
|
+
Profile Duration: [X] seconds
|
|
61
|
+
Total Operations: [X]
|
|
62
|
+
|
|
63
|
+
🔥 HOTSPOTS (Top 5)
|
|
64
|
+
─────────────────
|
|
65
|
+
1. [Function/Module] - X% CPU time
|
|
66
|
+
Current: [Performance metric]
|
|
67
|
+
Issue: [What's causing slowness]
|
|
68
|
+
Fix: [Specific optimization]
|
|
69
|
+
Expected: [Improved metric]
|
|
70
|
+
|
|
71
|
+
2. [Function/Module] - X% CPU time
|
|
72
|
+
[Similar details]
|
|
73
|
+
|
|
74
|
+
📊 MEMORY PROFILE
|
|
75
|
+
───────────────
|
|
76
|
+
- Initial: X MB
|
|
77
|
+
- Peak: X MB
|
|
78
|
+
- Growth: X MB/hour
|
|
79
|
+
- Potential leaks: [Yes/No]
|
|
80
|
+
|
|
81
|
+
🎯 OPTIMIZATION RECOMMENDATIONS
|
|
82
|
+
─────────────────────────────
|
|
83
|
+
1. [Specific optimization with code example]
|
|
84
|
+
Before: [slow code]
|
|
85
|
+
After: [optimized code]
|
|
86
|
+
Impact: X% improvement
|
|
87
|
+
|
|
88
|
+
2. [Another optimization]
|
|
89
|
+
|
|
90
|
+
💡 QUICK WINS
|
|
91
|
+
───────────
|
|
92
|
+
• [Easy optimization 1]
|
|
93
|
+
• [Easy optimization 2]
|
|
94
|
+
• [Easy optimization 3]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
If --benchmark is specified, create and run performance benchmarks:
|
|
98
|
+
!python -m timeit -n 1000 "[code to benchmark]" 2>/dev/null
|
|
99
|
+
!time python main.py 2>/dev/null
|
|
100
|
+
|
|
101
|
+
For specific function profiling (if function name in $ARGUMENTS):
|
|
102
|
+
- Profile that specific function
|
|
103
|
+
- Show call count and time spent
|
|
104
|
+
- Suggest optimizations
|
|
105
|
+
|
|
106
|
+
Common optimizations to check for:
|
|
107
|
+
- N+1 query problems
|
|
108
|
+
- Inefficient loops (nested loops, unnecessary iterations)
|
|
109
|
+
- Missing caching opportunities
|
|
110
|
+
- Synchronous I/O that could be async
|
|
111
|
+
- Large data structure copies
|
|
112
|
+
- Regex compilation in loops
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: AI-assisted project planning with roadmaps, estimation, and risk analysis
|
|
3
|
+
tags: [planning, roadmap, estimation, project-management]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# `/xplanning` - AI-Assisted Planning
|
|
7
|
+
|
|
8
|
+
Strategic planning and project management with AI-driven insights and estimation.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
/xplanning --roadmap # Generate roadmap
|
|
14
|
+
/xplanning --prioritize # Prioritize tasks
|
|
15
|
+
/xplanning --estimate # Effort estimation
|
|
16
|
+
/xplanning --resources # Plan allocation
|
|
17
|
+
/xplanning --risks # Identify risks
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Options
|
|
21
|
+
|
|
22
|
+
### `--roadmap`
|
|
23
|
+
Generate strategic roadmaps with timeline and milestone planning.
|
|
24
|
+
|
|
25
|
+
**Examples:**
|
|
26
|
+
```bash
|
|
27
|
+
/xplanning --roadmap # Generate full roadmap
|
|
28
|
+
/xplanning --roadmap --quarter Q2
|
|
29
|
+
/xplanning --roadmap --epic "user-management"
|
|
30
|
+
/xplanning --roadmap --dependencies
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### `--prioritize`
|
|
34
|
+
AI-driven task prioritization based on value, effort, and dependencies.
|
|
35
|
+
|
|
36
|
+
**Examples:**
|
|
37
|
+
```bash
|
|
38
|
+
/xplanning --prioritize # Prioritize all tasks
|
|
39
|
+
/xplanning --prioritize --method "moscow"
|
|
40
|
+
/xplanning --prioritize --criteria "business-value"
|
|
41
|
+
/xplanning --prioritize --stakeholder "product"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### `--estimate`
|
|
45
|
+
Effort estimation using historical data and AI analysis.
|
|
46
|
+
|
|
47
|
+
**Examples:**
|
|
48
|
+
```bash
|
|
49
|
+
/xplanning --estimate # Estimate all tasks
|
|
50
|
+
/xplanning --estimate --task "authentication"
|
|
51
|
+
/xplanning --estimate --method "story-points"
|
|
52
|
+
/xplanning --estimate --confidence 90
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### `--resources`
|
|
56
|
+
Resource allocation and capacity planning.
|
|
57
|
+
|
|
58
|
+
**Examples:**
|
|
59
|
+
```bash
|
|
60
|
+
/xplanning --resources # View resource allocation
|
|
61
|
+
/xplanning --resources --team "backend"
|
|
62
|
+
/xplanning --resources --capacity
|
|
63
|
+
/xplanning --resources --skills "python,aws"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### `--risks`
|
|
67
|
+
Risk identification and mitigation planning.
|
|
68
|
+
|
|
69
|
+
**Examples:**
|
|
70
|
+
```bash
|
|
71
|
+
/xplanning --risks # Identify all risks
|
|
72
|
+
/xplanning --risks --category "technical"
|
|
73
|
+
/xplanning --risks --impact high
|
|
74
|
+
/xplanning --risks --mitigation
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Planning Methodologies
|
|
78
|
+
|
|
79
|
+
### Agile Planning
|
|
80
|
+
- **Sprint Planning**: Plan sprints with velocity tracking
|
|
81
|
+
- **Story Estimation**: Story point estimation and refinement
|
|
82
|
+
- **Backlog Grooming**: Continuous backlog prioritization
|
|
83
|
+
- **Release Planning**: Multi-sprint release coordination
|
|
84
|
+
|
|
85
|
+
### Strategic Planning
|
|
86
|
+
- **OKR Planning**: Objectives and Key Results framework
|
|
87
|
+
- **Portfolio Planning**: Multi-project coordination
|
|
88
|
+
- **Capacity Planning**: Resource and timeline optimization
|
|
89
|
+
- **Scenario Planning**: Multiple timeline scenarios
|
|
90
|
+
|
|
91
|
+
### Risk Management
|
|
92
|
+
- **Risk Assessment**: Probability and impact analysis
|
|
93
|
+
- **Mitigation Strategies**: Risk reduction planning
|
|
94
|
+
- **Contingency Planning**: Backup plan development
|
|
95
|
+
- **Monitor and Control**: Ongoing risk tracking
|
|
96
|
+
|
|
97
|
+
## AI-Assisted Features
|
|
98
|
+
|
|
99
|
+
### Intelligent Estimation
|
|
100
|
+
- **Historical Analysis**: Learn from past project data
|
|
101
|
+
- **Complexity Assessment**: Automatic complexity scoring
|
|
102
|
+
- **Uncertainty Modeling**: Confidence intervals for estimates
|
|
103
|
+
- **Team Velocity**: Velocity-based planning
|
|
104
|
+
|
|
105
|
+
### Smart Prioritization
|
|
106
|
+
- **Value Scoring**: Business value assessment
|
|
107
|
+
- **Dependency Analysis**: Critical path identification
|
|
108
|
+
- **Resource Optimization**: Skill-based task assignment
|
|
109
|
+
- **Stakeholder Alignment**: Multi-stakeholder priority balancing
|
|
110
|
+
|
|
111
|
+
### Predictive Analytics
|
|
112
|
+
- **Delivery Forecasting**: Timeline prediction models
|
|
113
|
+
- **Resource Conflicts**: Early conflict detection
|
|
114
|
+
- **Scope Creep**: Scope change impact analysis
|
|
115
|
+
- **Success Probability**: Project success likelihood
|
|
116
|
+
|
|
117
|
+
## Integration
|
|
118
|
+
|
|
119
|
+
- **Specifications**: Links to `/xspec` for requirement-driven planning
|
|
120
|
+
- **Task Management**: Works with `/xatomic` for task decomposition
|
|
121
|
+
- **Product**: Integrates with `/xproduct` for product planning
|
|
122
|
+
- **Analytics**: Uses `/xanalytics` for data-driven insights
|
|
123
|
+
- **Risk Management**: Coordinates with `/xrisk` for risk assessment
|
|
124
|
+
|
|
125
|
+
## Output Formats
|
|
126
|
+
|
|
127
|
+
- **Visual Roadmaps**: Timeline-based project visualization
|
|
128
|
+
- **Planning Reports**: Detailed planning analysis and recommendations
|
|
129
|
+
- **Resource Charts**: Capacity and allocation visualizations
|
|
130
|
+
- **Risk Registers**: Comprehensive risk documentation
|
|
131
|
+
- **Estimation Summaries**: Effort and timeline estimates with confidence levels
|