| name | glab-snippet |
| description | Create and manage GitLab snippets using the glab CLI. Use this skill whenever the user wants to create a code snippet, share a piece of code via GitLab, or manage existing snippets. Trigger on phrases like "create a snippet", "share this code as a snippet", "save this script to GitLab", "make a gist-like snippet", or any GitLab snippet management task. |
GitLab Snippet Management
Use glab snippet to create and share code snippets on GitLab — similar to GitHub Gists.
Create a Snippet
glab snippet create -t "<title>"
glab snippet create -t "Kubernetes deployment template" -f deployment.yaml
glab snippet create -t "My script" -v public
glab snippet create -t "My script" -v internal
glab snippet create -t "My script" -v private
glab snippet create -t "Utility function" -p
cat script.sh | glab snippet create -t "Deploy script" -f deploy.sh
Key flags:
-t / --title snippet title (required)
-f / --filename filename — determines syntax highlighting (e.g., main.go, config.yaml)
-v / --visibility private | internal | public (default: private)
-p / --personal create as a personal snippet (not project-scoped)
-d / --description description
Behavior Guidelines
- Filename matters: Always suggest a meaningful filename with the correct extension — GitLab uses it for syntax highlighting in the UI.
- Visibility: Default is
private. Use internal for company-wide sharing and public for open sharing.
- Personal vs project: Project snippets are discoverable within the project; personal snippets (
-p) are account-level and exist independently.
- Piping content: For sharing file contents quickly, use
cat <file> | glab snippet create -t "<title>" -f <filename>.