gitlab-api
GitLab API integration for repository operations. Use when working with GitLab repositories for reading, writing, creating, or deleting files, listing projects, managing branches, or any other GitLab repository operations.
Best use case
gitlab-api is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
GitLab API integration for repository operations. Use when working with GitLab repositories for reading, writing, creating, or deleting files, listing projects, managing branches, or any other GitLab repository operations.
Teams using gitlab-api should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/gitlab-api/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How gitlab-api Compares
| Feature / Agent | gitlab-api | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
GitLab API integration for repository operations. Use when working with GitLab repositories for reading, writing, creating, or deleting files, listing projects, managing branches, or any other GitLab repository operations.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# GitLab API
Interact with GitLab repositories via the REST API. Supports both GitLab.com and self-hosted instances.
## Setup
Store your GitLab personal access token:
```bash
mkdir -p ~/.config/gitlab
echo "glpat-YOUR_TOKEN_HERE" > ~/.config/gitlab/api_token
```
**Token scopes needed:** `api` or `read_api` + `write_repository`
**Get a token:**
- GitLab.com: https://gitlab.com/-/user_settings/personal_access_tokens
- Self-hosted: https://YOUR_GITLAB/~/-/user_settings/personal_access_tokens
## Configuration
Default instance: `https://gitlab.com`
For self-hosted GitLab, create a config file:
```bash
echo "https://gitlab.example.com" > ~/.config/gitlab/instance_url
```
## Common Operations
### List Projects
```bash
GITLAB_TOKEN=$(cat ~/.config/gitlab/api_token)
GITLAB_URL=$(cat ~/.config/gitlab/instance_url 2>/dev/null || echo "https://gitlab.com")
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects?owned=true&per_page=20"
```
### Get Project ID
Projects are identified by ID or URL-encoded path (`namespace%2Fproject`).
```bash
# By path
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/username%2Frepo"
# Extract ID from response: jq '.id'
```
### Read File
```bash
PROJECT_ID="12345"
FILE_PATH="src/main.py"
BRANCH="main"
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}?ref=$BRANCH" \
| jq -r '.content' | base64 -d
```
### Create/Update File
```bash
PROJECT_ID="12345"
FILE_PATH="src/new_file.py"
BRANCH="main"
CONTENT=$(echo "print('hello')" | base64)
curl -X POST -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}" \
-d @- <<EOF
{
"branch": "$BRANCH",
"content": "$CONTENT",
"commit_message": "Add new file",
"encoding": "base64"
}
EOF
```
For updates, use `-X PUT` instead of `-X POST`.
### Delete File
```bash
curl -X DELETE -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}" \
-d '{"branch": "main", "commit_message": "Delete file"}'
```
### List Files in Directory
```bash
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/tree?path=src&ref=main"
```
### Get Repository Content (Archive)
```bash
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/archive.tar.gz" \
-o repo.tar.gz
```
### List Branches
```bash
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/branches"
```
### Create Branch
```bash
curl -X POST -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/branches" \
-d '{"branch": "feature-xyz", "ref": "main"}'
```
## Helper Script
Use `scripts/gitlab_api.sh` for common operations:
```bash
# List projects
./scripts/gitlab_api.sh list-projects
# Read file
./scripts/gitlab_api.sh read-file <project-id> <file-path> [branch]
# Write file
./scripts/gitlab_api.sh write-file <project-id> <file-path> <content> <commit-msg> [branch]
# Delete file
./scripts/gitlab_api.sh delete-file <project-id> <file-path> <commit-msg> [branch]
# List directory
./scripts/gitlab_api.sh list-dir <project-id> <dir-path> [branch]
```
## Rate Limits
- GitLab.com: 300 requests/minute (authenticated)
- Self-hosted: Configurable by admin
## API Reference
Full API docs: https://docs.gitlab.com/ee/api/api_resources.html
Key endpoints:
- Projects: `/api/v4/projects`
- Repository files: `/api/v4/projects/:id/repository/files`
- Repository tree: `/api/v4/projects/:id/repository/tree`
- Branches: `/api/v4/projects/:id/repository/branches`Related Skills
gitlab-manager
Manage GitLab repositories, merge requests, and issues via API. Use for tasks like creating repos, reviewing code in MRs, or tracking issues.
paylock
Non-custodial SOL escrow for AI agent deals.
agent-reputation
summary: Cross-platform AI agent reputation checker with trust scoring and PayLock escrow recommendations.
Telecom Agent Skill
Turn your AI Agent into a Telecom Operator. Bulk calling, ChatOps, and Field Monitoring.
OpenClaw-Finnhub
OpenClaw skill for real-time stock quote, and financials via Finnhub API.
```markdown
# OpenClaw-Last.fm
security-operator
Runtime security guardrails for OpenClaw agents.
operator-humanizer
Transform AI-generated text into authentic human writing.
kit-email-operator
**AI-powered email marketing for Kit (ConvertKit)**.
agora
Trade prediction markets on Agora — the prediction market exclusively for AI agents. Register, browse markets, trade YES/NO, create markets, earn reputation via Brier scores.
surf-check
Surf forecast decision engine.
jinko-flight-search
Search flights and discover travel destinations using the Jinko MCP server. Provides two core capabilities: (1) Destination discovery — find where to travel based on criteria like budget, climate, or activities when the user has no specific destination in mind, and (2) Specific flight search — compare flights between two known cities/airports with flexible dates, cabin classes, and budget filters. Use this skill when the user wants to: search for flights, find cheap flights, discover travel destinations, compare flight prices, plan a trip, find deals from a specific city, or explore where to go. Triggers on any flight-booking, travel-planning, or destination-discovery request. Requires the Jinko MCP server connected at https://mcp.gojinko.com.