share-card
Generates shareable card images from app content (achievements, stats, quotes) for social media sharing. Use when user wants to create share images, social cards, shareable content cards, or export app content as images with ShareLink integration.
What this skill does
# Share Card Generator
Generate a production share card system that renders app content (achievements, statistics, quotes, milestones) as shareable images with SwiftUI `ImageRenderer`, customizable styles, optional QR code overlays, and native `ShareLink` integration.
## When This Skill Activates
Use this skill when the user:
- Asks to "generate share cards" or "create shareable images"
- Wants to "share achievements as images" or "share stats to social media"
- Mentions "social media cards" or "shareable content cards"
- Asks about "exporting content as images" or "screenshot sharing"
- Wants "branded share images" or "share card templates"
- Asks to "add ShareLink with image" or "share rendered SwiftUI view"
- Wants "QR code on share image" or "deep link in share card"
## Pre-Generation Checks
### 1. Project Context Detection
- [ ] Check Swift version (requires Swift 5.9+)
- [ ] Check deployment target (iOS 16+ / macOS 13+ minimum for `ImageRenderer`)
- [ ] Check for @Observable support (iOS 17+ / macOS 14+)
- [ ] Identify source file locations
### 2. Conflict Detection
Search for existing share/export code:
```
Glob: **/*ShareCard*.swift, **/*ShareImage*.swift, **/*SocialCard*.swift
Grep: "ImageRenderer" or "ShareLink" or "UIGraphicsImageRenderer" or "share.*image"
```
If existing share infrastructure found:
- Ask if user wants to replace or extend it
- If extending, integrate with existing models and styles
### 3. Platform Detection
Determine if generating for iOS (`UIImage`) or macOS (`NSImage`) or both (cross-platform `PlatformImage` typealias).
## Configuration Questions
Ask user via AskUserQuestion:
1. **Card style?**
- Minimal (clean, text-focused, light/dark adaptive)
- Branded (app logo, brand colors, custom typography)
- Statistics (data-heavy with charts/numbers emphasis)
2. **Share destinations?**
- Social media (Instagram, Twitter/X — optimized aspect ratios)
- Messages / General sharing (flexible sizing)
- Both — recommended
3. **Card size preset?**
- Square (1080x1080 — Instagram, general purpose)
- Story (1080x1920 — Instagram Stories, TikTok)
- Wide (1200x630 — Twitter/X, Open Graph)
- Custom (user-specified dimensions)
4. **Include QR code?**
- Yes (deep link or App Store URL embedded in card corner)
- No (cleaner card, no link)
5. **Content types?** (multi-select)
- Achievements / Milestones
- Statistics / Progress
- Quotes / Text content
- Custom (user defines their own content model)
## Generation Process
### Step 1: Read Templates
Read `templates.md` for production Swift code.
### Step 2: Create Core Files
Generate these files:
1. `ShareCardContent.swift` — Protocol and concrete content types (achievement, statistics, quote)
2. `ShareCardStyle.swift` — Enum with predefined styles, colors, fonts, layout configuration
3. `ShareCardRenderer.swift` — `@MainActor` renderer using `ImageRenderer` to convert SwiftUI views to images
4. `ShareCardView.swift` — The SwiftUI view that composes the card layout (background, content, branding)
### Step 3: Create UI Files
5. `ShareCardSheet.swift` — Complete sharing sheet with style picker, live preview, and `ShareLink`
### Step 4: Create Optional Files
Based on configuration:
- `QRCodeOverlay.swift` — If QR code selected (CoreImage-based QR generator)
- `ShareCardPreview.swift` — SwiftUI Preview helpers for design iteration
### Step 5: Determine File Location
Check project structure:
- If `Sources/` exists -> `Sources/ShareCard/`
- If `App/` exists -> `App/ShareCard/`
- Otherwise -> `ShareCard/`
## Output Format
After generation, provide:
### Files Created
```
ShareCard/
├── ShareCardContent.swift # Protocol + concrete content types
├── ShareCardStyle.swift # Style enum with colors, fonts, layout
├── ShareCardRenderer.swift # ImageRenderer-based rendering
├── ShareCardView.swift # Card layout SwiftUI view
├── ShareCardSheet.swift # Share sheet with preview + ShareLink
├── QRCodeOverlay.swift # CoreImage QR code (optional)
└── ShareCardPreview.swift # Preview helpers (optional)
```
### Integration Steps
**Share an achievement:**
```swift
struct AchievementDetailView: View {
let achievement: Achievement
@State private var showShareCard = false
var body: some View {
VStack {
// ... achievement detail content ...
Button("Share Achievement") {
showShareCard = true
}
}
.sheet(isPresented: $showShareCard) {
ShareCardSheet(
content: AchievementCardContent(
title: achievement.title,
subtitle: achievement.description,
metric: "\(achievement.points) pts",
iconName: achievement.iconName,
brandName: "MyApp"
)
)
}
}
}
```
**Share statistics:**
```swift
ShareCardSheet(
content: StatisticsCardContent(
title: "Weekly Progress",
stats: [
StatItem(label: "Steps", value: "52,340"),
StatItem(label: "Calories", value: "3,200"),
StatItem(label: "Distance", value: "28.5 km"),
],
brandName: "FitTracker"
)
)
```
**Share a quote:**
```swift
ShareCardSheet(
content: QuoteCardContent(
quote: "The only way to do great work is to love what you do.",
attribution: "Steve Jobs",
brandName: "DailyQuotes"
)
)
```
**Inline ShareLink (without sheet):**
```swift
struct QuickShareButton: View {
let content: any ShareCardContent
@State private var renderedImage: PlatformImage?
var body: some View {
Group {
if let image = renderedImage {
ShareLink(
item: Image(platformImage: image),
preview: SharePreview(content.title, image: Image(platformImage: image))
)
} else {
ProgressView()
}
}
.task {
let renderer = ShareCardRenderer()
renderedImage = await renderer.render(content: content, style: .branded)
}
}
}
```
### Testing
```swift
@Test
func rendersAchievementCard() async throws {
let content = AchievementCardContent(
title: "First Run",
subtitle: "Completed your first 5K run",
metric: "500 pts",
iconName: "figure.run",
brandName: "FitApp"
)
let renderer = ShareCardRenderer()
let image = await renderer.render(content: content, style: .branded)
#expect(image != nil)
#expect(image!.size.width > 0)
#expect(image!.size.height > 0)
}
@Test
func allStylesRenderSuccessfully() async throws {
let content = QuoteCardContent(
quote: "Test quote",
attribution: "Author",
brandName: "App"
)
let renderer = ShareCardRenderer()
for style in ShareCardStyle.allCases {
let image = await renderer.render(content: content, style: style)
#expect(image != nil, "Style \(style) failed to render")
}
}
@Test
func qrCodeGeneratesValidImage() throws {
let image = QRCodeGenerator.generate(
from: "https://example.com/share/123",
size: CGSize(width: 100, height: 100)
)
#expect(image != nil)
}
```
## Common Patterns
### Achievement Card
Best for: gamification, milestones, unlockables.
- Large icon or badge at top
- Achievement title prominently displayed
- Metric or point value highlighted
- App branding at bottom
### Statistics Card
Best for: fitness, finance, productivity apps.
- Grid or list of stat items with labels and values
- Optional trend indicators (up/down arrows)
- Date range context
- App branding at bottom
### Quote Card
Best for: reading, journaling, social apps.
- Large quotation marks or decorative element
- Quote text centered with elegant typography
- Attribution below quote
- Minimal branding
## Gotchas
### Image Quality for DRelated in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.