К основному содержанию
правило

vscode-extension-dev-typescript-cursorrules-prompt-file

Задаёт рекомендации для разработки расширений VS Code на TypeScript: от структуры проекта и манифеста до тестов и обработки ошибок.

Установить в Cursor · Вручную: положить файлы Все способы и платформы ↓
.cursor/rules/vscode-extension-dev-typescript-cursorrules-prompt-file.mdc
Открыть на GitHub

Что делает vscode-extension-dev-typescript-cursorrules-prompt-file

Правило направляет агента при работе над расширением VS Code: предлагает разделять команды, интерфейс и бизнес-логику, использовать типы TypeScript и учитывать структуру проекта. Оно также охватывает package.json, регистрацию команд в activate() и взаимодействие с API редактора.

В рекомендациях есть проверка входных данных, обработка ошибок, тесты через Mocha или Jest и интеграционные тесты средствами VS Code. Правило охватывает Windows, macOS и Linux. Оно применяется к файлам по маске **/*, но alwaysApply: false, поэтому правило не включается автоматически во всех ситуациях Cursor.

Какие задачи решает

  • организовать структуру расширения VS Code
  • описать команды и настройки в package.json
  • подготовить типизированные API и обработку ошибок
  • наметить модульные и интеграционные тесты

Примеры запросов агенту

  • Спроектируй структуру расширения VS Code на TypeScript с отдельными модулями для команд и логики.
  • Проверь package.json расширения: команды, события активации и настройки.
  • Добавь тесты для этой функции и учти обработку ошибок API VS Code.

Как установить vscode-extension-dev-typescript-cursorrules-prompt-file

Вручную: положить файлы

.cursor/rules/vscode-extension-dev-typescript-cursorrules-prompt-file.mdc

Во frontmatter: description, globs, alwaysApply

По шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules

Вопросы о vscode-extension-dev-typescript-cursorrules-prompt-file

Как установить vscode-extension-dev-typescript-cursorrules-prompt-file в Cursor?

Сохраните правило по пути .cursor/rules/vscode-extension-dev-typescript-cursorrules-prompt-file.mdc.

Что делает vscode-extension-dev-typescript-cursorrules-prompt-file?

Задаёт ориентиры для разработки расширений VS Code на TypeScript: архитектура, манифест, API, безопасность и тестирование.

Применяется ли правило автоматически ко всем файлам?

Маска **/* охватывает файлы проекта, но alwaysApply: false означает, что правило не подключается автоматически во всех ситуациях.

Исходный текст

