plugin-data-storage
Canonical reference for where Claude Code plugins should persist user data.
Skill by danielrosehill
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/danielrosehill-plugin-data-storage
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: data, writing, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/plugin-data-storage
What's inside
- Skill name
plugin-data-storage- Description
- Canonical reference for where Claude Code plugins should persist user data. Defines the CLAUDE_USER_DATA convention, resolution order, and forbidden locations. Use this skill whenever designing or updating a plugin's onboarding flow, preferences storage, or persistent-state handling — and whenever Claude is tempted to write under ~/.claude/.
- License
- MIT
- Instructions
- 98 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Plugin User-Data Storage — Canonical Reference
This skill is the authoritative rule for where Daniel-authored Claude Code plugins persist user data. Every plugin's onboarding, preferences, and state-storage logic should follow the convention defined here.
## TL;DR
**Never write plugin data under `~/.claude/`.** That directory is Claude Code's own config surface; `~/.claude/plugins/<plugin>/` in particular is the plugin install directory and is overwritten on every plugin update.
Resolve the base data directory like this:
```
${CLAUDE_USER_DATA:-${XDG_DATA_HOME:-$HOME/.local/share}/claude-plugins}/<plugin-name>/
```
## The `CLAUDE_USER_DATA` convention
`CLAUDE_USER_DATA` is the single env var that controls where plugin-owned persistent data lives. If the user sets it, everything relocates there (useful for backups, Dropbox sync, external drives). If unset, the resolution falls through to XDG, then to `~/.local/share/claude-plugins/`.
Resolution order, in the exact form plugins should use:
1. `$CLAUDE_USER_DATA` if set → `$CLAUDE_USER_DATA/<plugin-name>/`
2. Else `$XDG_DATA_HOME` if set → `$XDG_DATA_HOME/claude-plugins/<plugin-name>/`
3. Else default → `$HOME/.local/share/claude-plugins/<plugin-name>/`
On macOS and Windows, the XDG fallback is conventional (most tools honour it on macOS; on Windows, `%APPDATA%\claude-plugins\<plugin>\` is acceptable if XDG isn't set).
### Shell snippet (for commands that need to resolve the path)
```bash
PLUGIN_NAME="<plugin-name>"
PLUGIN_DATA_DIR="${CLAUDE_USER_DATA:-${XDG_DATA_HOME:-$HOME/.local/share}/claude-plugins}/$PLUGIN_NAME"
mkdir -p "$PLUGIN_DATA_DIR"
```
### Prose form (for skills and commands written in markdown)
> Resolve the plugin's data directory as `$CLAUDE_USER_DATA/<plugin-name>/` if `CLAUDE_USER_DATA` is set; otherwise `$XDG_DATA_HOME/claude-plugins/<plugin-name>/` if `XDG_DATA_HOME` is set; otherwise `~/.local/share/claude-plugins/<plugin-name>/`. Create the directory if it doesn't exist.
## Standard subdirectory layout
Inside `<plugin-data-dir>/`:
| Subpath | Purpose |
|---|---|
| `config.json` | Small pointers and settings (e.g., path to user-owned data repo) |
| `data/` | Plugin-owned user data, if the plugin is the owner |
| `cache/` | Regenerable — safe to delete |
| `state/` | Runtime state that should persist across sessions |
Not every plugin needs all four — use only what applies.
## When the user owns the data in their own location
Many plugins (Resume-Typesetter, Budgeting, Purchasing workspaces) operate on data that lives in a user-chosen location — a GitHub repo, `~/Documents/...`, or `~/repos/...`. The rule:
- **Ask the user during onboarding** where the data should live.
- Default suggestions should be under `~/Documents/` or `~/repos/` — **never** under `~/.claude/` and **never** under the plugin's data dir.
- The plugin's `config.json` (in the plugin data dir) stores the pointer to the user's chosen path.
## Legitimate reads of `~/.claude/` (allowed)
Plugins MAY read (never write) from:
- `~/.claude/CLAUDE.md` — user's global context, useful for personalising generated workspaces.
- `~/.claude/settings.json` — Claude Code settings, for MCP config inspection.
- `~/.claude/context/` — chunked global context files.
The `user-context-file` plugin is the only exception that *writes* to `~/.claude/CLAUDE.md` — that's its entire purpose.
## Forbidden patterns
| Pattern | Why forbidden |
|---|---|
| `~/.claude/plugins/<plugin>/config.json` | Install directory — overwritten on plugin update. Data loss. |
| `~/.claude/plugins/<plugin>/data/...` | Same as above. |
| `~/.claude/<plugin>-preferences.md` | Clutters Claude Code config surface; inconsistent; hard to back up. |
| `~/.claude/<plugin>/...` | Same as above. |
| `~/.claude/data/...` | Same as above. |
## Migration from legacy paths
Plugins previously wrote to forbidden locations. Onboarding flows should include a migration block:
1. Resolve the new path per the convention above.
2. Check each legacy path (`~/.claude/plugins/<plugin>/config.json`, `~/.claude/<plugin>-preferences.md`, etc.).
3. If a legacy file exists AND the new path is empty, move the file to the new location.
4. After successful move, delete the legacy file (do not leave stubs — the legacy path was never a stable home).
5. Log the migration to the user: "Moved <file> from <old> to <new>."
## Backup guidance for users
Because all plugin data lives under one root (`$CLAUDE_USER_DATA` or `~/.local/share/claude-plugins/`), users can back up every plugin's state with a single directory target. Documentation should mention this when relevant.
## Upstream context
This convention exists to work around Anthropic bug [#51342](https://github.com/anthropics/claude-code/issues/51342) — Claude Code itself suggests inconsistent paths under `~/.claude/` for plugin data, creating update-clobber risk. If Anthropic later blesses an official env var or path, this reference is the single place to update.From danielrosehill/Claude-Rudder, MIT.
More from danielrosehill/Claude-Rudder
- 0.470score
context-gate
danielrosehill
One-shot context-checkpoint workflow — when the current session is getting cluttered, write a structured handover plan capturing what's done and what's…
SkillAFreshness: A★ 2Claude Code +9 - 0.470score
save-plan
danielrosehill
Save a Claude Code plan (from ExitPlanMode, design discussion, or multi-step task) to persistent storage.
SkillAFreshness: A★ 2Claude Code +9 - 0.470score
context-workflow-reference
danielrosehill
Reference and worked example for the CONTEXT.md / CLAUDE.md two-file workflow.
SkillAFreshness: A★ 2Claude Code +9 - 0.470score
scaffold-planning
danielrosehill
Create a lightweight `planning/` folder in the current repo with leftover-tasks.md, blockers.md, session-logs/, and handovers/.
SkillAFreshness: A★ 2Claude Code +9 - 0.470score
install-from-github
danielrosehill
Use when the user points at a GitHub repo (an agent skill, MCP server, or "Claude plugin"-ish project) and wants to install or register it.
SkillAFreshness: A★ 2Claude Code +9 - 0.467score
setup-agent-logs
danielrosehill
First-run setup for the session log archive.
SkillAFreshness: A★ 2Claude Code +9 - 0.467score
extract-skill
danielrosehill
Synthesize a new SKILL.md from the procedure that was just followed in this session, so the next session can replay it without being briefed from scratch.
SkillAFreshness: A★ 2Claude Code +9 - 0.348score
log-blocker
danielrosehill
Append a known blocker to `<repo>/planning/blockers.md` (auto-scaffolds if missing).
SkillDFreshness: D★ 2Claude Code +9 - 0.348score
fork-new-direction
danielrosehill
Create a new repo that starts from the current repo's state but takes a new direction — copy the code, seed CLAUDE.md with the revised approach, and push.
SkillDFreshness: D★ 2Claude Code +9 - 0.348score
capture-leftover
danielrosehill
Capture a follow-up task that surfaced mid-flow but shouldn't distract from the current focus.
SkillDFreshness: D★ 2Claude Code +9 - 0.348score
mirror-to-private
danielrosehill
Create a private GitHub repo that mirrors the current public repo.
SkillDFreshness: D★ 2Claude Code +9 - 0.348score
repo-from-thread
danielrosehill
Create a new GitHub repo seeded with context from the current conversation.
SkillDFreshness: D★ 2Claude Code +9
Signals
- Stars
- 2
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 15, 2026 (13 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/danielrosehill/Claude-Rudder
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from danielrosehill
- 0.470score
save-plan
danielrosehill
Save a Claude Code plan (from ExitPlanMode, design discussion, or multi-step task) to persistent storage.
SkillAFreshness: A★ 2Claude Code +9 - 0.470score
scaffold-planning
danielrosehill
Create a lightweight `planning/` folder in the current repo with leftover-tasks.md, blockers.md, session-logs/, and handovers/.
SkillAFreshness: A★ 2Claude Code +9 - 0.470score
onboard
danielrosehill
First-run onboarding for the adb-ops plugin.
SkillAFreshness: A★ 2Claude Code +9 - 0.470score
context-gate
danielrosehill
One-shot context-checkpoint workflow — when the current session is getting cluttered, write a structured handover plan capturing what's done and what's…
SkillAFreshness: A★ 2Claude Code +9 - 0.470score
context-workflow-reference
danielrosehill
Reference and worked example for the CONTEXT.md / CLAUDE.md two-file workflow.
SkillAFreshness: A★ 2Claude Code +9 - 0.470score
install-from-github
danielrosehill
Use when the user points at a GitHub repo (an agent skill, MCP server, or "Claude plugin"-ish project) and wants to install or register it.
SkillAFreshness: A★ 2Claude Code +9
Cite this page
plugin-data-storage skill. Agent Mart. https://agentmart.dev/skills/danielrosehill-plugin-data-storage (last updated 2026-10-24)