commit 67d0bb683b4cd53eebd926aecf815eb844c1fb52 Author: Zhongwei Li Date: Sun Nov 30 08:21:24 2025 +0800 Initial commit diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..3462964 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "resource-usage-tracker", + "description": "Track and optimize resource usage across the stack", + "version": "1.0.0", + "author": { + "name": "Claude Code Plugins", + "email": "[email protected]" + }, + "skills": [ + "./skills" + ], + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..d6f12a4 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# resource-usage-tracker + +Track and optimize resource usage across the stack diff --git a/commands/track-resources.md b/commands/track-resources.md new file mode 100644 index 0000000..c8d92b4 --- /dev/null +++ b/commands/track-resources.md @@ -0,0 +1,35 @@ +--- +description: Track resource usage and optimize allocation +--- + +# Resource Usage Tracker + +Implement comprehensive resource usage tracking and optimization. + +## Resources to Track + +1. **CPU Usage**: Process and thread-level CPU consumption +2. **Memory Usage**: Heap, stack, and RSS memory +3. **Disk I/O**: Read/write operations and throughput +4. **Network I/O**: Bandwidth and connection usage +5. **File Descriptors**: Open file and socket counts +6. **Database Connections**: Connection pool utilization +7. **Thread/Process Counts**: Concurrency resource usage + +## Process + +1. Identify all resource consumption points +2. Design monitoring instrumentation strategy +3. Implement resource tracking +4. Create dashboards and alerts +5. Generate optimization recommendations + +## Output + +Provide: +- Resource monitoring instrumentation code +- Dashboard configuration for resource metrics +- Alert thresholds for resource exhaustion +- Resource optimization strategies +- Right-sizing recommendations +- Cost optimization opportunities diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..5cfa609 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,61 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/performance/resource-usage-tracker", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "a532ae999ac1bab9ca84106ee1820ef3ca746a55", + "treeHash": "be03e5d2a90572416a6fa31b88fb01b233c5a5c8d32f75916ffd1d55a5b71156", + "generatedAt": "2025-11-28T10:18:42.075092Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "resource-usage-tracker", + "description": "Track and optimize resource usage across the stack", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "d322eb5d4560b446b454c57dd4a7d8ff94b6f4dafe917169bfc3414e58bd2ca7" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "8bc219d5cedc813667df2cac89d072a790929de966eab51c0b0d32e532783670" + }, + { + "path": "commands/track-resources.md", + "sha256": "47cd5c8c7f6368808ab69b4143a3708061b9d81dcd40299ee3c6059029294364" + }, + { + "path": "skills/resource-usage-tracker/SKILL.md", + "sha256": "33d4bb7d24a061dfad0813b903874ae7a44d77f2f696d3d98d2e840e03a5095e" + }, + { + "path": "skills/resource-usage-tracker/references/README.md", + "sha256": "1ef91e5eac970807f5f515bb91791225dcb86fe43113e7b64079f8592720da3a" + }, + { + "path": "skills/resource-usage-tracker/scripts/README.md", + "sha256": "4bfc4ab0e7b187275511d4918d59f4efc4c1f52cba59478291a9603a7b5eebd0" + }, + { + "path": "skills/resource-usage-tracker/assets/README.md", + "sha256": "e6272d217a553a56be0a498a90acdec49e9c256f825fffa13c2531332f81685b" + } + ], + "dirSha256": "be03e5d2a90572416a6fa31b88fb01b233c5a5c8d32f75916ffd1d55a5b71156" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/resource-usage-tracker/SKILL.md b/skills/resource-usage-tracker/SKILL.md new file mode 100644 index 0000000..e5891fb --- /dev/null +++ b/skills/resource-usage-tracker/SKILL.md @@ -0,0 +1,57 @@ +--- +name: tracking-resource-usage +description: | + This skill enables Claude to track and optimize resource usage across an application stack. It is activated when the user requests insights into resource consumption, performance bottlenecks, or cost optimization opportunities. The skill uses the resource-usage-tracker plugin to monitor CPU, memory, disk I/O, network I/O, file descriptors, database connections, and thread/process counts. Use this skill when the user mentions "resource usage", "performance optimization", "cost optimization", "track resources", or "right-sizing". +allowed-tools: Read, Bash, Grep, Glob +version: 1.0.0 +--- + +## Overview + +This skill provides a comprehensive solution for monitoring and optimizing resource usage within an application. It leverages the resource-usage-tracker plugin to gather real-time metrics, identify performance bottlenecks, and suggest optimization strategies. + +## How It Works + +1. **Identify Resources**: The skill identifies the resources to be tracked based on the user's request and the application's configuration (CPU, memory, disk I/O, network I/O, etc.). +2. **Collect Metrics**: The plugin collects real-time metrics for the identified resources, providing a snapshot of current resource consumption. +3. **Analyze Data**: The skill analyzes the collected data to identify performance bottlenecks, resource imbalances, and potential optimization opportunities. +4. **Provide Recommendations**: Based on the analysis, the skill provides specific recommendations for optimizing resource allocation, right-sizing instances, and reducing costs. + +## When to Use This Skill + +This skill activates when you need to: +- Identify performance bottlenecks in an application. +- Optimize resource allocation to improve efficiency. +- Reduce cloud infrastructure costs by right-sizing instances. +- Monitor resource usage in real-time to detect anomalies. +- Track the impact of code changes on resource consumption. + +## Examples + +### Example 1: Identifying Memory Leaks + +User request: "Track memory usage and identify potential memory leaks." + +The skill will: +1. Activate the resource-usage-tracker plugin to monitor memory usage (heap, stack, RSS). +2. Analyze the memory usage data over time to detect patterns indicative of memory leaks. +3. Provide recommendations for identifying and resolving the memory leaks. + +### Example 2: Optimizing Database Connection Pool + +User request: "Optimize database connection pool utilization." + +The skill will: +1. Activate the resource-usage-tracker plugin to monitor database connection pool metrics. +2. Analyze the connection pool utilization data to identify periods of high contention or underutilization. +3. Provide recommendations for adjusting the connection pool size to optimize performance and resource consumption. + +## Best Practices + +- **Granularity**: Track resource usage at a granular level (e.g., process-level CPU usage) to identify specific bottlenecks. +- **Historical Data**: Analyze historical resource usage data to identify trends and predict future resource needs. +- **Alerting**: Configure alerts to notify you when resource usage exceeds predefined thresholds. + +## Integration + +This skill can be integrated with other monitoring and alerting tools to provide a comprehensive view of application performance. It can also be used in conjunction with deployment automation tools to automatically right-size instances based on resource usage patterns. \ No newline at end of file diff --git a/skills/resource-usage-tracker/assets/README.md b/skills/resource-usage-tracker/assets/README.md new file mode 100644 index 0000000..85299bc --- /dev/null +++ b/skills/resource-usage-tracker/assets/README.md @@ -0,0 +1,9 @@ +# Assets + +Bundled resources for resource-usage-tracker skill + +- [ ] dashboard_template.html: HTML template for a resource usage dashboard. +- [ ] alert_template.json: JSON template for alert configurations. +- [ ] example_resource_data.json: Example resource usage data in JSON format. +- [ ] right_sizing_recommendation_template.md: Markdown template for right-sizing recommendations. +- [ ] cost_optimization_report_template.md: Markdown template for cost optimization reports. diff --git a/skills/resource-usage-tracker/references/README.md b/skills/resource-usage-tracker/references/README.md new file mode 100644 index 0000000..06816a5 --- /dev/null +++ b/skills/resource-usage-tracker/references/README.md @@ -0,0 +1,10 @@ +# References + +Bundled resources for resource-usage-tracker skill + +- [ ] resource_metrics_definition.md: Detailed definitions of resource metrics (CPU usage, memory consumption, disk I/O, network I/O, file descriptors, database connections, thread/process counts). +- [ ] performance_bottleneck_analysis.md: Guide on how to analyze resource usage data to identify performance bottlenecks. +- [ ] cost_optimization_strategies.md: Documentation on cost optimization strategies based on resource usage. +- [ ] alert_configuration_guide.md: Guide on how to configure alerts for resource usage thresholds. +- [ ] right_sizing_guide.md: Guide on how to right-size resources based on historical usage data. +- [ ] psutil_library_documentation.md: Documentation for the psutil library used for resource monitoring. diff --git a/skills/resource-usage-tracker/scripts/README.md b/skills/resource-usage-tracker/scripts/README.md new file mode 100644 index 0000000..83f86c9 --- /dev/null +++ b/skills/resource-usage-tracker/scripts/README.md @@ -0,0 +1,9 @@ +# Scripts + +Bundled resources for resource-usage-tracker skill + +- [ ] resource_monitor.py: Script to collect resource usage data (CPU, memory, disk I/O, network I/O, etc.) using system calls or libraries like psutil. +- [ ] data_analyzer.py: Script to analyze the collected resource usage data and identify performance bottlenecks or anomalies. +- [ ] alert_manager.py: Script to configure and manage alerts based on resource usage thresholds. +- [ ] right_sizing_recommendation.py: Script to provide right-sizing recommendations based on historical resource usage data. +- [ ] cost_optimization.py: Script to provide cost optimization insights based on resource usage and cloud pricing models.