Skills for Claude Code CLI such as full stack dev Cloudflare, React, Tailwind v4, and AI integrations.
Python aianthropicautomationclaude-codeclaude-skillscloudflaredevtoolsproductivityreactskillstailwindvite
plan: Add office skill for document generation (DOCX, XLSX, PDF)
Jez30075706640f
diff --git a/SESSION.md b/SESSION.mdindex 6ae18705..e644a037 100644--- a/SESSION.md+++ b/SESSION.md@@ -1,18 +1,55 @@# Current Session**Project**: Claude Skills Repository-**Focus**: January 2026 Skill Audit + Google Workspace Skill-**Started**: 2026-01-03-**Last Updated**: 2026-01-03-**Last Checkpoint**: 0585c41 (2026-01-03)+**Focus**: `office` Skill - TypeScript Document Generation+**Started**: 2026-01-12+**Last Updated**: 2026-01-12+**Last Checkpoint**: [none yet]-**Archives**: Previous session logs archived to `archive/session-logs/`:-- `phase-1-description-optimization.md` - Phase 1 complete (all 58 skills optimized)-- `phase-2-detailed-audits.md` - Phase 2 detailed findings (skills #1-37)+**Planning Docs**:+- `docs/IMPLEMENTATION_PHASES-office.md`+- `planning/PROJECT_BRIEF-office-skill.md`----## January 2026 Audit Summary+## office Skill: Phase 1 - Skill Scaffolding π++**Type**: Setup | **Started**: 2026-01-12+**Spec**: `docs/IMPLEMENTATION_PHASES-office.md#phase-1`++**Progress**:+- [ ] Create skill directory structure+- [ ] Create SKILL.md skeleton with YAML frontmatter+- [ ] Create README.md with keywords+- [ ] Verify against claude-skills standards++**Next Action**: Create `skills/office/` directory structure following `templates/skill-skeleton/`++**Key Files**:+- `skills/office/SKILL.md`+- `skills/office/README.md`+- `templates/skill-skeleton/` (reference)++**Known Issues**: None++## Phase 2: DOCX Patterns βΈοΈ+**Spec**: `docs/IMPLEMENTATION_PHASES-office.md#phase-2`++## Phase 3: XLSX Patterns βΈοΈ+**Spec**: `docs/IMPLEMENTATION_PHASES-office.md#phase-3`++## Phase 4: PDF Patterns βΈοΈ+**Spec**: `docs/IMPLEMENTATION_PHASES-office.md#phase-4`++## Phase 5: Workers Integration βΈοΈ+**Spec**: `docs/IMPLEMENTATION_PHASES-office.md#phase-5`++## Phase 6: Polish & Marketplace βΈοΈ+**Spec**: `docs/IMPLEMENTATION_PHASES-office.md#phase-6`++---++## Previous Session: January 2026 Audit**Status**: β COMPLETEdiff --git a/docs/IMPLEMENTATION_PHASES-office.md b/docs/IMPLEMENTATION_PHASES-office.mdnew file mode 100644index 00000000..03413bce--- /dev/null+++ b/docs/IMPLEMENTATION_PHASES-office.md@@ -0,0 +1,286 @@+# Implementation Phases: `office` Skill++**Project**: TypeScript document generation skill (DOCX, XLSX, PDF)+**Estimated Total**: ~4-5 hours (~4-5 min human time)+**Brief**: `planning/PROJECT_BRIEF-office-skill.md`++---++## Phase 1: Skill Scaffolding (~30 min)++**Type**: Setup+**Goal**: Create skill directory structure following claude-skills standards++### Tasks++1. **Create skill directory structure**+ ```+ skills/office/+ βββ SKILL.md+ βββ README.md+ βββ rules/+ βββ templates/+ βββ references/+ βββ scripts/+ ```++2. **Create SKILL.md skeleton**+ - YAML frontmatter (name, description)+ - Section headers for each format (DOCX, XLSX, PDF)+ - "Use when" scenarios+ - Known issues placeholder++3. **Create README.md with keywords**+ - Auto-trigger keywords for each format+ - Library names for discoverability++4. **Verify against claude-skills standards**+ - Check ONE_PAGE_CHECKLIST.md compliance+ - Ensure YAML frontmatter is valid++### Exit Criteria+- [ ] `skills/office/` directory exists with all subdirectories+- [ ] SKILL.md has valid YAML frontmatter+- [ ] README.md has comprehensive keywords+- [ ] Structure matches `templates/skill-skeleton/`++---++## Phase 2: DOCX Patterns (~1 hour)++**Type**: Implementation+**Goal**: Complete Word document generation patterns using `docx` npm package++### Tasks++1. **Research current `docx` npm API**+ - Check latest version (v9.x)+ - Review key classes: Document, Paragraph, TextRun, Table, ImageRun+ - Note Workers compatibility requirements++2. **Write SKILL.md DOCX section**+ - Installation: `npm install docx`+ - Basic document structure pattern+ - Headings, paragraphs, formatting+ - Tables with styling+ - Images (from buffer/URL)+ - Export patterns (Node.js vs browser)++3. **Create `templates/docx-basic.ts`**+ - Complete working example+ - Comments explaining each section+ - Both Node.js and browser export++4. **Create `references/docx-api.md`**+ - Quick reference for common classes+ - Formatting options table+ - Measurement units (DXA: 1440 = 1 inch)++5. **Add correction rules to `rules/office.md`**+ - Common mistakes with `docx` package+ - Import patterns+ - Export gotchas++### Exit Criteria+- [ ] SKILL.md DOCX section complete with patterns+- [ ] `templates/docx-basic.ts` creates valid .docx file+- [ ] Reference doc covers key API+- [ ] Correction rules prevent common errors++---++## Phase 3: XLSX Patterns (~1 hour)++**Type**: Implementation+**Goal**: Complete Excel spreadsheet generation patterns using SheetJS++### Tasks++1. **Research SheetJS (xlsx) API**+ - Check latest version (v0.18.x)+ - Review key functions: utils, writeFile, write+ - Confirm Workers compatibility++2. **Write SKILL.md XLSX section**+ - Installation: `npm install xlsx`+ - Workbook/worksheet creation+ - Cell data types and formatting+ - Formulas (basic)+ - Column widths and row heights+ - Export patterns++3. **Create `templates/xlsx-basic.ts`**+ - Complete working example+ - Multiple sheets+ - Formulas and formatting+ - Both Node.js and browser export++4. **Create `references/xlsx-api.md`**+ - Quick reference for utils functions+ - Cell reference formats (A1 vs R1C1)+ - Data type handling++5. **Add XLSX corrections to `rules/office.md`**+ - Formula syntax gotchas+ - Date handling issues+ - Large file considerations++### Exit Criteria+- [ ] SKILL.md XLSX section complete+- [ ] `templates/xlsx-basic.ts` creates valid .xlsx file+- [ ] Reference doc covers key API+- [ ] Correction rules added++---++## Phase 4: PDF Patterns (~1 hour)++**Type**: Implementation+**Goal**: Complete PDF generation patterns using pdf-lib++### Tasks++1. **Research pdf-lib API**+ - Check latest version (v1.17.x)+ - Review key classes: PDFDocument, PDFPage, PDFFont+ - Form filling capabilities+ - Merge/split operations++2. **Write SKILL.md PDF section**+ - Installation: `npm install pdf-lib`+ - Create PDF from scratch+ - Add text, images, shapes+ - Fill existing PDF forms+ - Merge multiple PDFs+ - Export patterns++3. **Create `templates/pdf-basic.ts`**+ - Complete working example+ - Text with custom fonts+ - Images from buffer+ - Basic shapes/lines++4. **Create `templates/pdf-form-fill.ts`**+ - Load existing PDF+ - Fill form fields+ - Save modified PDF++5. **Create `references/pdf-lib-api.md`**+ - Quick reference for key methods+ - Coordinate system (origin bottom-left)+ - Font embedding options++6. **Add PDF corrections to `rules/office.md`**+ - Coordinate system confusion+ - Font embedding requirements+ - Async patterns++### Exit Criteria+- [ ] SKILL.md PDF section complete+- [ ] `templates/pdf-basic.ts` creates valid PDF+- [ ] `templates/pdf-form-fill.ts` fills forms correctly+- [ ] Reference doc covers key API+- [ ] Correction rules added++---++## Phase 5: Workers Integration (~45 min)++**Type**: Implementation+**Goal**: Add Cloudflare Workers examples and HTMLβPDF via Browser Rendering++### Tasks++1. **Create `templates/workers-docx.ts`**+ - Hono route that generates DOCX+ - Returns as download or R2 upload+ - Demonstrate Workers compatibility++2. **Create `templates/workers-pdf-browser.ts`**+ - HTMLβPDF using Browser Rendering API+ - Template-based generation+ - Invoice/report example++3. **Add Workers section to SKILL.md**+ - Browser Rendering setup+ - Binding configuration+ - Cost considerations (paid feature)++4. **Add wrangler.jsonc snippet to references**+ - Browser Rendering binding example+ - R2 binding for storage++### Exit Criteria+- [ ] Workers DOCX template works+- [ ] Browser Rendering PDF example documented+- [ ] SKILL.md has Workers section+- [ ] Clear note about Browser Rendering being paid feature++---++## Phase 6: Polish & Marketplace (~30 min)++**Type**: Finalization+**Goal**: Complete skill, generate manifest, test installation++### Tasks++1. **Review and polish SKILL.md**+ - Ensure consistent formatting+ - Add "Use when" scenarios+ - Document limitations clearly+ - Add error prevention tips++2. **Finalize README.md keywords**+ - All format names (docx, xlsx, pdf, word, excel)+ - Use case keywords (invoice, report, export, spreadsheet)+ - Error keywords users might search++3. **Create `scripts/verify-deps.sh`**+ - Check docx, xlsx, pdf-lib versions+ - Output compatibility status++4. **Generate marketplace manifest**+ ```bash+ ./scripts/generate-plugin-manifests.sh office+ ```++5. **Test local installation**+ ```bash+ /plugin install ./skills/office+ ```++6. **Verify skill triggers correctly**+ - Ask Claude Code to "create a Word document"+ - Verify skill is discovered and proposed++### Exit Criteria+- [ ] SKILL.md polished and complete+- [ ] README.md has comprehensive keywords+- [ ] Manifest generated in `.claude-plugin/plugin.json`+- [ ] Local installation works+- [ ] Skill triggers on relevant queries++---++## Success Criteria (MVP Complete)++- [ ] `/plugin install office` works from marketplace+- [ ] DOCX: Create documents with headings, paragraphs, tables, images+- [ ] XLSX: Create spreadsheets with data, formulas, formatting+- [ ] PDF: Create PDFs, fill forms, merge documents+- [ ] All templates work in Node.js AND Cloudflare Workers+- [ ] Follows claude-skills standards (verified via checklist)+- [ ] Clear documentation of limitations vs Anthropic's skills++---++## Phase 2 Roadmap (Post-MVP)++After MVP is complete and validated:++1. **PPTX Generation** - Add PowerPoint support using pptxgenjs+2. **Template Filling** - Fill placeholders in existing DOCX/XLSX+3. **Advanced DOCX** - Headers, footers, table of contents+4. **Reading Files** - Parse existing Office documents+5. **CSV/JSON Export** - Data format conversionsdiff --git a/planning/PROJECT_BRIEF-office-skill.md b/planning/PROJECT_BRIEF-office-skill.mdnew file mode 100644index 00000000..4b94821c--- /dev/null+++ b/planning/PROJECT_BRIEF-office-skill.md@@ -0,0 +1,188 @@+# Project Brief: `office` Skill++**Created**: 2026-01-12+**Status**: Ready for Planning++---++## Vision++A TypeScript-first skill for generating Office documents (DOCX, XLSX, PDF) that works everywhere - Claude Code CLI, Cloudflare Workers, and browsers. Simpler and more portable than Anthropic's official skills, installable via `/plugin install office`.++## Problem/Opportunity++Anthropic published official document skills (`docx`, `xlsx`, `pdf`, `pptx`) but they're:+- **Not installable as a plugin** - requires manual setup+- **Python-heavy** - relies on openpyxl, pypdf, pandoc, LibreOffice+- **Local execution only** - can't run in Cloudflare Workers+- **Comprehensive but complex** - covers every edge case, ~500+ lines each++**Opportunity**: Create a streamlined, TypeScript-first alternative that:+- Installs with one command+- Works on edge runtimes (Cloudflare Workers)+- Covers 80% of use cases with 20% of the complexity++## Target Audience++- **Primary users**: Developers building web apps that need document exports (invoices, reports, proposals)+- **Secondary**: Claude Code users wanting to create Office docs during development+- **Scale**: Part of claude-skills marketplace (60+ skills)+- **Context**: Production skill for our marketplace++## Core Functionality (MVP)++### 1. **DOCX Generation** - Create Word documents+- Create documents with headings, paragraphs, tables, images+- Basic formatting (bold, italic, fonts, colors)+- Export to buffer/blob for download or storage+- **Library**: `docx` npm package (v9.x)++### 2. **XLSX Generation** - Create Excel spreadsheets+- Create workbooks with multiple sheets+- Cell formatting, formulas, column widths+- Export to buffer for download+- **Library**: `xlsx` (SheetJS) or `exceljs` for richer features++### 3. **PDF Generation** - Create and modify PDFs+- Create PDFs from scratch (text, images, shapes)+- Fill existing PDF forms+- Merge/split PDF documents+- **Library**: `pdf-lib` (v1.17.x)++### 4. **HTMLβPDF** (Cloudflare Workers bonus)+- Convert HTML/CSS to PDF using Browser Rendering API+- Template-based document generation+- **Requires**: Cloudflare Browser Rendering binding++**Out of Scope for MVP** (defer to Phase 2):+- PowerPoint (PPTX) - adds complexity, can add later+- Tracked changes / redlining in DOCX - requires OOXML manipulation+- Formula recalculation/validation - requires LibreOffice+- OCR for scanned PDFs - requires Python/pytesseract+- Reading/parsing existing Office files (focus on creation first)++## Tech Stack (Validated)++| Component | Choice | Rationale |+|-----------|--------|-----------|+| **DOCX** | `docx` npm v9.5+ | Pure JS, Workers-compatible, well-maintained |+| **XLSX** | `xlsx` (SheetJS) v0.18+ | Pure JS, universal runtime support |+| **PDF** | `pdf-lib` v1.17+ | Explicitly supports Workers + browser |+| **HTMLβPDF** | Cloudflare Browser Rendering | Native Cloudflare solution |++**Key Dependencies** (all Workers-compatible):+- `docx` - 3.4 MB unpacked, ~1.2 MB minified+- `xlsx` - 7.5 MB unpacked, ~500 KB minified+- `pdf-lib` - 19.5 MB unpacked, ~500 KB minified++## Research Findings++### Similar Solutions Reviewed++| Solution | Strengths | Weaknesses | Our Differentiation |+|----------|-----------|------------|---------------------|+| **Anthropic's official skills** | Comprehensive, battle-tested | Python-heavy, not a plugin, local only | TS-first, plugin installable, Workers-compatible |+| **tfriedel/claude-office-skills** | Packages Anthropic's approach | Incomplete, attribution concerns | Original implementation, maintained |+| **Individual npm libraries** | Work well standalone | No Claude Code integration | Skill bundles with templates + patterns |++### Technical Validation++- **`docx` in Workers**: Confirmed compatible - pure JS, uses jszip internally+- **`pdf-lib` in Workers**: Explicitly documented as supporting Cloudflare Workers+- **`xlsx` in Workers**: Pure JS algorithms, no Node dependencies+- **Browser Rendering**: [Official Cloudflare docs](https://developers.cloudflare.com/browser-rendering/how-to/pdf-generation/) show HTMLβPDF pattern+- **Working example**: [worker-generate-invoice-pdf](https://github.com/adamschwartz/worker-generate-invoice-pdf)++### Known Challenges++| Challenge | Mitigation |+|-----------|------------|+| Bundle size (~2-3MB total) | Tree-shaking, lazy loading, document which deps needed |+| No formula validation in XLSX | Document limitation, recommend manual verification |+| Complex DOCX editing | Out of scope for MVP, document as limitation |+| Browser Rendering requires paid plan | Document as optional enhancement |++## Scope Validation++**Why Build This?**+- Anthropic's skills aren't conveniently installable+- No existing skill covers server-side (Workers) document generation+- High demand use case (invoices, reports, exports)++**Why This Approach?**+- TypeScript aligns with our stack (Cloudflare, React, Vite)+- Pure JS libraries enable universal runtime support+- Focused scope = maintainable, high-quality skill++**What Could Go Wrong?**+1. **Bundle size concerns** - Mitigate with clear documentation on what to import+2. **Missing features users expect** - Clear scope documentation, Phase 2 roadmap+3. **Library updates breaking things** - Pin versions, test before updating++## Estimated Effort++- **MVP**: ~4-6 hours (~4-6 minutes human time with Claude Code)+- **Breakdown**:+ - Research/templates: 1h (done in this exploration)+ - DOCX patterns + templates: 1-1.5h+ - XLSX patterns + templates: 1-1.5h+ - PDF patterns + templates: 1-1.5h+ - Workers examples: 0.5-1h+ - Testing + polish: 0.5h++## Success Criteria (MVP)++- [ ] `/plugin install office` works from claude-skills marketplace+- [ ] Can create basic DOCX with headings, paragraphs, tables+- [ ] Can create basic XLSX with data, formulas, formatting+- [ ] Can create PDF with text, images, or fill forms+- [ ] All templates work in both Node.js AND Cloudflare Workers+- [ ] Documentation includes "Use when" scenarios and examples+- [ ] Skill follows claude-skills standards (YAML frontmatter, README, etc.)++## Skill Structure++```+skills/office/+βββ SKILL.md # Main skill with patterns for all 3 formats+βββ README.md # Auto-trigger keywords+βββ rules/+β βββ office.md # Correction rules for common mistakes+βββ templates/+β βββ docx-basic.ts # Word document template+β βββ xlsx-basic.ts # Excel spreadsheet template+β βββ pdf-basic.ts # PDF generation template+β βββ workers-pdf.ts # Cloudflare Workers HTMLβPDF example+βββ references/+β βββ docx-api.md # Quick reference for docx npm+β βββ xlsx-api.md # Quick reference for SheetJS+β βββ pdf-lib-api.md # Quick reference for pdf-lib+βββ scripts/+ βββ verify-deps.sh # Check library versions+```++## Next Steps++**If proceeding**:+1. Run `/plan-project` to generate IMPLEMENTATION_PHASES.md+2. Review phases and adjust+3. Start Phase 1 (skill scaffolding)++**Phase 2 Roadmap** (after MVP):+- Add PPTX generation+- Add template system (fill placeholders in existing docs)+- Add more complex DOCX features (headers/footers, TOC)+- Consider reading/parsing existing files++---++## Research References++- [Anthropic Skills Repository](https://github.com/anthropics/skills)+- [docx npm package](https://www.npmjs.com/package/docx)+- [pdf-lib](https://pdf-lib.js.org/)+- [SheetJS (xlsx)](https://sheetjs.com/)+- [Cloudflare Browser Rendering - PDF Generation](https://developers.cloudflare.com/browser-rendering/how-to/pdf-generation/)+- [worker-generate-invoice-pdf example](https://github.com/adamschwartz/worker-generate-invoice-pdf)+- [tfriedel/claude-office-skills](https://github.com/tfriedel/claude-office-skills)+- [pdfjs-serverless for Workers](https://github.com/johannschopplich/pdfjs-serverless)