Skip to main content
rule

typo3cms-extension-cursorrules-prompt-file — Cursor rule

This rule guides Cursor through TYPO3 CMS extension work, from PHP structure to tests and documentation. Use it when an agent is designing a new extension.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/typo3cms-extension-cursorrules-prompt-file.mdc
Open on GitHub

What typo3cms-extension-cursorrules-prompt-file does

The rule gives Cursor a working blueprint for TYPO3 CMS extensions. It covers Classes, Configuration, Resources, and Tests, plus ext_emconf.php and composer.json. The suggested layout includes Extbase controllers, domain models, repositories, services, PSR-14 event listeners, middleware, and utility classes.

Its coding guidance points to TYPO3 Coding Guidelines, PSR-12, strict typing, modern attributes, and dependency injection. Service wiring uses Services.yaml, while extension registration can involve ext_localconf.php, TypoScript, and YAML. A project running below PHP 8.3 needs a separate compatibility check against these recommendations.

Testing uses PHPUnit for unit and functional coverage, with typo3/testing-framework for TYPO3-specific cases. The rule also asks for a useful README.md, Docs guides, usage examples, API references, and detailed PHPDoc.

What it helps with

  • design a TYPO3 CMS extension layout
  • organize classes under PSR-4 namespaces
  • configure services and event registration
  • write unit and functional tests
  • document extension setup and usage

Example prompts for the agent

  • Create a TYPO3 CMS extension from this description and follow the recommended directory layout.
  • Review this PHP code against TYPO3 Coding Guidelines, PSR-12, and the dependency injection guidance.
  • Add PHPUnit tests for the model, repository, and service, using typo3/testing-framework for TYPO3-specific cases.

How to install typo3cms-extension-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/typo3cms-extension-cursorrules-prompt-file.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about typo3cms-extension-cursorrules-prompt-file

How do I install typo3cms-extension-cursorrules-prompt-file in Cursor?

Create the rule file at .cursor/rules/typo3cms-extension-cursorrules-prompt-file.mdc.

What does typo3cms-extension-cursorrules-prompt-file do?

It guides Cursor while planning and building TYPO3 CMS extensions, covering PHP conventions, project structure, service configuration, tests, and documentation.

What PHP version does the rule target?

The rule recommends PHP 8.3+ features where appropriate. It also calls for strict typing, PSR-12 practices, and dependency injection.

Source text

typo3cms-extension-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for TYPO3 CMS development with extension integration."
globs: **/*
alwaysApply: false
---
You are a highly skilled TYPO3 extension developer tasked with creating a new extension. Your goal is to provide a detailed plan and code structure for the extension based on the given project description and specific requirements.

---

### 1. Development Guidelines

- **Use PHP 8.3+ features where appropriate**
- Follow **TYPO3 Coding Guidelines (CGL)** and **Core Team Best Practices**
- Use the **Extension Builder** as a starting point where useful, but favor manual organization for better control
- Apply **PSR-12** coding standards
- Utilize **strict typing**, union types, readonly properties, and modern attributes
- Prefer **dependency injection** over static access or global scope
- Focus on excellent **Developer Experience (DX)**:
  - Clear type annotations
  - IDE autocompletion
  - Precise PHPDoc blocks
  - Consistent naming conventions

---

### 2. Coding Standards and Conventions

- **File Names**: Use `PascalCase.php` (e.g., `MyService.php`)
- **Class and Enum Names**: Use `PascalCase` (e.g., `MyUtilityClass`)
- **Method Names**: Use `camelCase` (e.g., `getUserData`)
- **Variable and Property Names**: Use `camelCase` (e.g., `userService`)
- **Constants and Enum Case Names**: Use `SCREAMING_SNAKE_CASE` (e.g., `DEFAULT_LIMIT`)
- **Namespaces**: Respect PSR-4 autoloading, use `Vendor\ExtensionName\SubNamespace`

---

### 3. Extension Structure and File Organization

```plaintext
my_extension/
├── Classes/
│   ├── Controller/           # Extbase Controllers
│   ├── Domain/
│   │   ├── Model/            # Domain Models
│   │   └── Repository/       # Domain Repositories
│   ├── Service/              # Business logic classes
│   ├── EventListener/        # PSR-14 event subscribers
│   ├── Middleware/           # Custom middlewares (if needed)
│   └── Utility/              # Utility/helper classes
├── Configuration/
│   ├── TCA/                  # Table configuration arrays
│   ├── Services.yaml         # Service container configuration
│   └── ext_localconf.php     # Extension registration
├── Resources/
│   ├── Private/
│   │   ├── Templates/        # Fluid templates
│   │   ├── Partials/
│   │   └── Layouts/
│   └── Public/               # JS, CSS, Images
├── Tests/
│   ├── Unit/                 # PHPUnit unit tests
│   └── Functional/           # Functional tests
├── ext_emconf.php            # Extension metadata
└── composer.json             # Composer configuration
```

#### Integration into TYPO3 CMS

- The extension is installed via **Composer** or manually via the **Extension Manager**
- Services are automatically injected via `Services.yaml` configuration
- PSR-14 Events, SignalSlots, and TypoScript are registered via `ext_localconf.php`
- Configuration is handled via TypoScript and YAML

---

### 4. Testing and Documentation

#### ✅ Testing Strategy

- Use **PHPUnit** for both **unit** and **functional** tests
- Use `typo3/testing-framework` for TYPO3-specific test cases
- Write tests for:
  - Domain logic (Models, Repositories)
  - Services (pure PHP logic)
  - Controllers (via functional tests)
- Ensure code coverage and test edge cases

#### 📚 Documentation Structure

- `README.md`
  - Extension purpose
  - Installation instructions
  - Minimal usage example
- `Docs/`
  - Setup and configuration guides
  - Full usage examples (Fluid templates, TypoScript)
  - API reference (linked with PHPDoc)
- Code is self-documented with comprehensive **PHPDoc**

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

Similar IDE rules

All IDE rules for Backend and APIs →

From the same set234

The whole set →
vercel-deployment Enforces Vercel standards for Edge Runtime, serverless functions, and vercel.json. Useful when configuring routing and deployment pipelines. ★ 41,024repo stars vercel-deployment-cursorrules-prompt-file This rule guides an agent through Vercel deployment choices, from environment variables and serverless functions to caching and CI/CD. Use it when preparing a project for deployment. ★ 41,024repo stars unity-cursor-ai-c-cursorrules-prompt-file A Cursor rule that briefs the assistant on a Unity game project in C#: modular code, responsive mechanics, real-time performance. ★ 41,024repo stars uikit-guidelines-cursorrules-prompt-file A rule that enforces programmatic Swift UIKit layouts without Storyboards. It standardizes SnapKit for Auto Layout, isolates data models from UI views, and handles events with closures. ★ 41,024repo stars typescript A Cursor rule that pins down how the agent writes TypeScript: types, naming, error handling. Useful when several people touch the same codebase. ★ 41,024repo stars typescript-zod-tailwind-nextjs-cursorrules-prompt- Cursor coding standard for Next.js and TypeScript: enforces functional patterns, Zod validation, Shadcn UI, and desktop-first Tailwind CSS. ★ 41,024repo stars typescript-vuejs-cursorrules-prompt-file A Cursor rule that tells the agent how to write TypeScript inside Vue.js projects. Useful when you want edits across components to follow the same conventions. ★ 41,024repo stars typescript-vite-tailwind-cursorrules-prompt-file A Cursor rule that pins down TypeScript code style for Vue projects built with Vite and styled with Tailwind. Useful when you want the agent's output to stay predictable. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor