hookcode-preview-highlight
Manages scripts and debugging for preview highlight integration.
Install
mkdir -p .claude/skills/hookcode-preview-highlight && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13037" && unzip -o skill.zip -d .claude/skills/hookcode-preview-highlight && rm skill.zipInstalls to .claude/skills/hookcode-preview-highlight
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
End-to-end workflow for HookCode preview DOM highlighting check/start/stop previews, install dependencies, send highlight commands, and verify preview bridge readiness via PAT-authenticated APIs. Use when debugging cross-origin preview iframes, validating bridge integration, or scripting highlight requests against task-group previews.Key capabilities
- →Query preview status to find instance names and availability
- →Start preview instances or install dependencies if needed
- →Send highlight commands with various selector options
- →Send optional bubble tooltip payloads alongside highlights
- →Auto-navigate previews using `targetUrl` with route patterns
- →Verify bridge readiness by checking `subscribers` and error responses
How it works
The skill uses JS request scripts and API calls to manage preview status, send highlight commands with various selectors and optional bubble tooltips, and verify the preview bridge handshake.
Inputs & outputs
When to use hookcode-preview-highlight
- →Debug preview highlight
- →Test cross-origin iframe
- →Validate highlight commands
About this skill
{/* Add tags metadata for built-in skill filtering. docs/en/developer/plans/skills-registry-20260225/task_plan.md skills-registry-20260225 */}
Hookcode Preview Highlight
Overview
This skill ships JS request scripts (with .env loading) and protocol notes for the complete preview highlight flow: check preview status, start previews, install dependencies if needed, send highlight commands, and stop previews after debugging. It also explains the bridge handshake required for cross-origin iframes so you can confirm whether highlight commands are actually reaching the preview DOM. Selector rules now include CSS selectors plus text/attribute matchers (for example text:Save, attr:data-testid=cta, data:testid=cta, aria:label=Search, role:button, or loose data-testid=cta). If a highlight command includes targetUrl, the preview UI will auto-navigate to that URL (and push it to the iframe history) unless the user locks auto-navigation in the toolbar. Target URL matching now supports route patterns like :id, *, **, hash/query wildcards, and || alternatives to avoid unnecessary navigation.
{/* Document auto-navigation + lock behavior for highlight target URLs. docs/en/developer/plans/previewhighlightselector20260204/task_plan.md previewhighlightselector20260204 /}
{/ Document selector matcher rules in the skill overview. docs/en/developer/plans/previewhighlightselector20260204/task_plan.md previewhighlightselector20260204 /}
{/ Document advanced targetUrl route matching rules in the skill overview. docs/en/developer/plans/previewhighlightselector20260204/task_plan.md previewhighlightselector20260204 */}
Capabilities
- Query preview status to discover instance names and availability before highlighting.
- Start preview instances or install dependencies when the dev server is missing.
- Send highlight commands with selector/mode/color/padding/scroll options via the backend API.
- Send optional bubble tooltip payloads alongside highlights (text + placement + theme).
- Provide CLI flags that map one-to-one with highlight + bubble payload fields. {/* Expand highlight capability coverage to include bubble payloads. docs/en/developer/plans/jemhyxnaw3lt4qbxtr48/task_plan.md jemhyxnaw3lt4qbxtr48 */}
- Support selector matcher rules like
text:,attr:,data:,aria:,role:, andtestid:when CSS selectors are not enough. {/* Describe selector matcher capabilities for highlight requests. docs/en/developer/plans/previewhighlightselector20260204/task_plan.md previewhighlightselector20260204 */} - Auto-navigate previews when
targetUrlis supplied, with a lock toggle and route-matching rules to keep the current URL stable. {/* Explain auto-navigation support in the preview highlight skill. docs/en/developer/plans/previewhighlightselector20260204/task_plan.md previewhighlightselector20260204 */} - Verify bridge readiness by checking
subscribersand bridge error responses. - Stop previews after debugging to free ports and resources.
Quick Start
- Copy
.env.example→.envinside this skill folder and fill inHOOKCODE_API_BASE_URL,HOOKCODE_PAT, andHOOKCODE_TASK_GROUP_ID(optional:HOOKCODE_PREVIEW_INSTANCE). - Fetch preview status to confirm instance names:
node .codex/skills/hookcode-preview-highlight/scripts/preview_status.mjs \
--task-group <taskGroupId>
- Send a highlight command (highlight parameters must be passed via CLI flags):
node .codex/skills/hookcode-preview-highlight/scripts/preview_highlight.mjs \
--task-group <taskGroupId> \
--instance app \
--selector ".page-kicker"
- Send a highlight + bubble command:
node .codex/skills/hookcode-preview-highlight/scripts/preview_highlight.mjs \
--task-group <taskGroupId> \
--instance app \
--selector ".page-kicker" \
--target-url "/add" \
--bubble-text "Update this headline" \
--bubble-placement right \
--bubble-theme dark
{/* Document bubble highlight example for CLI usage. docs/en/developer/plans/jemhyxnaw3lt4qbxtr48/task_plan.md jemhyxnaw3lt4qbxtr48 */}
Environment Variables
Set these in .env (or override via CLI flags). Highlight-specific options are CLI-only.
| Variable | Purpose | Used by |
|---|---|---|
HOOKCODE_API_BASE_URL | Base URL of the HookCode backend (for example http://127.0.0.1:4000). | All scripts |
HOOKCODE_PAT | PAT token for API authentication. | All scripts |
HOOKCODE_TASK_GROUP_ID | Default task group id to target. | All scripts |
HOOKCODE_PREVIEW_INSTANCE | Default preview instance name (for example app). | preview_highlight.mjs |
Operations (HTTP)
1) Get preview status
Endpoint: GET /api/task-groups/:id/preview/status
Purpose: Confirm the preview is configured, see instance names, and check running/starting status before highlighting.
Script: scripts/preview_status.mjs
node .codex/skills/hookcode-preview-highlight/scripts/preview_status.mjs \
--task-group <taskGroupId>
2) Start preview
Endpoint: POST /api/task-groups/:id/preview/start
Purpose: Start all configured preview instances so the highlight API can reach a running dev server.
Script: scripts/preview_start.mjs
node .codex/skills/hookcode-preview-highlight/scripts/preview_start.mjs \
--task-group <taskGroupId>
3) Install preview dependencies
Endpoint: POST /api/task-groups/:id/preview/dependencies/install
Purpose: Run dependency installation without starting the dev server. Use this when highlight requests fail because the dev server never started.
Script: scripts/preview_dependencies_install.mjs
node .codex/skills/hookcode-preview-highlight/scripts/preview_dependencies_install.mjs \
--task-group <taskGroupId>
4) Send highlight command
Endpoint: POST /api/task-groups/:id/preview/:instance/highlight
Purpose: Forward a DOM highlight command to the preview iframe bridge.
Script: scripts/preview_highlight.mjs
Parameters:
selector(required): CSS selector to highlight (max length 200); supports matcher rules liketext:,attr:,data:,aria:,role:,testid:, or loosedata-testid=.... {/* Document selector matcher rules in the parameter list. docs/en/developer/plans/previewhighlightselector20260204/task_plan.md previewhighlightselector20260204 */}targetUrl(optional): preview URL or path to navigate to before highlighting; matching supports:param,*,**, query/hash wildcards (e.g./users/:id?tab=*), and||alternatives (first entry is used for navigation). {/* Document target URL route matching behavior in the parameter list. docs/en/developer/plans/previewhighlightselector20260204/task_plan.md previewhighlightselector20260204 */}
TargetUrl matching rules:
:parammatches a single path segment (e.g./users/:id).*matches any characters within a segment;**matches across segments (e.g./projects/**/settings).- Query rules only require params you declare; use
?tabfor any value or?tab=*for wildcard values. - Hash rules accept wildcards like
#section-*. ||separates alternatives; the first entry is used for navigation if auto-navigation is needed. {/* Detail targetUrl route matching rules in the skill docs. docs/en/developer/plans/previewhighlightselector20260204/task_plan.md previewhighlightselector20260204 */}padding(optional): number of pixels around the element (0-64, default 4).color(optional): CSS color string for outline/glow (max length 40).mode(optional):outlineormask(defaultoutline).scrollIntoView(optional):true/false(defaultfalse).bubble(optional): object for tooltip rendering near the highlight.text(required when bubble provided): text content to display (1-280 chars).placement(optional):top|right|bottom|left|auto(defaultauto); auto prefers bottom/top and flips when space is insufficient to avoid clipping. {/* Document bubble placement flipping rules to avoid clipped tooltips. docs/en/developer/plans/previewhighlightselector20260204/task_plan.md previewhighlightselector20260204 */}align(optional):start|center|end(defaultcenter).offset(optional): number of pixels between highlight and bubble (0-64, default10).maxWidth(optional): max width in px (120-640, default320).theme(optional):dark|light(defaultdark).background(optional): bubble background CSS color override.textColor(optional): bubble text color override.borderColor(optional): bubble border color override.radius(optional): bubble corner radius in px (0-24, default12).arrow(optional):true/falseto show the pointer (defaulttrue).
requestId(optional): client-defined id for tracking. {/* Expand highlight parameter docs to include bubble payload fields. docs/en/developer/plans/jemhyxnaw3lt4qbxtr48/task_plan.md jemhyxnaw3lt4qbxtr48 */}
Response:
success,requestId,subscribers, and optionaltargetUrlecho for navigation-aware clients. {/* Document highlight response fields including targetUrl echo. docs/en/developer/plans/previewhighlightselector20260204/task_plan.md previewhighlightselector20260204 */}
node .codex/skills/hookcode-preview-highlight/scripts/preview_highlight.mjs \
--task-group <taskGroupId> \
--instance app \
--selector ".page-kicker" \
--mode outline \
--color "#ff4d4f" \
--padding 4 \
--scroll true \
--bubble-text "Edit this title" \
--bubble-placement top \
--bubble-align center \
--bubble-offset 12 \
--bubble-theme dark
{/* Add bubble flag example to highlight CLI sample. docs/en/developer/plans/jemhyxnaw3lt4qbxtr48/task_plan.md jemhyxnaw3lt4qbxtr48 */}
5) Stop preview
Endpoint: POST /api/task-groups/:id/preview/stop
Purpose: Stop preview instances after debugging to free po
Content truncated.
When not to use it
- →When debugging is not related to cross-origin preview iframes
- →When validating bridge integration is not required
- →When scripting highlight requests against task-group previews is not the goal
Prerequisites
Limitations
- →Requires `shared/preview-bridge.js` to be installed in the preview app
- →Requires PAT-authenticated APIs
- →Highlight commands need to reach a running dev server
How it compares
This workflow provides an end-to-end, API-driven solution for debugging and scripting preview DOM highlighting, including cross-origin iframe support and detailed selector rules, unlike manual inspection.
Compared to similar skills
hookcode-preview-highlight side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| hookcode-preview-highlight (this skill) | 0 | 5mo | Review | Advanced |
| python-testing-patterns | 77 | 2mo | Review | Intermediate |
| chrome-devtools | 41 | 7mo | Review | Intermediate |
| bats | 9 | 7mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
python-testing-patterns
wshobson
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.
chrome-devtools
mrgoonie
Browser automation, debugging, and performance analysis using Puppeteer CLI scripts. Use for automating browsers, taking screenshots, analyzing performance, monitoring network traffic, web scraping, form automation, and JavaScript debugging.
bats
OleksandrKucherenko
Bash Automated Testing System (BATS) for TDD-style testing of shell scripts. Use when: (1) Writing unit or integration tests for Bash scripts, (2) Testing CLI tools or shell functions, (3) Setting up test infrastructure with setup/teardown hooks, (4) Mocking external commands (curl, git, docker), (5) Generating JUnit reports for CI/CD, (6) Debugging test failures or flaky tests, (7) Implementing test-driven development for shell scripts.
browser-daemon
noiv
Persistent browser automation via Playwright daemon. Keep a browser window open and send it commands (navigate, execute JS, inspect console). Perfect for interactive debugging, development, and testing web applications. Use when you need to interact with a browser repeatedly without opening/closing it.
performance-profiling
davila7
Performance profiling principles. Measurement, analysis, and optimization techniques.
obsidian-local-dev-loop
jeremylongshore
Configure Obsidian plugin development with hot-reload and fast iteration. Use when setting up development workflow, configuring test vaults, or establishing a rapid development cycle. Trigger with phrases like "obsidian dev loop", "obsidian hot reload", "obsidian development workflow", "develop obsidian plugin".