data-export
Skill915 starsChanged 22 days agoMITView on GitHub
Generates data export/import infrastructure for JSON, CSV, PDF formats with GDPR data portability, share sheet integration, and file import. Use when user wants data export functionality, CSV/JSON/PDF export, GDPR compliance data portability, import from files, or share sheet for data.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- teachskillofskills-ai/DigitalMarketingPro-techshutheir own version, first seen Oct 11, 2026
- QuantConnect/Documentationtheir own version, first seen Oct 8, 2026
- indranilbanerjee/digital-marketing-protheir own version, first seen Feb 12, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- indranilbanerjee/digital-marketing-pro★ 934same name
- QuantConnect/Documentation★ 269same name
- teachskillofskills-ai/DigitalMarketingPro-techshu★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository184 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- app-intentsSkill
- foundation-modelsSkill
- apple-intelligenceSkill
- visual-intelligenceSkill
- ad-attributionSkill
- app-description-writerSkill
- apple-search-adsSkill
- iap-finalizerSkill
- keyword-optimizerSkill
- marketing-strategySkill
- originality-checkSkill
- ratings-mechanicsSkill
- rejection-handlerSkill
- review-response-writerSkill
- screenshot-plannerSkill
- app-storeSkill
- web-presenceSkill
- core-mlSkill
- animation-patternsSkill
- design-systemSkill
- game-feelSkill
- liquid-glassSkill
- sf-symbolsSkill
- designSkill
- typographySkill
- ui-prototypingSkill
- ux-writingSkill
- attributed-stringSkill
- foundationSkill
- accessibility-generatorSkill
- account-deletionSkill
- analytics-setupSkill
- announcement-bannerSkill
- app-clipSkill
- app-extensionsSkill
- app-icon-generatorSkill
- app-store-assetsSkill
- auth-flowSkill
- background-processingSkill
- ci-cd-setupSkill
- cloudkit-syncSkill
- consent-flowSkill
- custom-product-pagesSkill
- debug-menuSkill
- deep-linkingSkill
- error-monitoringSkill
- feature-flagsSkill
- featuring-nominationSkill
- feedback-formSkill
- force-updateSkill
- http-cacheSkill
- image-loadingSkill
- in-app-eventsSkill
- lapsed-userSkill
- live-activity-generatorSkill
- localization-setupSkill
- logging-setupSkill
- milestone-celebrationSkill
- networking-layerSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 12 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Use this skill when the user:
- Distinctive: line 34
Search for existing export code:
- Distinctive: line 40
If existing export code found:
- Distinctive: line 41
Ask if user wants to replace or add additional formats
- Distinctive: line 45
Search for data models that need exporting:
- Distinctive: line 54
Ask user via AskUserQuestion:
- Distinctive: line 63
All user data -- GDPR compliance (every piece of stored user data)
- Very specific: line 81
Read templates.md for production Swift code.
- Distinctive: line 94
If import capability selected:
- Very specific: line 99
If Sources/ exists -> Sources/DataExport/
- Distinctive: line 299
Always export to a temporary directory, then present via share sheet:
- Distinctive: line 309
All personal data the user provided
- Distinctive: line 310
All data generated about the user
- Distinctive: line 319
Delete large export files after sharing completes rather than relying on the system's periodic cleanup.
- Very specific: line 328
Use ShareLink for the simple case.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Data Export Generator
Generate production data export and import infrastructure -- JSON export via Codable, CSV generation with proper escaping, PDF report rendering with UIGraphicsPDFRenderer, GDPR-compliant full data export, file import with UTType-based picker, and share sheet integration. No third-party dependencies.
When This Skill Activates
Use this skill when the user:
- Asks to "add data export" or "export user data"
- Wants "CSV export" or "JSON export" or "PDF export"
- Mentions "GDPR data portability" or "right to data portability"
- Asks about "exporting all user data" for compliance
- Wants to "import data" from files or competitor apps
- Mentions "share sheet" for exporting data
- Asks about "data backup" or "data download"
Pre-Generation Checks
1. Project Context Detection
- Check deployment target (iOS 16+ / macOS 13+)
- Check Swift version (requires Swift 5.9+)
- Identify data model layer (SwiftData, Core Data, custom structs)
- Identify source file locations
2. Existing Export Detection
Search for existing export code:
Glob: **/*Export*.swift, **/*Import*.swift, **/*CSV*.swift, **/*PDF*.swift
Grep: "UIGraphicsPDFRenderer" or "CSVExport" or "UIActivityViewController" or "ShareLink" or "fileExporter"If existing export code found:
- Ask if user wants to replace or add additional formats
- Identify which formats are already supported
3. Data Model Detection
Search for data models that need exporting:
Grep: "@Model" or "NSManagedObject" or "struct.*Codable" or "class.*Codable"Identify the models to build export conformances for.
Configuration Questions
Ask user via AskUserQuestion:
- Export formats needed?
- JSON (structured, machine-readable, best for GDPR)
- CSV (tabular data, spreadsheet-compatible)
- PDF (formatted reports with headers, tables, branding)
- Multiple (select which combination)
- What data needs exporting?
- All user data -- GDPR compliance (every piece of stored user data)
- Specific data types (user selects which models to export)
- Reports/summaries (aggregated data, not raw records)
- Do you need import capability?
- No -- export only
- Yes -- from files (JSON, CSV via file picker)
- Yes -- from competitor apps (custom format parsing)
- How should users trigger export?
- Share sheet (system share UI with multiple destinations)
- Settings screen (dedicated export section)
- Export button (inline in content views)
- Automatic backup (periodic export to iCloud/local)
Generation Process
Step 1: Read Templates
Read templates.md for production Swift code.
Step 2: Create Core Files
Generate these files:
DataExportManager.swift-- Central export coordinator with format routingDataExportable.swift-- Protocol for models that support export
Step 3: Create Format-Specific Files
Based on configuration:
3. CSVExporter.swift -- If CSV format selected
4. PDFExporter.swift -- If PDF format selected
Step 4: Create Import Files
If import capability selected:
5. DataImporter.swift -- File picker and format parser
Step 5: Determine File Location
Check project structure:
- If
Sources/exists ->Sources/DataExport/ - If
App/exists ->App/DataExport/ - Otherwise ->
DataExport/
Output Format
After generation, provide:
Files Created
DataExport/
├── DataExportable.swift # Protocol for exportable models
├── DataExportManager.swift # Central export coordinator
├── CSVExporter.swift # CSV generation (optional)
├── PDFExporter.swift # PDF rendering (optional)
└── DataImporter.swift # File import (optional)Integration with Data Models
Make a model exportable:
struct Expense: Codable, DataExportable {
let id: UUID
let title: String
let amount: Double
let date: Date
let category: String
// DataExportable conformance
static var csvHeaders: [String] {
["ID", "Title", "Amount", "Date", "Category"]
}
var csvRow: [String] {
[id.uuidString, title, String(format: "%.2f", amount),
ISO8601DateFormatter().string(from: date), category]
}
var pdfDescription: String {
"\(title) - $\(String(format: "%.2f", amount)) (\(category))"
}
}Export from a view:
struct ExpenseListView: View {
let expenses: [Expense]
@State private var exportURL: URL?
@State private var showShareSheet = false
var body: some View {
List(expenses) { expense in
ExpenseRow(expense: expense)
}
.toolbar {
Menu {
Button("Export as JSON") {
Task { await exportAs(.json) }
}
Button("Export as CSV") {
Task { await exportAs(.csv) }
}
Button("Export as PDF") {
Task { await exportAs(.pdf) }
}
} label: {
Label("Export", systemImage: "square.and.arrow.up")
}
}
.sheet(isPresented: $showShareSheet) {
if let exportURL {
ShareSheet(activityItems: [exportURL])
}
}
}
private func exportAs(_ format: DataExportManager.ExportFormat) async {
do {
exportURL = try await DataExportManager.shared.export(
expenses, format: format, filename: "expenses"
)
showShareSheet = true
} catch {
// Handle error
}
}
}SwiftUI ShareLink (iOS 16+):
if let url = exportURL {
ShareLink(item: url) {
Label("Share Export", systemImage: "square.and.arrow.up")
}
}Import from file picker:
struct ImportView: View {
@State private var showFilePicker = false
@State private var importedItems: [Expense] = []
var body: some View {
Button("Import Data") { showFilePicker = true }
.fileImporter(
isPresented: $showFilePicker,
allowedContentTypes: DataImporter.supportedTypes
) { result in
Task {
let url = try result.get()
importedItems = try await DataImporter.importFile(
from: url, as: Expense.self
)
}
}
}
}GDPR Data Portability
For full GDPR compliance, export ALL user data:
func exportAllUserData() async throws -> URL {
let allData = GDPRExportData(
profile: try await fetchUserProfile(),
expenses: try await fetchAllExpenses(),
settings: try await fetchUserSettings(),
exportDate: Date(),
appVersion: Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0"
)
let encoder = JSONEncoder()
encoder.outputFormatting = [.prettyPrinted, .sortedKeys]
encoder.dateEncodingStrategy = .iso8601
let data = try encoder.encode(allData)
let url = FileManager.default.temporaryDirectory
.appendingPathComponent("user-data-export.json")
try data.write(to: url)
return url
}Testing
@Test
func jsonExportRoundTrip() async throws {
let expenses = [
Expense(id: UUID(), title: "Coffee", amount: 4.50,
date: Date(), category: "Food")
]
let url = try await DataExportManager.shared.export(
expenses, format: .json, filename: "test"
)
let data = try Data(contentsOf: url)
let decoded = try JSONDecoder().decode([Expense].self, from: data)
#expect(decoded.count == 1)
#expect(decoded.first?.title == "Coffee")
}
@Test
func csvExportFormatsCorrectly() {
let expenses = [
Expense(id: UUID(), title: "Coffee, Large", amount: 4.50,
date: Date(), category: "Food")
]
let csv = CSVExporter.generate(
from: expenses,
headers: Expense.csvHeaders,
rowMapper: { $0.csvRow }
)
#expect(csv.contains("\"Coffee, Large\"")) // Commas escaped with quotes
#expect(csv.hasPrefix("ID,Title,Amount,Date,Category"))
}
@Test
func importParsesCSV() async throws {
let csvContent = "ID,Title,Amount\n1,Coffee,4.50\n2,Lunch,12.00"
let url = FileManager.default.temporaryDirectory.appendingPathComponent("test.csv")
try csvContent.write(to: url, atomically: true, encoding: .utf8)
let rows = try CSVExporter.parse(from: url)
#expect(rows.count == 2)
#expect(rows.first?["Title"] == "Coffee")
}Common Patterns
Export to Temporary File for Sharing
Always export to a temporary directory, then present via share sheet:
let url = FileManager.default.temporaryDirectory
.appendingPathComponent("export.\(format.fileExtension)")
try data.write(to: url)
// Present via UIActivityViewController or ShareLinkGDPR Export Should Include Everything
For GDPR Article 20 compliance, export must include:
- All personal data the user provided
- All data generated about the user
- With clear field descriptions
CSV Must Handle Special Characters
Wrap fields containing commas, quotes, or newlines in double quotes; escape internal quotes by doubling them.
Gotchas
Temporary Files Cleanup
Delete large export files after sharing completes rather than relying on the system's periodic cleanup.
PDF Rendering on Background Thread
UIGraphicsPDFRenderer must be used on the main thread if it references UIKit views. For data-only PDF generation (text, lines, rectangles), it is safe to render on a background thread.
Large Dataset Memory
For exporting thousands of records, stream the output instead of building the entire string/data in memory. Write CSV line-by-line to a file handle. For JSON, use JSONSerialization with streams.
ShareLink vs UIActivityViewController
Use ShareLink for the simple case; use UIActivityViewController when you need excluded activities, completion handlers, or custom activities.
File Import Security Scoped URLs
.fileImporter URLs are security-scoped: call url.startAccessingSecurityScopedResource() before reading, url.stopAccessingSecurityScopedResource() after.
References
- templates.md -- All production Swift templates for data export/import
- UIGraphicsPDFRenderer
- UIActivityViewController
- UniformTypeIdentifiers
- GDPR Article 20 - Right to Data Portability
- Related:
generators/settings-screen-- Settings screen with export button - Related:
generators/account-deletion-- Account deletion includes data export option
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

