GitLab Integration with Claude Code CLI
AI Board Reviewed 2026-01-20This proposal outlines an automated software development pipeline that combines Spec-Driven Development methodology with Claude Code CLI and GitLab for task visibility. The solution leverages existing infrastructure (64 MCP tools, 5 agents) while adding structured specification workflows and Kanban board tracking.
Specifications define intent before code. Multi-step refinement, not single-prompt generation.
All AI agent work visible on GitLab Kanban boards with real-time label updates.
Approval gates at spec review and code review stages ensure human control.
No new tools needed initially. Defer GitLab Duo ($29/user) and OpenHands until validated.
Five-layer architecture separating concerns from infrastructure to visibility:
flowchart LR
subgraph L4["Layer 4: Visibility"]
direction TB
KB[GitLab Kanban Board]
WH[Webhooks]
end
subgraph L3["Layer 3: Orchestration"]
direction TB
CI[GitLab CI/CD]
TR[Triage]
SP[Spec]
B1[ ]
PL[Plan]
B2[ ]
B3[ ]
IM[Implement]
SC[Security]
TS[Test]
CI --> TR --> SP --> B1 --> PL --> B2 --> B3 --> IM --> SC --> TS
end
subgraph L2["Layer 2: Methodology"]
direction TB
SK[Spec-Kit CLI]
S1["/speckit.clarify"]
S2["/speckit.specify"]
S3["/speckit.checklist"]
S4["/speckit.plan"]
S5["/speckit.tasks"]
S6["/speckit.analyze"]
S7["/speckit.implement"]
B4[ ]
B5[ ]
SK ~~~ S1 ~~~ S2 ~~~ S3 ~~~ S4 ~~~ S5 ~~~ S6 ~~~ S7 ~~~ B4 ~~~ B5
end
subgraph L15["Layer 1.5: Bridge"]
direction TB
GL[glab CLI / MCP-GitLab]
TK[GL_TOKEN Auth]
end
subgraph L0["Layer 1: Execution"]
direction TB
CC[Claude Code CLI]
PM[PM Agent]
AR[Architect]
DV[Developer]
SE[Security]
QA[QA Agent]
CC --> PM & AR & DV & SE & QA
end
%% Connections to enforce left-to-right order
KB --> CI
CI -.-> SK
%% Layer 3 to Layer 2 (horizontal arrows - aligned)
TR -.-> S1
SP -.-> S2
B1 -.-> S3
PL -.-> S4
B2 -.-> S5
B3 -.-> S6
IM -.-> S7
%% Layer 2 to Layer 1.5 to Layer 1
B5 --> GL
GL --> CC
style L4 fill:#10b981,stroke:#059669
style L3 fill:#60a5fa,stroke:#3b82f6
style L2 fill:#f59e0b,stroke:#d97706
style L15 fill:#e94560,stroke:#dc2626
style L0 fill:#8b5cf6,stroke:#7c3aed
style B1 fill:none,stroke:none
style B2 fill:none,stroke:none
style B3 fill:none,stroke:none
style B4 fill:none,stroke:none
style B5 fill:none,stroke:none
All 8 Spec-Kit commands and when they're invoked in the pipeline:
| Command | Stage | Purpose |
|---|---|---|
/speckit.constitution |
Setup (one-time) | Define project principles, tech stack constraints, coding standards |
/speckit.clarify |
Clarification | Generate structured questions to resolve vague/ambiguous requirements |
/speckit.specify |
Specification | Create structured spec document (WHAT + WHY, not technical HOW) |
/speckit.checklist |
Quality Gates | "Unit tests for English" - domain-specific validation (security, UX, etc.) |
/speckit.plan |
Planning | Technical implementation plan + data models + API contracts |
/speckit.tasks |
Task Generation | Break plan into granular, ordered, parallelizable tasks |
/speckit.analyze |
Analysis | Cross-artifact consistency check (spec ↔ plan ↔ tasks) |
/speckit.implement |
Implementation | Execute tasks in order, creating code changes |
/speckit.clarify, /speckit.checklist, and /speckit.analyze catch problems BEFORE any code is written, preventing wasted implementation effort.
How a feature request flows through the pipeline (with full Spec-Kit integration):
Human creates GitLab issue describing the feature request. Native GitLab pipeline triggers on issue events.
Claude analyzes the issue for complexity (simple/complex) AND clarity. If requirements are vague, the issue is routed to clarification before any spec is generated. This prevents wasted effort on specs built from assumptions.
Claude executes /speckit.clarify to generate structured clarifying questions. Questions are posted as a comment on the issue. Pipeline blocks until human answers. This loop repeats until requirements are clear.
Claude executes /speckit.specify to generate a structured specification document with requirements, acceptance criteria, and constraints. Focus is on WHAT and WHY, not technical HOW.
Claude executes /speckit.checklist to run domain-specific quality checks: security requirements, infrastructure needs, testability, UX considerations. Failed checks loop back to clarification.
Spec moves to status::spec-review on Kanban. Human reviews and approves (or requests changes). This is a mandatory gate before technical planning.
Architect agent executes /speckit.plan to create detailed implementation plan: architecture decisions, data models, API contracts, file changes, risks. This transforms WHAT into HOW.
Claude executes /speckit.tasks to break the plan into granular, ordered tasks. Parallelizable tasks are marked with [P]. Each task is atomic with clear completion criteria.
Claude executes /speckit.analyze to check cross-artifact consistency: spec ↔ plan ↔ tasks. Catches coverage gaps, ambiguities, duplications, and constitution violations before coding starts.
Developer agent executes /speckit.implement to run all tasks in order. Creates merge request with all changes. Labels updated to status::code-review.
Security agent reviews infrastructure security: secret management, networking configuration, authentication setup. QA agent runs tests and verifies acceptance criteria using /speckit.checklist.
Human reviews MR, considers agent feedback, and merges. Issue automatically moves to status::done on Kanban.
sequenceDiagram
participant H as Human
participant GL as GitLab
participant CI as CI/CD Pipeline
participant CC as Claude Code
participant SK as Spec-Kit
participant KB as Kanban Board
H->>GL: Create Issue
GL->>CI: Pipeline trigger (issue event)
CI->>CC: Triage stage (complexity + clarity)
alt Issue is VAGUE
CC->>KB: Update status::needs-clarification
CC->>SK: /speckit.clarify
SK-->>CC: Clarifying questions
CC->>GL: Post questions as comment
Note over H,GL: Pipeline BLOCKS - awaiting human answers
H->>GL: Answer clarifying questions
GL->>CI: Pipeline trigger (comment event)
CC->>GL: Consolidate answers into issue
end
CC->>KB: Update status::spec-ready
CI->>CC: Specification stage
CC->>SK: /speckit.specify
SK-->>CC: Structured spec (WHAT + WHY)
CC->>GL: Commit spec.md to repo
CI->>CC: Quality gates stage
CC->>SK: /speckit.checklist
SK-->>CC: Domain checklists (security, UX, etc.)
alt Checklist FAILS
CC->>GL: Post failed items
CC->>KB: Keep status::spec-checklist
Note over H,GL: Loop back to clarify gaps
end
CC->>KB: Update status::spec-review
Note over H,KB: HUMAN GATE: Reviews spec...
H->>GL: Approve spec (label change)
GL->>CI: Pipeline trigger (label event)
CI->>CC: Planning stage
CC->>SK: /speckit.plan
SK-->>CC: plan.md + data-model + contracts
CC->>GL: Commit plan artifacts
CI->>CC: Task generation stage
CC->>SK: /speckit.tasks
SK-->>CC: tasks.md (granular, ordered)
CC->>GL: Commit tasks
CI->>CC: Consistency analysis stage
CC->>SK: /speckit.analyze
SK-->>CC: Cross-artifact validation
alt Analysis FAILS
CC->>GL: Post inconsistencies found
Note over CI,CC: Loop back to plan or tasks
end
CC->>KB: Update status::ready-to-implement
CI->>CC: Implementation stage
CC->>SK: /speckit.implement
SK-->>CC: Execute tasks in order
CC->>GL: Create MR with changes
CC->>KB: Update status::code-review
CI->>CC: Security review
CC->>GL: Add security findings
CI->>CC: Testing stage
CC->>GL: Add test results
Note over H,KB: HUMAN GATE: Reviews MR...
H->>GL: Merge MR
GL->>KB: Update status::done
| Factor | Current Setup (Claude Code) | GitLab Duo ($29/user/mo) | OpenHands (Free) |
|---|---|---|---|
| Capability Gaps | None critical | None | None |
| Cost (5 users/mo) | $0* | $145-240 | $0* |
| Setup Effort | Already done | Low (native) | Medium-High |
| Model Flexibility | Claude only | GitLab models | Any LLM |
| IDE Integration | None | Good | CLI only |
| Scale (100+ agents) | Limited | Limited | Excellent |
* Infrastructure costs only
Master the Human + Claude CLI + Spec-Kit workflow first. Adding tools without process mastery creates complexity.
Team grows beyond 10 developers, IDE-centric workflow becomes primary, or single-vendor relationship desired.
Need 100+ concurrent agents, model diversity required (GPT, Gemini, local), or cost optimization critical at scale.
Install glab CLI, configure GL_TOKEN, create labels, install Spec-Kit, set up Kanban board
Create .gitlab-ci.yml template, configure CI/CD variables, set up runner networking, test triage stage
Create spec template repository, test /speckit.specify and /speckit.plan workflows
Enable implementation, security, and testing stages; run end-to-end pilot project
Create Grafana dashboard, add Loki queries, set up Matrix notifications, document runbook
Start getting value immediately, before the full pipeline is deployed:
# 1. Verify gitlab-integration skill ls ~/.claude/skills/gitlab-integration/ # 2. Install glab CLI sudo apt install glab || snap install glab # 3. Configure authentication glab auth login --hostname gitlab.ai-servicers.com # 4. Create basic labels glab label create "status::backlog" "status::in-progress" "status::done" # 5. Immediate workflow (manual) claude "Implement GitLab issue #123" # Claude reads issue via glab, implements, creates MR
This gives 80% of the value while the full CI/CD pipeline is being developed.
~/projects/ainotes/createsolution/cicd.final.md
~/projects/ainotes/createsolution/cicd.md
~/projects/ainotes/createsolution/cicd.gemini.md
~/projects/ainotes/createsolution/cicd.codex.md