report-generator について
report-generator は、提供されたデータやその説明からレポートを作成するスキルです。チャート、表、分析結果を含むダッシュボード、KPI サマリー、分析レポートを生成します。
主な機能
- 01ダッシュボードと KPI サマリーの生成
- 02分析レポートの作成
- 03チャートと表の追加
- 04CSV、Excel、JSON データの利用
活用シーン
- 01月次業務 KPI の要約
- 02データからの売上レポート作成
- 03チャート付きエグゼクティブサマリーの作成
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ claude-office-skills/ skills --skill report-generatorインストール後、Claude Code で/report-generatorを入力して読み込まれたか確認します。
詳細
レポート生成スキル
概要
このスキルを使うと、プロフェッショナルなデータレポートを自動生成できます。お持ちのデータから、グラフ、表、インサイトを含むダッシュボード、KPIサマリー、分析レポートを作成します。
使い方
- データを提供します(CSV、Excel、JSON、または内容を説明してください)
- 必要なレポートの種類を指定します
- 視覚化を含む書式設定済みのレポートを生成します
プロンプトの例:
- 「このデータから売上レポートを生成してください」
- 「月次KPIダッシュボードを作成してください」
- 「グラフ付きのエグゼクティブサマリーを作成してください」
- 「データ分析レポートを作成してください」
ドメイン知識
レポートの構成要素
# Report structure
report = {
'title': 'Monthly Sales Report',
'period': 'January 2024',
'sections': [
'executive_summary',
'kpi_dashboard',
'detailed_analysis',
'charts',
'recommendations'
]
}
レポートでのPythonの使用
import pandas as pd
import matplotlib.pyplot as plt
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
def generate_report(data, output_path):
# Load data
df = pd.read_csv(data)
# Calculate KPIs
total_revenue = df['revenue'].sum()
avg_order = df['revenue'].mean()
growth = df['revenue'].pct_change().mean()
# Create charts
fig, axes = plt.subplots(2, 2, figsize=(12, 10))
df.plot(kind='bar', ax=axes[0,0], title='Revenue by Month')
df.plot(kind='line', ax=axes[0,1], title='Trend')
plt.savefig('charts.png')
# Generate PDF
# ... PDF generation code
return output_path
HTMLレポートのテンプレート
def generate_html_report(data, title):
html = f'''
<!DOCTYPE html>
<html>
<head>
<title>{title}</title>
<style>
body {{ font-family: Arial; margin: 40px; }}
.kpi {{ display: flex; gap: 20px; }}
.kpi-card {{ background: #f5f5f5; padding: 20px; border-radius: 8px; }}
.metric {{ font-size: 2em; font-weight: bold; color: #2563eb; }}
table {{ border-collapse: collapse; width: 100%; }}
th, td {{ border: 1px solid #ddd; padding: 12px; text-align: left; }}
</style>
</head>
<body>
<h1>{title}</h1>
<div class="kpi">
<div class="kpi-card">
<div class="metric">${data['revenue']:,.0f}</div>
<div>Total Revenue</div>
</div>
<div class="kpi-card">
<div class="metric">{data['growth']:.1%}</div>
<div>Growth Rate</div>
</div>
</div>
</body>
</html>
'''
return html
例:売上レポート
import pandas as pd
import matplotlib.pyplot as plt
def create_sales_report(csv_path, output_path):
# Read data
df = pd.read_csv(csv_path)
# Calculate metrics
metrics = {
'total_revenue': df['amount'].sum(),
'total_orders': len(df),
'avg_order': df['amount'].mean(),
'top_product': df.groupby('product')['amount'].sum().idxmax()
}
# Create visualizations
fig, axes = plt.subplots(2, 2, figsize=(14, 10))
# Revenue by product
df.groupby('product')['amount'].sum().plot(
kind='bar', ax=axes[0,0], title='Revenue by Product'
)
# Monthly trend
df.groupby('month')['amount'].sum().plot(
kind='line', ax=axes[0,1], title='Monthly Revenue'
)
plt.tight_layout()
plt.savefig(output_path.replace('.html', '_charts.png'))
# Generate HTML report
html = generate_html_report(metrics, 'Sales Report')
with open(output_path, 'w') as f:
f.write(html)
return output_path
create_sales_report('sales_data.csv', 'sales_report.html')
リソース
コメント
Markdown 対応