Validate companies DOCX
ALWAYS use this skill instead of validate-companies when a .docx file is involved. Validates Israeli company references in Word (.docx) files and annotates with correct registration details from the Israeli Companies Registrar (ืจืฉื ืืืืจืืช ืืืฉืจืืื). Triggers on: any request referencing a .docx file with company validation, annotation, or completion โ e.g. 'check companies in this contract', 'annotate the Word file with company numbers', 'fill in company details in the document', 'validate companies in the agreement', 'complete the company details in the docx'. Also triggers when user provides a .docx path and asks to complete, verify, or fix company information. For Hebrew documents, assume Israeli company unless stated otherwise.
validate-companies-docx
Validates Israeli company references in a Word .docx file and annotates the document. Missing details are inserted as tracked changes; discrepancies or not-found companies receive comment balloons.
Required
isracorpMCP server (providessearch_companyandget_companytools)- Python with the scripts in
scripts/(unpacking, packing, comments) pandoc(for text extraction)
Scripts Location
All scripts are at .claude/skills/validate-companies-docx/scripts/. When running commands, use paths relative to the skill's scripts directory, or provide full paths.
Full Workflow
Step 1: Confirm the Document Path
If not provided, ask the user:
Please provide the full path to the .docx file you want to annotate.
Verify the file exists before proceeding.
Step 2: Extract Text for Analysis
pandoc --track-changes=all "<input.docx>" -o "/tmp/doc_text.md"
Read /tmp/doc_text.md to identify company mentions. This gives clean text that's easier to search than raw XML.
Step 3: Unpack the Document
python scripts/office/unpack.py "<input.docx>" unpacked/
The default --merge-runs collapses adjacent same-format runs, which helps locate company names that Word has split across <w:r> elements.
Step 4: Extract Company Mentions
Apply the same extraction logic as the validate-companies skill:
- Hebrew names:
[\u0590-\u05FF\s"'ืด]+ ?(ืืข"ื|ืืขื|ืืขืดื) - English names:
[A-Z][A-Za-z\s]+ (Ltd|Limited|Inc|LP)\.? - Numbers already present:
ื\.?[ืคืฆ]\.?\s*(\d{2}-\d{6}-\d|\d{9})orNo\.\s*(\d{2}-\d{6}-\d|\d{9}) - Placeholders:
ื\.?[ืคืฆ]\.?\s*_{2,}orNo\.\s*_{2,}
For each mention, note the surrounding sentence for context when locating it in the XML.
Step 5: Validate Each Mention via MCP
Same logic as validate-companies skill (Steps 2โ3):
- Number present โ
get_company({ number }) - Name only โ
search_company({ name }); if no results and name contains parentheses, strip the parenthetical and retry (e.g.ืื ืืฉืงืืืช (2000)โ retry asืื ืืฉืงืืืช) - Record: confirmed match / discrepancy / not found / warnings
Step 6: Locate Each Mention in the XML
Read unpacked/word/document.xml.
For each mention to annotate:
- Concatenate all
<w:t>text within each<w:p>paragraph (ignoring tags) to reconstruct visible text - Find the paragraph(s) whose concatenated text contains the company mention
- Within that paragraph, identify which
<w:r>run(s) end with the company name
RTL detection: Check if the paragraph's <w:pPr> contains <w:bidi/>. If so, it's a Hebrew RTL paragraph and RTL insertion rules apply.
Step 7: Annotate the XML
Use sequential comment IDs starting from 0 (or the next available ID if comments already exist).
Case A: Missing detail โ company confirmed in registry
Insert the missing detail (company number and/or city) immediately after the company name as a tracked change.
Choosing the number label:
- If the paragraph already contains a label (
ื.ืค.,ื.ืฆ., orCompany Number) immediately before the blank (___), preserve that exact label โ do not change it. - If there is no existing label, determine the correct one:
- Hebrew document: use
ื.ืฆ.if the company number starts with52or the company name containsืฆืืืืจืืช; otherwise useื.ืค. - English document: use
Company Number
- Hebrew document: use
<!-- Example: inserting ", ื.ืค. 51-234567-9" after "ืืื ืืื ืืข"ื" in a Hebrew paragraph (private company) -->
<w:ins w:id="[next-id]" w:author="Claude" w:date="[ISO-8601-date]">
<w:r>
<w:rPr>
<!-- CRITICAL: Copy <w:rPr> from the preceding Hebrew run exactly.
This preserves: <w:cs/>, <w:rFonts w:cs="...">, <w:lang w:bidi="he-IL"/> -->
[copied rPr here]
</w:rPr>
<w:t xml:space="preserve">, ื.ืค. 51-234567-9</w:t>
</w:r>
</w:ins>
RTL rules (when inserting into a Hebrew paragraph โ <w:bidi/> present):
- Copy
<w:rPr>from the immediately preceding<w:r>run in the same paragraph - The copied
<w:rPr>will already contain<w:cs/>and the bidi font โ do NOT omit these - Add
xml:space="preserve"to<w:t>when the inserted text begins with a space - If the preceding run has no
<w:rPr>, add one with<w:cs/>and<w:lang w:bidi="he-IL"/>
LTR rules (English paragraphs โ no <w:bidi/>):
- Copy
<w:rPr>from preceding run (preserves font, size) - No special bidi properties needed
Case B: Company not found in registry
Add a comment balloon on the company name span:
If the document is in Hebrew:
python scripts/comment.py unpacked/ [id] "ืืืืจื ืื ื ืืฆืื ืืจืฉื ืืืืจื. ืื ื ืืืืื ืืช ืืฉื ืื ืืกืคืจ ืืืืจื ืฉืื."
If the document is in any other language:
python scripts/comment.py unpacked/ [id] "Company "[name]" was not found in the Israeli Companies Registrar. Please verify the name before signing."
Then add markers in document.xml around the company name text:
<w:commentRangeStart w:id="[id]"/>
[... existing runs with company name ...]
<w:commentRangeEnd w:id="[id]"/>
<w:r>
<w:rPr><w:rStyle w:val="CommentReference"/></w:rPr>
<w:commentReference w:id="[id]"/>
</w:r>
CRITICAL: <w:commentRangeStart> and <w:commentRangeEnd> are direct children of <w:p>, never inside <w:r>.
Case C: Document details differ from registry
Add a comment balloon.
If the document is in Hebrew:
python scripts/comment.py unpacked/ [id] "ืคืจืื ืืืืจื ืืจืฉื: "[registryName]", ื.ืค. [number]. ืืคืจืืื ืืืกืื ืฉืื ืื — ืื ื ืืืืื ืืคื ื ืืืชืืื."
If the document is in any other language:
python scripts/comment.py unpacked/ [id] "Registry shows: "[registryName]", Company Number [number]. Document has different details — please reconcile before signing."
Add markers as in Case B.
Case D: Dissolved or violating company
Add a comment warning regardless of whether other details were inserted.
If the document is in Hebrew:
python scripts/comment.py unpacked/ [id] "ืืืืจื: [name] (ื.ืค. [number]) — ืกืืืืก: "[status]". ืื ื ืืืงื ืืช ืืขืื ืืืืจื ืืคื ื ืืืชืืื."
If the document is in any other language:
python scripts/comment.py unpacked/ [id] "WARNING: [name] (Company Number [number]) has status "[status]". Verify current standing before signing."
Step 8: Pack the Document
python scripts/office/pack.py unpacked/ "<output_validated.docx>" --original "<input.docx>"
The output filename should be <original-name>_validated.docx in the same directory.
Step 9: Report to User
For a Hebrew document, report in Hebrew:
ืขืืื ืขื: <input_filename>
ืคืื: <output_filename>
ืชืืฆืืืช:
โ ืืืืช (ืฉืื ืื ืขื ืืขืงื ืืืื ืก): [ืฉื ืขืืจื] / [ืฉื ืื ืืื] โ ื.ืค. [ืืกืคืจ]
โ ืืืืจื (ืชืืืื ืืืกืคื): [ืฉื ืขืืจื] / [ืฉื ืื ืืื] โ [ืกืืืช ืืืืืจื]
โ ืื ื ืืฆื ืืจืฉื (ืชืืืื ืืืกืคื): [ืฉื ืืืจื]
โ ืื-ืืชืืื (ืชืืืื ืืืกืคื): [ืฉื ืขืืจื] / [ืฉื ืื ืืื] โ [ืื ืฉืื ื]
For any other language document, report in English:
Processed: <input_filename>
Output: <output_filename>
Results:
โ Validated (tracked change inserted): [Hebrew name] / [English name] โ No. [number]
โ Warning (comment added): [Hebrew name] / [English name] โ [warning reason]
โ Not found (comment added): [company name as mentioned]
โ Discrepancy (comment added): [Hebrew name] / [English name] โ [what differs]
Always show both Hebrew and English names when the registry has both. Omit the / [English name] part if the English name is absent.
Important Docx XML Rules
Comment ID Management
Before adding new comments, check if unpacked/word/comments.xml already exists. If it does, find the highest existing w:id value and start new comment IDs from that value + 1.
Tracked Change IDs
Every <w:ins> and <w:del> element needs a unique w:id. Use sequential integers not used elsewhere in the document. Scan document.xml for all existing w:id attributes on <w:ins> and <w:del> before assigning new ones.
XML Escaping in Hebrew Text
When inserting Hebrew text in <w:t> elements:
- Apostrophes/double quotes in company names like
ืืข"ื: use"for"and’for' - The
unpack.pyscript converts smart quotes to XML entities โ new insertions should do the same
Do Not Use \n in XML
Separate text runs use separate <w:r> elements. Never use \n or newlines inside <w:t>.
Example: Complete Hebrew Annotation
Input paragraph in document.xml (simplified):
<w:p>
<w:pPr>
<w:bidi/>
<w:jc w:val="right"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:cs="David"/>
<w:cs/>
<w:lang w:bidi="he-IL"/>
</w:rPr>
<w:t xml:space="preserve">ืืืกืื ื ืืชื ืืื </w:t>
</w:r>
<w:r>
<w:rPr>
<w:rFonts w:cs="David"/>
<w:cs/>
<w:lang w:bidi="he-IL"/>
</w:rPr>
<w:t>ืืื ืืื ืืข"ื</w:t>
</w:r>
<w:r>
<w:rPr>
<w:rFonts w:cs="David"/>
<w:cs/>
<w:lang w:bidi="he-IL"/>
</w:rPr>
<w:t xml:space="preserve"> ืืืื ืฆื ื.</w:t>
</w:r>
</w:p>
After annotation (inserting company number as tracked change):
<w:p>
<w:pPr>
<w:bidi/>
<w:jc w:val="right"/>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:cs="David"/>
<w:cs/>
<w:lang w:bidi="he-IL"/>
</w:rPr>
<w:t xml:space="preserve">ืืืกืื ื ืืชื ืืื </w:t>
</w:r>
<w:r>
<w:rPr>
<w:rFonts w:cs="David"/>
<w:cs/>
<w:lang w:bidi="he-IL"/>
</w:rPr>
<w:t>ืืื ืืื ืืข"ื</w:t>
</w:r>
<w:ins w:id="1" w:author="Claude" w:date="2026-04-08T00:00:00Z">
<w:r>
<w:rPr>
<w:rFonts w:cs="David"/>
<w:cs/>
<w:lang w:bidi="he-IL"/>
</w:rPr>
<w:t xml:space="preserve">, ื.ืค. 51-234567-9</w:t>
</w:r>
</w:ins>
<w:r>
<w:rPr>
<w:rFonts w:cs="David"/>
<w:cs/>
<w:lang w:bidi="he-IL"/>
</w:rPr>
<w:t xml:space="preserve"> ืืืื ืฆื ื.</w:t>
</w:r>
</w:p>
Last updated: October 13, 2026
Files (61)
LICENSEAssetsscripts/accept_changes.pyScriptsscripts/comment.pyScriptsscripts/__init__.pyScriptsscripts/office/helpers/__init__.pyScriptsscripts/office/helpers/merge_runs.pyScriptsscripts/office/helpers/simplify_redlines.pyScriptsscripts/office/pack.pyScriptsscripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsdScriptsscripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsdScriptsscripts/office/schemas/ecma/fouth-edition/opc-digSig.xsdScriptsscripts/office/schemas/ecma/fouth-edition/opc-relationships.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/pml.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/sml.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/wml.xsdScriptsscripts/office/schemas/ISO-IEC29500-4_2016/xml.xsdScriptsscripts/office/schemas/mce/mc.xsdScriptsscripts/office/schemas/microsoft/wml-2010.xsdScriptsscripts/office/schemas/microsoft/wml-2012.xsdScriptsscripts/office/schemas/microsoft/wml-2018.xsdScriptsscripts/office/schemas/microsoft/wml-cex-2018.xsdScriptsscripts/office/schemas/microsoft/wml-cid-2016.xsdScriptsscripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsdScriptsscripts/office/schemas/microsoft/wml-symex-2015.xsdScriptsscripts/office/soffice.pyScriptsscripts/office/unpack.pyScriptsscripts/office/validate.pyScriptsscripts/office/validators/base.pyScriptsscripts/office/validators/docx.pyScriptsscripts/office/validators/__init__.pyScriptsscripts/office/validators/pptx.pyScriptsscripts/office/validators/redlining.pyScriptsscripts/templates/commentsExtended.xmlScriptsscripts/templates/commentsExtensible.xmlScriptsscripts/templates/commentsIds.xmlScriptsscripts/templates/comments.xmlScriptsscripts/templates/people.xmlScriptsSKILL.mdSKILL.md
- Jurisdiction
- ๐ฎ๐ฑ Israel
- Practice area
- Corporate
- License
- Apache-2.0
- Author
- ShaiShulman
Test Validate companies DOCX
Ask a legal question โ get an answer generated live from this skillโs instructions.
Sign in to test this skill.