Handlebars — 18 Operations for AI Agents

Handlebars templates render the logic-light HTML behind Ember apps and email systems. act101 reads helpers, partials, and blocks as structure, so agents trace what renders where without expanding templates in their head.

This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Handlebars code through the act MCP server. 18 operations available: 0 refactor, 18 query, 0 analysis. Each operation is callable from Claude Code, Cursor, Codex, OpenCode, or any MCP-compatible agent host. Click any operation for a stable anchor link suitable for citation.

18Query

Worked Handlebars examples

act101 reads a Handlebars template's block helpers — {{#if}}, {{#each}}, and custom helpers — as block declarations named for the helper, and its HTML elements as element declarations named for the tag. symbols covers the same helpers and elements, plus two things the skeleton skips: standalone helper invocations like {{formatCurrency amount}} (as function, named for the helper) and every dot-separated segment of a {{path.expression}} reference inside a mustache (as field, one entry per segment rather than one per reference). The unit of structure in this grammar is the mustache tag: symbols reaches further into a template's data references than skeleton does, at the cost of also reporting the block helpers under a different kind than the skeleton gives them. Each example below is the verbatim output of the command shown, run against the file shown. Query outputs are pretty-printed with the timing block omitted.

Read the lot sheet's blocks and elements

lot-sheet.hbs is a livestock auction lot sheet: an {{#if}}/{{else}} pair reports whether the reserve was met, and an {{#each}} block lists each bid's paddle number and amount.

$ act query skeleton lot-sheet.hbs

Before

<section class="lot-sheet">
  <h1>{{auction.name}} — Lot {{lot.number}}</h1>
  {{#if lot.reserveMet}}
    <p class="status">Reserve met</p>
  {{else}}
    <p class="status">Reserve not met</p>
  {{/if}}
  <table class="bids">
    {{#each lot.bids as |bid|}}
      <tr>
        <td>{{bid.paddleNumber}}</td>
        <td>{{formatCurrency bid.amount}}</td>
      </tr>
    {{/each}}
  </table>
  <img src="{{lot.photoUrl}}" alt="Lot photo" />
</section>

Output

{
    "type": "Skeleton",
    "declarations": [
        {
            "kind": "element",
            "name": "section",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 1,
                    "column": 1,
                    "byte_offset": 0
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 17,
                    "column": 11,
                    "byte_offset": 452
                }
            },
            "name_range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 1,
                    "column": 2,
                    "byte_offset": 1
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 1,
                    "column": 9,
                    "byte_offset": 8
                }
            }
        },
        {
            "kind": "element",
            "name": "h1",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 3,
                    "byte_offset": 30
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 51,
                    "byte_offset": 78
                }
            },
            "name_range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 4,
                    "byte_offset": 31
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 6,
                    "byte_offset": 33
                }
            }
        },
        {
            "kind": "block",
            "name": "if",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 3,
                    "column": 3,
                    "byte_offset": 81
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 7,
                    "column": 10,
                    "byte_offset": 204
                }
            },
            "name_range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 3,
                    "column": 6,
                    "byte_offset": 84
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 3,
                    "column": 8,
                    "byte_offset": 86
                }
            }
        },
        {
            "kind": "element",
            "name": "p",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 4,
                    "column": 5,
                    "byte_offset": 108
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 4,
                    "column": 38,
                    "byte_offset": 141
                }
            },
            "name_range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 4,
                    "column": 6,
                    "byte_offset": 109
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 4,
                    "column": 7,
                    "byte_offset": 110
                }
            }
        },
        {
            "kind": "element",
            "name": "p",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 6,
                    "column": 5,
                    "byte_offset": 157
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 6,
                    "column": 42,
                    "byte_offset": 194
                }
            },
            "name_range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 6,
                    "column": 6,
                    "byte_offset": 158
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 6,
                    "column": 7,
                    "byte_offset": 159
                }
            }
        },
        {
            "kind": "element",
            "name": "table",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 8,
                    "column": 3,
                    "byte_offset": 207
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 15,
                    "column": 11,
                    "byte_offset": 392
                }
            },
            "name_range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 8,
                    "column": 4,
                    "byte_offset": 208
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 8,
                    "column": 9,
                    "byte_offset": 213
                }
            }
        },
        {
            "kind": "block",
            "name": "each",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 9,
                    "column": 5,
                    "byte_offset": 232
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 14,
                    "column": 14,
                    "byte_offset": 381
                }
            },
            "name_range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 9,
                    "column": 8,
                    "byte_offset": 235
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 9,
                    "column": 12,
                    "byte_offset": 239
                }
            }
        },
        {
            "kind": "element",
            "name": "tr",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 10,
                    "column": 7,
                    "byte_offset": 266
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 13,
                    "column": 12,
                    "byte_offset": 367
                }
            },
            "name_range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 10,
                    "column": 8,
                    "byte_offset": 267
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 10,
                    "column": 10,
                    "byte_offset": 269
                }
            }
        },
        {
            "kind": "element",
            "name": "td",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 11,
                    "column": 9,
                    "byte_offset": 279
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 11,
                    "column": 38,
                    "byte_offset": 308
                }
            },
            "name_range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 11,
                    "column": 10,
                    "byte_offset": 280
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 11,
                    "column": 12,
                    "byte_offset": 282
                }
            }
        },
        {
            "kind": "element",
            "name": "td",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 12,
                    "column": 9,
                    "byte_offset": 317
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 12,
                    "column": 47,
                    "byte_offset": 355
                }
            },
            "name_range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 12,
                    "column": 10,
                    "byte_offset": 318
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 12,
                    "column": 12,
                    "byte_offset": 320
                }
            }
        },
        {
            "kind": "element",
            "name": "img",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 16,
                    "column": 3,
                    "byte_offset": 395
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 16,
                    "column": 49,
                    "byte_offset": 441
                }
            },
            "name_range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 16,
                    "column": 4,
                    "byte_offset": 396
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 16,
                    "column": 7,
                    "byte_offset": 399
                }
            }
        }
    ]
}

