AgentSkillsCN

chrome-extension

Chrome 扩展(Manifest V3)的性能与代码质量指南。适用于编写、审查或重构 Chrome 扩展代码时使用,包括服务工作者、内容脚本、消息传递、存储 API、TypeScript 模式,以及测试相关代码。

SKILL.md
--- frontmatter
name: chrome-extension
description: Chrome Extensions (Manifest V3) performance and code quality guidelines. Use when writing, reviewing, or refactoring Chrome extension code including service workers, content scripts, message passing, storage APIs, TypeScript patterns, and testing.

Chrome Extension Best Practices

Comprehensive performance and code quality guide for Chrome Extensions (Manifest V3). Contains 67 rules across 12 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

  • Writing new Chrome extension code
  • Migrating from Manifest V2 to Manifest V3
  • Optimizing service worker lifecycle and state management
  • Implementing content scripts for page interaction
  • Debugging performance issues in extensions

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Service Worker LifecycleCRITICALsw-
2Content Script OptimizationCRITICALcontent-
3Message Passing EfficiencyHIGHmsg-
4Storage OperationsHIGHstorage-
5Network & PermissionsMEDIUM-HIGHnet-
6Memory ManagementMEDIUMmem-
7UI PerformanceMEDIUMui-
8API Usage PatternsLOW-MEDIUMapi-
9Code Style & NamingMEDIUMstyle-
10Component PatternsMEDIUMcomp-
11Error HandlingHIGHerr-
12Testing PatternsMEDIUMtest-

Quick Reference

1. Service Worker Lifecycle (CRITICAL)

2. Content Script Optimization (CRITICAL)

3. Message Passing Efficiency (HIGH)

4. Storage Operations (HIGH)

5. Network & Permissions (MEDIUM-HIGH)

6. Memory Management (MEDIUM)

7. UI Performance (MEDIUM)

8. API Usage Patterns (LOW-MEDIUM)

9. Code Style & Naming (MEDIUM)

10. Component Patterns (MEDIUM)

11. Error Handling (HIGH)

12. Testing Patterns (MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Full Compiled Document

For a complete guide with all rules in a single document, see AGENTS.md.

Reference Files

FileDescription
AGENTS.mdComplete compiled guide with all rules
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information