Skip to content

Commit 9e82d6a

Browse files
committed
Document registry config and add cache TTL
1 parent d37ca41 commit 9e82d6a

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<p align="center">
44
<a href="https://github.com/majiayu000/caude-skill-manager/releases"><img src="https://img.shields.io/github/v/release/majiayu000/caude-skill-manager?style=flat-square" alt="Release"></a>
5-
<img src="https://img.shields.io/badge/Go-1.21+-00ADD8?style=flat-square&logo=go" alt="Go">
5+
<img src="https://img.shields.io/badge/Go-1.25+-00ADD8?style=flat-square&logo=go" alt="Go">
66
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" alt="License">
77
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs Welcome">
88
</p>
@@ -20,7 +20,7 @@
2020
## Why sk?
2121

2222
- 🚀 **One-command install**`sk install user/repo`
23-
- 🔄 **Batch update**`sk update` to update all skills
23+
- 🔄 **Batch update**`sk update` (coming soon)
2424
- 🔍 **Smart search**`sk search testing`
2525
- 🩺 **Health check**`sk doctor` to find issues
2626
- 🎨 **Beautiful TUI** — Built with [Charm](https://charm.sh)
@@ -55,6 +55,9 @@ sk install anthropics/skills/docx
5555
sk install obra/superpowers
5656
sk install https://github.com/user/repo
5757

58+
# Install a skill by registry name
59+
sk install docx
60+
5861
# List installed skills
5962
sk list
6063

@@ -120,6 +123,9 @@ Anthropic Official (anthropics/skills)
120123
## Supported Sources
121124

122125
```bash
126+
# From registry by name
127+
sk install docx
128+
123129
# Short format
124130
sk install owner/repo # Entire repo
125131
sk install owner/repo/path # Subdirectory (monorepo)
@@ -152,10 +158,14 @@ Config file: `~/.skrc`
152158
```json
153159
{
154160
"skills_dir": "~/.claude/skills",
155-
"registry": "github"
161+
"registry": "https://raw.githubusercontent.com/majiayu000/claude-skill-registry/main"
156162
}
157163
```
158164

165+
Registry cache:
166+
- Location: `~/.cache/sk/registry.json`
167+
- TTL: 24 hours (cache is ignored after expiry)
168+
159169
## Built With
160170

161171
- [Cobra](https://github.com/spf13/cobra) — CLI framework

internal/registry/registry.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
const (
1616
// DefaultRegistryURL is the base URL for the skill registry
1717
DefaultRegistryURL = "https://raw.githubusercontent.com/majiayu000/claude-skill-registry/main"
18+
registryCacheTTL = 24 * time.Hour
1819
)
1920

2021
// Registry represents the skill registry
@@ -234,6 +235,14 @@ func ResolveInstall(name string) (string, RegistrySource, error) {
234235

235236
func loadRegistryCache() (*Registry, error) {
236237
path := config.RegistryCachePath()
238+
info, err := os.Stat(path)
239+
if err != nil {
240+
return nil, err
241+
}
242+
if time.Since(info.ModTime()) > registryCacheTTL {
243+
return nil, fmt.Errorf("registry cache expired")
244+
}
245+
237246
data, err := os.ReadFile(path)
238247
if err != nil {
239248
return nil, err

0 commit comments

Comments
 (0)