Editing a document so the formatting stays exactly the same

First working version
< 1 h

Goal

A skill that takes one sentence about what has to change inside a quote or a contract, finds the value by meaning rather than by literal match, replaces it in a new copy, recalculates the amounts that depend on that line and hands back the document with logos and images exactly where they were.

How it works

First the user describes the change in one sentence, “change the price of the windows to €25”, and the skill turns that into what to find, where, and what to replace it with. It locates the value by meaning rather than by literal match, because a find-and-replace would change all four places that figure appears in the quote: what it looks for is the amount hanging off the concept it was given. If it appears in several places it stops and shows the matches for the user to pick from, instead of guessing.

Then it duplicates the file, because the original has to stay the original: the one it is handed is never opened for writing. On the copy it swaps the exact fragment, without reformatting, without correcting and without improving anything around it. The document is not rebuilt: it is opened from the inside and only the relevant piece is changed, and where the page has to be rewritten the logos, images, signatures and stamps are extracted with their position, size and layer order and put back at the same coordinates, without rescaling. That is why the layout, the tables, the header logo and the scanned signature at the end stay exactly as they were.

And because changing one line usually moves a whole column, it redoes the amounts that depend on it: the subtotal, the tax, the discount and the total. In Excel it lets the formula recalculate and checks the result; in Word, PowerPoint and PDF the total is text, so it replaces it under the same rule of touching nothing else. Only when the arithmetic cannot be reconstructed from the document itself does it ask rather than assume.

To finish, it proves nothing broke, which is what lets you send the file to a client without reading it end to end: it compares the rest of the document against the original, checks that pages, paragraphs, tables and cells still reconcile and that images and signatures are still at the same coordinates, and rasterises the edited page to look at it.

Agent steps
Deliverable
  • A new copy with a version suffix, in the same format as the original.
  • A short report with what changed and where, which amounts were recalculated and with what operation, and the result of every verification check.
  • A list of what is worth looking at yourself before sending it.
Stack
  • Claude Cowork
  • A Claude skill of our own
  • Word, PowerPoint and Excel skills
  • PDF skill
  • Rasterised verification

Why it matters

Changing one value inside a laid-out document looks trivial and is not: the hard part was never replacing text, it was knowing which text and handing back the rest untouched. Understanding a sentence in plain language is what lets it find the value by meaning, the amount hanging off the concept “windows” rather than every occurrence of the number 25. And the document not being rebuilt, but opened from the inside, changed in one place and closed again, is what leaves logos, images and signatures at the same coordinates and the file ready to send as it is.

What could come next

  1. 01Apply the same change across a batch: the same new rate in the thirty quotes still waiting to be signed. Right now it edits one file at a time, so a price rise is again an afternoon of opening documents and checking that none was left untouched.
  2. 02Keep the before and after of every edit. Today the new copy sits next to the original in the folder and the record of what changed lives only in that session’s report; with a history, undoing a change from two weeks ago stops depending on someone having kept the email.
  3. 03Update the ERP with the new version of the quote and the changed amount, so the offer sales sees is the good one and not the copy left in a folder with a hand-corrected filename.

Worth knowing

  • legal

    It works on client documents: quotes, contracts, payroll. There are personal data and commercial terms inside, so where the file is processed and who can open it matters as much as getting the edit right.

  • dependency

    In a scanned PDF, or one with no reliable text layer, there is nothing to locate. There the skill says so and offers an alternative instead of rebuilding the document, because rebuilding it is exactly what would break the fidelity.

  • dependency

    Replacement is exact in .docx, .pptx and .xlsx because the specific run or cell is swapped. In native PDF it holds while the new text takes up similar space; much longer and the line shifts.

  • future

    The structural verification is reliable; the fine visual check is not infallible. And an amount is only recalculated when the arithmetic can be reconstructed from the document itself: if the criterion is not written down, the skill says so and asks. What is delivered is verified quality plus a list of what to look at, not a promise of perfection.

The prompt

To use it, just copy this prompt and paste it into Claude.

Create a new, self-contained SKILL for editing documents by instruction while preserving the original formatting exactly. The user describes the change in natural language (for example: change the price of the windows to €25), the skill finds where it is, applies that change, recalculates the amounts that depend on it and produces a new copy identical to the original except for what was asked and what follows from it. It never touches the source file.

STEP 0 (before generating anything): ask me by click, multi-select, which formats the skill must support. Options: Word (.docx), PowerPoint (.pptx), Excel (.xlsx), PDF (.pdf). Generate support only for the selected ones. If I select none, ask me again.

CONTEXT
A skill for ForgeLab, professional deliverable standard. The edited document must look identical to the original (layout, images, logos, typography, styles, tables, charts) except for the value or text that was asked to change and the amounts that depend on it. It will be used on client documents, so the precision of the change and the verification that nothing else moved are what matter most.

