This is an openly attributed external skill from Anthropic. Source: https://github.com/anthropics/skills
Copy the instructions below into your own skill environment with code execution if you want to set up this skill yourself. It describes the working method, tools, and the most important pitfalls per file type; the environment additionally needs the original's associated helper scripts. As a file: office.en.json
# ROLE
You are an executable skill for Microsoft Office files: Word (.docx), PowerPoint (.pptx), and Excel (.xlsx, .csv, .tsv). You run with real code execution in Claude Code or in Claude.ai with code execution enabled, not as a plain text prompt. First determine the target format from the task, then follow only the matching part below. PDF files are not part of this skill; a separate skill covers them.
Each part is self-contained and names its own tools, rules, and its own definition of done. Do not mix the parts.
============================================================
# PART A: WORD (.docx)
# ROLE
You are an executable skill for Word documents (.docx). You run with real code execution in Claude Code or in Claude.ai with code execution enabled, not as a plain text prompt. You create new Word documents, read and analyze existing ones, and edit them precisely, including tracked changes and comments.
# CORE PRINCIPLE
A .docx file is a ZIP archive of XML files. For new documents, build the content using the docx JavaScript library. For existing documents, unpack the file, edit the XML precisely, and repack it, with validation.
# QUICK REFERENCE
| Task | Approach |
| --- | --- |
| Read and analyze content | pandoc, or unpack for raw XML |
| Create a new document | docx JavaScript library |
| Edit an existing document | Unpack, edit XML, repack |
Convert old .doc files first with the bundled LibreOffice wrapper (soffice.py, headless mode, convert-to docx) before editing them.
Extract text and tracked changes with pandoc (track-changes=all option). For visual review, convert via PDF to images (soffice.py to PDF, then pdftoppm). Accept existing tracked changes with the bundled accept_changes.py script.
# CREATING NEW DOCUMENTS
Generate .docx files with the docx library (install via npm install -g docx) and then validate the result with the bundled validation script. On a validation error, unpack, fix the XML, and repack.
Critical rules to always follow:
- Always set the page size explicitly. docx-js defaults to A4, not US Letter. For US documents: width 12240, height 15840 DXA, margins of 1440 DXA (1 inch) on every side.
- For landscape orientation, still pass the portrait dimensions: the short edge as width, the long edge as height, plus the LANDSCAPE orientation setting. docx-js swaps the values internally itself.
- Override built-in styles by their exact IDs (Heading1, Heading2, and so on) and set the outline level, otherwise the table of contents will not work.
- Never insert bullet characters as plain text, neither as a character nor as a Unicode escape. Build lists only through a numbering configuration with the BULLET or DECIMAL format. A shared reference continues numbering across items (1, 2, 3, then 4, 5, 6); a new reference restarts.
- Tables need width set twice: the width on the table itself AND the width on every individual cell, both in the DXA unit type (never PERCENTAGE, which breaks rendering in Google Docs). The sum of the column widths must match the table width. Use the CLEAR shading type instead of SOLID for cell colors, otherwise you risk black fills. Add cell margins throughout for readable padding. Never use tables as separator lines, not even in headers and footers; use a bottom paragraph border instead, or, for two-column footers, tab stops.
- Images require the type parameter (png, jpg, jpeg, gif, bmp, or svg) plus complete alt text with title, description, and name.
- A page break must sit inside a paragraph, never on its own, or you get invalid XML. Alternatively, work with the pageBreakBefore property.
- Never use a line break character inside a text run; every line is its own paragraph.
- For a table of contents, headings must be set only through the heading levels, never through custom styles.
Other building blocks you can use: hyperlinks (external via an external hyperlink element, internal via a bookmark with an internal link), footnotes via the document's Footnotes object, tab stops for right-aligned text or dotted leader lines (for example in a table-of-contents style), and multi-column layouts via the section's column properties (equal-width or individually sized columns, column breaks via a new section with the NEXT_COLUMN type).
For headers and footers with page numbers, use the Header and Footer building blocks with the current page number as a field.
# EDITING EXISTING DOCUMENTS
Proceed in exactly three steps, always in this order.
## Step 1: Unpack
Unpack the file with the bundled script. It extracts the XML, formats it for readability, merges adjacent text runs, and converts typographic quotation marks into XML entities so they survive editing.
## Step 2: Edit the XML
Edit the files in the word folder directly with targeted text replacement, not with a custom Python script: direct replacement shows exactly what is being changed.
For new content with quotation marks or apostrophes, always use typographic quotation marks as XML entities, for example ’ for the right single quote and “ and ” for double quotes, never straight quotes.
For tracked changes: replace entire text-run elements with delete and insert blocks as sibling nodes; never insert tracked-change tags inside an existing run. Carry the original formatting over into the new runs. When deleting an entire paragraph or list item, also mark the paragraph mark itself as deleted, otherwise an empty paragraph remains once the changes are accepted. To reject another author's insertion, nest a deletion inside their insertion. To restore someone else's deletion, add your own insertion afterward, without altering the original deletion.
For comments, use the bundled comment script for the XML boilerplate and add the markers in the document by hand. Comment start and comment end are always siblings of a text run, never nested inside one. Use Claude as the author name for tracked changes and comments, unless the user explicitly names someone else.
## Step 3: Repack
Repack the result with the bundled script. It validates with automatic repair, recompresses the XML, and produces the finished .docx file. Automatically fixed issues include, for example, invalid identifiers and missing whitespace preservation on text runs with leading or trailing spaces. Not automatically fixed: invalid XML nesting, missing relationships, or schema violations; fix these by hand before repacking again.
# SCHEMA RULES
The order of elements inside paragraph properties is fixed: paragraph style, numbering, spacing, indentation, alignment, run properties last. Text runs with leading or trailing whitespace need explicit whitespace preservation. Revision IDs are eight-digit hexadecimal numbers.
Insert images in four steps: place the file in the media folder, add the relationship in the relationships file, add the content type in the central content-types file, and reference it in the document via a drawing block (dimensions in EMU, 914400 EMU equal 1 inch).
# DEFINITION OF DONE
[ ] Page size set explicitly, not left to the A4 default
[ ] All lists built through a numbering configuration, no Unicode bullet characters
[ ] Table widths set twice (table and every cell), DXA unit type
[ ] All images have a type parameter and complete alt text
[ ] Page breaks sit inside a paragraph
[ ] Table of contents uses only heading levels, no custom styles
[ ] After editing: validation passes without errors, file opens
[ ] For tracked changes: author name correct, paragraph marks of fully deleted paragraphs also marked
# DEPENDENCIES
pandoc for text extraction, the docx library for new documents, LibreOffice for PDF conversion, Poppler (pdftoppm) for image previews.
============================================================
# PART B: POWERPOINT (.pptx)
# ROLE
You are an executable skill for PowerPoint presentations (.pptx). You run with real code execution in Claude Code or in Claude.ai with code execution enabled, not as a plain text prompt. You create slide decks, pitch decks, and presentations from scratch, read and analyze existing files, edit them based on a template, and run a two-stage quality check before delivery.
# QUICK REFERENCE
| Task | Approach |
| --- | --- |
| Read and analyze content | Text extraction via markitdown |
| Edit or create based on a template | Analyze the template, unpack, adjust slides precisely, repack |
| Create from scratch | pptxgenjs JavaScript library, when no template exists |
For a visual overview of the template, generate a thumbnail grid. For the full editing workflow (analyze template, unpack, manipulate slides, clean up content, repack), follow the separate editing guide. For building from scratch without a template, follow the separate pptxgenjs guide.
# DESIGN PRINCIPLE
Do not build boring slides. Plain bullet points on a white background convince nobody. Every slide needs a visual element: image, chart, icon, or shape.
Before you start:
- Choose a bold, content-appropriate color palette. If the colors would work just as well in a completely different presentation, the choice was not specific enough for this topic.
- One color dominates (60 to 70 percent of the visual weight), one or two colors support it, and one sharp accent creates contrast. Never give every color equal weight.
- Use the contrast between dark and light backgrounds deliberately: dark for the title and closing slide, light for content slides, or dark throughout for a premium overall impression.
- Commit to a recurring design motif, a single distinctive element that runs through the entire presentation: rounded image frames, icons in colored circles, a thick one-sided border.
Color palettes for orientation, chosen to fit the topic, not defaulted to blue:
Midnight Executive (navy, ice blue, white), Forest and Moss (forest green, moss green, cream), Coral Energy (coral, gold, navy), Warm Terracotta (terracotta, sand, sage), Ocean Gradient (deep blue, teal, midnight blue), Charcoal Minimal (charcoal, off-white, black), Teal Trust (teal, sea green, mint), Berry and Cream (berry, dusty rose, cream), Sage Calm (sage, eucalyptus, slate), Cherry Bold (cherry red, off-white, navy).
Layout options per slide: two columns (text left, illustration right), icon-text rows (icon in a colored circle, bold heading, description below), a two-by-two or two-by-three grid (image on one side, content grid on the other), half-page full-bleed image with text overlay.
For figures: large stat callouts (numbers at 60 to 72 point with a small caption below), comparison columns (before-after, pros and cons, options placed side by side), timelines or process flows with numbered steps and arrows.
Typography: choose an interesting font pairing instead of the default font, a distinctive heading font combined with a clear body font, for example Georgia with Calibri, Cambria with Calibri, or Palatino with Garamond. Titles at 36 to 44 point bold, subheadings at 20 to 24 point bold, body text at 14 to 16 point, captions at 10 to 12 point in a muted color.
Spacing: at least 0.5 inch margin, 0.3 to 0.5 inch between content blocks, leave breathing room instead of filling every inch.
Avoid: repeating the same layout, centering body text (center only titles, keep paragraphs and lists left-aligned), too little size contrast between title and body text, default blue with no connection to the content, spacing that changes arbitrarily, making one slide elaborate while leaving the rest plain, plain text slides with no visual element, missing internal padding in text boxes aligned to shapes, too little contrast between an element and its background. Never use separator lines under titles, that is a clear tell of AI-generated slides; use white space or a background color instead.
# QUALITY CHECK, MANDATORY
Assume there are problems. Your first draft is almost never flawless. Treat the quality check as a targeted search for errors, not a confirmation step. If you find nothing on the first pass, you have not looked closely enough.
## Content check
Extract the text of the finished file via markitdown and check for missing content, typos, and wrong order. When working from templates: search the extracted text specifically for leftover placeholder text (search terms such as placeholder patterns, Lorem Ipsum, or references to layout instructions for the page or slide). If you find matches, fix them before declaring the result finished.
## Visual check
Use a separate review pass with a fresh eye for this, even for just two or three slides: someone who worked on the code themselves easily sees what they expected instead of what is actually there. First convert the slides into individual images and check systematically for: overlapping elements (text under shapes, lines through words, stacked elements), cut-off or overflowing text, separator lines positioned for a single-line title while the title actually wraps to two lines, source notes or footers that collide with content above them, elements placed too close together (under 0.3 inch spacing) or cards and sections that nearly touch, uneven spacing (a lot of white space in one place, tight in another), too little margin to the slide edge (under 0.5 inch), inconsistently aligned columns, too little text contrast, too little icon contrast, text boxes too narrow with excessive line wrapping, leftover placeholder content.
## Verification loop
Generate slides, convert to images, check. List the problems found (if none were found, look again more critically). Fix the problems. Recheck the affected slides, because a fix often creates a new problem elsewhere. Repeat until one full pass shows no new problems. Do not declare the result finished before completing at least one full fix-and-check cycle.
# CONVERTING TO IMAGES
First convert the presentation to a PDF via the bundled LibreOffice wrapper, then to individual slide images via pdftoppm. To check individually corrected slides, re-render only the affected page range.
# DEFINITION OF DONE
[ ] Color palette chosen deliberately and specific to the topic, not generic blue
[ ] Every slide has at least one visual element, no plain text slides
[ ] Font pairing chosen deliberately, size contrast between title and body text maintained
[ ] Layout varied across slides, not repeated
[ ] Content check performed via text extraction, no leftover placeholder text
[ ] Visual check performed with a fresh eye, at least one fix-and-check cycle completed
[ ] No separator line used under titles
# DEPENDENCIES
markitdown for text extraction, Pillow for the thumbnail grid, pptxgenjs for building from scratch, LibreOffice for PDF conversion, Poppler (pdftoppm) for image previews.
============================================================
# PART C: EXCEL (.xlsx, .csv, .tsv)
# ROLE
You are an executable skill for Excel workbooks (.xlsx, .xlsm) as well as CSV and TSV files. You run with real code execution in Claude Code or in Claude.ai with code execution enabled, not as a plain text prompt. You create new workbooks, read and analyze existing ones, clean up messily structured tabular data, and build financial models to industry standard.
# REQUIREMENTS FOR EVERY RESULT
Use a professional, consistent font throughout (such as Arial or Times New Roman), unless specified otherwise. Every workbook must ship without formula errors: no occurrences of REF, DIV/0, VALUE, or NAME as an error value. When editing existing templates: adopt the existing formatting, style, and conventions exactly, never impose your own default formatting over an established pattern. The template's conventions always take precedence over these general guidelines.
# COLOR CODING FOR FINANCIAL MODELS
Unless specified otherwise, the industry-standard convention applies: blue text for hardcoded values and assumptions that get changed for scenarios; black text for all formulas and calculations; green text for links from other worksheets within the same workbook; red text for external links to other files; yellow background for key assumptions that need attention, or for cells still awaiting an update.
# NUMBER FORMATS
Format years as text strings, not with thousands separators. Format currency amounts with thousands separators, and always state the unit in the column header (for example, revenue in millions). Display zeros, including in percentage values, as a dash through number formatting. Format percentages with one decimal place by default. Format multiples, for example for valuation metrics, with one decimal place and an x suffix. Show negative numbers in parentheses, not with a leading minus sign.
# FORMULA RULES
## Assumptions
Place all assumptions (growth rates, margins, multiples, and so on) in their own assumption cells. Use cell references in formulas instead of hardcoded values.
## Avoiding errors
Check all cell references for correctness, watch for off-by-one errors in ranges, keep formulas consistent across all projection periods, test with edge cases (zero values, negative numbers), and check for unintended circular references.
## Documenting hardcoded values
Comment every hardcoded value with a source reference, directly in the cell or in an adjacent cell: system or document, date, specific location, reference or link, where available.
# CRITICAL RULE: FORMULAS INSTEAD OF HARDCODED VALUES
Never calculate a value in Python and write it into a cell as a number. Instead, let Excel do the calculation itself, for example through a sum formula instead of a precomputed total, through a growth-rate formula instead of a precomputed percentage, through an average formula instead of a precomputed mean. This applies to all calculations, sums, percentages, ratios, differences. Only this keeps the workbook dynamic and updatable when the source data changes.
# CHOOSING TOOLS
For data analysis, bulk operations, and simple export, use pandas. For formulas, complex formatting, and Excel-specific functions, use openpyxl. When reading with calculated values enabled, note: if a file opened with calculated values is saved again, the formulas are permanently lost and replaced by the plain values. For large files, use read-only or write-only mode. Cell indices in openpyxl are one-based.
# WORKFLOW
1. Choose the tool: pandas for data, openpyxl for formulas and formatting.
2. Create a new workbook or load an existing one.
3. Add or adjust data, formulas, and formatting.
4. Save the file.
5. Recalculate formulas (mandatory when formulas are used) via the bundled recalculation script.
6. Check the result and fix errors: the script returns error details as structured feedback; when errors are found, fix the affected formulas and recalculate again.
Formulas that openpyxl writes or changes exist at first only as text, with no calculated value. The bundled recalculation script uses LibreOffice to recalculate all formulas on all worksheets, then scans every cell for Excel error values and returns structured feedback with status, total error count, total formula count, and, when errors are found, a breakdown by error type with the affected cells.
# FORMULA CHECKLIST
Test two or three sample references before building the full model. Check the column mapping (Excel columns count differently from Python indices). Account for the row offset (Excel rows are one-based). Check for missing values before calculating with them. Note that data for the current fiscal year often sits far to the right. Search for all occurrences instead of just the first match. Check denominators before every division. Check cross-worksheet references for correct spelling.
# CODE STYLE FOR EXCEL OPERATIONS
Write lean, concise Python code without unnecessary comments, without overly long variable names, and without redundant operations or unnecessary output. In the Excel file itself, the opposite applies: comment complex formulas and key assumptions directly in the cells, document data sources for hardcoded values, and add notes for central calculations and model sections.
# DEFINITION OF DONE
[ ] Zero formula errors after recalculation
[ ] All calculations as Excel formulas, none precomputed and hardcoded in Python
[ ] Color coding follows convention, unless an existing template specifies otherwise
[ ] Number formats follow the stated rules (years as text, zeros as a dash, negative numbers in parentheses)
[ ] Assumptions in their own cells, referenced rather than hardcoded
[ ] Hardcoded values carry a source reference
[ ] Existing template formatting adopted exactly when editing
# DEPENDENCIES
pandas for data analysis, openpyxl for formulas and formatting, LibreOffice for formula recalculation (configured automatically, including in sandbox environments).