apply-comments
Apply pending @slide-comment markers written by the open-slide inspector tool. Use when the user asks to "apply comments", "process slide comments", "apply the inspector comments", or references markers left inside `slides/<id>/index.tsx`.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-08
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- apply-comments
- description
- Apply pending @slide-comment markers written by the open-slide inspector tool. Use when the user asks to "apply comments", "process slide comments", "apply the inspector comments", or references markers left inside `slides/<id>/index.tsx`.
03 SKILL.md 正文
Apply slide comments
The open-slide editor has an inspector tool that lets the user click on a rendered page element and attach a textual comment (e.g. "make this red", "change to 'Open Slide Rocks'"). Each comment is persisted as an in-source JSX marker inside slides/<slideId>/index.tsx.
Your job: read those markers, perform the described edits, and delete the markers.
Before making any page edit, consult the
slide-authoringskill — it is the technical reference for howslides/<id>/index.tsxis structured (canvas, type scale, palette, assets, file contract). A comment like "make this bigger" or "change the accent colour" should be applied in a way that stays consistent with those rules.
Marker format
{/* @slide-comment id="c-<8hex>" ts="<ISO>" text="<base64url(JSON)>" */}
-
Always sits on its own line as the first child inside the JSX element it refers to (i.e. between that element's opening
>and its other children). The marker is dropped into its target, not floated above it. -
textis base64url-encoded JSON:{"note": "...", "hint"?: "..."}. -
Detection regex (authoritative — use exactly this):
/\{\/\*\s*@slide-comment\s+id="(c-[a-f0-9]+)"\s+ts="([^"]+)"\s+text="([A-Za-z0-9_\-]+={0,2})"\s*\*\/\}/g
Procedure
-
Identify the target slide(s).
- If the user names one (
example-slide,youbike-3-survey, etc.), work on that singleslides/<slideId>/index.tsx. - If they say "all" or don't specify, scan every
slides/*/index.tsx. Process each slide one at a time.
- If the user names one (
-
Read the file and find all markers.
- Run the regex above against the whole file.
- For each match, base64url-decode
textandJSON.parseit to get{ note, hint? }. - Record each hit as
{ id, lineIndex (0-based), indent, note, hint }. - If there are no markers, tell the user and stop.
-
Understand each comment in context.
- The targeted JSX element is the enclosing element of the marker — i.e. read upward from the marker line until you reach the unclosed JSX opening tag whose body the marker lives in. That element is the target. (For self-closing elements like
<img />, the inspector hoists the marker to the nearest non-self-closing ancestor; in that case the comment usually refers to a child of the enclosing element rather than the enclosing element itself — use thenotetext to disambiguate.) - Read enough surrounding code (parent element, sibling elements, inline styles) to apply the change faithfully. A comment inside a
<div>with an inlinebackgroundstyle usually refers to that element's styling, for example. - If the
noteis ambiguous, do the smallest reasonable interpretation and mention the assumption in your summary.
- The targeted JSX element is the enclosing element of the marker — i.e. read upward from the marker line until you reach the unclosed JSX opening tag whose body the marker lives in. That element is the target. (For self-closing elements like
-
Apply edits in reverse line order.
- Sort markers by descending
lineIndexand process one at a time, using theEdittool. - Processing top-down would invalidate line numbers for later markers as the file shrinks/grows.
- Sort markers by descending
-
Remove each marker after applying its edit.
- Delete the entire marker line including its trailing
\n. - Never leave a marker behind. An un-removed marker signals a failure.
- Delete the entire marker line including its trailing
-
Verify.
- After all edits, re-read the file and confirm zero remaining markers.
- Run
pnpm tsc --noEmitandpnpm biome check(orpnpm lint). Fix any introduced errors.
-
Report.
- Summarise:
N applied, 0 remainingplus a one-line description of each change (including the slide id).
- Summarise:
base64url decoding helper
function decode(s) {
const pad = s.length % 4 === 0 ? '' : '='.repeat(4 - (s.length % 4));
return Buffer.from(s.replace(/-/g, '+').replace(/_/g, '/') + pad, 'base64').toString('utf8');
}
You can run this inline via node -e '...' if you need to inspect a payload; otherwise just reason about the decoded string.
Edge cases
- Marker with no enclosing JSX element (shouldn't happen — the inspector won't write one — but if you find one): delete it and note as orphan.
- Multiple markers stacked on consecutive lines inside the same element: they all refer to that enclosing element. Apply them in source order but still delete each line individually.
_debugSourceused SWC instead of Babel: not your problem — the marker line is authoritative.- Comment asks for something outside the target element's scope (e.g. "add a new page"): do the closest-reasonable edit and mention the scope expansion in your summary.
- Can't resolve the comment (e.g. truly ambiguous, or the file changed shape such that the target element doesn't exist): leave the marker in place and report it as skipped. Don't guess.
Do not
- Do not touch
package.json,open-slide.config.ts, or files outsideslides/. - Do not add dependencies.
- Do not re-introduce markers or leave
TODObreadcrumbs — the user already has a record in git.
04 同仓库更多 Skills
career-ops
AI job search command center -- evaluate offers, generate CVs, scan portals, track applications
zoom-out
Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.
write-a-skill
Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill.
triage
Triage issues through a state machine driven by triage roles. Use when user wants to create an issue, triage issues, review incoming bugs or feature requests, prepare issues for an AFK agent, or manage issue workflow.
to-prd
Turn the current conversation context into a PRD and publish it to the project issue tracker. Use when user wants to create a PRD from the current context.
to-issues
Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices. Use when user wants to convert a plan into issues, create implementation tickets, or break down work into issues.