/nette:frontend-developmentfrom nette
Provides frontend development guidelines for Nette: Vite, SCSS, TypeScript, Nette Assets, Naja AJAX, Tailwind CSS, Latte templates, and data passing from PHP to JavaScript.
Ships in nette. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
"type": "module" in package.jsonSource vs Built Assets separation:
assets/ directory with source files (SCSS, TypeScript, images)www/assets/ with optimized, versioned files for browsersBasic asset loading
{* Loads complete bundle with all dependencies *}
{asset 'app.js'}
Configuration
assets:
mapping:
default:
type: vite
path: assets # REQUIRED in practice - must match Vite's build.outDir
path is optional in the schema and nothing validates it, but when omitted it falls back to
%wwwDir%, so the manifest is looked up in www/.vite/manifest.json instead of
www/assets/.vite/manifest.json and you get RuntimeException: Failed to read Vite manifest.
devServer defaults to true, so there is no need to write it.
HMR works only when the application is in debug mode and the dev server is running, which PHP
learns from the file .vite/nette.json that the plugin writes into the mapper's path. The
lookup is hardcoded, so renaming the file with the plugin's infoFile option silently disables the
detection; then set devServer: '<url>' in NEON by hand.
type="module" is added only to Vite entry points. A script served by a file mapper
renders as a plain <script>, so an import in it fails with Cannot use import statement
outside a module. Write the attribute yourself, <script type="module" n:asset="app.js"></script>;
the only option {asset} accepts for such a file is version, anything else throws.
Passing data to JavaScript:
{* In template *}
<script>
window.appConfig = {
apiUrl: {$baseUrl . '/api'},
userId: {$user->isLoggedIn() ? $user->getId() : null},
locale: {$locale},
csrfToken: {$csrfToken}
};
</script>
{asset 'app.js'}
Latte automatically applies context-sensitive escaping – values inside <script> are JSON-encoded, so strings get quoted and null stays null.
// In JavaScript component
const { apiUrl, userId, csrfToken } = window.appConfig;
fetch(`${apiUrl}/user-data`, {
headers: { 'X-CSRF-Token': csrfToken }
});
Naja is the standard AJAX library for Nette – it handles snippet redrawing, form submissions, and history integration:
npm install naja
import naja from 'naja';
// Initialize after DOM is ready
naja.initialize();
Naja automatically intercepts links and forms with the ajax CSS class and handles snippet updates from the server. See Naja documentation for configuration and extensions.
Requires nette-forms npm package:
npm install nette-forms
Standard enhancement pattern:
import netteForms from 'nette-forms';
// Initialize Nette Forms validation
netteForms.initOnLoad();
Vite transpiles .ts entry points out of the box but never type-checks them. For checking, install
typescript, set "moduleResolution": "bundler" and "noEmit": true in tsconfig.json, and add a
script "typecheck": "tsc --noEmit" to package.json.
npm install --save-dev @nette/eslint-plugin eslint
Basic configuration with recommended rules:
// eslint.config.js
import nette from '@nette/eslint-plugin';
import { defineConfig } from 'eslint/config';
export default defineConfig([
{
extends: [nette.configs.recommended],
},
]);
Linting JavaScript in Latte templates:
npm install --save-dev eslint-plugin-html
// eslint.config.js
import nette from '@nette/eslint-plugin';
import pluginHtml from 'eslint-plugin-html';
import { defineConfig } from 'eslint/config';
export default defineConfig([
{
extends: [nette.configs.recommended],
},
{
files: ['app/**/*.latte'],
plugins: {
html: pluginHtml,
},
processor: '@nette/latte', // Handles Latte tags in JS
},
]);
This allows ESLint to check JavaScript inside <script> tags with Latte variables:
<script>
let name = {$name};
</script>
TypeScript support:
npm install --save-dev typescript typescript-eslint
import nette from '@nette/eslint-plugin/typescript';
export default defineConfig([
{
extends: [nette.configs.typescript],
},
]);
Custom rules:
@nette/no-this-in-arrow-except - Prevents this binding issues in arrow functions@nette/prefer-line-comments - Enforces // over /* */ for single-line commentsWhen using Tailwind CSS, configure it to scan Latte templates for class names:
/* assets/css/app.css */
@import 'tailwindcss';
@source '../app/**/*.latte';
The full Nette documentation for this topic is bundled with the plugin. Read a page when you need details beyond this skill:
{asset}, n:asset, {preload}, mappers, the PHP APIassets: sectionNaja, the AJAX library, has its own documentation at https://naja.js.org/.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub nette/agent-plugins --plugin nette20 skills in this plugin
/latte-templatesInvoke before creating or modifying .latte files, even for single-line changes. Provides Latte syntax, tags, filters, n:attributes, layouts, template inheritance, AJAX snippets, extensions, and Nette integration. Also trigger when user mentions Latte by name./neon-formatInvoke before creating or modifying .neon files. Provides NEON syntax and Nette configuration conventions. Use when writing or editing .neon config files, asking about NEON syntax (entities, multiline strings, inline notation, special values, escaping), converting YAML to NEON, parsing or encoding NEON in PHP (Neon::decode, Neon::encode), running neon-lint, or debugging NEON syntax errors. For phpstan.neon, use the phpstan-analysis skill (from nette-dev plugin) instead. Do not trigger for Nette DI concepts like autowiring and service registration without .neon file context./nette-architectureInvoke before designing presenters, modules, or application structure in web application. Use when asking about directory structure (app/ folder organization), presenter organization (modules, Admin/Front/Api, BasePresenter), domain-driven placement (Core/ vs Model/), component and factory placement, presenter lifecycle (action/render/template), CLI tasks, Accessory placement, project skeleton, or refactoring architecture. Also trigger when starting a new Nette project./nette-cachingInvoke before writing or reviewing code that uses nette/caching. Covers the Cache object and namespaces, load() with a generator callback, save(), remove(), clean(), the dependency array (Cache::Expire, Cache::Tags, Cache::Files, Cache::Items, Cache::Priority, Cache::Sliding, Cache::Callbacks), the Journal requirement for tags and priorities, bulkLoad(), output capture, storages (FileStorage, MemcachedStorage, SQLiteStorage, MemoryStorage, DevNullStorage) and the {cache} Latte tag. Also trigger for cache.storage or cache.journal in NEON, invalidation by tag, cache stampede, or disabling the cache in tests. Not for the Latte template cache or the DI container cache, which are separate mechanisms./nette-command-lineInvoke before writing or reviewing a PHP command-line script or tool that uses nette/command-line 2.0. Covers Command with addFlag(), addOption(), addArgument() and addCommand(), the Parser and its ParseResult, standalone --help and --version, negatable flags, optional values, defaults, enum, repeatable parameters, Normalizers, commands and subcommands dispatched with match, HelpRenderer, ParseException and ParseFailure, and the Console (colors and ColorDepth, NO_COLOR and FORCE_COLOR, links, setStatus() progress lines) with Ansi for measuring text. Also trigger for bin/ scripts, CLI argument parsing, "print the help", colored terminal output or progress bars in PHP. Also trigger when upgrading from 1.x, for code using new Parser($help), addFromHelp(), addSwitch(), parseOnly() or Parser::normalizeRealPath(), and for errors such as "Call to undefined method Parser::addFromHelp()" or "Too few arguments to function Parser::parse()"./nette-componentsInvoke before writing or modifying a Nette component (Control), a component factory or a signal handler, and before any AJAX/snippet code. Use when working with createComponent<Name>(), $this['name'], handle<Signal>() methods, signal links (n:href="click!", link('click')), {plink} in a component template, persistent parameters (#[Persistent]) and persistent components, redrawControl()/isControlInvalid(), {snippet} and {snippetArea}, dynamic snippets, isAjax() and $this->payload, Multiplier, or the component tree (getComponents(), getComponentTree(), monitor(), lookup(), $onAnchor). Also trigger for "snippet is not redrawing", BadSignalException, or "how do I do AJAX in Nette".Other plugins' skills for the same job