AGENT SKILL

run2_csv-reporting

Reliable CSV generation for security audits with automated field mapping.

License 许可
MIT
最近更新
2026-10-02
Stars
★ 93
Forks
8

01 前言 Front Matter

name
run2_csv-reporting
description
Reliable CSV generation for security audits with automated field mapping.

03 SKILL.md 正文

Reliable CSV Reporting

This skill focuses on clean and error-free CSV generation.

Best Practices

  • Use csv.DictWriter for clarity and automatic field alignment.
  • Always specify newline='' when opening the file to avoid blank lines on some platforms.
  • Ensure all dictionary keys match the fieldnames list exactly.
import csv

def generate_csv_report(data_list, output_file):
    if not data_list:
        print("No data to write to CSV.")
        return

    fieldnames = list(data_list[0].keys())
    with open(output_file, 'w', newline='', encoding='utf-8') as f:
        writer = csv.DictWriter(f, fieldnames=fieldnames)
        writer.writeheader()
        writer.writerows(data_list)

04 同仓库更多 Skills