mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-18 18:04:26 +00:00
fix(extension): local content extraction for Chrome Web Store approval (#76)
* fix(extension): replace server API with local content extraction Chrome Web Store rejected the extension because the core "Save page as Skill" feature called https://skillkit.sh/api/save-skill which is unreachable during review. This rewires page saving to work entirely locally using chrome.scripting.executeScript to extract page content (title, meta description, headings, body text) directly in the browser. - Remove API_URL and callSaveApi() server dependency - Add extractPageContent() via chrome.scripting.executeScript - Add detectTags() with weighted keyword scoring (URL/headings/body) - Add buildPageSkill() to generate SKILL.md with frontmatter locally - Add scripting permission to manifest - Pass tabId from popup to background for script injection targeting - Block chrome-extension:// and chromewebstore.google.com URLs - Add console.error logging in catch blocks for debuggability - Guard currentTabId validity in popup click handler - Update store listing to reflect fully local processing - Bump version to 1.20.0 * fix(extension): address code review findings for robustness - Extract RESTRICTED_PREFIXES and isRestricted() into shared constants.ts so popup and background use the same URL blocklist - Fix yamlEscape to quote YAML bare scalars (true/false/null/yes/no/on/off) and numeric strings that parsers would coerce to non-string types - Apply yamlEscape to skill name fields in both buildPageSkill and buildSelectionSkill to prevent YAML misinterpretation - Switch tag detection from substring matching to word-boundary regex to eliminate false positives (e.g. "js" matching "adjustments") - Check chrome.runtime.lastError in download callback and always revoke blob URL to prevent leaks on download failure
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@skillkit/extension",
|
||||
"version": "1.19.2",
|
||||
"version": "1.20.0",
|
||||
"private": true,
|
||||
"description": "Chrome extension to save any webpage as an AI agent skill",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,18 +1,61 @@
|
||||
import type { SaveResponse, ErrorResponse, ExtensionMessage } from './types';
|
||||
import type { SaveResponse, ErrorResponse, ExtensionMessage } from "./types";
|
||||
import { isRestricted } from "./constants";
|
||||
|
||||
const API_URL = 'https://skillkit.sh/api/save-skill';
|
||||
const TECH_KEYWORDS: Record<string, string[]> = {
|
||||
react: ["react", "jsx", "tsx", "usestate", "useeffect", "nextjs", "next.js"],
|
||||
typescript: ["typescript", "ts", "tsx", "type-safe"],
|
||||
javascript: [
|
||||
"javascript",
|
||||
"js",
|
||||
"es6",
|
||||
"es2015",
|
||||
"ecmascript",
|
||||
"node",
|
||||
"nodejs",
|
||||
"node.js",
|
||||
],
|
||||
python: ["python", "pip", "django", "flask", "fastapi", "pytorch", "pandas"],
|
||||
rust: ["rust", "cargo", "crate", "rustc", "tokio"],
|
||||
go: ["golang", "goroutine", "gomod"],
|
||||
docker: ["docker", "dockerfile", "container", "kubernetes", "k8s", "helm"],
|
||||
database: [
|
||||
"sql",
|
||||
"postgres",
|
||||
"mysql",
|
||||
"mongodb",
|
||||
"redis",
|
||||
"supabase",
|
||||
"prisma",
|
||||
],
|
||||
api: ["api", "rest", "graphql", "grpc", "endpoint", "webhook"],
|
||||
testing: ["test", "jest", "vitest", "playwright", "cypress", "pytest"],
|
||||
devops: ["ci", "cd", "cicd", "pipeline", "deploy", "terraform", "ansible"],
|
||||
ai: [
|
||||
"ai",
|
||||
"llm",
|
||||
"gpt",
|
||||
"claude",
|
||||
"openai",
|
||||
"anthropic",
|
||||
"machine-learning",
|
||||
"ml",
|
||||
],
|
||||
security: ["security", "auth", "oauth", "jwt", "encryption", "vulnerability"],
|
||||
css: ["css", "tailwind", "scss", "sass", "styled-components"],
|
||||
git: ["git", "github", "gitlab", "bitbucket", "branch", "merge"],
|
||||
};
|
||||
|
||||
chrome.runtime.onInstalled.addListener(() => {
|
||||
chrome.contextMenus.create({
|
||||
id: 'save-page',
|
||||
title: 'Save page as Skill',
|
||||
contexts: ['page'],
|
||||
id: "save-page",
|
||||
title: "Save page as Skill",
|
||||
contexts: ["page"],
|
||||
});
|
||||
|
||||
chrome.contextMenus.create({
|
||||
id: 'save-selection',
|
||||
title: 'Save selection as Skill',
|
||||
contexts: ['selection'],
|
||||
id: "save-selection",
|
||||
title: "Save selection as Skill",
|
||||
contexts: ["selection"],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,46 +63,52 @@ chrome.contextMenus.onClicked.addListener(async (info, tab) => {
|
||||
if (!tab?.id) return;
|
||||
|
||||
try {
|
||||
if (info.menuItemId === 'save-page') {
|
||||
const url = tab.url ?? '';
|
||||
if (!url || url.startsWith('chrome://') || url.startsWith('about:')) {
|
||||
notifyTab(tab.id, { error: 'Cannot save skills from this page' });
|
||||
if (info.menuItemId === "save-page") {
|
||||
const url = tab.url ?? "";
|
||||
if (isRestricted(url)) {
|
||||
notifyTab(tab.id, { error: "Cannot save skills from this page" });
|
||||
return;
|
||||
}
|
||||
const result = await callSaveApi(url);
|
||||
if (!('error' in result)) {
|
||||
downloadSkill(result.name, result.skillMd);
|
||||
}
|
||||
const page = await extractPageContent(tab.id);
|
||||
const result = buildPageSkill({ ...page, url });
|
||||
downloadSkill(result.name, result.skillMd);
|
||||
notifyTab(tab.id, result);
|
||||
}
|
||||
|
||||
if (info.menuItemId === 'save-selection' && info.selectionText) {
|
||||
const url = tab.url ?? '';
|
||||
if (info.menuItemId === "save-selection" && info.selectionText) {
|
||||
const url = tab.url ?? "";
|
||||
const result = buildSelectionSkill(info.selectionText, url);
|
||||
downloadSkill(result.name, result.skillMd);
|
||||
notifyTab(tab.id, result);
|
||||
}
|
||||
} catch {
|
||||
notifyTab(tab.id, { error: 'Failed to save skill' });
|
||||
} catch (err) {
|
||||
console.error("[SkillKit] Failed to save skill:", err);
|
||||
notifyTab(tab.id, { error: "Failed to save skill" });
|
||||
}
|
||||
});
|
||||
|
||||
chrome.runtime.onMessage.addListener(
|
||||
(message: ExtensionMessage, _sender, sendResponse) => {
|
||||
if (message.type === 'SAVE_PAGE') {
|
||||
const { url, name } = message.payload;
|
||||
callSaveApi(url, name).then((result) => {
|
||||
if (!('error' in result)) {
|
||||
if (message.type === "SAVE_PAGE") {
|
||||
const { url, name, tabId } = message.payload;
|
||||
if (isRestricted(url)) {
|
||||
sendResponse({ error: "Cannot save skills from this page" });
|
||||
return true;
|
||||
}
|
||||
extractPageContent(tabId)
|
||||
.then((page) => {
|
||||
const result = buildPageSkill({ ...page, url }, name);
|
||||
downloadSkill(result.name, result.skillMd);
|
||||
}
|
||||
sendResponse(result);
|
||||
}).catch(() => {
|
||||
sendResponse({ error: 'Failed to save skill' });
|
||||
});
|
||||
sendResponse(result);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("[SkillKit] Failed to extract page content:", err);
|
||||
sendResponse({ error: "Failed to extract page content" });
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
if (message.type === 'SAVE_SELECTION') {
|
||||
if (message.type === "SAVE_SELECTION") {
|
||||
const { text, url, name } = message.payload;
|
||||
const result = buildSelectionSkill(text, url, name);
|
||||
downloadSkill(result.name, result.skillMd);
|
||||
@@ -70,43 +119,179 @@ chrome.runtime.onMessage.addListener(
|
||||
},
|
||||
);
|
||||
|
||||
async function callSaveApi(url: string, name?: string): Promise<SaveResponse | ErrorResponse> {
|
||||
const response = await fetch(API_URL, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ url, name }),
|
||||
interface PageContent {
|
||||
title: string;
|
||||
metaDescription: string;
|
||||
headings: string[];
|
||||
bodyText: string;
|
||||
}
|
||||
|
||||
async function extractPageContent(tabId: number): Promise<PageContent> {
|
||||
const [result] = await chrome.scripting.executeScript({
|
||||
target: { tabId },
|
||||
func: () => {
|
||||
const title = document.title || "";
|
||||
|
||||
const metaEl = document.querySelector('meta[name="description"]');
|
||||
const metaDescription = metaEl?.getAttribute("content") || "";
|
||||
|
||||
const headings: string[] = [];
|
||||
document.querySelectorAll("h1, h2, h3").forEach((el) => {
|
||||
const text = (el as HTMLElement).innerText?.trim();
|
||||
if (text) headings.push(text);
|
||||
});
|
||||
|
||||
const container =
|
||||
document.querySelector("article") ||
|
||||
document.querySelector("main") ||
|
||||
document.body;
|
||||
const clone = container.cloneNode(true) as HTMLElement;
|
||||
clone
|
||||
.querySelectorAll("nav, footer, script, style, noscript, iframe, svg")
|
||||
.forEach((el) => el.remove());
|
||||
const bodyText = (clone.innerText || "").slice(0, 50000);
|
||||
|
||||
return {
|
||||
title,
|
||||
metaDescription,
|
||||
headings: headings.slice(0, 30),
|
||||
bodyText,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
let data: Record<string, unknown>;
|
||||
try {
|
||||
data = await response.json();
|
||||
} catch {
|
||||
return { error: `Server error: ${response.status}` };
|
||||
if (!result?.result) {
|
||||
return { title: "", metaDescription: "", headings: [], bodyText: "" };
|
||||
}
|
||||
if (!response.ok) {
|
||||
return { error: (data.error as string) ?? `Server error: ${response.status}` };
|
||||
|
||||
return result.result as PageContent;
|
||||
}
|
||||
|
||||
function detectTags(
|
||||
url: string,
|
||||
headings: string[],
|
||||
bodyText: string,
|
||||
): string[] {
|
||||
const scores: Record<string, number> = {};
|
||||
|
||||
const urlLower = url.toLowerCase();
|
||||
const headingsLower = headings.join(" ").toLowerCase();
|
||||
const bodyLower = bodyText.slice(0, 5000).toLowerCase();
|
||||
|
||||
for (const [tag, keywords] of Object.entries(TECH_KEYWORDS)) {
|
||||
let score = 0;
|
||||
for (const kw of keywords) {
|
||||
const escaped = kw.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
const re = new RegExp(`\\b${escaped}\\b`, "i");
|
||||
if (re.test(urlLower)) score += 3;
|
||||
if (re.test(headingsLower)) score += 2;
|
||||
if (re.test(bodyLower)) score += 1;
|
||||
}
|
||||
if (score > 0) scores[tag] = score;
|
||||
}
|
||||
|
||||
return Object.entries(scores)
|
||||
.sort((a, b) => b[1] - a[1])
|
||||
.slice(0, 5)
|
||||
.map(([tag]) => tag);
|
||||
}
|
||||
|
||||
function makeDescription(metaDescription: string, bodyText: string): string {
|
||||
if (metaDescription) {
|
||||
return metaDescription.slice(0, 200);
|
||||
}
|
||||
const lines = bodyText.split("\n");
|
||||
for (const line of lines) {
|
||||
const trimmed = line.trim();
|
||||
if (trimmed.length > 20) {
|
||||
return trimmed.slice(0, 200);
|
||||
}
|
||||
}
|
||||
return "Saved webpage content";
|
||||
}
|
||||
|
||||
function buildPageSkill(
|
||||
page: PageContent & { url: string },
|
||||
customName?: string,
|
||||
): SaveResponse {
|
||||
const skillName = slugify(
|
||||
customName || deriveNameFromUrl(page.url) || page.title || "webpage",
|
||||
);
|
||||
const tags = detectTags(page.url, page.headings, page.bodyText);
|
||||
const description = makeDescription(page.metaDescription, page.bodyText);
|
||||
const savedAt = new Date().toISOString();
|
||||
|
||||
let skillMd =
|
||||
`---\n` +
|
||||
`name: ${yamlEscape(skillName)}\n` +
|
||||
`description: ${yamlEscape(description)}\n` +
|
||||
`version: 1.0.0\n`;
|
||||
|
||||
if (tags.length > 0) {
|
||||
skillMd += `tags: [${tags.join(", ")}]\n`;
|
||||
}
|
||||
|
||||
skillMd +=
|
||||
`metadata:\n` +
|
||||
` source: ${yamlEscape(page.url)}\n` +
|
||||
` savedAt: ${savedAt}\n` +
|
||||
`---\n\n`;
|
||||
|
||||
if (page.title) {
|
||||
skillMd += `# ${page.title}\n\n`;
|
||||
}
|
||||
|
||||
if (page.headings.length > 0) {
|
||||
skillMd += page.headings.map((h) => `- ${h}`).join("\n") + "\n\n";
|
||||
}
|
||||
|
||||
const content = page.bodyText.trim();
|
||||
if (content) {
|
||||
skillMd += content + "\n";
|
||||
}
|
||||
|
||||
return {
|
||||
name: data.name as string,
|
||||
filename: `${data.name}/SKILL.md`,
|
||||
skillMd: data.skillMd as string,
|
||||
tags: (data.tags as string[]) ?? [],
|
||||
name: skillName,
|
||||
filename: `${skillName}/SKILL.md`,
|
||||
skillMd,
|
||||
tags,
|
||||
};
|
||||
}
|
||||
|
||||
function buildSelectionSkill(text: string, url: string, name?: string): SaveResponse {
|
||||
const skillName = slugify(name || 'selection');
|
||||
function deriveNameFromUrl(url: string): string {
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
const segments = parsed.pathname.split("/").filter(Boolean);
|
||||
if (segments.length > 0) {
|
||||
const last = segments[segments.length - 1]
|
||||
.replace(/\.[^.]+$/, "")
|
||||
.replace(/[^a-zA-Z0-9-]/g, "-");
|
||||
if (last.length > 2) return last;
|
||||
}
|
||||
return parsed.hostname.replace(/^www\./, "").replace(/\.[^.]+$/, "");
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
function buildSelectionSkill(
|
||||
text: string,
|
||||
url: string,
|
||||
name?: string,
|
||||
): SaveResponse {
|
||||
const skillName = slugify(name || "selection");
|
||||
const savedAt = new Date().toISOString();
|
||||
|
||||
const skillMd =
|
||||
`---\n` +
|
||||
`name: ${skillName}\n` +
|
||||
`name: ${yamlEscape(skillName)}\n` +
|
||||
`description: Selected text saved as skill\n` +
|
||||
`metadata:\n` +
|
||||
(url ? ` source: ${yamlEscape(url)}\n` : '') +
|
||||
(url ? ` source: ${yamlEscape(url)}\n` : "") +
|
||||
` savedAt: ${savedAt}\n` +
|
||||
`---\n\n` +
|
||||
text + '\n';
|
||||
text +
|
||||
"\n";
|
||||
|
||||
return {
|
||||
name: skillName,
|
||||
@@ -116,10 +301,19 @@ function buildSelectionSkill(text: string, url: string, name?: string): SaveResp
|
||||
};
|
||||
}
|
||||
|
||||
const YAML_BARE_SCALARS = /^(true|false|yes|no|on|off|null|~)$/i;
|
||||
const YAML_NUMERIC = /^-?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
|
||||
|
||||
function yamlEscape(value: string): string {
|
||||
const singleLine = value.replace(/\r?\n/g, ' ').trim();
|
||||
if (/[:#{}[\],&*?|>!%@`]/.test(singleLine) || singleLine.startsWith("'") || singleLine.startsWith('"')) {
|
||||
return `"${singleLine.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
||||
const singleLine = value.replace(/\r?\n/g, " ").trim();
|
||||
if (
|
||||
/[:#{}[\],&*?|>!%@`]/.test(singleLine) ||
|
||||
singleLine.startsWith("'") ||
|
||||
singleLine.startsWith('"') ||
|
||||
YAML_BARE_SCALARS.test(singleLine) ||
|
||||
YAML_NUMERIC.test(singleLine)
|
||||
) {
|
||||
return `"${singleLine.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
||||
}
|
||||
return singleLine;
|
||||
}
|
||||
@@ -127,27 +321,39 @@ function yamlEscape(value: string): string {
|
||||
function slugify(input: string): string {
|
||||
const slug = input
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '')
|
||||
.replace(/-{2,}/g, '-');
|
||||
return slug.slice(0, 64).replace(/-+$/, '') || 'untitled-skill';
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/^-+|-+$/g, "")
|
||||
.replace(/-{2,}/g, "-");
|
||||
return slug.slice(0, 64).replace(/-+$/, "") || "untitled-skill";
|
||||
}
|
||||
|
||||
function downloadSkill(name: string, skillMd: string): void {
|
||||
const blob = new Blob([skillMd], { type: 'text/markdown' });
|
||||
const blob = new Blob([skillMd], { type: "text/markdown" });
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
chrome.downloads.download({
|
||||
url: blobUrl,
|
||||
filename: `skillkit-skills/${name}/SKILL.md`,
|
||||
saveAs: false,
|
||||
}, () => {
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
});
|
||||
chrome.downloads.download(
|
||||
{
|
||||
url: blobUrl,
|
||||
filename: `skillkit-skills/${name}/SKILL.md`,
|
||||
saveAs: false,
|
||||
},
|
||||
() => {
|
||||
if (chrome.runtime.lastError) {
|
||||
console.error(
|
||||
`[SkillKit] Download failed for skillkit-skills/${name}/SKILL.md:`,
|
||||
chrome.runtime.lastError.message,
|
||||
);
|
||||
}
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
function notifyTab(tabId: number, result: SaveResponse | ErrorResponse): void {
|
||||
const isError = 'error' in result;
|
||||
chrome.action.setBadgeText({ text: isError ? '!' : '\u2713', tabId });
|
||||
chrome.action.setBadgeBackgroundColor({ color: isError ? '#ef4444' : '#22c55e', tabId });
|
||||
setTimeout(() => chrome.action.setBadgeText({ text: '', tabId }), 3000);
|
||||
const isError = "error" in result;
|
||||
chrome.action.setBadgeText({ text: isError ? "!" : "\u2713", tabId });
|
||||
chrome.action.setBadgeBackgroundColor({
|
||||
color: isError ? "#ef4444" : "#22c55e",
|
||||
tabId,
|
||||
});
|
||||
setTimeout(() => chrome.action.setBadgeText({ text: "", tabId }), 3000);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
export const RESTRICTED_PREFIXES = [
|
||||
"chrome://",
|
||||
"chrome-extension://",
|
||||
"https://chromewebstore.google.com",
|
||||
"about:",
|
||||
];
|
||||
|
||||
export function isRestricted(url: string): boolean {
|
||||
if (!url) return true;
|
||||
return RESTRICTED_PREFIXES.some((p) => url.startsWith(p));
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "SkillKit - Save as Skill",
|
||||
"version": "1.19.0",
|
||||
"version": "1.20.0",
|
||||
"description": "Save any webpage as an AI agent skill — instantly available across 44 agents",
|
||||
"permissions": ["contextMenus", "activeTab", "downloads"],
|
||||
"permissions": ["contextMenus", "activeTab", "downloads", "scripting"],
|
||||
"background": {
|
||||
"service_worker": "background.global.js"
|
||||
},
|
||||
|
||||
@@ -1,76 +1,81 @@
|
||||
import type { ExtensionMessage, SaveResponse, ErrorResponse } from './types';
|
||||
import type { ExtensionMessage, SaveResponse, ErrorResponse } from "./types";
|
||||
import { isRestricted } from "./constants";
|
||||
|
||||
const pageTitle = document.getElementById('page-title')!;
|
||||
const pageUrl = document.getElementById('page-url')!;
|
||||
const skillNameInput = document.getElementById('skill-name') as HTMLInputElement;
|
||||
const saveBtn = document.getElementById('save-btn')!;
|
||||
const statusEl = document.getElementById('status')!;
|
||||
const statusIcon = document.getElementById('status-icon')!;
|
||||
const statusText = document.getElementById('status-text')!;
|
||||
const resultEl = document.getElementById('result')!;
|
||||
const resultPath = document.getElementById('result-path')!;
|
||||
const pageTitle = document.getElementById("page-title")!;
|
||||
const pageUrl = document.getElementById("page-url")!;
|
||||
const skillNameInput = document.getElementById(
|
||||
"skill-name",
|
||||
) as HTMLInputElement;
|
||||
const saveBtn = document.getElementById("save-btn")!;
|
||||
const statusEl = document.getElementById("status")!;
|
||||
const statusIcon = document.getElementById("status-icon")!;
|
||||
const statusText = document.getElementById("status-text")!;
|
||||
const resultEl = document.getElementById("result")!;
|
||||
const resultPath = document.getElementById("result-path")!;
|
||||
|
||||
let currentUrl = '';
|
||||
let currentTitle = '';
|
||||
let currentUrl = "";
|
||||
let currentTitle = "";
|
||||
let currentTabId = 0;
|
||||
|
||||
async function init() {
|
||||
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
||||
if (!tab?.id) return;
|
||||
|
||||
pageTitle.textContent = tab.title || 'Unknown';
|
||||
pageUrl.textContent = tab.url || '\u2014';
|
||||
currentUrl = tab.url || '';
|
||||
currentTitle = tab.title || '';
|
||||
pageTitle.textContent = tab.title || "Unknown";
|
||||
pageUrl.textContent = tab.url || "\u2014";
|
||||
currentUrl = tab.url || "";
|
||||
currentTitle = tab.title || "";
|
||||
currentTabId = tab.id;
|
||||
|
||||
const isRestricted = !currentUrl || currentUrl.startsWith('chrome://') || currentUrl.startsWith('chrome-extension://') || currentUrl.startsWith('about:');
|
||||
if (isRestricted) {
|
||||
saveBtn.setAttribute('disabled', '');
|
||||
setStatus('error', 'Cannot save skills from this page');
|
||||
if (isRestricted(currentUrl)) {
|
||||
saveBtn.setAttribute("disabled", "");
|
||||
setStatus("error", "Cannot save skills from this page");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
saveBtn.addEventListener('click', async () => {
|
||||
if (!currentUrl) return;
|
||||
saveBtn.addEventListener("click", async () => {
|
||||
if (!currentUrl || !currentTabId) return;
|
||||
|
||||
setStatus('saving', 'Saving...');
|
||||
saveBtn.setAttribute('disabled', '');
|
||||
setStatus("saving", "Saving...");
|
||||
saveBtn.setAttribute("disabled", "");
|
||||
|
||||
const message: ExtensionMessage = {
|
||||
type: 'SAVE_PAGE',
|
||||
type: "SAVE_PAGE",
|
||||
payload: {
|
||||
url: currentUrl,
|
||||
title: currentTitle,
|
||||
name: skillNameInput.value.trim() || undefined,
|
||||
tabId: currentTabId,
|
||||
},
|
||||
};
|
||||
|
||||
const response: SaveResponse | ErrorResponse | undefined =
|
||||
await chrome.runtime.sendMessage(message);
|
||||
|
||||
saveBtn.removeAttribute('disabled');
|
||||
saveBtn.removeAttribute("disabled");
|
||||
|
||||
if (!response) {
|
||||
setStatus('error', 'No response from background script');
|
||||
resultEl.style.display = 'none';
|
||||
setStatus("error", "No response from background script");
|
||||
resultEl.style.display = "none";
|
||||
return;
|
||||
}
|
||||
|
||||
if ('error' in response) {
|
||||
setStatus('error', response.error);
|
||||
resultEl.style.display = 'none';
|
||||
if ("error" in response) {
|
||||
setStatus("error", response.error);
|
||||
resultEl.style.display = "none";
|
||||
return;
|
||||
}
|
||||
|
||||
setStatus('success', `Saved "${response.name}"`);
|
||||
setStatus("success", `Saved "${response.name}"`);
|
||||
resultPath.textContent = `Downloads/skillkit-skills/${response.filename}`;
|
||||
resultEl.style.display = 'block';
|
||||
resultEl.style.display = "block";
|
||||
});
|
||||
|
||||
function setStatus(type: 'saving' | 'success' | 'error', text: string) {
|
||||
statusEl.style.display = 'flex';
|
||||
function setStatus(type: "saving" | "success" | "error", text: string) {
|
||||
statusEl.style.display = "flex";
|
||||
statusEl.className = `status ${type}`;
|
||||
const icons = { saving: '...', success: '\u2713', error: '\u2717' };
|
||||
const icons = { saving: "...", success: "\u2713", error: "\u2717" };
|
||||
statusIcon.textContent = icons[type];
|
||||
statusText.textContent = text;
|
||||
}
|
||||
|
||||
@@ -10,5 +10,11 @@ export interface ErrorResponse {
|
||||
}
|
||||
|
||||
export type ExtensionMessage =
|
||||
| { type: 'SAVE_PAGE'; payload: { url: string; title: string; name?: string } }
|
||||
| { type: 'SAVE_SELECTION'; payload: { text: string; url: string; name?: string } };
|
||||
| {
|
||||
type: "SAVE_PAGE";
|
||||
payload: { url: string; title: string; name?: string; tabId: number };
|
||||
}
|
||||
| {
|
||||
type: "SAVE_SELECTION";
|
||||
payload: { text: string; url: string; name?: string };
|
||||
};
|
||||
|
||||
@@ -7,24 +7,21 @@ SkillKit - Save as Skill
|
||||
Save any webpage as an AI agent skill file. One click, works across 44 coding agents.
|
||||
|
||||
## Description
|
||||
SkillKit lets you save any webpage as a reusable AI agent skill with one click. The saved SKILL.md file works instantly across 44 coding agents including Claude Code, Cursor, Codex, Gemini CLI, Windsurf, and more.
|
||||
SkillKit lets you save any webpage as a reusable AI agent skill with one click. The extension extracts page content directly in your browser and generates a SKILL.md file that works instantly across 44 coding agents including Claude Code, Cursor, Codex, Gemini CLI, Windsurf, and more.
|
||||
|
||||
How it works:
|
||||
- Click the extension icon to save the current page as a skill
|
||||
- Right-click any page and select "Save page as Skill"
|
||||
- Select text, right-click, and choose "Save selection as Skill"
|
||||
|
||||
When you save a page, the extension sends the page URL to our server (skillkit.sh / agenstskills.com) where it is converted to clean markdown with auto-generated tags and YAML frontmatter. The resulting skill file is downloaded to your computer. No page content, browsing history, or personal data is ever sent — only the URL of the page you choose to save.
|
||||
|
||||
Saving selected text works entirely offline with no network requests.
|
||||
When you save a page, the extension extracts and converts page content locally in your browser — no data is sent to any server. The resulting skill file with auto-generated tags and YAML frontmatter is downloaded directly to your computer.
|
||||
|
||||
After saving, run `skillkit install <path>` to make the skill available to all your AI coding agents at once.
|
||||
|
||||
Features:
|
||||
- Converts HTML to clean markdown via server-side processing
|
||||
- Extracts and converts page content locally — no data sent to external servers
|
||||
- Auto-generates YAML frontmatter with metadata
|
||||
- Smart tag detection from 50+ tech keywords (weighted 5-source analysis)
|
||||
- GitHub URL support (auto-converts blob URLs to raw content)
|
||||
- Smart tag detection from 50+ tech keywords (weighted URL, heading, and body analysis)
|
||||
- Context menu integration for quick saves
|
||||
- Works on any webpage
|
||||
- No account or API key required
|
||||
@@ -53,13 +50,13 @@ Save webpages as AI agent skill files (SKILL.md) for use with coding AI agents.
|
||||
- activeTab: Read the URL and title of the current tab when the user clicks the extension icon or context menu. Only accessed on explicit user action.
|
||||
- contextMenus: Add "Save page as Skill" and "Save selection as Skill" to the right-click context menu.
|
||||
- downloads: Save the generated SKILL.md file to the user's Downloads folder.
|
||||
- scripting: Inject a content extraction script into the active tab to read page content (title, headings, body text) for local skill generation. Only executed on explicit user action (click or context menu).
|
||||
|
||||
## Data Usage Disclosure (for Chrome Web Store Privacy tab)
|
||||
- Does the extension use remote code? No
|
||||
- Does it collect user data? No personal data. The page URL is sent to our server (skillkit.sh / agenstskills.com) when the user clicks save.
|
||||
- Data type: Website content (URL only, on user action)
|
||||
- Use: Required for core functionality (converting webpage to skill file)
|
||||
- Transfer: Sent to our server (skillkit.sh / agenstskills.com) over HTTPS
|
||||
- Does it collect user data? No. All processing happens locally in the browser. No data is sent to any server.
|
||||
- Data type: None collected or transmitted
|
||||
- Transfer: No data is transferred externally
|
||||
- Not sold to third parties
|
||||
- Not used for creditworthiness or lending
|
||||
|
||||
|
||||
Reference in New Issue
Block a user