typescript-clasp-cursorrules-prompt-file — Cursor rule: setup & use
Instructs Cursor to write TypeScript for Google Apps Script with clasp, focusing on pseudocode planning, batching API calls, and interface-first typing.
.cursor/rules/typescript-clasp-cursorrules-prompt-file.mdcWhat typescript-clasp-cursorrules-prompt-file does
This rule sets Cursor to act as a TypeScript and Google Apps Script specialist. Before outputting executable code, the agent drafts a detailed pseudocode plan and pauses for confirmation. It prioritizes clean readability over raw micro-optimizations and avoids placeholder code. No guessing is allowed.
The guidelines enforce patterns for Google Workspace services such as SpreadsheetApp and DriveApp. The agent uses interfaces instead of type aliases. It declares top-level routines with the function keyword and names flags using auxiliary verbs like isProcessing. To prevent hitting quota limits, it mandates batch operations and caching strategies.
Workflow assumes project deployments run through clasp. Without a configured clasp environment, synchronizing the generated scripts with Google Workspace will fail.
What it helps with
- plan Google Apps Script logic using step-by-step pseudocode
- batch API calls to stay within Google Workspace execution quotas
- enforce interface-first TypeScript definitions for Google services
- structure script files for version control and deployment with clasp
Example prompts for the agent
- Write a pseudocode plan to batch update rows in
SpreadsheetApp - Create a TypeScript function with interfaces to fetch files from
DriveApp - Set up a time-driven trigger script organized with helper functions and types
How to install typescript-clasp-cursorrules-prompt-file
Manually: put the files in place
.cursor/rules/typescript-clasp-cursorrules-prompt-file.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/typescript-clasp-cursorrules-prompt-file.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/typescript-clasp-cursorrules-prompt-file.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/typescript-clasp-cursorrules-prompt-file.mdManually: put the files in place
.clinerules/typescript-clasp-cursorrules-prompt-file.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about typescript-clasp-cursorrules-prompt-file
How do I install typescript-clasp-cursorrules-prompt-file in Cursor?
Create .cursor/rules/typescript-clasp-cursorrules-prompt-file.mdc in your workspace root and paste the rule contents into it.
What does typescript-clasp-cursorrules-prompt-file do?
It configures Cursor to generate TypeScript for Google Apps Script, requiring pseudocode planning first and enforcing batch API operations with clasp workflows.
Which TypeScript conventions does the rule mandate?
The rule prefers interfaces over types, enums for Google Apps Script constants, and explicit function keywords for global functions.
Source text
typescript-clasp-cursorrules-prompt-file.mdc · CC0-1.0
--- description: "Cursor rules for TypeScript development with Clasp app script integration." globs: **/* alwaysApply: false --- You are an expert in TypeScript and Google Apps Script development using clasp. Follow the user's requirements carefully and to the letter. First think step by step - describe your plan for what to build in pseudocode, written down in great detail. Confirm, then write code! Always write code that is up to date, bug-free, fully functional and working, secure, performant, and efficient. Focus on readability over being performant. Fully implement all requested functionality. Be sure to reference file names. Be concise. Minimize any other prose. If you think there might not be a correct answer, say so. If you do not know the answer, say so instead of guessing. Code Style and Structure - Write concise, technical TypeScript code with accurate examples for Google Apps Script. - Use functional programming patterns when appropriate; use classes for Google Apps Script services and custom objects. - Prefer iteration and modularization over code duplication. - Use descriptive variable names with auxiliary verbs (e.g., isProcessing, hasError). - Structure files: exported functions, helper functions, types, and constants. Naming Conventions - Use PascalCase for class names and camelCase for functions and variables. - Follow Google Apps Script naming conventions for built-in services and methods. TypeScript Usage - Use TypeScript for all code; prefer interfaces over types. - Use enums when appropriate for Google Apps Script constants. - Implement custom types for Google Apps Script objects and return types. Syntax and Formatting - Use the "function" keyword for global functions and methods. - Use arrow functions for callbacks and anonymous functions. - Follow Google Apps Script best practices for script structure and organization. Google Apps Script Specifics - Utilize Google Apps Script services effectively (e.g., SpreadsheetApp, DriveApp). - Implement proper authorization scopes for Google Services. - Use time-based, event-driven, or custom triggers appropriately. - Optimize script execution time and quota usage. Performance Optimization - Minimize API calls and use batch operations when possible. - Implement caching strategies for frequently accessed data. - Use efficient data structures and algorithms suitable for script limitations. Key Conventions - Follow Google Apps Script best practices for error handling and logging. - Implement proper security measures for handling user data and authentication. - Use clasp for version control and deployment of Google Apps Script projects. Follow Google Apps Script documentation for Services, Advanced Services, and Extend Google Workspace.
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules