Agent skill

Agent Restore Context Setup

by commercetools in commercetools/ui-kit

Set up the restore-context hook so skills can resume workflows after /clear and /compact.

MITAuto-check: notesFrontend & Design

Install Agent Restore Context Setup

skills CLI
$ npx skills add commercetools/ui-kit --skill agent-restore-context-setup -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install commercetools/ui-kit agent-restore-context-setup --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/commercetools/ui-kit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/agent-restore-context-setup .claude/skills/agent-restore-context-setup && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
agent-restore-context-setup
GitHub stars
154
Token cost
~1.4k tokens
SKILL.md length
623 words
Files
2
Skills in repo
11
Repo updated
First seen
Licence
MIT

At a glance

Set up the restore-context hook so skills can resume workflows after /clear and /compact.

  • Works in 6 steps: Detect Layout → Check if Already Configured → Locate the Hook Script → …
  • Setting up a new project
  • SKILL.md covers How It Works, Process and Guidelines
  • Runs Shell scripts from its folder; calls git

What it does

Agent Restore Context Setup is an agent skill from commercetools/ui-kit. Set up the restore-context hook so skills can resume workflows after /clear and /compact. Use when setting up a new project or after cloning a repo that uses restore-context skills.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `resources/agent-restore-context.sh`).

It sits in Frontend & Design, covering Design systems. The licence is MIT.

When your agent uses it

  • Setting up a new project
  • After cloning a repo that uses restore-context skills

Example prompts

  • “/agent-restore-context-setup”

Requirements

  • A Bash shell
  • Pre-approved tools (allowed-tools): Bash, Grep, Glob, Read, Edit, Write

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Detect Layout
  2. Check if Already Configured
  3. Locate the Hook Script
  4. Register the Hook
  5. Add Gitignore Entry
  6. Confirm

What it can do on your machine

Read from SKILL.md and the folder at commit 62ca335. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash
    • Grep
    • Glob
    • Read
    • Edit
    • Write

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Agent Restore Context Setup loads about 1.4k tokens when it runs. Until then it costs about 52 tokens; SKILL.md has 623 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~52
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Bash, Grep, Glob, Read, Edit, Write

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from commercetools/ui-kit at commit 62ca335, republished under its MIT licence (© commercetools). 623 words, ~1,390 tokens.

Download SKILL.mdSave it as .claude/skills/agent-restore-context-setup/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
agent-restore-context-setup
description
Set up the restore-context hook so skills can resume workflows after /clear and /compact. Use when setting up a new project or after cloning a repo that uses restore-context skills.
allowed-tools
Bash, Grep, Glob, Read, Edit, Write
disable-model-invocation
false
scope
knowledge

Setup Restore Context

Set up a generic SessionStart hook that re-injects context after /clear or /compact. Any skill that writes a .agent-restore-context-<name> file in the project root will have its contents automatically injected into the fresh conversation.

How It Works

  1. Skills write .agent-restore-context-<skill-name> files with resume prompts.
  2. A SessionStart hook with matcher clear|compact runs agent-restore-context.sh.
  3. The script globs for .agent-restore-context-* and outputs their contents.
  4. The model receives that output and follows the resume instructions.
  5. Skills manage their own file lifecycle (write/delete).

Security: The contents of .agent-restore-context-* files are injected verbatim into the model's context on every session start after /clear or /compact. Treat these files with the same trust as other executable config. Only skills running in your project should write them — this is why the .gitignore entry in step 5 is important.

Process

1. Detect Layout

Determine which configuration layer the project uses:

CheckLayoutSkills directory
.agents/ directory existsagents.agents/skills/
Only .claude/ existsclaude.claude/skills/

Settings files always live under .claude/ regardless of layout.

Note: When installed via the skills CLI targeting the Claude Code agent, the skill is placed under .claude/skills/. When targeting a universal agent (Amp, Cline, Cursor, etc.), it is placed under .agents/skills/.

2. Check if Already Configured

Read .claude/settings.json and .claude/settings.local.json (if it exists). Search both for restore-context. If found in either file, report that the hook is already configured and stop.

3. Locate the Hook Script

Find the script by checking both potential locations in order:

  1. .claude/skills/agent-restore-context-setup/resources/agent-restore-context.sh
  2. .agents/skills/agent-restore-context-setup/resources/agent-restore-context.sh

Use whichever path exists. If neither exists, stop and report that the skill files could not be found — the user may need to re-install the skill.

Verify the script is executable. If not executable, run chmod +x.

Optional — symlink for dual-layout projects: If both .claude/skills/ and .agents/skills/ directories exist but the skill is only in one of them, you may create a symlink at the missing location so both layouts share a single copy. For example, if the script was found under .claude/skills/, create a symlink under .agents/skills/:

bash
ln -s ../../.claude/skills/agent-restore-context-setup \
      .agents/skills/agent-restore-context-setup

Reverse the paths if the script was found under .agents/skills/ instead. This is optional — the hook only needs the one resolved path to work.

4. Register the Hook
Show full SKILL.md (249 more words)Show less
Choose settings file

Ask the user:

"Should I add the restore-context hook to .claude/settings.json (shared — committed to the repo, takes effect for all teammates once pushed) or .claude/settings.local.json (local only — never committed, affects only your machine)?"

Recommendation: choose settings.json if you want the whole team to benefit from the hook. Choose settings.local.json if you are the only one who will use this workflow, or if teammates install their skills to different paths.

If the chosen settings file does not exist, create it as an empty JSON object ({}) before merging.

Use the resolved script path from step 3 (relative to the project root), then merge the following into the chosen file's hooks object. Do not overwrite existing hooks — add to or create the SessionStart array:

json
{
  "SessionStart": [
    {
      "matcher": "clear|compact",
      "hooks": [
        {
          "type": "command",
          "command": "bash <resolved-script-path>"
        }
      ]
    }
  ]
}

Where <resolved-script-path> is the relative path found in step 3, e.g. .claude/skills/agent-restore-context-setup/resources/agent-restore-context.sh or .agents/skills/agent-restore-context-setup/resources/agent-restore-context.sh.

5. Add Gitignore Entry

Check .gitignore for .agent-restore-context-*. If the pattern is already present, skip this step. If .gitignore does not exist, check whether the project is a git repo (git rev-parse --is-inside-work-tree). If it is, create .gitignore; if not, skip this step entirely. Once the file exists, append:

# Restore context files (used by skills to resume workflows after /clear and /compact)
.agent-restore-context-*
6. Confirm

Report to the user:

  • Where the hook was registered (which settings file)
  • The path to the script
  • That any skill can now write .agent-restore-context-<name> files to use this pattern

Guidelines

  • Always read target files before modifying them
  • Do not create .agents/ or .agents/skills/ directories — only use them if they already exist
  • This skill is idempotent — safe to run multiple times

© commercetools, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in .agents/skills/agent-restore-context-setup of commercetools/ui-kit.

  • SKILL.md
  • resources/agent-restore-context.sh

Open the folder on GitHubat commit 62ca335

Compare with similar skills

Agent Restore Context Setup next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Agent Restore Context Setup compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Agent Restore Context Setup this skillcommercetools/ui-kit154—~1.4kAutomated safety check: NotesMIT
Impeccablebestofjs/bestofjs3.1k27 repos~2.6kAutomated safety check: PassMIT
Figma Design System Builderwarpdotdev/warp65k2 repos~4.4kAutomated safety check: PassAGPL-3.0
Figma use_figma Plugin API Ruleswarpdotdev/warp65k4 repos~4.4kAutomated safety check: PassAGPL-3.0
UI StylingOhh-889/skyroc79513 repos~2.5kAutomated safety check: PassMIT
Shadcnsupabase/evals14342 repos~4.5kAutomated safety check: PassApache-2.0

Similar skills

  • Impeccable

    bestofjs/bestofjs

    A skill your agent uses when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a…

    3.1k GitHub starsUsed in 27 repos~2.6k tokens
    Frontend & DesignAuto-check passed
  • Builds or updates a design system in Figma from a codebase in ordered phases: discovery, variables and tokens, components, theming and documentation, with checkpoints.

    65k GitHub starsUsed in 2 repos~4.4k tokens
    Frontend & DesignAuto-check passed
  • Required groundwork before any use_figma call: the rules and reference files for running JavaScript in a Figma file through the Plugin API without common failures.

    65k GitHub starsUsed in 4 repos~4.4k tokens
    Frontend & DesignAuto-check passed
  • UI Styling

    Ohh-889/skyroc

    Create beautiful, accessible user interfaces with shadcn/ui components (built on Radix UI + Tailwind), Tailwind CSS utility-first styling, and canvas-based visual designs.

    795 GitHub starsUsed in 13 repos~2.5k tokens
    Frontend & DesignAuto-check passed
  • Shadcn

    supabase/evals

    Official

    Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI.

    143 GitHub starsUsed in 42 repos~4.5k tokens
    Frontend & DesignAuto-check passed
  • Design System

    Ohh-889/skyroc

    Token architecture, component specifications, and slide generation.

    795 GitHub starsUsed in 11 repos~1.7k tokens
    Frontend & DesignAuto-check passed

More from commercetools/ui-kit

All 11 skills in this repo
  • Agent Restore Context

    commercetools/ui-kit

    Manage restore context files so skills can survive /clear and /compact.

    154 GitHub stars~944 tokensUpdated 4 days ago
    Auto-check: notes
  • PR Review Navigator

    commercetools/ui-kit

    Generate AI-assisted navigation aids to help humans start reviewing a pull request more efficiently.

    154 GitHub stars~1.3k tokensUpdated 4 days ago
    Auto-check: notes
  • Remember

    commercetools/ui-kit

    Persist guidelines, conventions, and architectural decisions into the repository's knowledge base.

    154 GitHub stars~2k tokensUpdated 4 days ago
    Auto-check: notes
  • Renovate Review

    commercetools/ui-kit

    Review Renovate dependency upgrade PRs to assess safety and effort.

    154 GitHub stars~907 tokensUpdated 4 days ago
    Auto-check: notes
  • Repo Healthcheck Node

    commercetools/ui-kit

    Verify a Node.js/TypeScript repo's development environment is correctly set up.

    154 GitHub stars~1.6k tokensUpdated 4 days ago
    Auto-check: notes
  • Repo Maintenance Node

    commercetools/ui-kit

    Perform a broad Node/TypeScript repository health sweep — formatting, linting, type errors, dead code, dependency hygiene, and open Renovate PRs.

    154 GitHub stars~3k tokensUpdated 4 days ago
    Auto-check: notes

Questions about Agent Restore Context Setup

What does Agent Restore Context Setup do?

Set up the restore-context hook so skills can resume workflows after /clear and /compact. Agent Restore Context Setup is an agent skill from commercetools/ui-kit. Set up the restore-context hook so skills can resume workflows after /clear and /compact.

When should I use Agent Restore Context Setup?

Agent Restore Context Setup fits situations like: setting up a new project; after cloning a repo that uses restore-context skills.

How do I install Agent Restore Context Setup in Claude Code?

Run `npx skills add commercetools/ui-kit --skill agent-restore-context-setup -a claude-code`. Or copy the skill folder (.agents/skills/agent-restore-context-setup in commercetools/ui-kit) into .claude/skills/agent-restore-context-setup in your project. Claude Code loads it when a task matches its description.

How do I install Agent Restore Context Setup in Codex?

Run `npx skills add commercetools/ui-kit --skill agent-restore-context-setup -a codex`. Or copy the skill folder (.agents/skills/agent-restore-context-setup in commercetools/ui-kit) into .agents/skills/agent-restore-context-setup in your project. Codex loads it when a task matches its description.

Can I use Agent Restore Context Setup in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add commercetools/ui-kit --skill agent-restore-context-setup -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/agent-restore-context-setup, .gemini/skills/agent-restore-context-setup, .github/skills/agent-restore-context-setup and .opencode/skills/agent-restore-context-setup in your project.

What does Agent Restore Context Setup need to run?

Going by SKILL.md and its folder, Agent Restore Context Setup needs a shell for the scripts in its folder and the command-line tools its instructions call (git). Our summary lists: A Bash shell. Its frontmatter pre-approves these tools: Bash, Grep, Glob, Read, Edit, Write.

Does Agent Restore Context Setup access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Agent Restore Context Setup safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Agent Restore Context Setup use?

Agent Restore Context Setup is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Agent Restore Context Setup use?

About 1.4k tokens (SKILL.md is roughly 5.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Agent Restore Context Setup?

Skills that share tags, products or a category with Agent Restore Context Setup: Impeccable (bestofjs/bestofjs, 3.1k stars), Figma Design System Builder (warpdotdev/warp, 65k stars), Figma use_figma Plugin API Rules (warpdotdev/warp, 65k stars) and UI Styling (Ohh-889/skyroc, 795 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Agent Restore Context Setup?

commercetools (a GitHub organization) maintains it in commercetools/ui-kit, which has 154 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on October 3, 2026.

Source: commercetools/ui-kit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.