Skip to content
Check Code Block Highlights logo

Check Code Block Highlights

Verify that hl_lines attributes in markdown code blocks correctly highlight the intended lines. Use when reviewing documentation with code examples, especially Before/After comparisons, or when highlights seem incorrect.

SKILL.md

Full skill instructions

Check Code Block Highlights

Verify that hl_lines attributes in markdown code blocks are correctly set to highlight the intended lines.

Critical Understanding

hl_lines is snippet-relative, NOT related to linenums:

  • linenums="21" sets the displayed starting line number
  • hl_lines="3" highlights the 3rd line of the snippet (which displays as line 23)
  • These are completely independent attributes

Example:

`groovy linenums="21" hl_lines="3"
process FOO {      <- displayed as line 21 (snippet line 1)
    input:         <- displayed as line 22 (snippet line 2)
    val x          <- displayed as line 23 (snippet line 3) - HIGHLIGHTED
}
`

When to Use

  • After writing or editing code blocks with highlights
  • When reviewing Before/​After comparison blocks
  • When a user reports highlights look wrong
  • As part of lesson review/​validation

How to Check

For each code block with hl_lines:

  1. Identify the code block - Find blocks with hl_lines="..." attribute

  2. Count snippet lines - Number each line of the code block starting from 1:

    1: #!/​usr/​bin/​env nextflow
    2: (blank line)
    3: process FOO {
    4:     publishDir 'results'  <- if this should be highlighted, hl_lines should include "4"
    ...
    
  3. Verify intent - For Before/​After blocks:

    • "After" should highlight the NEW or CHANGED lines
    • "Before" should highlight the lines that WILL change (same content positions)
    • Both blocks should highlight corresponding lines showing the difference
  4. Check for common errors:

    • Off-by-one errors (highlighting blank lines instead of code)
    • Confusing linenums with hl_lines (thinking hl_lines="21" highlights displayed line 21)
    • Highlighting section headers (input:, output:) instead of the actual values

Fixing Issues

When you find incorrect highlights:

  1. Count the actual line positions in the snippet (1-indexed)
  2. Identify which lines contain the meaningful changes
  3. Update hl_lines to reference those snippet line numbers
  4. Verify Before/​After blocks highlight corresponding positions

Output Format

For each file checked, report:

## [filename]

### Block at line [N]: [description]
- Current: hl_lines="X Y Z"
- Lines X, Y, Z contain: [what's on those lines]
- Issue: [description of problem, if any]
- Suggested fix: hl_lines="A B C" (highlighting [what those lines contain])

### Summary
- Blocks checked: N
- Issues found: M
- [List of fixes needed]

Example Analysis

Given this code block:

`groovy title="example.nf" linenums="1" hl_lines="8 11 14"
#!/​usr/​bin/​env nextflow       <- snippet line 1
                              <- snippet line 2 (blank)
process SAY_HELLO {           <- snippet line 3
                              <- snippet line 4 (blank)
    publishDir 'results'      <- snippet line 5
                              <- snippet line 6 (blank)
    input:                    <- snippet line 7
        val greeting          <- snippet line 8 - HIGHLIGHTED
                              <- snippet line 9 (blank)
    output:                   <- snippet line 10
        path "*.txt"          <- snippet line 11 - HIGHLIGHTED
                              <- snippet line 12 (blank)
    script:                   <- snippet line 13
        """echo hi"""         <- snippet line 14 - HIGHLIGHTED
}
`

Analysis: hl_lines="8 11 14" correctly highlights the input value (line 8), output value (line 11), and script content (line 14).

Notes

  • Blank lines count! They're common sources of off-by-one errors
  • In Before/​After comparisons, both blocks should highlight the same conceptual elements
  • When in doubt, count every line including blanks and comments

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View