The skeleton reports nine element declarations, from section down to img, alongside two block declarations, if and each; the {{else}} branch and the plain mustache references like {{auction.name}} don't get their own entries.

List elements, blocks, helper calls, and path roots together

The {{#each}} block calls the formatCurrency helper on bid.amount, and the page header reads auction.name and lot.number.

$ act query symbols lot-sheet.hbs

Before

<section class="lot-sheet">
  <h1>{{auction.name}} — Lot {{lot.number}}</h1>
  {{#if lot.reserveMet}}
    <p class="status">Reserve met</p>
  {{else}}
    <p class="status">Reserve not met</p>
  {{/if}}
  <table class="bids">
    {{#each lot.bids as |bid|}}
      <tr>
        <td>{{bid.paddleNumber}}</td>
        <td>{{formatCurrency bid.amount}}</td>
      </tr>
    {{/each}}
  </table>
  <img src="{{lot.photoUrl}}" alt="Lot photo" />
</section>

Output

{
    "type": "Symbols",
    "symbols": [
        {
            "name": "section",
            "kind": "class",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 1,
                    "column": 2,
                    "byte_offset": 1
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 1,
                    "column": 9,
                    "byte_offset": 8
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "h1",
            "kind": "class",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 4,
                    "byte_offset": 31
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 6,
                    "byte_offset": 33
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "auction",
            "kind": "field",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 9,
                    "byte_offset": 36
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 16,
                    "byte_offset": 43
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "name",
            "kind": "field",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 17,
                    "byte_offset": 44
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 21,
                    "byte_offset": 48
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "lot",
            "kind": "field",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 34,
                    "byte_offset": 61
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 37,
                    "byte_offset": 64
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "number",
            "kind": "field",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 38,
                    "byte_offset": 65
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 2,
                    "column": 44,
                    "byte_offset": 71
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "if",
            "kind": "function",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 3,
                    "column": 6,
                    "byte_offset": 84
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 3,
                    "column": 8,
                    "byte_offset": 86
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "p",
            "kind": "class",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 4,
                    "column": 6,
                    "byte_offset": 109
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 4,
                    "column": 7,
                    "byte_offset": 110
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "p",
            "kind": "class",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 6,
                    "column": 6,
                    "byte_offset": 158
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 6,
                    "column": 7,
                    "byte_offset": 159
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "table",
            "kind": "class",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 8,
                    "column": 4,
                    "byte_offset": 208
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 8,
                    "column": 9,
                    "byte_offset": 213
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "each",
            "kind": "function",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 9,
                    "column": 8,
                    "byte_offset": 235
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 9,
                    "column": 12,
                    "byte_offset": 239
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "tr",
            "kind": "class",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 10,
                    "column": 8,
                    "byte_offset": 267
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 10,
                    "column": 10,
                    "byte_offset": 269
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "td",
            "kind": "class",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 11,
                    "column": 10,
                    "byte_offset": 280
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 11,
                    "column": 12,
                    "byte_offset": 282
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "bid",
            "kind": "field",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 11,
                    "column": 15,
                    "byte_offset": 285
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 11,
                    "column": 18,
                    "byte_offset": 288
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "paddleNumber",
            "kind": "field",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 11,
                    "column": 19,
                    "byte_offset": 289
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 11,
                    "column": 31,
                    "byte_offset": 301
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "td",
            "kind": "class",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 12,
                    "column": 10,
                    "byte_offset": 318
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 12,
                    "column": 12,
                    "byte_offset": 320
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "formatCurrency",
            "kind": "function",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 12,
                    "column": 15,
                    "byte_offset": 323
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 12,
                    "column": 29,
                    "byte_offset": 337
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "img",
            "kind": "class",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 16,
                    "column": 4,
                    "byte_offset": 396
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 16,
                    "column": 7,
                    "byte_offset": 399
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "lot",
            "kind": "field",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 16,
                    "column": 15,
                    "byte_offset": 407
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 16,
                    "column": 18,
                    "byte_offset": 410
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "photoUrl",
            "kind": "field",
            "range": {
                "start": {
                    "file": "lot-sheet.hbs",
                    "line": 16,
                    "column": 19,
                    "byte_offset": 411
                },
                "end": {
                    "file": "lot-sheet.hbs",
                    "line": 16,
                    "column": 27,
                    "byte_offset": 419
                }
            },
            "visibility": "unknown"
        }
    ]
}

symbols reports the same nine elements as class, the if and each blocks as function, formatCurrency as a function in its own right, and every segment of a dotted path as a separate field — {{auction.name}} contributes both auction and name, and {{lot.photoUrl}} contributes both lot and photoUrl, rather than one root entry per reference.

Query

18 query tools, the same on every supported language. Descriptions live in the shared reference: /docs/query-tools.

callers control_flow data_flow definition diagnostics effect_closure effect_summary fix_auto get_type graph import_organize interface mutations references repo_outline skeleton symbols symbols_batch

← HackHaskell →