Loading...
Loading...
Simplify and refine TYPO3 extension code for clarity, consistency, and maintainability while preserving functionality. Reviews PHP classes, Fluid templates, TCA, Services.yaml, and ext_localconf/ext_tables for TYPO3 v14 best practices. Run after implementing a feature or before merging a PR. Use when working with simplify, clean up, refine, code quality, reduce complexity, readability, maintainability, review code, polish, TYPO3 code review.
npx skill4agent add dirnbauer/webconsulting-skills typo3-simplifyAdapted from Boris Cherny's (Anthropic) code-simplifier agent for TYPO3 contexts. Target: TYPO3 v14 (primary), v13, v12.4 LTS (fallbacks noted).
git diff --name-only HEAD~1| Custom Pattern | TYPO3 API Replacement |
|---|---|
Manual DB queries ( | |
| Inject |
| |
| Manual JSON response construction | |
| Constructor injection via |
| |
| Inject |
| Constructor DI |
| Manual file path resolution | |
| Custom caching with globals | |
| |
| Manual page tree traversal | |
| |
| PSR-14 events or |
| Manual link generation | |
| Deprecated | v14 Replacement |
|---|---|
| |
| PSR-14 events |
| |
| PSR-14 events or DI decoration |
| Separate plugins per action |
| Set in controller, not repository |
| Signal/Slot | PSR-14 events |
| Extbase controller or middleware |
TCA | Dedicated TCA keys: |
| |
| |
| |
declare(strict_types=1)finalreadonlyuse@array// Before
class MyService
{
private ConnectionPool $connectionPool;
private Context $context;
public function __construct(ConnectionPool $connectionPool, Context $context)
{
$this->connectionPool = $connectionPool;
$this->context = $context;
}
public function getData($id)
{
// ...
}
}
// After
final class MyService
{
public function __construct(
private readonly ConnectionPool $connectionPool,
private readonly Context $context,
) {}
public function getData(int $id): array
{
// ...
}
}<f:translate><f:link.page><f:link.typolink><a href><f:image><img>{variable -> f:format.raw()}<f:section><f:if><f:switch>itemslabelvalue'exclude' => true'type' => 'email''type' => 'datetime''type' => 'number''type' => 'link''type' => 'color''type' => 'json''required' => true'eval' => 'required''nullable' => true'eval' => 'null''default' => ''columnsctrlhiddenstarttimeendtimefe_groupsys_language_uidl10n_parentl10n_diffsourcevisibilityhiddenaccessstarttime, endtimeext_tables.sqlshowitem_defaults: autowire: true, autoconfigure: true, public: falsefactory#[Autoconfigure]public: trueGeneralUtility::makeInstance()Configuration/ExtensionUtility::configurePlugin()registerPluginaddPageTSConfigConfiguration/page.tsconfigaddUserTSConfigConfiguration/user.tsconfigaddTypoScriptConfiguration/TypoScript/setup.typoscript*setMaxResults()count()JOINTYPO3\CMS\Core\Resource\ProcessedFileRepositoryfindAll()@TYPO3\CMS\Extbase\Annotation\ORM\Lazyforeachin_array()WHERE INcache:flush## Classes/Controller/MyController.php
:42 — replace GeneralUtility::makeInstance(MyService::class) → constructor injection
:18 — add return type `: ResponseInterface`
:55 — deprecated: $GLOBALS['TSFE']->id → $request routing attribute
:67 — guard clause: invert condition, return early, reduce nesting
## Resources/Private/Templates/List.html
:12 — hardcoded string "No items found" → f:translate
:34 — manual <a href> → f:link.page
## Configuration/TCA/Overrides/tt_content.php
:8 — v12 items format ['Label', 'value'] → ['label' => 'Label', 'value' => 'value']
Applied 7 fixes. No behavior changes. Run tests to verify.Configuration/RequestMiddlewares.php#[AsMiddleware]Services.yaml#[AsEventListener]itemslabelvalue#[Autoconfigure]The following simplification opportunities are v14-specific.
| Pattern | Simplification |
|---|---|
| Replace with |
Extbase annotations ( | Replace with |
| Replace with |
| Replace with |
| Bootstrap Modal JS | Replace with native |
TCA | Replace with per-column |
| Custom localization parsers | Remove, use Symfony Translation Component |
| Remove, use System Resource API |
/simplify