File contents Report Generator
Report Generator
def generate_usage_report(analytics: UsageAnalytics, days: int = 30) -> str:
"""Generate a formatted usage report."""
summary = analytics.get_summary(
start=datetime.utcnow() - timedelta(days=days)
)
performance = analytics.get_performance_metrics(days)
top_users = analytics.get_top_users(limit=5, days=days)
anomalies = analytics.detect_anomalies(days=7)
report = f"""
================================================================================
KLING AI USAGE REPORT ({days} DAYS)
================================================================================
SUMMARY
-------
Total Generations: {summary['total_generations']}
Completed: {summary['completed']} ({summary['success_rate']:.1f}% success rate)
Failed: {summary['failed']}
Total Credits Used: {summary['total_credits']}
Average Credits/Video: {summary['avg_credits_per_video']:.1f}
PERFORMANCE
-----------
Average Generation Time: {performance['generation_time']['avg']:.1f}s
P95 Generation Time: {performance['generation_time']['p95']:.1f}s
Failure Rate: {performance['failure_rate']:.2f}%
BY MODEL
--------
"""
for model, stats in summary['by_model'].items():
report += f" {model}: {stats['count']} videos, {stats['credits']} credits\n"
report += """
BY DURATION
-----------
"""
for duration, stats in summary['by_duration'].items():
report += f" {duration}: {stats['count']} videos, {stats['credits']} credits\n"
report += """
TOP USERS
---------
"""
for i, user in enumerate(top_users, 1):
report += f" {i}. {user['user_id']}: {user['generations']} videos, {user['credits']} credits\n"
if anomalies:
report += """
ANOMALIES DETECTED
------------------
"""
for a in anomalies:
report += f" {a['date']}: {a['type'].upper()} - {a['generations']} generations (expected ~{a['expected']})\n"
report += """
================================================================================
"""
return report
# Usage
analytics = UsageAnalytics()
# Record events (in production, this would come from your tracking system)
# analytics.record_event(...)
# Generate report
print(generate_usage_report(analytics, days=30))
1 --- 2 name: 2306-report-generator-405cb64a 3 description: Report Generator 4 --- 5 # Report Generator 6 7 ## Report Generator 8 9 ```python 10 def generate_usage_report(analytics: UsageAnalytics, days: int = 30) -> str: 11 """Generate a formatted usage report.""" 12 summary = analytics.get_summary( 13 start=datetime.utcnow() - timedelta(days=days) 14 ) 15 performance = analytics.get_performance_metrics(days) 16 top_users = analytics.get_top_users(limit=5, days=days) 17 anomalies = analytics.detect_anomalies(days=7) 18 19 report = f""" 20 ================================================================================ 21 KLING AI USAGE REPORT ({days} DAYS) 22 ================================================================================ 23 24 SUMMARY 25 ------- 26 Total Generations: {summary['total_generations']} 27 Completed: {summary['completed']} ({summary['success_rate']:.1f}% success rate) 28 Failed: {summary['failed']} 29 Total Credits Used: {summary['total_credits']} 30 Average Credits/Video: {summary['avg_credits_per_video']:.1f} 31 32 PERFORMANCE 33 ----------- 34 Average Generation Time: {performance['generation_time']['avg']:.1f}s 35 P95 Generation Time: {performance['generation_time']['p95']:.1f}s 36 Failure Rate: {performance['failure_rate']:.2f}% 37 38 BY MODEL 39 -------- 40 """ 41 for model, stats in summary['by_model'].items(): 42 report += f" {model}: {stats['count']} videos, {stats['credits']} credits\n" 43 44 report += """ 45 BY DURATION 46 ----------- 47 """ 48 for duration, stats in summary['by_duration'].items(): 49 report += f" {duration}: {stats['count']} videos, {stats['credits']} credits\n" 50 51 report += """ 52 TOP USERS 53 --------- 54 """ 55 for i, user in enumerate(top_users, 1): 56 report += f" {i}. {user['user_id']}: {user['generations']} videos, {user['credits']} credits\n" 57 58 if anomalies: 59 report += """ 60 ANOMALIES DETECTED 61 ------------------ 62 """ 63 for a in anomalies: 64 report += f" {a['date']}: {a['type'].upper()} - {a['generations']} generations (expected ~{a['expected']})\n" 65 66 report += """ 67 ================================================================================ 68 """ 69 70 return report 71 72 # Usage 73 analytics = UsageAnalytics() 74 75 # Record events (in production, this would come from your tracking system) 76 # analytics.record_event(...) 77 78 # Generate report 79 print(generate_usage_report(analytics, days=30)) 80 ```
tools-only/X-Skills/tree/main/commercial/2306-report-generator_405cb64a commit 608783adc2
Frequently asked questions How do I install the 2306 Report Generator 405cb64a skill? Run npx skillmds@latest add tools-only/2306-report-generator-405cb64a in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the 2306 Report Generator 405cb64a skill do? Report Generator It is listed under Docs & Writing on SkillMD.
Is 2306 Report Generator 405cb64a safe to use? This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with 2306 Report Generator 405cb64a? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is 2306 Report Generator 405cb64a free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published 2306 Report Generator 405cb64a? tools-only (@tools-only) published this skill. Their other Agent Skills are listed on their SkillMD profile.