Skip to content

feat: add Claude Code skill for managing markco comments#3

Open
lesandiz wants to merge 6 commits into
babonet:mainfrom
lesandiz:feat/claude-skill
Open

feat: add Claude Code skill for managing markco comments#3
lesandiz wants to merge 6 commits into
babonet:mainfrom
lesandiz:feat/claude-skill

Conversation

@lesandiz

@lesandiz lesandiz commented May 6, 2026

Copy link
Copy Markdown

Summary

  • Adds a Claude Code skill (skills/markco/SKILL.md) that gives AI agents the ability to manage markco comments in markdown files — add, reply, resolve, edit, remove, and list comments
  • Includes a zero-dependency Node.js CLI script (skills/markco/scripts/markco.mjs) that handles deterministic operations ported from CommentService.ts: anchor position calculation, code-context detection (backtick fences/inline code), --> sanitization, and block parsing/writing
  • The script provides 4 subcommands: parse, serialize, find-anchor, and reconcile
  • The skills/markco/ directory can be copied directly into a project's .claude/skills/ without renaming
  • Updates README with setup instructions and usage examples (slash command and conversational)

How it works

The skill splits responsibilities:

  • Script handles the error-prone parts: computing exact line/char positions, detecting code contexts, sanitising --> sequences, and reading/writing the markco JSON block
  • AI agent handles the business logic: deciding what comments to add/edit/remove, formatting output for the user, resolving ambiguous references

Test plan

  • parse correctly extracts all comments from a file with existing markco comments
  • find-anchor returns correct 0-based line/char positions matching the extension's stored data
  • reconcile detects orphaned anchors when text has been removed from the file
  • Round-trip parseserialize preserves the file (no unintended changes)
  • parse on a file with no markco block returns {"version": 2, "comments": []}
  • Code-context detection correctly skips <!-- markco-comments inside code fences
  • Verify the VS Code extension still renders comments correctly after script modifications

🤖 Generated with Claude Code

lesandiz and others added 6 commits May 6, 2026 17:19
Adds a skill with a Node.js CLI script that provides deterministic
operations for comment management — anchor position calculation,
code-context detection, JSON sanitization, and block parsing/writing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s/ copy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update README references and usage examples to include conversational
invocation alongside the /markco slash command.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@babonet

babonet commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Thank you for your PR,

  1. Cross-platform command usage in SKILL.md and README
    • The skill currently instructs uuidgen, date -u, and cp -r, which are Unix-specific and will fail on Windows.
    • Recommendation: make ID/time generation platform-neutral in Node (crypto.randomUUID(), new Date().toISOString()), and avoid shell-specific copy examples.
  2. Fragile JSON piping with echo '' | ... serialize
    • Single-quote based echo piping breaks when content includes apostrophes and can corrupt payloads.
    • Recommendation: use temp-file input (serialize < tmp.json) or add a --data-file option.
  3. findFirstAnchor behavior diverges from extension parity
    • In skills/markco/scripts/markco.mjs, reconcile uses findFirstAnchor, which skips code-context matches if the first match is in code context.
    • In CommentService.findAnchorInDocument, the first indexOf hit is used without code-context filtering.
    • Impact: script reconciliation can mark orphaned or relocate differently from extension behavior.
    • Recommendation: either align script behavior with extension or explicitly document this as an intentional improvement.
  4. Trailing-newline handling differs from extension output
    • replaceBlock trims trailing newlines before append; extension appends at end-of-file position without trimming.
    • Impact: not functionally harmful, but can produce formatting diffs and non-identical round trips.
      Parse error handling differs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants