Skip to content

feat: migrate skill ledger to lowdb and unify skills directory#317

Merged
alchemistklk merged 2 commits intomainfrom
feat/skillhub-lowdb-enhancements
Mar 20, 2026
Merged

feat: migrate skill ledger to lowdb and unify skills directory#317
alchemistklk merged 2 commits intomainfrom
feat/skillhub-lowdb-enhancements

Conversation

@alchemistklk
Copy link
Copy Markdown
Contributor

Summary

  • Replace sql.js with lowdb (JSON-based) for the skill installation ledger
  • Unify all skills (curated, managed, custom) into a single skillsDir — the DB source field is the only differentiator
  • Add zip-based custom skill import (POST /api/v1/skillhub/import)
  • Add filesystem watcher to detect skills installed/uninstalled by the OpenClaw agent
  • Remove OpenClawSkillsWriter which was deleting SkillHub-installed skills during config sync
  • Frontend: source-based filter tabs (All/Recommended/Installed), download count fallback, Explore sorted by downloads desc

Changes

Controller

  • skill-db.ts: Rewritten from sql.js to lowdb with LowSync + AtomicJsonFileSync, Zod validation, legacy sqlite migration via sqlite3 CLI
  • catalog-manager.ts: Single skillsDir for all skills, DB ledger as sole source of truth for getCatalog(), download fallback (1k), installed skills sorted by installedAt ASC, zip import method, filesystem watcher, junk directory cleanup
  • curated-skills.ts: curatedDirtargetDir param rename (all installs target skillsDir)
  • skillhub-service.ts: Async factory (static create()), watcher started after reconcile
  • zip-importer.ts: New — extracts zip, validates SKILL.md, slug validation/slugify, zip-slip defense, 50MB size limit
  • skillhub-routes.ts: Updated schemas (custom source, installedAt), download fallback in detail route, new POST /import endpoint
  • openclaw-skills-writer.ts: Deleted — was deleting SkillHub skills during doSync()
  • env.ts: skillDbPath changed to .json, OPENCLAW_STATE_DIR default aligned with desktop layout

Frontend

  • skills.tsx: Yours sub-tabs filter by source (Recommended = curated+managed, Installed = custom), Explore sorted by downloads desc, Import button with file picker
  • desktop.d.ts: Added custom to SkillSource, installedAt to InstalledSkill
  • use-community-catalog.ts: Added useImportSkill hook

Known limitations

  • Agent-installed skills via clawhub install land in agent workspace, not shared skillsDir (documented in docs/plans/2026-03-20-skillhub-known-limitations.md)

Test plan

  • pnpm typecheck passes
  • pnpm build passes
  • pnpm test passes (32/32, 1 pre-existing home.test failure)
  • pnpm start — all 24 curated skills install into skillsDir
  • Install from Explore tab — skill appears in Yours, recorded as managed
  • Uninstall — skill removed from disk and DB
  • Import zip — skill appears as custom source
  • Agent installs skill externally — watcher detects and records in DB
  • Verify on packaged desktop build (pnpm dist:mac:unsigned)

🤖 Generated with Claude Code

…ctory

- Replace sql.js with lowdb (LowSync + atomic JSON file) for the skill ledger
- Add "custom" source type to SkillSource for zip-imported skills
- Unify all skills (curated, managed, custom) into single skillsDir
- DB ledger is the single source of truth; source field categorizes skills
- Add installedAt field for sorting installed skills by install time
- Add download count fallback (1k for zero-download marketplace skills, 0 for custom)
- Add POST /api/v1/skillhub/import endpoint for zip file upload
- Add file watcher on skillsDir to detect agent-installed skills
- Remove OpenClawSkillsWriter (was deleting SkillHub-installed skills during sync)
- Frontend: filter chips (All/Recommended/Installed) by source, tab count bug fix
- Frontend: Explore tab sorted by downloads desc, Import button wired up
- Support multiline YAML description parsing in SKILL.md frontmatter
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 20, 2026

Deploying nexu-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9471bcf
Status: ✅  Deploy successful!
Preview URL: https://16cb2965.nexu-docs.pages.dev
Branch Preview URL: https://feat-skillhub-lowdb-enhancem.nexu-docs.pages.dev

View logs

@alchemistklk
Copy link
Copy Markdown
Contributor Author

/cr

@slack-code-review-channel
Copy link
Copy Markdown

✅ CR topic created in Feishu topic group Refly CR.

@alchemistklk alchemistklk merged commit 6bbfc67 into main Mar 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants