--- name: limacharlie-reporting description: Use this skill when users need interactive HTML reports, dashboards, charts, or visualizations for LimaCharlie data. You generate the HTML, this skill serves it on localhost. --- # LimaCharlie Reporting Skill ## Overview This skill lets you create rich, interactive HTML reports that open in a browser instead of displaying in the terminal. **You generate whatever HTML you want** - tables, charts, dashboards, visualizations - and this skill serves it on localhost. ## When to Use This Skill Use this when users want: - Visual reports, dashboards, or charts - Billing analysis with graphs - Interactive tables with sorting/filtering - MITRE ATT&CK coverage heatmaps - Any data visualization that's better in a browser than text ## How It Works **Three simple steps:** 1. **You generate HTML** (with any charts, tables, styling you want) 2. **Call `create_and_serve_report(html)`** - This spawns Python's `http.server` as a background subprocess 3. **User opens the localhost URL in their browser** The implementation uses Python's built-in `http.server` module running as a subprocess, serving files directly from `/tmp`. This approach is simple, reliable, and requires no complex threading or process management. You have complete freedom to generate whatever HTML makes sense. ## Basic Usage ```python import sys sys.path.insert(0, '/full/path/to/skills/limacharlie-reporting') from lib import create_and_serve_report # Generate your HTML however you want html = """

My Report

Some analysis here...

MetricValue
Sensors45
Cost$1,234
""" # Serve it url = create_and_serve_report(html, title="My Report") print(f"\nReport ready: {url}") ``` The URL will be something like `http://localhost:8080/report-abc123.html`. ## Adding Charts with Chart.js Chart.js is a simple, popular charting library. Here's how to use it: ```python html = """

Billing Trend

""" url = create_and_serve_report(html, title="Billing Dashboard") ``` **Chart.js Quick Reference:** - **Line charts**: `type: 'line'` - **Bar charts**: `type: 'bar'` - **Pie/Donut**: `type: 'pie'` or `type: 'doughnut'` - Docs: https://www.chartjs.org/docs/latest/ ## Creating Interactive Tables For sortable, filterable tables, you can generate simple HTML tables or use libraries like DataTables: ```python # Simple HTML table (users can still sort/filter in browser with Ctrl+F) html = """

Sensor Inventory

Hostname Platform Status
web-01linuxonline
db-01linuxonline
win-dc01windowsoffline
""" url = create_and_serve_report(html, title="Sensors") ``` ## Styling Your Reports You can include CSS inline or link to frameworks: ```python html = """

Overview

$1,234
Total Cost
45
Active Sensors
""" url = create_and_serve_report(html, title="Dashboard") ``` ## Using Other Visualization Libraries You can use any JavaScript library from a CDN: - **ApexCharts**: Modern, interactive charts - https://apexcharts.com/ - **Plotly**: Scientific/statistical visualizations - https://plotly.com/javascript/ - **ECharts**: Rich enterprise charts - https://echarts.apache.org/ - **D3.js**: Custom data visualizations - https://d3js.org/ Just include the CDN script tag and use the library's API in your HTML. ## API Reference ### `create_and_serve_report(html_content, title="Report", filename=None, wrap=True, include_chart_js=False)` **Parameters:** - `html_content` (str): Your HTML content - `title` (str): Page title (used if wrap=True) - `filename` (str, optional): Custom filename (e.g., "billing" → "billing.html") - `wrap` (bool): If True, wraps content in minimal HTML template. If False, uses content as complete HTML document. - `include_chart_js` (bool): If True (and wrap=True), automatically includes Chart.js CDN script **Returns:** - (str): URL where report can be accessed (e.g., `http://localhost:8080/report-abc123.html`) ### Helper: `wrap_html(content, title, include_chart_js=False)` Wraps your content in a minimal HTML document with basic styling. Called automatically if `wrap=True` in `create_and_serve_report`. ## Complete Example: Billing Report ```python import sys sys.path.insert(0, '/full/path/to/skills/limacharlie-reporting') from lib import create_and_serve_report # Assume we fetched billing data from LimaCharlie MCP total_cost = 1234.56 services = [ {'name': 'Detection & Response', 'cost': 500.00}, {'name': 'Artifact Collection', 'cost': 300.00}, {'name': 'Outputs', 'cost': 434.56} ] # Generate HTML with inline Chart.js html = f"""

Billing Dashboard

Current billing cycle: ${total_cost:,.2f}

Cost by Service

Service Breakdown

{''.join(f'' for s in services)}
Service Cost
{s["name"]}${s["cost"]:,.2f}
""" url = create_and_serve_report(html, title="Billing Report") print(f"\nāœ… Billing report ready: {url}") ``` ## Best Practices 1. **Keep it simple**: Generate clean HTML, don't over-engineer 2. **Use CDNs**: Link to Chart.js, Plotly, etc. from CDN (no local dependencies) 3. **Inline styles**: Put CSS in `