<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pawon Kumar on Medium]]></title>
        <description><![CDATA[Stories by Pawon Kumar on Medium]]></description>
        <link>https://medium.com/@pawon.katiyar?source=rss-015e8581c1e4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*lQA5wTChR60oXj9q</url>
            <title>Stories by Pawon Kumar on Medium</title>
            <link>https://medium.com/@pawon.katiyar?source=rss-015e8581c1e4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 05:59:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pawon.katiyar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build a GitLab AI Code Review Assistant with Claude Code]]></title>
            <link>https://medium.com/@pawon.katiyar/build-a-gitlab-ai-code-review-assistant-with-claude-code-04de6d5753b0?source=rss-015e8581c1e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/04de6d5753b0</guid>
            <category><![CDATA[ai-code-review]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[claude-code-skills]]></category>
            <category><![CDATA[gitlab]]></category>
            <dc:creator><![CDATA[Pawon Kumar]]></dc:creator>
            <pubDate>Mon, 24 Aug 2026 06:12:29 GMT</pubDate>
            <atom:updated>2026-09-07T07:12:54.716Z</atom:updated>
            <content:encoded><![CDATA[<p>Code reviews are essential, but they can also be time-consuming – especially when the same review patterns, security checks, and quality checks need to be repeated across multiple Merge Requests.</p><p>What if you could turn your existing Claude Code setup into a lightweight GitLab AI code review assistant without building a separate server, deploying a bot, or maintaining another service?</p><p>That’s the idea behind this approach. This is a GitLab adaptation of the same idea originally built for Bitbucket.</p><p><strong>The Idea:</strong></p><p>Claude Code supports custom slash commands defined as Markdown files under:</p><p>~/.claude/commands/</p><p>You write the instructions in the Markdown file, and Claude follows them whenever you invoke the command.</p><p>There are no additional AI APIs or separate review services required. Claude Code itself acts as the review engine.</p><p><strong>The custom skill follows this workflow:</strong></p><ol><li>Parses your GitLab Merge Request URL.</li></ol><p>2. Fetches the MR diff and existing discussions.</p><p>3. Reads repository-level review guidelines such as CLAUDE.md or CONTRIBUTING.md.</p><p>4. Reviews only the lines actually changed in the MR.</p><p>5. Filters out pre-existing issues and low-value nitpicks.</p><p>6. Displays the findings directly in the terminal.</p><p>7. Lets you select which findings should be posted.</p><p>8. Shows the exact comment and target file/line before posting.</p><p>9. Posts approved inline comments to GitLab using your own account and Personal Access Token.</p><p>The important part is that nothing gets posted automatically without your confirmation.</p><p><strong>Setup in 5 Minutes</strong></p><ol><li><strong>Create the Command File</strong></li></ol><p>Download the skill file from the GitHub Gist:</p><p>https://gist.github.com/pkatiyar387/c45e53fb8194c2ad3e0c2e156cdae05c</p><p>Save it to:</p><p>~/.claude/commands/gitlab/mr-comment.md</p><p>Once configured, invoke it with:</p><p>/gitlab:mr-comment https://your-gitlab.com/group/repo/-/merge_requests/123</p><p>2. <strong>Add Your GitLab Personal Access Token</strong></p><p>Generate a GitLab Personal Access Token from:</p><p>User Settings &gt; Access Tokens</p><p>The token needs the api scope to read Merge Requests and post comments.</p><p>Add it to ~/.claude/settings.json:</p><p>{</p><p>. “env”: {</p><p>. “GITLAB_ACCESS_TOKEN”: “your-token-here”</p><p>. }</p><p>}</p><p>The token remains local to your Claude Code environment. Claude Code injects it as an environment variable when the session starts, so the skill can access GitLab without hardcoding the token into the Markdown file.</p><p><strong>Important: Treat your Personal Access Token like any other credential. Never commit it to Git, include it in the skill file, or expose it in screenshots or logs.</strong></p><p>3. <strong>Allow Node.js Execution</strong></p><p>The skill uses Node.js 18+ to communicate with the GitLab REST API.</p><p>Add the following to ~/.claude/settings.json under permissions.allow:</p><p>{</p><p>. “env”: {</p><p>. “GITLAB_ACCESS_TOKEN”: “your-token-here”</p><p>. },</p><p>. “permissions”: {</p><p>. “allow”: [</p><p>. “Bash(node:*)”</p><p>. ]</p><p>. }</p><p>}</p><p>How It Works</p><p>Parsing the Merge Request URL</p><p>You only need to provide the GitLab MR URL. <strong>For example:</strong></p><p>https://your-gitlab.com/group/repo/-/merge_requests/3663</p><p>The skill extracts:</p><ul><li>Base URL – your GitLab instance</li><li>Project path – group/repo</li><li>MR IID – 3663</li></ul><p>There is no need to maintain a separate GITLAB_BASE_URL configuration. The same skill works with different self-hosted GitLab instances or GitLab.com, provided the token has the required permissions.</p><p><strong>Fetching the Diff</strong></p><p>The skill communicates with GitLab through its REST API using your personal access token. It also retrieves existing discussions so that it doesn’t repeatedly report issues already being discussed in the Merge Request.</p><p>One implementation detail that makes the approach more reliable across Windows and macOS: instead of constructing complicated multi-line node -e commands, the skill writes a small temporary Node.js script, executes it, reads the result, and removes the temporary file. This avoids shell-quoting problems that can occur with multi-line commands.</p><p><strong>Adapting to Your Repository’s Rules</strong></p><p>Before starting the review, the skill looks for repository-level guidance on the MR’s source branch – specifically CLAUDE.md or CONTRIBUTING.md.</p><p>If these files exist, their instructions are incorporated into the review. This allows the same skill to adapt to different repositories. For example, one project might require:</p><ul><li>Unit tests for every service change</li><li>Specific exception-handling patterns</li><li>No direct database access from controllers</li><li>Mandatory logging standards</li></ul><p>Another project may have completely different engineering standards. The repository’s own rules take priority over the generic review checklist.</p><p><strong>What Gets Flagged – and What Doesn’t</strong></p><p>The review focuses on meaningful issues introduced by the current Merge Request, not the entire codebase.</p><p>It skips:</p><ul><li>Pre-existing issues outside the changes</li><li>Compiler errors that the build already catches</li><li>Basic linting or type-checking issues</li><li>Cosmetic formatting issues</li><li>Nitpicks a senior engineer would normally ignore</li><li>Issues already covered by an unresolved discussion thread</li></ul><p>It focuses on:</p><ul><li>Real bugs</li><li>Security vulnerabilities (OWASP-relevant)</li><li>Incorrect business logic</li><li>Missing tests for important new behavior</li><li>Meaningful opportunities to simplify or improve the implementation</li></ul><p>The goal isn’t to generate the maximum number of comments. The goal is to generate comments that are actually worth sending to the developer.</p><p><strong>Two Mandatory Gates Before Posting</strong></p><p>The skill never posts review comments silently.</p><p><strong>Gate 1 – Select What to Post</strong></p><p>The tool shows findings and lets you choose:</p><ul><li>Post all findings</li><li>Select specific findings</li><li>Review findings only, don’t post</li></ul><p><strong>Gate 2 – Confirm the Exact Comment</strong></p><p>Before any GitLab POST request, the skill displays the target file and line, finding category, finding description and suggested fix, and the exact comment text that will be posted.</p><p>You then explicitly confirm before it posts. Even if you select Post all, you still get a final confirmation. Review comments are visible to the entire engineering team – a false positive should never reach the Merge Request simply because an AI decided to publish it.</p><p>The Complete Review Flow</p><p>GitLab MR URL</p><p>Parse MR Details</p><p>Fetch MR Diff</p><p>Fetch Existing Discussions</p><p>Fetch Repository Rules (CLAUDE.md / CONTRIBUTING.md)</p><p>Analyze Changed Lines</p><p>Filter Low-Value Findings</p><p>Display Findings</p><p>Developer Selection</p><p>Show Exact Comment + Location</p><p>Explicit Confirmation</p><p>GitLab API</p><p>Inline MR Comments</p><p><strong>The Skill File</strong></p><p>The complete mr-comment.md is available as a GitHub Gist:</p><p>https://gist.github.com/pkatiyar83/c45e53fb8194c2ad3e0c2e156cdae05c</p><p>Save it to ~/.claude/commands/gitlab/mr-comment.md, then invoke:</p><p>/gitlab:mr-comment https://your-gitlab.com/group/repo/-/merge_requests/123</p><p>Claude Code will fetch, analyze, show findings, let you select, confirm, and post.</p><p>Comments post under your own GitLab identity. There is no bot account, no separate AI service, no review server, no deployment pipeline, and no additional service to maintain.</p><p><strong>What It Won’t Do – By Design</strong></p><p>This is not a CI bot. It doesn’t execute automatically on every push or every Merge Request event. It is a developer-controlled tool you deliberately invoke when you want an AI-assisted review.</p><p>If you want fully automated review, you would need a GitLab webhook feeding into a review service, which calls an AI model, which posts back via the GitLab API. That introduces infrastructure, authentication, deployment, monitoring, and maintenance.</p><p>This Claude Code approach intentionally takes a much smaller path – an 80% solution with a fraction of the infrastructure.</p><p><strong>Security Considerations</strong></p><p>Keep the token outside the repository. Store it in ~/.claude/settings.json, not inside the Markdown skill file.</p><p>Use the minimum required permissions. The api scope is required. Don’t grant broader scopes than needed.</p><p>Never expose the token. Avoid including it in source code, Git commits, screenshots, terminal recordings, logs, or documentation.</p><p>Review before posting. The mandatory confirmation step is a safeguard against accidental or inappropriate comments. The AI identifies potential issues, but the developer remains the final decision-maker.</p><p><strong>Final Thoughts</strong></p><p>AI-assisted code review doesn’t require a large platform. For teams already using Claude Code, a custom slash command provides a practical middle ground between completely manual reviews and fully automated CI-based bots.</p><p>The key is to keep the AI focused on meaningful issues, limit the review to code actually changed, respect repository-specific rules, and keep a human approval step before comments are published.</p><p><strong>The architecture is simple:</strong></p><p>One Markdown File + Claude Code + GitLab API = AI-Assisted MR Review</p><p>No server. No deployment. No bot account. No additional AI service.</p><p>Just a developer invoking a command when they need an extra pair of eyes.</p><p><strong>Resources</strong></p><p>Skill file: https://gist.github.com/pkatiyar83/c45e53fb8194c2ad3e0c2e156cdae05c</p><p>Built with Claude Code. The skill file is the entire implementation – no server, no deployment, no ongoing service to maintain.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04de6d5753b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>