Skip to content
All Skills

Invoice Generator

Generates professional invoices with line items, tax calculations, payment terms, and exports to PDF via pandoc. Tracks invoice numbers and calculates totals. Prerequisites: python3, pandoc.

Business & Freelance|v1|Updated 5/18/2026
MCP get_skill({ skillId: "invoice-generator-ff661939" })

Use this skill with your agent

Create a free account and connect via MCP

Get Started Free
# Invoice Generator

Generate professional invoices with line items, tax, payment terms, and PDF export.

## When to Use

- "Create an invoice for {client}"
- "I need to bill {client} for {N} hours"
- "Generate an invoice for this project"

## Requirements

- **python3** for calculations and invoice numbering
- **pandoc** for PDF export

## Workflow

### Step 1 — Invoice Details

- **Your business name and address**
- **Client name and address**
- **Line items** (description, hours/quantity, rate)
- **Tax rate** (if applicable)
- **Payment terms** (net 15, net 30, due on receipt)
- **Notes** (project reference, PO number, etc.)

### Step 2 — Calculate Totals

```bash
python3 << 'PYEOF'
import datetime
import json
import os

# Invoice number tracking
invoice_dir = "outputs/invoices"
os.makedirs(invoice_dir, exist_ok=True)
counter_file = os.path.join(invoice_dir, ".invoice_counter")

if os.path.exists(counter_file):
    with open(counter_file) as f:
        counter = int(f.read().strip()) + 1
else:
    counter = 1001

with open(counter_file, "w") as f:
    f.write(str(counter))

invoice_number = f"INV-{counter}"
date = datetime.date.today().isoformat()
due_date = (datetime.date.today() + datetime.timedelta(days={NET_DAYS})).isoformat()

line_items = [
    {"desc": "{Description 1}", "qty": {QTY}, "rate": {RATE}},
    {"desc": "{Description 2}", "qty": {QTY}, "rate": {RATE}},
]

tax_rate = {TAX_RATE}  # e.g., 0.0 for no tax, 0.08 for 8%

subtotal = sum(item["qty"] * item["rate"] for item in line_items)
tax = subtotal * tax_rate
total = subtotal + tax

print(f"Invoice: {invoice_number}")
print(f"Date: {date}")
print(f"Due: {due_date}")
print(f"Subtotal: ${subtotal:,.2f}")
print(f"Tax ({tax_rate*100:.0f}%): ${tax:,.2f}")
print(f"Total: ${total:,.2f}")
PYEOF
```

### Step 3 — Generate Invoice

```markdown
# INVOICE

**Invoice #:** {INV-NUMBER}
**Date:** {DATE}
**Due:** {DUE_DATE}

---

**From:**
{YOUR_BUSINESS_NAME}
{YOUR_ADDRESS}
{YOUR_EMAIL}

**Bill To:**
{CLIENT_NAME}
{CLIENT_COMPANY}
{CLIENT_ADDRESS}

---

| Description | Qty/Hours | Rate | Amount |
|-------------|-----------|------|--------|
| {Description 1} | {QTY} | ${RATE} | ${AMOUNT} |
| {Description 2} | {QTY} | ${RATE} | ${AMOUNT} |
| | | | |
| | | **Subtotal** | **${SUBTOTAL}** |
| | | **Tax ({RATE}%)** | **${TAX}** |
| | | **TOTAL** | **${TOTAL}** |

---

**Payment Terms:** {TERMS}

**Payment Methods:**
- Bank transfer: {DETAILS}
- PayPal: {EMAIL}

**Notes:** {PROJECT_REFERENCE}

---
*Thank you for your business!*
```

### Step 4 — Export to PDF

```bash
mkdir -p outputs/invoices
pandoc "outputs/invoices/{INV_NUMBER}.md" -o "outputs/invoices/{INV_NUMBER}.pdf" --pdf-engine=wkhtmltopdf -V geometry:margin=1in
echo "Invoice saved: outputs/invoices/{INV_NUMBER}.pdf"
```

## Important Rules

- Auto-increment invoice numbers — never reuse or skip
- Always include payment terms and due date
- Calculate tax correctly based on user's jurisdiction
- Include at least one payment method
- Keep records — save both .md and .pdf

## Example Prompts

- "Create an invoice for Acme Corp — 40 hours at $150/hr"
- "Generate an invoice for my web design project, $3000 flat rate"
- "I need to bill {client} for October work"
#business#freelance#invoice#billingpython3pandoc