Skip to content

jeremylongshore/tons-of-skills-marketplace / plugins/devops/cloud-cost-optimizer/skills/optimizing-cloud-costs

optimizing-cloud-costs

Verified

Execute use when you need to work with cloud cost optimization. This skill provides cost analysis and optimization with comprehensive guidance and automation. Trigger with phrases like "optimize costs", "analyze spending", or "reduce costs".

scripts/generate_cost_report.py

View on GitHub
#!/usr/bin/env python3
"""
cloud-cost-optimizer - Generator Script
Generates a detailed cost report in various formats (CSV, PDF, etc.) based on cloud provider APIs.
Generated: 2025-12-10 03:48:17
"""

import json
import argparse
from pathlib import Path
from datetime import datetime
from typing import Dict


class Generator:
    def __init__(self, config: Dict):
        self.config = config
        self.output_dir = Path(config.get("output", "./output"))
        self.output_dir.mkdir(parents=True, exist_ok=True)

    def generate_markdown(self, title: str, content: str) -> Path:
        """Generate markdown document."""
        filename = f"{title.lower().replace(' ', '_')}_{datetime.now().strftime('%Y%m%d_%H%M%S')}.md"
        file_path = self.output_dir / filename

        md_content = f"""# {title}

Generated by cloud-cost-optimizer
Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}

## Overview
{content}

## Configuration
```json
{json.dumps(self.config, indent=2)}
```

## Category
devops

## Plugin
cloud-cost-optimizer
"""

        file_path.write_text(md_content)
        return file_path

    def generate_json(self, data: Dict) -> Path:
        """Generate JSON output."""
        filename = f"output_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json"
        file_path = self.output_dir / filename

        output_data = {
            "generated_by": "cloud-cost-optimizer",
            "timestamp": datetime.now().isoformat(),
            "category": "devops",
            "plugin": "cloud-cost-optimizer",
            "data": data,
            "config": self.config,
        }

        with open(file_path, "w") as f:
            json.dump(output_data, f, indent=2)

        return file_path

    def generate_script(self, name: str, template: str) -> Path:
        """Generate executable script."""
        filename = f"{name}.sh"
        file_path = self.output_dir / filename

        script_content = f"""#!/bin/bash
# Generated by cloud-cost-optimizer
# Date: {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}

set -e  # Exit on error

echo "πŸš€ Running {name}..."

# Template content
{template}

echo "βœ… Completed successfully"
"""

        file_path.write_text(script_content)
        file_path.chmod(0o755)  # Make executable
        return file_path


def main():
    parser = argparse.ArgumentParser(
        description="Generates a detailed cost report in various formats (CSV, PDF, etc.) based on cloud provider APIs."
    )
    parser.add_argument("--type", choices=["markdown", "json", "script"], default="markdown")
    parser.add_argument("--output", "-o", default="./output", help="Output directory")
    parser.add_argument("--config", "-c", help="Configuration file")
    parser.add_argument("--title", default="cloud-cost-optimizer Output")
    parser.add_argument("--content", help="Content to include")

    args = parser.parse_args()

    config = {"output": args.output}
    if args.config and Path(args.config).exists():
        with open(args.config) as f:
            config.update(json.load(f))

    generator = Generator(config)

    print(f"πŸ”§ Generating {args.type} output...")

    if args.type == "markdown":
        output_file = generator.generate_markdown(args.title, args.content or "Generated content")
    elif args.type == "json":
        output_file = generator.generate_json({"title": args.title, "content": args.content})
    else:  # script
        output_file = generator.generate_script(
            args.title.lower().replace(" ", "_"), args.content or "# Add your script content here"
        )

    print(f"βœ… Generated: {output_file}")
    return 0


if __name__ == "__main__":
    import sys

    sys.exit(main())
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why β€” repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" β€” or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself β€” your human partner chose inline execution, or no subagent tool is availableStars: 323kUpdated Claude CodeCodexVerifiedInstall