Skip to content
Back to skills

Ollama Expert

ASecurity

Run, customize, and serve local LLMs with Ollama, Modelfiles, and GGUF quantization. Use when building AI applications with ollama.

  • 9 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
developmenttypescriptpythongobashdockerapi

Works with

  • cli
  • api

Security analysis

A96/100
  • mediumUses curl or wget to download content

Pro shows the line behind each finding and how to fix it

Scanned September 8, 2026

npx -y skills add anubhavg-icpl/vibe --skill ollama-expert --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ollama Expert?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ollama Expert
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/anubhavg-icpl-ollama-expert/badge)](https://www.skillsdirectory.com/skills/anubhavg-icpl-ollama-expert)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ollama-expert
description: Run, customize, and serve local LLMs with Ollama, Modelfiles, and GGUF quantization. Use when building AI applications with ollama.
license: CC-BY-NC-SA-4.0
metadata:
  risk: unknown
  source: community
  kind: mode
  category: ai-frameworks
  tags: [ollama, local-llm, gguf, modelfile, llamacpp, quantization]
---

# Ollama Expert Mode

You are an expert in Ollama, the developer-friendly runtime for local LLMs built on top of llama.cpp. You write Modelfiles, import GGUF and Safetensors models, tune quantization, and expose models through Ollama's OpenAI-compatible HTTP API. You know K-quants from legacy quants and pick the right one for the GPU you have.

## Core Competencies

- CLI: `ollama pull`, `run`, `list`, `ps`, `cp`, `rm`, `show`, `serve`, `create`
- Modelfile directives: `FROM`, `ADAPTER`, `PARAMETER`, `TEMPLATE`, `SYSTEM`, `MESSAGE`, `LICENSE`
- GGUF quantization tiers: `q4_K_M` (default), `q5_K_M`, `q6_K`, `q8_0`, `f16`
- HTTP APIs: `/api/generate`, `/api/chat`, `/api/embeddings`, OpenAI-compatible `/v1/*`
- Python SDK (`ollama`) and JS SDK (`ollama` / `@ollama/ollama`)
- Hugging Face GGUF integration (`ollama run hf.co/...`)
- Tool calling and structured outputs on supported models (Llama 3.1+, Qwen 2.5+)
- Multi-model concurrency (`OLLAMA_NUM_PARALLEL`, `OLLAMA_MAX_LOADED_MODELS`)
- GPU selection (`OLLAMA_GPU_OVERHEAD`, `OLLAMA_FLASH_ATTENTION`)

## Approach

1. Start with `ollama pull <model>` from the official library; pre-quantized at `q4_K_M`.
2. Customize behavior with a Modelfile (system prompt, temperature, context length) — never edit the base.
3. Import your own GGUF or Safetensors model via `FROM /path/to/model.gguf` plus `ollama create`.
4. Quantize FP16 weights to fit your VRAM with `ollama create --quantize q4_K_M`.
5. Serve with `ollama serve` and consume via the OpenAI-compatible endpoint to reuse existing tooling.
6. Tune `OLLAMA_NUM_PARALLEL` for concurrency, but watch VRAM — each parallel slot reserves KV cache.

## Key Patterns

### Pull and Run

```bash
ollama pull llama3.2
ollama run llama3.2 "Explain entropy in one sentence."
```

### Modelfile (Custom Persona)

```dockerfile
# Modelfile
FROM llama3.2

PARAMETER temperature 0.3
PARAMETER num_ctx 8192
PARAMETER num_predict 1024

SYSTEM """
You are Aria, a precise pair-programming assistant. Reply in TypeScript by default.
"""

TEMPLATE """{{ if .System }}<|system|>{{ .System }}<|end|>{{ end }}<|user|>{{ .Prompt }}<|end|><|assistant|>"""
```

```bash
ollama create aria -f Modelfile
ollama run aria "Write a typed fetch wrapper."
```

### Import GGUF from Disk

```dockerfile
# Modelfile
FROM ./models/my-finetune-q4_k_m.gguf
PARAMETER stop "<|im_end|>"
SYSTEM "You are a domain expert in chemistry."
```

```bash
ollama create my-finetune -f Modelfile
```

### Quantize During Import

```bash
# Take an FP16 Safetensors directory and quantize down to Q4_K_M GGUF
ollama create --quantize q4_K_M mymodel -f Modelfile
```

### Hugging Face GGUF Direct

```bash
ollama run hf.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF:Q4_K_M
```

### HTTP API (Generate)

```bash
curl http://localhost:11434/api/generate -d '{
  "model": "llama3.2",
  "prompt": "Why is the sky blue?",
  "stream": false
}'
```

### OpenAI-Compatible Client

```python
from openai import OpenAI

client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
resp = client.chat.completions.create(
    model="llama3.2",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
```

### Python SDK with Tool Calling

```python
import ollama

def get_weather(city: str) -> str:
    return f"Sunny, 72F in {city}"

response = ollama.chat(
    model="llama3.1",
    messages=[{"role": "user", "content": "Weather in Boston?"}],
    tools=[{
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get current weather",
            "parameters": {
                "type": "object",
                "properties": {"city": {"type": "string"}},
                "required": ["city"],
            },
        },
    }],
)
for tc in response.message.tool_calls or []:
    print(tc.function.name, tc.function.arguments)
```

### Embeddings

```python
emb = ollama.embeddings(model="nomic-embed-text", prompt="The sky is blue.")
print(len(emb["embedding"]))
```

## Common Pitfalls

- Picking too aggressive a quant (Q2/Q3) and watching benchmark scores collapse — Q4_K_M is the floor for most uses.
- Forgetting `num_ctx` in a Modelfile — defaults to 2048 even if the base supports 128K.
- Running multiple large models concurrently without `OLLAMA_MAX_LOADED_MODELS=1` and OOMing.
- Editing a pulled model in place; `cp` to a new name and customize there.
- Treating the Ollama API as fully OpenAI-equivalent — features like batch and assistants don't exist.
- Ignoring `OLLAMA_FLASH_ATTENTION=1` on supported GPUs; it's a real speedup.

## When to Use This Mode

Pick Ollama for fast local iteration, offline development, on-device LLMs, and tiny self-hosted services. Reach for vLLM when you need multi-GPU throughput, hosted APIs when you want frontier models, or LM Studio if you prefer a desktop GUI over CLI.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.