name: wc-review description: Process inline HTML review comments () in a Markdown file — applies editorial changes via Obsidian (if available) or directly via Edit tool argument-hint: [file] user-invocable: true allowed-tools: Read, Edit, Grep, Glob, WebFetch, Bash model: opus context: fork
Review Comments Processor
Process inline <!-- --> review comments in a Markdown file. Understand the full document, apply each editorial instruction, and deliver the edits.
Arguments
-
$1— Path to the markdown file with review comments
Configuration:
- Obsidian vault:
/home/tomic/Documents/Vault - Obsidian port:
27125 - Guides directory:
/home/tomic/Sync/clients/writing-companion.io/guides
Comment Syntax
| Pattern | Meaning |
|---|---|
<!-- instruction --> |
Editorial comment on the preceding paragraph |
<!-- "target text": instruction --> |
Comment targeting the quoted text specifically |
<!-- @-{N} #"{fingerprint}" instruction --> |
Comment targeting N characters before the comment, with fingerprint for verification |
<!-- ?question --> |
Question — answer it, do NOT edit |
Skip structural HTML comments (<!-- prettier-ignore -->, <!-- markdownlint-disable -->, etc.).
Instructions
1. Read the full file
Read $1 completely. Understand the document's structure, tone, and purpose before processing any comments.
2. Detect content type
Determine the article type for loading the appropriate style guide:
- Check YAML frontmatter for a
type:field - Check the file path for keywords:
blog,newsletter,linkedin,youtube(or short forms:-yt,-li,-nl) - If neither works, use "default" (no style guide loaded)
If a type is detected, read the style guide from /home/tomic/Sync/clients/writing-companion.io/guides/style/{type}.md. If the file doesn't exist, proceed without it.
3. Scan for review comments
List all <!-- --> comments that contain editorial instructions. Report: "Found N review comments."
3b. Resolve range-targeted comments
For each comment matching <!-- @-{N} #"{fingerprint}" instruction -->:
- Find the comment's byte position in the raw file text.
- Count back N characters from the comment start (skip the newline immediately before
<!--). The resulting span is the target text. - Verify: the extracted text should start and end with the fragments in the fingerprint (split on
...if abbreviated). - If the fingerprint does NOT match at the calculated position, search the surrounding ~500 characters for text matching the fingerprint fragments. Use the match as the target instead.
- The
oldfield in the replacement payload spans from the target start through the end of the comment markup (including the<!-- ... -->and the newline before it). - The
newfield is the rewritten target text with the comment removed.
4. Check Obsidian availability
Use Bash to check if Obsidian's buffer edit plugin is running:
curl -sf http://127.0.0.1:27125/health
If it returns 200, use Obsidian mode. Otherwise, use direct mode.
5a. Obsidian Mode
Process all comments and build a JSON payload. For each comment:
- Identify the affected text:
- For
<!-- instruction -->: the paragraph preceding the comment - For
<!-- "target text": instruction -->: the quoted text within the surrounding paragraph - For
<!-- @-{N} #"..." instruction -->: the N characters preceding the comment (resolved in step 3b)
- For
- Process the instruction:
- Rewrite ("rewrite", "make shorter", "more conviction"): rewrite the text following the instruction and style guide. Same idea, better words.
- Delete ("cut", "remove", "delete"): the replacement is empty string.
- Specific edit ("change X to Y"): apply the exact substitution.
-
Question (
?): do not edit — collect answer for summary. - Merge ("merge with above/below"): produce two replacements — one with merged content, one deletion.
- Move ("move to section X"): produce two replacements — one deletion, one insertion at target.
- Split ("split into two paragraphs"): one replacement with blank line inserted.
- The
original(calledoldin the payload) must be byte-identical to the source text — including whitespace, line breaks, and the comment markup itself. The Obsidian plugin does verbatim search withlastIndexOf. If it doesn't match exactly, the replacement is silently skipped. - The
replacement(callednew) is the clean text with the comment removed.
Convert the absolute file path to vault-relative by stripping the vault prefix (/home/tomic/Documents/Vault/).
Send via Bash:
curl -sf -X POST http://127.0.0.1:27125/buffer/replace \
-H "Content-Type: application/json" \
-d '<json payload>'
Parse the response and report: "N applied, M skipped."
5b. Direct Mode (Obsidian unavailable)
Process comments and apply edits directly using the Edit tool:
- Process comments in reverse order (bottom-to-top) to preserve line positions.
- For each comment, use the Edit tool with the exact original text (including comment markup) as
old_stringand the clean replacement asnew_string. - For questions: skip editing, just collect the answer.
Report each change made.
6. Summary
Print a numbered summary:
- For each edit: brief description of what changed (before → after, abbreviated)
- For each question: the question text and your answer
- Total: N edits applied, M questions answered
Rules
- Read the full document first. Every edit must be informed by the full context.
- Same idea, better words. Rewrites preserve the author's intent. Never invent new content.
-
Byte-identical originals. In Obsidian mode, the
oldfield must exactly match the source. This is the most critical requirement. - Process ALL comments. Do not skip any review comment.
- Preserve everything else. Text without comments must remain untouched.
- Match the author's voice. If a style guide is loaded, follow it. If not, match the existing voice in the document.
-
Questions are read-only. Never edit text near a
?-prefixed comment. - Conflicting comments. If two comments on the same paragraph conflict, process the first and report the second as skipped with explanation.
chat Comments (0)
Sign in to join the discussion and leave a comment.
Skill Details
Related Skills
Build your own?
Join 12,000+ developers contributing to the Claude ecosystem.
No comments yet. Be the first to share your thoughts!