8.3 KiB
8.3 KiB
TYPO3 Project Rules for LLM Assistance
Project Overview
This project is a TYPO3 installation with a custom site-package extension located in packages/base, providing layout, templates, and modular ContentBlocks for pages. The LLM should dynamically determine the TYPO3 version and related dependencies by examining project files.
Technology Stack
- PHP (version defined in
composer.json) - TYPO3 (version defined in
composer.json) - Composer (
composer.json) - Deployer (
build/deploy.php,build/servers.yaml) - Webpack (
webpack.config.js) - PostCSS (
postcss.config.js) with Tailwind CSS (version defined inpackage.json) and Autoprefixer - SCSS (
packages/base/Resources/Public/Scss/) - JavaScript bundling (
packages/base/Resources/Public/JavaScript/) - PHPStan, Rector (
phpstan.neon,rector.php) - YAML and TypoScript for configuration
Project Structure
config/: Global TYPO3 config and environment overridesdata/: Database dumps and test fixturespackages/base/: Site-package extension with design assets, Fluid templates, TypoScript, ContentBlockspublic/: Document root- Build files:
webpack.config.js,postcss.config.js - Dependency manifests:
package.json,composer.json
Development Guidelines
- Use DDEV for local environment management:
ddev start,ddev restart,ddev stop, etc. - Check versions in
composer.jsonandpackage.jsonbefore referencing dependencies; the LLM should examine these files to determine actual versions - Manage PHP dependencies via Composer within DDEV:
ddev exec composer install,ddev exec composer update - Manage JS/CSS via npm within DDEV:
ddev exec npm install,ddev exec npm run dev/ddev exec npm run build - Follow TYPO3 extension conventions in
packages/base:ext_localconf.php,ext_tables.php,ext_emconf.php - Organize TypoScript under
packages/base/Configuration/Sets/SitePackage/TypoScript/ - Enforce static analysis and automated refactoring with PHPStan and Rector
Default Workflow
When handling any task, LLMs should follow this structured approach:
-
Information Gathering
- Read the necessary code from the project using available tools
- Examine
composer.jsonandpackage.jsonto understand current dependencies and versions - Use MCP servers to read documentation about libraries that are used and should be used
- Review relevant project files to understand the current implementation
- Gather context about the specific area of the codebase that will be affected
-
Planning
- Analyze the gathered information to understand the task requirements
- Plan how the task should be implemented within the existing project structure
- Consider potential impacts on other parts of the codebase
- Identify which files need to be created, modified, or reviewed
- Determine the best approach that follows project conventions and best practices
-
Implementation
- Execute the planned task using appropriate tools
- Follow the project's coding standards and conventions
- Test the implementation where possible
- Ensure all changes work within the existing project structure
-
Documentation Updates
- Update project documentation (README files) if the task affects user-facing functionality
- Update these rules (
.roo/rules/rules.md) if the task introduces new patterns, conventions, or important information that future LLMs should know - Ensure any new features or changes are properly documented for future reference
This workflow ensures thorough understanding, proper planning, clean implementation, and maintained documentation for all project changes.
ContentBlocks Usage
- Defined under
packages/base/ContentBlocks/ContentElements/ - Element folder contains:
config.yaml(block definition)templates/frontend.html(frontend rendering)templates/backend-preview.html(backend preview)language/labels.xlf(translations)
- To add a new block:
- Create a folder under
ContentElements/ - Define
config.yamland labels - Add Fluid templates in
templates/ - Clear caches and verify in TYPO3 backend (
ddev exec vendor/bin/typo3cms cache:flush)
- Create a folder under
- Content element restrictions:
- ContentBlocks are automatically registered via their YAML config files
- Availability is controlled through PageTSconfig using
TCEFORM.tt_content.CType.keepItems - The
keepItemslist inpackages/base/Configuration/Sets/SitePackage/page.tsconfigdetermines which content elements editors can use - To enable a new ContentBlock, add its CType to the
keepItemslist
- Clear caches after changes
Styling Guidelines
- All design work lives in the
packages/baseextension - SCSS structure in
Resources/Public/Scss/:abstracts/(variables, mixins, functions)base/(resets, global styles)components/(UI modules: buttons, cards, nav, etc.)layouts/(page-specific styles)
- Include Tailwind directives in
main.scss:@tailwind base; @tailwind components; @tailwind utilities; - Customize Tailwind in
tailwind.config.js
Build Process
- Compile SCSS → PostCSS (Tailwind + Autoprefixer) → CSS in
Resources/Public/Css/(within DDEV:ddev exec npm run build:css) - Bundle JS via Webpack →
Resources/Public/JavaScript/(within DDEV:ddev exec npm run build:js) - Run dev mode:
ddev exec npm run dev - Run production build:
ddev exec npm run build - Deploy via Deployer:
ddev exec vendor/bin/dep deploy
File Editing Guidelines
- TypoScript:
packages/base/Configuration/Sets/SitePackage/TypoScript/ - YAML:
packages/base/Configuration/**/*.yaml - Fluid templates:
packages/base/Resources/Private/**/*.html - SCSS:
packages/base/Resources/Public/Scss/**/*.scss - JavaScript:
packages/base/Resources/Public/JavaScript/**/*.js - Never read or commit the environment file:
.env
MCP Server Usage
- Use
brave_web_searchfor general web searches viause_mcp_tool - Use
resolve-library-id+get-library-docsfor official API docs:/typo3/docsfor TYPO3 reference/tailwindcssfor Tailwind CSS docs
- For NixOS/Home Manager queries: use
nixos_search,home_manager_search
Version Management
- Always inspect
composer.jsonfor PHP dependencies and TYPO3 version - Always inspect
package.jsonfor frontend dependencies - Use MCP servers (e.g.,
resolve-library-id,get-library-docs) to fetch documentation matching the exact versions found - Never assume specific dependency versions in code examples; dynamically reference versions as discovered
Common Tasks
- Initial Setup
ddev start ddev composer install ddev npm install - Development Build
ddev npm run dev - Production Build
ddev npm run build - Clear TYPO3 Cache
ddev typo3cms cache:flush - Add a ContentBlock
- Create folder, config, templates, translations
- Add the new ContentBlock's CType to the
keepItemslist inpackages/base/Configuration/Sets/SitePackage/page.tsconfig - Clear caches and verify in backend
- DDEV Environment Management
- Restart environment:
ddev restart - Stop environment:
ddev stop
- Restart environment:
- Deploy
ddev exec vendor/bin/dep deploy production
Troubleshooting
- Blank CSS/JS: confirm build pipeline ran; check
webpack.config.js - YAML Syntax Errors: validate
config.yamlwith a linter - Fluid Rendering Issues: clear caches; verify template paths
- TypoScript Not Loading: ensure correct path under
Configuration/Sets - Cache Problems: always flush caches after changes