vscode-extension-dev-typescript-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for Vscode Extension Dev Typescript."
globs: **/*
alwaysApply: false
---
You are an expert in VSCode Extension Development, TypeScript, Node.js, HTML, CSS, VSCode APIs, and Electron.

Code Style and Structure:
- Write clear, concise TypeScript code following modern ECMAScript standards.
- Use modular design patterns to separate concerns (e.g., separate commands, UI components, and business logic).
- Organize your project into meaningful directories such as src, out, and assets.
- Include comprehensive inline comments and JSDoc annotations for public APIs.

Naming Conventions:
- Use kebab-case for file and folder names (e.g., my-extension, command-handler.ts).
- Use camelCase for variables and function names.
- Use PascalCase for classes and interfaces.
- Name commands and configuration keys descriptively (e.g., 'extension.activateFeature', 'extension.showOutput').

TypeScript Usage:
- Leverage TypeScript for static type checking and enhanced developer experience.
- Use interfaces and types to define extension commands, configuration schemas, and message payloads.
- Utilize generics, union types, and type guards to create robust and flexible APIs.
- Configure strict type checking in tsconfig.json to catch potential errors early.

Extension Architecture:
- Follow the VSCode Extension API guidelines to structure your extension entry point (typically in extension.ts).
- Register commands, events, and providers within the activate() function.
- Use dependency injection where possible to manage state and service interactions.
- Modularize features into separate files or modules to improve maintainability.

Manifest (package.json) and Configuration:
- Define extension metadata, activation events, contributions (commands, menus, keybindings), and configuration in package.json.
- Follow VSCode’s schema for extension manifests to ensure compatibility and discoverability.
- Use activation events wisely to minimize performance overhead (e.g., onCommand, onLanguage).
- Document all configurable options clearly in package.json and corresponding README files.

Security and Privacy:
- Adhere to the principle of least privilege; request only the permissions you need.
- Validate and sanitize any input or configuration data.
- Avoid exposing sensitive APIs or secrets within the extension.
- Implement error handling and logging that do not leak internal state information.

UI and Styling:
- Use VSCode’s Webview API for custom UIs when necessary; otherwise, leverage the built-in VSCode UI components.
- Maintain consistency with the VSCode design language to provide a seamless user experience.
- Use responsive design principles to support different screen sizes and themes (dark/light modes).
- Structure HTML, CSS, and JavaScript/TypeScript in a way that separates concerns and supports maintainability.

Performance Optimization:
- Optimize extension activation by deferring non-critical operations until after activation.
- Use asynchronous programming (async/await, Promises) to avoid blocking the main thread.
- Profile and monitor resource usage; consider lazy-loading features to reduce initial load time.
- Avoid unnecessary file system or network operations during activation.

VSCode API Usage:
- Familiarize yourself with the official VSCode API and follow its guidelines for registering commands, creating status bar items, handling events, etc.
- Use vscode.workspace, vscode.window, and vscode.commands to interact with the editor efficiently.
- Always handle potential errors when calling VSCode APIs to improve extension resilience.
- Keep up to date with the latest VSCode API changes and deprecations.

Cross-platform Compatibility:
- Ensure your extension works seamlessly across Windows, macOS, and Linux.
- Test on different environments to identify any OS-specific issues.
- Use Node.js APIs judiciously and favor VSCode APIs for file and process management.

Testing and Debugging:
- Write unit tests for core functionality using testing frameworks like Mocha or Jest.
- Use the VSCode Extension Test Runner for integration tests.
- Leverage VSCode’s built-in debugging tools to set breakpoints and inspect runtime behavior.
- Incorporate logging with appropriate levels (info, warn, error) to aid in troubleshooting.

Context-Aware Development:
- Consider the full project context when integrating new features; ensure consistency with existing functionality.
- Avoid duplicating code and ensure new components interact seamlessly with current ones.
- Review user feedback and extension telemetry to continuously refine and optimize your extension.
- When providing code snippets or solutions, ensure they align with the established project architecture and coding standards.

Code Output:
- Provide full file contents when sharing code examples to ensure completeness and clarity.
- Include all necessary imports, module declarations, and surrounding code context.
- Clearly comment on significant changes or additions to explain the rationale behind decisions.
- When code snippets are too long, indicate where the snippet fits into the overall project structure.

Follow the official VSCode Extension documentation for best practices, API usage, and security guidelines.

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Похожие правила IDE

Все правила IDE по теме «Языки программирования» →
winui3 официальный github Правило задаёт рекомендации для WinUI 3 и Windows App SDK: от XAML и потоков до окон и MVVM. Пригодится, чтобы Copilot учитывал особенности настольных приложений Windows. ★ 40 451звёзд репо vue официальный github Правило задаёт Copilot стандарты Vue 3: Composition API, <script setup>, реактивность, Pinia и Vue Router. Пригодится, когда агент пишет компоненты в вашем стиле. ★ 40 451звёзд репо vsixtoolkit официальный github Направляет GitHub Copilot при создании расширений VSIX через библиотеку Community.VisualStudio.Toolkit. Задаёт совместимость с .NET Framework 4.8 и правила потоков. ★ 40 451звёзд репо tanstack-start-shadcn-tailwind официальный github Правило задаёт Copilot стек TanStack Start, Shadcn/ui и Tailwind CSS и требует валидировать внешние данные через Zod. ★ 40 451звёзд репо swift-mcp-server официальный github Правило задаёт Copilot шаблоны для сборки MCP-серверов на Swift через официальный SDK: инструменты, ресурсы, промпты и транспорты. ★ 40 451звёзд репо svelte официальный github Направляет GitHub Copilot на стандарты Svelte 5 и SvelteKit 2: руны вместо старых сторов, типизация компонентов и безопасная работа с SSR. ★ 40 451звёзд репо

Из того же набора234

Весь набор →
webassembly-z80-cellular-automata-cursorrules-prom Правило для Cursor, которое ведёт агента при добавлении сетки регионов в симуляцию клеточных автоматов на Z80 и WebAssembly. ★ 41 024звёзд репо web-app-optimization-cursorrules-prompt-file Набор инструкций для Cursor по разработке веб-приложений на Svelte 5 и SvelteKit с акцентом на производительность и руны. ★ 41 024звёзд репо vue3-composition-api-cursorrules-prompt-file Правило задаёт рекомендации для разработки на Vue 3 с Composition API: от реактивного состояния до структуры проекта. Пригодится, чтобы Cursor учитывал эти практики при работе с файлами. ★ 41 024звёзд репо vue Правило для Cursor задаёт агенту стиль работы с Vue: Composition API, Pinia, типизация и маршрутизация. Пригодится, когда в проекте уже есть .vue и .ts. ★ 41 024звёзд репо vue-pinia-cursorrules-prompt-file Задаёт стандарты работы с Pinia и TypeScript во Vue 3: разделение состояния, синтаксис setup-хранилищ, типизацию, SSR и правила персистентности. ★ 41 024звёзд репо vue-claude-stack Правило задаёт стиль генерации кода для Vue 3 и Nuxt 3: Composition API, TypeScript и Pinia. Пригодится, чтобы направлять агента по единым правилам проекта. ★ 41 024звёзд репо vue-3-nuxt-3-typescript-cursorrules-prompt-file Правило для Cursor задаёт агенту стиль кода на Vue 3 и Nuxt 3: Composition API, TypeScript-интерфейсы, конвенции Nuxt. Пригодится, когда проект уже на этом стеке и не хочется каждый раз объяснять структуру. ★ 41 024звёзд репо vue-3-nuxt-3-development-cursorrules-prompt-file Правило задаёт стандарты для фронтенда на Vue 3 и Nuxt 3 в Cursor. Ассистент составляет псевдокод до написания кода, использует Composition API и оформляет разметку только через Tailwind. ★ 41 024звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой