tikz
LaTeX TikZ/PGF package for programmatic vector graphics and diagrams. Use when helping users draw flowcharts, trees, graphs, automata, circuits, geometric figures, or any custom diagram in LaTeX.
What this skill does
# TikZ/PGF — Vector Graphics & Diagrams
**CTAN:** https://ctan.org/pkg/pgf
**Manual:** `texdoc tikz` (~1300 pages)
## Setup
```latex
\usepackage{tikz}
% Load libraries as needed:
\usetikzlibrary{arrows.meta, calc, positioning, decorations.pathmorphing,
patterns, shapes.geometric, shapes.misc, fit, backgrounds,
automata, trees, mindmap, circuits.logic.US}
```
## Basic Drawing
### Minimal Example
```latex
\begin{tikzpicture}
\draw (0,0) -- (2,0) -- (2,2) -- cycle; % triangle
\end{tikzpicture}
```
### Path Operations
| Operation | Syntax | Example |
|-----------|--------|---------|
| Line | `--` | `(0,0) -- (1,1)` |
| Horizontal-vertical | <code>-\|</code> | `(0,0) -| (1,1)` (go right then up) |
| Vertical-horizontal | <code>\|-</code> | `(0,0) |- (1,1)` (go up then right) |
| Curve | `.. controls .. ..` | `(0,0) .. controls (0.5,1) .. (1,0)` |
| Smooth curve | `to[out=..,in=..]` | `(0,0) to[out=90,in=180] (2,1)` |
| Arc | `arc` | `(0,0) arc (0:90:1cm)` start:end:radius |
| Circle | `circle` | `(0,0) circle[radius=1]` |
| Ellipse | `ellipse` | `(0,0) ellipse[x radius=2, y radius=1]` |
| Rectangle | `rectangle` | `(0,0) rectangle (2,1)` |
| Grid | `grid` | `(0,0) grid (3,3)` |
| Parabola | `parabola` | `(0,0) parabola (2,2)` |
| Sin/Cos | `sin`/`cos` | `(0,0) sin (1,1)` |
| Plot | `plot` | `plot[domain=0:3] (\x, {\x^2})` |
| Cycle | `cycle` | close path back to start |
### Path Actions
| Command | Effect |
|---------|--------|
| `\draw` | Stroke the path |
| `\fill` | Fill the path |
| `\filldraw` | Fill and stroke |
| `\path` | Invisible path (for coordinates, nodes) |
| `\clip` | Clip subsequent drawing to path |
| `\shade` | Gradient fill |
| `\shadedraw` | Gradient fill + stroke |
| `\node` | Shorthand for `\path node` |
| `\coordinate` | Shorthand for `\path coordinate` |
### Common Draw Options
```latex
\draw[
color=blue, % or just: blue
line width=1pt, % or: thin, thick, very thick, ultra thick
dashed, % or: dotted, dash dot, dash dot dot
dash pattern={on 3pt off 2pt},
rounded corners=5pt,
-> % arrow tip (see arrows section)
opacity=0.5,
double,
double distance=2pt,
] (0,0) -- (2,2);
```
### Common Fill Options
```latex
\fill[
fill=blue!20, % 20% blue
fill opacity=0.5,
pattern=north lines, % requires patterns library
pattern color=gray,
] (0,0) rectangle (2,1);
```
## Coordinate Systems
```latex
% Cartesian (default)
(2, 3)
% Polar (angle:radius)
(45:2cm)
% Relative (shift from last point)
++(1,0) % move reference point
+(1,0) % don't move reference point
% Named
\coordinate (A) at (1,2);
\draw (A) -- (2,3);
% Intersection (calc library)
\usetikzlibrary{calc}
($(A)!0.5!(B)$) % midpoint of A and B
($(A)!0.5!90:(B)$) % midpoint rotated 90°
($(A) + (1,2)$) % A shifted by (1,2)
($(A)!1cm!(B)$) % 1cm from A toward B
% Perpendicular coordinates (A -| B) = (x of B, y of A)
(A |- B) % (x of A, y of B)
% Barycentric
(barycentric cs:A=1,B=1,C=1) % centroid
```
## Nodes
### Basic Nodes
```latex
\node (name) at (0,0) {Text};
% Node options
\node[
draw, % draw border
fill=yellow!20,
rectangle, % shape (default)
circle,
ellipse,
rounded corners,
minimum width=2cm,
minimum height=1cm,
inner sep=5pt, % padding
outer sep=2pt, % margin
text=red,
font=\bfseries\small,
align=center, % for multi-line: use \\ in text
text width=3cm,
anchor=north, % positioning anchor
rotate=45,
] (mynode) at (1,2) {Hello\\World};
```
### Node Anchors
```
north west north north east
┌──────────┐
west │ center │ east
└──────────┘
south west south south east
```
Also: `base`, `mid`, `text`, and angle anchors like `45`, `135`.
### Nodes on Paths
```latex
\draw (0,0) -- node[above] {label} (3,0);
\draw (0,0) -- node[midway, sloped, above] {sloped text} (3,2);
\draw (0,0) -- node[pos=0.3, below] {at 30\%} (3,0);
\draw (0,0) to[out=90,in=0] node[near start, left] {A} (2,2);
```
### Common Shapes (requires libraries)
```latex
\usetikzlibrary{shapes.geometric, shapes.misc}
\node[diamond, draw] {D};
\node[star, draw, star points=5] {S};
\node[regular polygon, regular polygon sides=6, draw] {Hex};
\node[trapezium, draw] {T};
\node[cylinder, draw, shape border rotate=90] {DB};
\node[cloud, draw, cloud puffs=10] {Cloud};
\node[cross out, draw] at (0,0) {};
\node[strike out, draw] at (0,0) {};
```
## Arrows
```latex
\usetikzlibrary{arrows.meta}
% Arrow tips (arrows.meta syntax)
\draw[->] (0,0) -- (1,0); % default
\draw[-Stealth] (0,0) -- (1,0); % filled triangle
\draw[-Latex] (0,0) -- (1,0); % larger filled
\draw[-{Stealth[length=5mm]}] (0,0) -- (1,0);
\draw[{Latex[red]}-{Latex[blue]}] (0,0) -- (1,0); % colored
\draw[-{>[scale=2]}] (0,0) -- (1,0);
% Common tips: >, Stealth, Latex, To, Circle, Square, |, Hooks
% Modifiers: [length=..], [width=..], [open], [fill=..], [scale=..]
```
## Styles
```latex
% Define in preamble or tikzpicture options
\tikzset{
mybox/.style = {draw, fill=blue!20, rounded corners, minimum width=2cm},
myarrow/.style = {-Stealth, thick, red},
highlight/.style = {fill=yellow, draw=orange, line width=2pt},
}
% Use
\node[mybox] {Box};
\draw[myarrow] (0,0) -- (1,1);
% Style with parameters
\tikzset{
box/.style = {draw, fill=#1!20, minimum width=1.5cm},
box/.default = blue,
}
\node[box] {Blue}; % default
\node[box=red] {Red}; % override
% every node/.style applies to all nodes
\begin{tikzpicture}[every node/.style={font=\small}]
```
## Foreach Loops
```latex
% Basic
\foreach \x in {0,1,2,3}
\draw (\x, 0) circle (0.3);
% With step
\foreach \x in {0,0.5,...,3}
\fill (\x,0) circle (1pt);
% Multiple variables
\foreach \x/\y in {0/A, 1/B, 2/C}
\node at (\x, 0) {\y};
% Counter
\foreach \x [count=\i] in {a,b,c,d}
\node at (\i, 0) {\x};
% Evaluate
\foreach \x [evaluate=\x as \y using \x*\x] in {1,...,5}
\fill (\x, \y/5) circle (2pt);
% Remember
\foreach \x [remember=\x as \lastx (initially 0)] in {1,...,5}
\draw (\lastx, 0) -- (\x, 0);
```
## Scopes and Transformations
```latex
\begin{tikzpicture}
\draw (0,0) -- (1,0);
\begin{scope}[shift={(2,0)}, rotate=45, scale=0.5, red, thick]
\draw (0,0) -- (1,0) -- (1,1) -- cycle;
\end{scope}
% Transformations
% shift={(x,y)}, xshift=1cm, yshift=2cm
% rotate=45, rotate around={45:(1,1)}
% scale=2, xscale=2, yscale=0.5
% xslant=0.5, yslant=0.5
\end{tikzpicture}
```
## Clipping
```latex
\begin{tikzpicture}
\clip (0,0) circle (1.5cm);
% Everything below is clipped to the circle
\fill[blue!30] (-2,-2) rectangle (2,2);
\draw[step=0.5, gray] (-2,-2) grid (2,2);
\end{tikzpicture}
```
## Layers (backgrounds library)
```latex
\usetikzlibrary{backgrounds}
\begin{tikzpicture}
\node[draw, fill=white] (A) {Foreground};
\begin{pgfonlayer}{background}
\fill[yellow!30] (A.south west) rectangle (A.north east);
\end{pgfonlayer}
\end{tikzpicture}
```
## Pics
```latex
\tikzset{
myshape/.pic = {
\draw (-0.5,-0.5) rectangle (0.5,0.5);
\draw (0,0) circle (0.3);
}
}
\begin{tikzpicture}
\pic at (0,0) {myshape};
\pic[rotate=45, scale=1.5] at (2,0) {myshape};
\end{tikzpicture}
```
## Decorations
```latex
\usetikzlibrary{decorations.pathmorphing, decorations.markings, decorations.text}
% Wavy/zigzag lines
\draw[decorate, decoration={zigzag, amplitude=2mm, segment length=5mm}]
(0,0) -- (4,0);
\draw[decorate, decoration={snake, amplitude=1mm}]
(0,0) -- (4,0);
\draw[decorate, decoration={coil, aspect=0.5}]
(0,0) -- (4,0);
\draw[decorate, decoration={random steps, segment length=3mm}]
(0,0) -- (4,0);
% Brace
\draw[decorate, decoration={brace, amplitude=5pt}]
(0,0) -- (3,0) node[midway, above=5pt] {label};
% Text along path
\draw[decorate, decoratioRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.