agentsclimarketplace

Readme auto toc with markers

Skill kjuhwa/skills-hub/skills/build-tooling/readme-auto-toc-with-markers

Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.

Install
npx -y skills add kjuhwa/skills-hub --skill readme-auto-toc-with-markers

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use HTML comment markers (`<!-- BEGIN AUTO GENERATED X -->`/`<!-- END AUTO GENERATED X -->`) to carve mutable regions inside README.md and regenerate them idempotently from source of truth.

SKILL.md

3.0 KB, as published. Nobody here has run it

README Auto-Regenerated Regions

When to use

  • Your README has one or more sections that need to reflect code (tool list, CLI options, supported env vars) and you hate hand-keeping them in sync.
  • You want humans to edit everything else around them without risk of accidental stomp.

How it works

  • In your README, place paired markers: <!-- BEGIN AUTO GENERATED TOOLS --> and <!-- END AUTO GENERATED TOOLS -->. You can have multiple marker pairs with different names.
  • In your docs generator: const before = readmeContent.slice(0, beginIndex + beginMarker.length); const after = readmeContent.slice(endIndex); fs.writeFileSync(README_PATH, before + '\n\n' + newContent + '\n' + after);
  • Always leave the markers themselves in the file (before + ... + endMarker + after). The regex only replaces the content between them.
  • On missing markers, warn and skip. Don't refuse the build — the generator should be best-effort.
  • Run all generator passes in sequence (tools TOC, options list, anything else) against the same README, each finding its own markers.

Example

function updateReadmeRegion(readmePath, begin, end, newContent) {
  const content = fs.readFileSync(readmePath, 'utf8');
  const beginIdx = content.indexOf(begin);
  const endIdx = content.indexOf(end);
  if (beginIdx === -1 || endIdx === -1) {
    console.warn(`Missing markers ${begin} / ${end} in ${readmePath}`);
    return;
  }
  const before = content.slice(0, beginIdx + begin.length);
  const after = content.slice(endIdx);
  fs.writeFileSync(readmePath, before + '\n\n' + newContent + '\n' + after);
}

updateReadmeRegion('./README.md',
  '<!-- BEGIN AUTO GENERATED TOOLS -->',
  '<!-- END AUTO GENERATED TOOLS -->',
  generateToolsTOC(categories));

Gotchas

  • Marker names must be unique — <!-- BEGIN AUTO GENERATED --> alone collides when you add more sections. Name them (TOOLS, OPTIONS, ENV).
  • indexOf finds the first occurrence. If a PR accidentally commits two begin markers, the second-region replacement nukes content. Add a "refuse if marker appears twice" guard.
  • Include the markers in committed README — never auto-generate them as part of the content or they vanish on a broken build.
  • Run the generator in CI and fail the build if the file changed. That's how you enforce "docs stay in sync".
  • Prefer HTML comments over custom block fences; HTML comments survive Markdown rendering as nothing visible.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.