استخدمه عندما يكون هدفك واضحًا في الملفات والمستندات وتستطيع تحديد البيانات والأفعال التي يحتاجها فقط.
Docx
Docx: مهارة ينشرها Nous Research. مجالها الملفات والمستندات. الرخصة MIT. الإصدار الموثّق 1.0.0. مثبّتة افتراضيًا مع Hermes، فلا تحتاج خطوة تثبيت. تدعم: linux، macos، windows.
ماذا يضيف إلى Hermes؟
Docx: مهارة ينشرها Nous Research. مجالها الملفات والمستندات. الرخصة MIT. الإصدار الموثّق 1.0.0. مثبّتة افتراضيًا مع Hermes، فلا تحتاج خطوة تثبيت. تدعم: linux، macos، windows.
Docx هي مهارة مرتبطة بمجال الملفات والمستندات. يتيح للوكيل قراءة ملفات أو تنظيمها أو إنشاء مستندات، وفق نطاق المجلد والحساب الذي تمنحه له.
هذا تفسير مبسّط مبني على وصف الناشر. أبقينا الوصف الإنجليزي بجانبه حتى تستطيع مقارنة المعنى بالمصدر.
لا تضفه لمجرد التجربة إذا كان لديك طريق أبسط داخل Hermes، أو إذا لم تستطع مراجعة المصدر والصلاحيات.
مناسب لمن يريد طريقة عمل قابلة للتكرار داخل Hermes.
استخدم مجلدًا تجريبيًا فيه نسخ من ملفات غير حساسة، وابدأ بعملية قراءة واحدة.
Create, read, edit, and template Word .docx files
فُهرس هذا الإدخال من Hermes Bundled Skills. الشرح العربي يفسّر النوع والمجال ولا يضيف وظيفة غير مذكورة في المصدر.
المصدر رسمي أو خضع لمراجعة تحريرية، لكن ذلك لا يغني عن مراجعة الصلاحيات والإصدار.
افحص، ثبّت، ثم اختبر.
- 01افتح المصدر
طابق اسم الناشر والرخصة والوصف مع حاجتك، وراجع آخر تحديث فعلي.
- 02راجع الصلاحيات والأسرار
لا تلصق قيمة سر داخل الموقع. استخدم أسماء متغيرات البيئة وامنح أقل نطاق ممكن.
- 03انسخ الإعداد فقط بعد المراجعة
الأزرار أدناه تنسخ نصًا إلى الحافظة ولا تشغّل أمرًا على جهازك.
- 04اختبر بمهمة غير حساسة
تحقق من الأدوات الظاهرة، ثم استبعد أدوات الكتابة أو الحذف التي لا تحتاجها.
مثبّتة مسبقًا مع Hermes.
تأتي هذه المهارة مع Hermes وتُحمَّل عندما يرى الوكيل أنها مناسبة. لا شيء لتثبيته؛ اقرأ التعريف أدناه لتعرف ما ستفعله.
افتح الصفحة الرسمية ↗ما الذي يحمّله Hermes بالضبط عند تشغيل هذه المهارة.
منقول من التوثيق الرسمي. اقرأه قبل تفعيل المهارة، فهذا النص يصبح تعليمات الوكيل نفسه.
Create, read, edit, and template Word .docx files.
Skill metadata
جدول مرجعي. لا تقرأه كله، ابحث عن السطر الذي يخصّك فقط.
| Source | Bundled (installed by default) |
| Path | skills/productivity/docx |
| Version | 1.0.0 |
| Author | Nous Research |
| License | MIT |
| Platforms | linux, macos, windows |
| Tags | word, docx, documents, office, templates |
| Related skills | pdf, xlsx, powerpoint |
Reference: full SKILL.md
شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.
Create, read, edit, and template Microsoft Word .docx files with
python-docx via four small CLIs. It handles text, styles, lists, tables,
images, headers/footers, and {{token}} templating. It does not render
documents to PDF, edit legacy .doc binaries, or accept/reject tracked
changes (it only detects them — see Pitfalls).
When to Use
شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.
- The user asks to generate a Word document (report, letter, contract).
- You need the text, outline, styles, or embedded images of a
.docx. - You must change an existing
.docx: replace text, edit table cells, insert/delete paragraphs, apply styles. - You have a
.docxtemplate with{{placeholders}}to fill from data. - Not for:
.doc(legacy),.odt, PDF conversion, or WYSIWYG layout work.
Prerequisites
شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.
- Python 3.10+ with
python-docxinstalled:pip install python-docx(import name isdocx). - For image blocks: the image files must exist locally (PNG/JPEG).
How to Run
شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.
All helpers live in scripts/ next to this file. Run them with the
terminal tool; each supports --help and prints JSON to stdout.
python scripts/docx_create.py spec.json out.docx
python scripts/docx_read.py out.docx --text
python scripts/docx_edit.py replace out.docx --find old --replace new
python scripts/docx_template.py tpl.docx values.json filled.docxQuick Reference
جدول مرجعي. لا تقرأه كله، ابحث عن السطر الذي يخصّك فقط.
| Task | Command |
|---|---|
| Create from JSON spec | docx_create.py spec.json out.docx |
| Full text (body+tables+headers/footers) | docx_read.py f.docx --text |
| Heading outline + table shapes | docx_read.py f.docx --structure |
| Styles actually used | docx_read.py f.docx --styles |
| Extract embedded images | docx_read.py f.docx --images outdir/ |
| Detect tracked changes/comments | docx_read.py f.docx --revisions |
| Find/replace (formatting kept) | docx_edit.py replace f.docx --find A --replace B -o out.docx |
| Set a table cell | docx_edit.py set-cell f.docx --table 0 --row 1 --col 2 --text X |
| Insert paragraph before index N | docx_edit.py insert f.docx --index N --text X --style Normal |
| Delete paragraph N | docx_edit.py delete f.docx --index N |
| Apply style to paragraph N | docx_edit.py style f.docx --index N --style "Heading 1" |
Fill {{tokens}} | docx_template.py tpl.docx values.json out.docx --strict |
Procedure
شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.
- Create. Write a JSON spec with
write_file, then runscripts/docx_create.py. The spec supports:page(size + margins in mm),header/footerstrings,styles(custom paragraph styles with font, size, bold/italic, hexcolor), andblocks—heading(level 1-9),paragraph(eithertextor arunslist where each run may setbold/italic/underline),bullet_list,numbered_list,table(headerrow rendered bold,rows, optional built-in tablestylesuch asTable Grid),image(path, optionalwidth_mm), andpage_break. The full spec format is documented at the top ofscripts/docx_create.py— read it withread_filewhen composing. - Read. Use
scripts/docx_read.pywith exactly one mode flag.--textreturns body paragraphs, all table cell text, and header/footer text as JSON.--structurereturns the heading outline plus paragraph/table/section counts.--images DIRcopies every file underword/media/out of the package. - Edit. Use
scripts/docx_edit.py.replacewalks body, tables (nested included), headers and footers, and preserves run formatting; add--body-onlyto skip headers/footers. Pass-o out.docxto keep the original; omit it to edit in place. Paragraph indices forinsert/delete/stylerefer to--structure/--textbody order. - Template. Put
{{name}}-style tokens in the document (letters, digits,_,.,-; optional inner spaces like{{ name }}are accepted). Runscripts/docx_template.pywith a JSON object of values. Use--strictto fail when tokens remain unfilled; the JSON output listsfilledcounts andunfilled_tokenseither way. - Verify (always): re-read the output with
--textor--structureand confirm the expected content is present.
Pitfalls
شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.
- Tokens split across runs. Word often fragments
{{name}}into several runs. The replace helpers handle this by collapsing the runs; the replacement inherits the formatting of the run where the match starts. Mid-token formatting changes are therefore flattened. - Tracked changes.
--revisionsonly detects insertions, deletions, format changes, and comments. Text extraction returns the as-is body (insertions included, deletions omitted, i.e. roughly the accepted view), but this skill cannot accept/reject revisions or read comment text. Say so to the user rather than guessing. - Style names must exist. Applying a style that isn't defined in the document raises
KeyError. Built-ins likeHeading 1,List Bullet,List Number,Table Gridexist in the default template; custom styles must be declared in the create spec first. - Numbered lists restart.
List Numberrelies on Word's default numbering; separate lists in one document may continue numbering instead of restarting. Acceptable for simple docs; warn users needing precise multi-list numbering. - Cell writes replace formatting.
set-cellusescell.text = ..., which resets runs in that cell to plain formatting. - Encoding. All JSON specs/values files are read as UTF-8 explicitly; never rely on locale defaults when writing your own glue code.
- Don't unzip-and-sed the XML. Edit through the scripts (or python-docx); raw text substitution in
document.xmlcorrupts files easily. Usepatch/write_fileonly for the JSON inputs, never on the.docxitself.
Verification
شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.
- After create/edit/template, run
docx_read.py out.docx --textand check the expected strings appear (and old strings are gone). - For templates run with
--strict, or checkunfilled_tokens == []. - Structure checks:
--structureshould show the expected heading outline and table shapes;--stylesconfirms custom styles applied. - A valid
.docxopens withDocument(path)without exception — the read script exiting 0 is itself a sanity check.