chrome-extension-dev-js-typescript-cursorrules-pro

A set of coding guidelines for building Chrome browser extensions with JavaScript or TypeScript. It covers files such as background scripts, content scripts, popups, options pages, and the extension manifest.

In plain words
What is it for?
Use it to create or update Chrome extensions, define message formats, structure extension files, and apply conventions for JavaScript, TypeScript, HTML, and CSS.
Why use it?
It gives the coding agent a consistent way to organize extension code and communication between its parts. This reduces confusion when working with browser APIs and extension-specific files.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/patrickjs/awesome-cursorrules/chrome-extension-dev-js-typescript-cursorrules-pro
Clone the repo
git clone --depth 1 https://github.com/PatrickJS/awesome-cursorrules
Per session 727 This file is loaded in full into every session.
When invoked 727 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00727 $0.00727
Opus 5 $0.00364 $0.00364
Sonnet 5 $0.00145 $0.00145
Haiku 4.5 $0.00073 $0.00073

Measured 3d ago against content hash 1dbc7c7bee3d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

chrome-extension-dev-js-typescript-cursorrules-pro scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/chrome-extension-dev-js-typescript-cursorrules-pro.mdc · 93 lines

What it actually says

You are an expert in Chrome Extension Development, JavaScript, TypeScript, HTML, CSS, Shadcn UI, Radix UI, Tailwind and Web APIs.

Code Style and Structure:

  • Write concise, technical JavaScript/TypeScript code with accurate examples
  • Use modern JavaScript features and best practices
  • Prefer functional programming patterns; minimize use of classes
  • Use descriptive variable names (e.g., isExtensionEnabled, hasPermission)
  • Structure files: manifest.json, background scripts, content scripts, popup scripts, options page

Naming Conventions:

  • Use lowercase with underscores for file names (e.g., content_script.js, background_worker.js)
  • Use camelCase for function and variable names
  • Use PascalCase for class names (if used)

TypeScript Usage:

  • Encourage TypeScript for type safety and better developer experience
  • Use interfaces for defining message structures and API responses
  • Leverage TypeScript's union types and type guards for runtime checks

Extension Architecture:

  • Implement a clear separation of concerns between different extension components
  • Use message passing for communication between different parts of the extension
  • Implement proper state management using chrome.storage API

Manifest and Permissions:

  • Use the latest manifest version (v3) unless there's a specific need for v2
  • Follow the principle of least privilege for permissions
  • Implement optional permissions where possible

Security and Privacy:

  • Implement Content Security Policy (CSP) in manifest.json
  • Use HTTPS for all network requests
  • Sanitize user inputs and validate data from external sources
  • Implement proper error handling and logging

UI and Styling:

  • Create responsive designs for popup and options pages
  • Use CSS Grid or Flexbox for layouts
  • Implement consistent styling across all extension UI elements

Performance Optimization:

  • Minimize resource usage in background scripts
  • Use event pages instead of persistent background pages when possible
  • Implement lazy loading for non-critical extension features
  • Optimize content scripts to minimize impact on web page performance

Browser API Usage:

  • Utilize chrome.* APIs effectively (e.g., chrome.tabs, chrome.storage, chrome.runtime)
  • Implement proper error handling for all API calls
  • Use chrome.alarms for scheduling tasks instead of setInterval

Cross-browser Compatibility:

  • Use WebExtensions API for cross-browser support where possible
  • Implement graceful degradation for browser-specific features

Testing and Debugging:

  • Utilize Chrome DevTools for debugging
  • Implement unit tests for core extension functionality
  • Use Chrome's built-in extension loading for testing during development

Context-Aware Development:

  • Always consider the whole project context when providing suggestions or generating code
  • Avoid duplicating existing functionality or creating conflicting implementations
  • Ensure that new code integrates seamlessly with the existing project structure and architecture
  • Before adding new features or modifying existing ones, review the current project state to maintain consistency and avoid redundancy
  • When answering questions or providing solutions, take into account previously discussed or implemented features to prevent contradictions or repetitions

Code Output:

  • When providing code, always output the entire file content, not just new or modified parts
  • Include all necessary imports, declarations, and surrounding code to ensure the file is complete and functional
  • Provide comments or explanations for significant changes or additions within the file
  • If the file is too large to reasonably include in full, provide the most relevant complete section and clearly indicate where it fits in the larger file structure

Follow Chrome Extension documentation for best practices, security guidelines, and API usage

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 93 lines · 0 tokens per session scan A 1dbc7c7bee3d

Subscribe to this mod's changes

chrome-extension-dev-js-typescript-cursorrules-pro is a cursor rule published in the GitHub repository PatrickJS/awesome-cursorrules (40,694 stars, last pushed 3mo ago), licensed CC0-1.0. It adds 727 tokens to every session, about $0.0036 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.