[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KDWZ9AFS9GRPR6MJ87MZS4":3,"skill-same:01M6KDWZ9AFS9GRPR6MJ87MZS4":66},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":27,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":51,"install":52,"resources":65},"01M6KDWZ9AFS9GRPR6MJ87MZS4","docx-placeholder-replacement",null,"Robustly replace {{PLACEHOLDER}} tokens in Word documents, handling split runs across paragraphs, tables, headers, and footers.","cxcscmu\u002FSkillLearnBench","cxcscmu","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142838272?v=4","01M6KCQDFQWPDSN0MKZY96MSQP","01M6KCQDM7G70TKJ28NTSQC0RZ",93,"MIT","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fb1-one-shot-claude-sonnet-4-6\u002Foffer-letter-generator\u002Fdocx-placeholder-replacement\u002FSKILL.md",[17,22],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[28,29,30,31,32,33,34,35,36,37,38],"docx","placeholder","docx placeholder replacement","documents","Word","across","tokens","headers","word documents","tables","split","2026-11-10 10:12:30",false,"---\nname: docx-placeholder-replacement\ndescription: Robustly replace {{PLACEHOLDER}} tokens in Word documents, handling split runs across paragraphs, tables, headers, and footers.\n---\n\n# Robust Placeholder Replacement in Word Documents\n\n## The Split-Run Problem\n\nWord's XML engine often breaks a single word like `{{CANDIDATE_NAME}}` across multiple runs:\n\n```\nrun[0]: '{{CANDI'\nrun[1]: 'DATE_NAME}}'\n```\n\nA naive `run.text.replace()` will miss these. Always reconstruct from `para.text`.\n\n## Safe Replacement Algorithm\n\n```python\nimport re\n\ndef replace_in_paragraph(para, data):\n    \"\"\"Replace all {{KEY}} placeholders in paragraph, handling split runs.\"\"\"\n    full_text = para.text\n    pattern = re.compile(r'\\{\\{([A-Z0-9_]+)\\}\\}')\n\n    if not pattern.search(full_text):\n        return  # Nothing to do\n\n    # Build replacement\n    def replacer(m):\n        key = m.group(1)\n        return str(data[key]) if key in data else m.group(0)\n\n    new_text = pattern.sub(replacer, full_text)\n\n    if new_text != full_text and para.runs:\n        # Put all text in first run, clear the rest\n        para.runs[0].text = new_text\n        for run in para.runs[1:]:\n            run.text = ''\n```\n\n## Apply to Entire Document\n\n```python\ndef replace_all_placeholders(doc, data):\n    \"\"\"Replace placeholders everywhere: body, tables, headers, footers.\"\"\"\n\n    # Body paragraphs\n    for para in doc.paragraphs:\n        replace_in_paragraph(para, data)\n\n    # Tables (with nested table recursion)\n    def process_table(table):\n        for row in table.rows:\n            for cell in row.cells:\n                for para in cell.paragraphs:\n                    replace_in_paragraph(para, data)\n                for nested in cell.tables:\n                    process_table(nested)\n\n    for table in doc.tables:\n        process_table(table)\n\n    # Headers and footers\n    for section in doc.sections:\n        for para in section.header.paragraphs:\n            replace_in_paragraph(para, data)\n        for para in section.footer.paragraphs:\n            replace_in_paragraph(para, data)\n```\n\n## Notes\n\n- Only the first run's formatting is preserved after merging. If parts of the placeholder text have different formatting (e.g., bold `{{NAME}}`), that formatting is lost — which is usually acceptable for template filling.\n- Unknown placeholders (keys not in `data`) are left as-is by default. Adjust the `replacer` function to raise errors or substitute empty strings if needed.\n","# Robust Placeholder Replacement in Word Documents\n\n## The Split-Run Problem\n\nWord's XML engine often breaks a single word like `{{CANDIDATE_NAME}}` across multiple runs:\n\n```\nrun[0]: '{{CANDI'\nrun[1]: 'DATE_NAME}}'\n```\n\nA naive `run.text.replace()` will miss these. Always reconstruct from `para.text`.\n\n## Safe Replacement Algorithm\n\n```python\nimport re\n\ndef replace_in_paragraph(para, data):\n    \"\"\"Replace all {{KEY}} placeholders in paragraph, handling split runs.\"\"\"\n    full_text = para.text\n    pattern = re.compile(r'\\{\\{([A-Z0-9_]+)\\}\\}')\n\n    if not pattern.search(full_text):\n        return  # Nothing to do\n\n    # Build replacement\n    def replacer(m):\n        key = m.group(1)\n        return str(data[key]) if key in data else m.group(0)\n\n    new_text = pattern.sub(replacer, full_text)\n\n    if new_text != full_text and para.runs:\n        # Put all text in first run, clear the rest\n        para.runs[0].text = new_text\n        for run in para.runs[1:]:\n            run.text = ''\n```\n\n## Apply to Entire Document\n\n```python\ndef replace_all_placeholders(doc, data):\n    \"\"\"Replace placeholders everywhere: body, tables, headers, footers.\"\"\"\n\n    # Body paragraphs\n    for para in doc.paragraphs:\n        replace_in_paragraph(para, data)\n\n    # Tables (with nested table recursion)\n    def process_table(table):\n        for row in table.rows:\n            for cell in row.cells:\n                for para in cell.paragraphs:\n                    replace_in_paragraph(para, data)\n                for nested in cell.tables:\n                    process_table(nested)\n\n    for table in doc.tables:\n        process_table(table)\n\n    # Headers and footers\n    for section in doc.sections:\n        for para in section.header.paragraphs:\n            replace_in_paragraph(para, data)\n        for para in section.footer.paragraphs:\n            replace_in_paragraph(para, data)\n```\n\n## Notes\n\n- Only the first run's formatting is preserved after merging. If parts of the placeholder text have different formatting (e.g., bold `{{NAME}}`), that formatting is lost — which is usually acceptable for template filling.\n- Unknown placeholders (keys not in `data`) are left as-is by default. Adjust the `replacer` function to raise errors or substitute empty strings if needed.\n",{"name":5,"description":7},"main","726e1f79b96b0cb3d729d0e55a1c847e0b5353ae","skills\u002Fb1-one-shot-claude-sonnet-4-6\u002Foffer-letter-generator\u002Fdocx-placeholder-replacement",8,"https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench","https:\u002F\u002Fcxcscmu.github.io\u002FSkillLearnBench","https:\u002F\u002Fgithub.com\u002Fcxcscmu","2026-10-02 22:55:36",{"source":8,"skillName":5,"commands":53,"prompt":63,"zipAvailable":64},[54,57,60],{"tool":55,"command":56},"npx","npx skills add cxcscmu\u002FSkillLearnBench --skill docx-placeholder-replacement",{"tool":58,"command":59},"bunx","bunx skills add cxcscmu\u002FSkillLearnBench --skill docx-placeholder-replacement",{"tool":61,"command":62},"pnpm","pnpm dlx skills add cxcscmu\u002FSkillLearnBench --skill docx-placeholder-replacement","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fb1-one-shot-claude-sonnet-4-6\u002Foffer-letter-generator\u002Fdocx-placeholder-replacement\u002FSKILL.md",true,[],[67,83,108,126,146,158],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":76,"publishedAt":39},"01M6KM5KH175P5ABP5JMX2SBDQ","object_counter","Count occurrences of an object in the image using computer vision algorithm.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Fvideo-object-counting\u002Fobject_counter\u002FSKILL.md",[73],{"categoryNo":74,"categoryName":75,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000016","图像与多媒体",[77,78,79,80,81,82],"object counter","object","vision","computer","Computer Vision","image",{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":92,"publishedAt":39},"01M6KM51TMVXG79MMPCS6Y8G86","travel-planning-workflow","Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftravel-planning\u002Ftravel-planning-workflow\u002FSKILL.md",[89],{"categoryNo":90,"categoryName":91,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[93,94,95,96,97,98,99,100,101,102,103,104,105,106,107],"workflow","planning","planning workflow","travel","travel planning","travel planning workflow","structured","performing","plan","for","user","it","requirements","essential","itineraries",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":39},"01M6KM4DY820XHS9YTSK5QP5HD","bundled-dataset-search-tool","invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftravel-planning\u002Fbundled-dataset-search-tool\u002FSKILL.md",[],[115,116,117,118,119,120,121,96,122,123,97,124,102,125,94],"search","tool","dataset","bundled dataset search tool","restaurants","Tools","up","look","flights","you","database",{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":132,"publishedAt":39},"01M6KM465BB9PQ0B548HQSVAWZ","glm-output","Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final \u002Froot\u002Fmetrics.json.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-output\u002FSKILL.md",[],[133,134,135,102,136,137,138,139,140,141,142,143,124,144,145],"glm output","output","glm","tasks","metrics","json","basics","guidance","matching","verifier","processing","root","calibration",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":153,"publishedAt":39},"01M6KM40KY3QWDW5W97S39R2BC","glm-calibration","Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-calibration\u002FSKILL.md",[152],{"categoryNo":90,"categoryName":91,"taxonomyType":20,"taxonomyTypeDesc":21},[154,145,135,134,140,139,136,155,156,102,157],"glm calibration","setup","companion","metric",{"skillNo":159,"name":160,"nameZh":6,"description":161,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":39},"01M6KM3VHHVSGMGHJQB3PPT6YG","glm-basics","A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.","https:\u002F\u002Fgithub.com\u002Fcxcscmu\u002FSkillLearnBench\u002Fblob\u002Fmain\u002Fskills\u002Fhuman_authored\u002Ftemperature-simulation\u002Fglm-basics\u002FSKILL.md",[],[165,135,139,166,154,145,102,134,167,168,169,170,171,172,136],"glm basics","inspect","relevant","files","good","use","how","Evaluation"]