Invoke before creating or modifying Nette Forms. Provides form controls, validation, rendering patterns.
View on GitHubnette/claude-code
nette
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/nette/claude-code/blob/main/plugins/nette/skills/nette-forms/SKILL.md -a claude-code --skill nette-formsInstallation paths:
.claude/skills/nette-forms/## Nette Forms
Nette Forms provides secure, reusable forms with automatic validation on both client and server side.
```shell
composer require nette/forms
```
### Forms in Presenters
Forms are created in factory methods named `createComponent<Name>`:
```php
protected function createComponentRegistrationForm(): Form
{
$form = new Form;
$form->addText('name', 'Name:')
->setRequired('Please enter your name.');
$form->addEmail('email', 'Email:')
->setRequired('Please enter your email.');
$form->addPassword('password', 'Password:')
->setRequired('Please enter password.')
->addRule($form::MinLength, 'Password must be at least %d characters', 8);
$form->addSubmit('send', 'Register');
$form->onSuccess[] = $this->registrationFormSucceeded(...);
return $form;
}
private function registrationFormSucceeded(Form $form, \stdClass $data): void
{
// $data->name, $data->email, $data->password
$this->flashMessage('Registration successful.');
$this->redirect('Home:');
}
```
Render in template:
```latte
{control registrationForm}
```
### Create and Edit Pattern
Unified form for both creating and editing records:
```php
class ProductPresenter extends BasePresenter
{
public function __construct(
private ProductFacade $facade,
) {}
public function renderEdit(int $id = null): void
{
$this->template->product = $id
? $this->facade->getProduct($id)
: null;
}
protected function createComponentProductForm(): Form
{
$form = new Form;
$form->addText('name', 'Name:')
->setRequired();
$form->addTextArea('description', 'Description:');
$form->addInteger('price', 'Price:')
->setRequired()
->addRule($form::Min, 'Price must be positive', 1);
$form->addSubmit('send', 'Save');
$form->onSuccess[] = $this->productFormSucceeded(...);
return $form;
}
private function productFormSucceeded(Form $form, \stdClass $data): void
{
$id = $this->getParameter('id');
if ($id) {
$this->facade->update($id, (array) $data);
$this->flash