Generate a formal donation confirmation letter for a donor. Use this skill whenever the user asks to write a letter, confirmation, receipt, acknowledgment, or thank-you for a donor. Triggers on phrases like "write a letter for donor", "donation confirmation letter", "donor acknowledgment", "generate a receipt for donations", "make a letter like we did before", or when someone provides a donor email and asks for documentation of their contributions. Also use when the user forwards a donor's request for confirmation of their giving history.
Generate a professional HTML donation confirmation letter by querying the donor's transaction history from BigQuery and producing a formatted, printable document.
The user will provide:
Read PROJECT_ID from .env or .env.local in the project root. Then query BigQuery for the donor's records:
bq query --use_legacy_sql=false --format=prettyjson "
SELECT
event_ts,
ROUND(amount_cents / 100, 2) AS amount,
currency,
source,
status
FROM \`<PROJECT_ID>.donations.events\`
WHERE donor_email IN (<comma-separated quoted emails>)
AND status = 'succeeded'
<AND event_ts date filter if timeframe given>
ORDER BY event_ts ASC
"
If the user specified a timeframe, add appropriate event_ts filters.
If no results are returned, tell the user and ask them to double-check the email address.
Create an HTML file at ~/Downloads/donation-confirmation-<lastname>.html.
The letter must include these elements, in this order:
~/Downloads/logo.png as a base64 data URI (read and encode the file), if the file existsORG_NAME from .env or .env.local (e.g., "Your Organization")ORG_ADDRESS from .env or .env.localToday's date, right-aligned.
The donor's name (from the query results — use the most recent donor_name value).
"Re: Donation Confirmation Letter"
The letter body should include:
ORG_NAME from .env)ORG_MISSION value from .env or .env.local. All contributions are directed toward the organization's charitable purposes.ORG_TAX_STATUS value from .env or .env.local. Mention no goods or services were provided in exchange.Leave space for a signature, then:
DEFAULT_SIGNER_NAME from .env or .env.local (e.g., "Organization Leader")DEFAULT_SIGNER_TITLE from .env or .env.local, followed by the organization name from ORG_NAMEORG_NAME) with the address (from ORG_ADDRESS), centered, small textThe letter should look professional and be print-ready. Use:
@page CSS for letter-size paper with marginsAfter writing the file, open it in the browser:
open ~/Downloads/donation-confirmation-<lastname>.html
Tell the user the file location so they can print to PDF (Cmd+P) from the browser.
If the donor has donations in multiple currencies, show the currency on each row and provide separate totals per currency at the bottom of the table. Do not mix currencies in a single sum.
Use the donor_name from the most recent donation record. If the user provides a specific name to use, prefer that.