agentsclimarketplace

Run3 Traverse All Locations in Word Documents

Skill cxcscmu/SkillLearnBench/skills/b3-teacher-feedback-claude-haiku-4-5/offer-letter-generator/run3_Traverse-All-Locations-in-Word-Documents

Use this skill when you need to find and process text in Word documents beyond just `doc.paragraphs`. Include tables, headers, and footers to ensure no content is missed.From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill run3_Traverse-All-Locations-in-Word-Documents

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.3 KB, 238 tokens by cl100k_base, as published. Nobody here has run it

Locations to Process

  1. Main body paragraphs: doc.paragraphs
  2. Table cells: Iterate doc.tables → rows → cells → paragraphs
  3. Headers: doc.sections[*].header.paragraphs
  4. Footers: doc.sections[*].footer.paragraphs

Algorithm

def get_all_paragraphs(doc):
    paragraphs = []
    
    # Main body
    paragraphs.extend(doc.paragraphs)
    
    # Tables
    for table in doc.tables:
        for row in table.rows:
            for cell in row.cells:
                paragraphs.extend(cell.paragraphs)
    
    # Headers and footers
    for section in doc.sections:
        paragraphs.extend(section.header.paragraphs)
        paragraphs.extend(section.footer.paragraphs)
    
    return paragraphs

Processing Strategy

  • Use this function when you need to process all text locations (replacements, conditional handling, validation)
  • Maintain iteration order to ensure markers like {{IF_*}} and {{END_IF_*}} are encountered in the correct sequence
  • Collect elements to delete first, then delete after iteration completes

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.