Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AIPexStudio AIPex SkillStorage saveSkill

From Leeroopedia
Knowledge Sources
Domains Package_Management, Browser_Storage
Last Updated 2026-10-24 12:00 GMT

Overview

Concrete storage method that accepts a ZIP blob, extracts it into ZenFS virtual storage, and persists skill metadata to IndexedDB.

Description

The SkillStorage.saveSkill method handles the skill upload pipeline. It parses metadata from the ZIP (via `parseSkillMetadataFromZip`), uses the skill name as ID, checks for conflicts (throwing `SkillConflictError` if exists and not replacing), optionally deletes existing skill files, extracts the ZIP directly to ZenFS via `extractZipToFS`, creates lightweight metadata, and persists it to an IndexedDB store (`AIPexSkills` database). The `SkillStorage` class manages an IndexedDB connection with a `skills` object store indexed by name and enabled status.

Usage

  • Upload skill: `await skillStorage.saveSkill(zipBlob)` (throws on conflict)
  • Replace skill: `await skillStorage.saveSkill(zipBlob, true)` (overwrites)
  • List skills: `const skills = await skillStorage.listSkills()`

Code Reference

Source Location

  • Repository: AIPex
  • File: packages/browser-runtime/src/skill/lib/storage/skill-storage.ts
  • Lines: L155-300 (saveSkill), L166-188 (initialize), L655 (singleton)
  • Support: packages/browser-runtime/src/skill/lib/utils/zip-utils.ts:L1-288 (extractZipToFS, parseSkillMetadataFromZip)

Signature

export class SkillStorage {
  async initialize(): Promise<void>
  async saveSkill(zipBlob: Blob, replace?: boolean): Promise<SkillMetadata>
  async listSkills(): Promise<SkillMetadata[]>
}

interface SkillMetadata {
  id: string;
  name: string;
  description: string;
  enabled: boolean;
  // ...
}

// Singleton: export const skillStorage = new SkillStorage();

Import

import { skillStorage } from "@aipexstudio/browser-runtime";

I/O Contract

Inputs

Name Type Required Description
zipBlob ArrayBuffer Yes Skill package ZIP file
replace boolean No Overwrite if skill exists (default false)

Outputs

Name Type Description
returns SkillMetadata Metadata for the saved skill

Usage Examples

Upload Skill ZIP

import { skillStorage } from "@aipexstudio/browser-runtime";

await skillStorage.initialize();

// Upload from file input
const file = fileInput.files[0];
const metadata = await skillStorage.saveSkill(file);
console.log("Skill saved:", metadata.name);

// Replace existing
await skillStorage.saveSkill(updatedZipBlob, true);

List All Skills

const skills = await skillStorage.listSkills();
console.log(`${skills.length} skills installed`);
for (const skill of skills) {
  console.log(`- ${skill.name} (${skill.enabled ? "enabled" : "disabled"})`);
}

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment