agentleFS
aws-samplesaws-samples/sample-agent-skills-for-builders/skills/gitlab-docs-publishing/SKILL.md

gitlab-docs-publishing

Skill51 starsChanged 3 months agoApache-2.0View on GitHub

Publish HTML/Markdown design documents on GitLab Pages with selection-driven discussion. Reviewers select any text in the published doc; a floating ๐Ÿ’ฌ bubble opens a prefilled GitLab Issue (title + anchor link + selection quote + label) in a new tab. GitLab handles auth via the user's existing session โ€” no OAuth, no PAT, no API calls. Works on gitlab.com, self-hosted, and proxy-fronted GitLab.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • โ‰ˆ0

    Common ยท estimate

    Many files like this have a rule of this kind.

  • โ‰ˆ2

    Distinctive ยท estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After merge to main, the doc is served at the project's Pages URL โ€” check

    line 73
  2. Distinctive:

    Commit a small per-page config:

    line 78

โ‰ˆ โ€œCommonโ€ is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. โ€œVery specificโ€ is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GitLab Docs Publishing

Publish styled HTML design docs on GitLab Pages and let reviewers file in-context feedback by selecting any text and clicking a floating ๐Ÿ’ฌ bubble โ€” which opens a pre-filled GitLab Issue in a new tab. Zero external services, zero in-page API calls.

Standalone HTML design docs are great for reading but miss two things GitLab does not provide out of the box: a public URL (GitLab renders .html blobs as source code, not as a page) and an in-context comment thread tied to the exact piece of prose a reviewer wants to discuss. This skill bolts both on using only free GitLab features:

  • GitLab Pages auto-publishes HTML on every merge to main.
  • Selection-driven ๐Ÿ’ฌ bubble โ€” a small JS widget watches text selection. On click, it navigates the browser to GitLab's "New issue" page with title
    • description + label prefilled. GitLab authenticates the user with their existing session cookie.

When to Apply

  • Publishing a technical design doc (HTML or Markdown) for team review.
  • Teammates complain they have to git clone to see the styled HTML version.
  • Meeting feedback gets lost because there's no place to write it against specific sentences.
  • An HTML visual doc has been generated from source Markdown and now needs a distribution channel with feedback affordances.

Not for:

  • Documents that belong in GitLab Wiki (Wiki renders Markdown natively and has built-in comments).
  • Single-reviewer review โ€” use MR line comments instead.
  • External/public audiences who do not have GitLab accounts.

How It Works

docs/<v>/foo.html
   โ”‚
   โ”‚ inject-comments.py:
   โ”‚   1. Strip any pre-existing in-page widgets
   โ”‚   2. Add ids to headings/figures/tables
   โ”‚   3. Inject <link>+<script> for the selection-bubble widget
   โ”‚   4. Copy comment-widget.{js,css} into <assets-dir>
   โ†“
public/<v>/index.html  โ”€โ”€โ–ถ  GitLab Pages CI publishes public/
                              โ†“
                     Reviewer opens published URL
                     Selects any text โ†’ ๐Ÿ’ฌ bubble appears
                     Clicks โ†’ new tab on GitLab issues/new
                     with title + description + label prefilled
                     GitLab uses existing session cookie
                     Reviewer types โ†’ submits โ†’ labelled Issue created

Usage

Step 1 โ€” Add the Pages CI job

Copy templates/gitlab-ci-pages.yml into your project's .gitlab-ci.yml and replace <VERSION> / <MAIN_HTML>. The template already runs the inject step (Step 2 explains its config). After merge to main, the doc is served at the project's Pages URL โ€” check Settings โ†’ Pages for the exact host.

Step 2 โ€” Configure the per-page Issue settings

Commit a small per-page config:

// docs/v1.0.0/comments-issue.json
{
  "gitlabHost": "https://gitlab.example.com",
  "projectPath": "group/subgroup/project",
  "pageUrl": "https://<pages-url>/v1.0.0/",
  "titlePrefix": "[v1.0.0-tech-design]",
  "issueLabels": "doc-comments"
}

The CI template invokes the injector with this config. The injector:

  • Adds id attributes to every <h1>โ€“<h6> (slug from heading text), <div class="diagram-frame"> (figure-N), and <div class="aws-table-wrap"> (table-N) so anchor URLs resolve.
  • Injects <link rel="stylesheet"> and <script defer> referencing the bundled widget assets.
  • Copies comment-widget.{js,css} into --assets-dir.
  • Is idempotent โ€” re-running on the same HTML doesn't double up.

Step 3 โ€” Validate before publishing

python3 scripts/validate-html.py docs/v1.0.0/tech-design.html

Confirms tag balance and that anchor IDs are present.

What the reviewer sees

  • The published doc renders normally โ€” no extra buttons or chrome anywhere.
  • Selecting any text shows a small orange "๐Ÿ’ฌ ๆทปๅŠ ่ฏ„่ฎบ" / "๐Ÿ’ฌ Add comment" bubble above the selection.
  • Clicking opens a new tab on GitLab's New Issue page. Title is [<prefix>] ยง<heading-text> ยท "<first 30 chars of selection>โ€ฆ". Description contains an anchor link (back to the section) plus the selection quote, plus a hidden anchor JSON block for forward-compat tooling.
  • The reviewer types their comment under "Your comment:" and submits.

Deployment Checklist

  • HTML generated; tag balance and anchors validated.
  • .gitlab-ci.yml includes the pages job and the inject step.
  • comments-issue.json is committed and has the right gitlabHost, projectPath, and pageUrl.
  • Selecting text on the published page shows the bubble.
  • Clicking the bubble opens GitLab's New Issue page with prefilled title, description, and label.
  • After submitting, the resulting Issue has a working anchor link in its description that scrolls back to the right section.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.