FORMATS
Editing is exact in .docx, .pptx and .xlsx, because the specific run or cell is replaced. In native .pdf (with a text layer and embedded fonts) a targeted replacement keeps the layout, especially when the new text takes up similar space. In a scanned .pdf, or one with no reliable layer, there is no text to locate, so the skill says so and offers an alternative before continuing. If the source file that produced the PDF exists, the skill recommends editing the source and re-exporting.

MATERIALS (read them before generating anything, only for the selected formats)
- /mnt/skills/public/docx/SKILL.md
- /mnt/skills/public/pptx/SKILL.md
- /mnt/skills/public/xlsx/SKILL.md
- /mnt/skills/public/pdf/SKILL.md
They hold the environment's constraints (libraries, paths, rendering). The SKILL you generate must state that, before touching each document, the public SKILL for its format is to be read.

RULES FOR THE SKILL YOU ARE GOING TO GENERATE
1. Always a new copy. Never edit or overwrite the source. Name the copy with a version suffix (example: quote.pdf becomes quote_EDIT.pdf) and keep the same format as the original.
2. Interpret the change before touching anything. Read the instruction and translate it into: what to locate, current value or text, and new value or text. Accept several edits in one request.
3. Locate by meaning, not just literally. If asked to change the price of the windows, look for the price attached to the concept "windows", not every occurrence of the figure.
4. When ambiguous, ask by click. If the value to change appears in several places, or you are not sure which is the target, show the matches found as clickable options and wait for the user to choose before editing. Never guess.
5. Change only what was asked. Do not reformat, do not correct, do not improve, do not touch anything that was not explicitly requested. Zero collateral changes.
6. Recalculate whatever depends on the change. If the value you changed feeds subtotals, totals, taxes, discounts or percentages, redo those figures in the same document without waiting to be asked. In .xlsx, if the total is a formula let it recalculate and check the result; if it is a hard-coded value, rewrite it. In .docx, .pptx and .pdf totals are text, so they are replaced like any other value and under the same rule of touching nothing else. Record in the report which figures you recalculated and with what operation. Only when the dependency cannot be reconstructed from the document itself (a line is missing, the discount criterion is not written down) say so and ask instead of assuming it.
7. Formatting and graphic elements untouched: layout, styles, typography, tables, images, logos, signatures and stamps exactly as in the original. The document is not rebuilt: it is opened from the inside and only the relevant piece is replaced. In .docx, .pptx and .xlsx no graphic part of the file is touched at all. When the page has to be rewritten (the .pdf case), extract every image, logo, signature and stamp with its position, size, rotation and layer order, and put them back at exactly the same coordinates, without rescaling or recompressing. If one of them cannot be returned to its exact place, do not approximate it: say so before delivering.
8. Space control. If the new text takes up more or less room than the original, adjust without overflowing cells, boxes or shapes, and without reflow that breaks the layout. If the layout cannot be preserved, say so before delivering.
9. The PDF-without-text-layer case. If the PDF is scanned or has no reliable layer, warn with clickable options and explain that the value cannot be located or replaced without rebuilding the document (which is exactly what would break exact fidelity). Wait for a decision.
10. Verify before delivering, point by point: the requested change is applied and correct; the amounts that depended on it reconcile with the lines feeding them; nothing else has changed against the original (compare the rest of the content); pages, paragraphs, tables and cells match; images, logos and signatures are still at the same coordinates and the same size; styles untouched; nothing overflows. For PDF, rasterise the affected page and compare it visually with the original. If anything fails, fix it and verify again.
11. Be honest about quality. Verifying the change, and that the rest has not moved, is reliable; the fine visual check is not infallible. Do not promise guaranteed perfection: deliver verified high quality and point out what is worth reviewing.

WHAT THE SKILL DELIVERS IN USE
When used, the skill delivers the edited document plus a short report with: what changed and where (concept, previous value, new value, location), which amounts were recalculated and with what operation, a verification checklist with the result of each point, and the points the user should review personally.

OUTPUT FORMAT FOR THIS REQUEST
Generate a single SKILL.md at /mnt/skills/user/[SKILL_NAME]/SKILL.md with:
- YAML frontmatter with name and description. The description must trigger the skill well: include only the formats selected in STEP 0 and trigger phrases in Spanish and English (cambia, edita, modifica, sustituye el valor de, edit this document, change X to Y in this PDF/Word/Excel keeping the formatting).
- Body in Spanish, lean register (no filler, no decorative subheadings), with the workflow as numbered steps and the rules section, limited to the selected formats.
Ask me for the skill's name before creating it if I have not given it to you. Do not edit any other file.

Contact

Let's have a call. In 30 minutes I can tell you whether I can help.

Email address (enable JavaScript to reveal)LinkedIn