Back to Skills

extension-apis

verified

Chrome Extension APIs reference covering runtime, storage, tabs, scripting, action, alarms, notifications, contextMenus, sidePanel, offscreen, and identity APIs. Use when implementing Chrome extension functionality.

View on GitHub

Marketplace

fran-marketplace

francanete/fran-marketplace

Plugin

chrome-extension-expert

development

Repository

francanete/fran-marketplace

chrome-extension-expert/skills/extension-apis/SKILL.md

Last Verified

January 20, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/francanete/fran-marketplace/blob/main/chrome-extension-expert/skills/extension-apis/SKILL.md -a claude-code --skill extension-apis

Installation paths:

Claude
.claude/skills/extension-apis/
Powered by add-skill CLI

Instructions

# Chrome Extension APIs Reference

## chrome.runtime

### Lifecycle Events

```javascript
// Extension installed or updated
chrome.runtime.onInstalled.addListener((details) => {
  if (details.reason === 'install') {
    // First install
  } else if (details.reason === 'update') {
    // Updated from details.previousVersion
  }
});

// Browser started with extension enabled
chrome.runtime.onStartup.addListener(() => {
  // Browser startup
});

// Extension suspended (MV3)
chrome.runtime.onSuspend.addListener(() => {
  // Clean up before suspension
});
```

### Messaging

```javascript
// Send message to background
const response = await chrome.runtime.sendMessage({
  type: 'ACTION',
  data: payload
});

// Listen for messages
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
  console.log('From:', sender.tab?.id || 'extension');

  // Async response - MUST return true
  handleAsync(message).then(sendResponse);
  return true;
});

// Connect for long-lived connection
const port = chrome.runtime.connect({ name: 'channel' });
port.postMessage({ type: 'HELLO' });
port.onMessage.addListener((message) => {
  console.log('Received:', message);
});
port.onDisconnect.addListener(() => {
  console.log('Port disconnected');
});
```

### Extension Info

```javascript
// Get extension info
const manifest = chrome.runtime.getManifest();
const id = chrome.runtime.id;
const url = chrome.runtime.getURL('page.html');

// Reload extension
chrome.runtime.reload();

// Open options page
chrome.runtime.openOptionsPage();
```

---

## chrome.storage

### Storage Areas

```javascript
// Local storage (10MB limit, persistent)
await chrome.storage.local.set({ key: 'value' });
const { key } = await chrome.storage.local.get('key');
const all = await chrome.storage.local.get(null);
await chrome.storage.local.remove('key');
await chrome.storage.local.clear();

// Sync storage (100KB limit, synced across devices)
await chrome.storage.sync.set({ settings: { theme: 'dark' } }

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
12432 chars