cache-ttl
Skill0 starsChanged 2 months agoMITView on GitHub
Flip Claude Code's prompt-cache TTL between 5m and 1h via env.ENABLE_PROMPT_CACHING_1H in settings.json. Use on "프롬프트 캐시 1시간으로", "cache TTL 5분으로 되돌려", "/claudecode:cache-ttl". Other settings.json keys: the built-in `update-config`. Model: `/model`.
- Reads credentials
In this repository3 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- statusline-setupSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
If the argument is -h, --help, or help, read references/help.md and follow it, then stop.
- Very specific: line 54
Do not hand-write jq or sed against settings.json instead.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Prompt Cache TTL Switch
Writes one key in settings.json. Everything else in that file is preserved.
Help
If the argument is -h, --help, or help, read references/help.md and
follow it, then stop.
Step 1: Pick the mode
| User says | Mode |
| "1시간", "1h", "long cache", "extend the cache" | 1h |
| "5분", "5m", "기본값", "back to default", "turn it off" | 5m |
| nothing recognisable | ask which one; do not guess |
Step 2: Run the script
Paste the locator block from references/run-script.md (the only place this skill spells the path), then:
sh "$_CC" 1h
sh "$_CC" 5m| Option | Description | Default |
1h | set env.ENABLE_PROMPT_CACHING_1H to "1" | — |
5m | delete the key (5-minute default cache) | yes — used when no argument is given |
The script targets ${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json, so a
multi-account setup switches accounts by exporting CLAUDE_CONFIG_DIR before
the call.
Do not hand-write jq or sed against settings.json instead. The script
is the contract; a one-off edit is how an unrelated key gets dropped.
Step 3: Report
On exit 0, print [OK] followed by the script's own three lines verbatim:
[OK] cache TTL: 5m -> 1h (env.ENABLE_PROMPT_CACHING_1H: (unset) -> 1)
file: /home/you/.claude/settings.json
Restart Claude Code to pick it up.On any non-zero exit, print [FAIL] exit=<n> and relay the script's stderr
verbatim, then stop — see Failure modes.
What the script does
1h->.env.ENABLE_PROMPT_CACHING_1H = "1"5m-> deletes that key, and drops.enventirely if it becomes empty- missing
settings.json-> creates{}first, then patches - reads to a temp file and
mvs it into place, so ajqfailure cannot truncate the real file
Failure modes — read the exit, do not work around it
| Exit | Meaning | Correct response |
| 2 | argument was neither 1h nor 5m | re-read Step 1 and re-run |
| 3 | jq not on PATH | relay the install hint the script printed; stop |
| 4 | settings.json is not valid JSON | a .bak copy was saved and nothing was written; refusing to touch broken JSON is the feature, not a bug — tell the user to fix the JSON, never rewrite it with sed or python -c |
Constraints
- Touches exactly one key. Never edit
model,hooks,permissions, orstatusLinefrom this skill. - Requires
jq. There is no degraded mode. - Self-contained: the script depends on nothing outside this skill directory.
Related Skills
claudecode:statusline-setup installs the status line into the same
settings.json using the same lossless merge.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

