Back to Skills

nette-database

verified

Invoke before writing database queries or working with Selection API, ActiveRow in Nette.

View on GitHub

Marketplace

nette

nette/claude-code

Plugin

nette

development

Repository
Verified Org

nette/claude-code
29stars

plugins/nette/skills/nette-database/SKILL.md

Last Verified

January 20, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/nette/claude-code/blob/main/plugins/nette/skills/nette-database/SKILL.md -a claude-code --skill nette-database

Installation paths:

Claude
.claude/skills/nette-database/
Powered by add-skill CLI

Instructions

## Database

Uses Nette Database with MySQL 8.4+ as the backend.

```shell
composer require nette/database
```

For complete Explorer API, see [explorer.md](explorer.md).
For SQL queries, see [sql-way.md](sql-way.md).

### Database Conventions

- Table names use **singular form** (e.g., `user` not `users`)
- Use TINYINT(1) for booleans
- Use `id` for primary keys
- Character encoding should be:
  - `utf8mb4_cs_0900_ai_ci` for Czech-language applications
  - `utf8mb4_0900_ai_ci` for English-language applications
- Standard timestamp fields:
  - `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP
  - never use TIMESTAMP for date/time fields


### Database Explorer

Extends Nette Database Explorer to automatically map database tables to typed entity classes.

**Core benefit:** Zero-configuration entity mapping with full IDE support.
**How it works:** Converts table names (snake_case) to entity class names (PascalCase + Row suffix).

### Entity Design Strategy

All entities in `App\Entity` with consistent `Row` suffix:

- `product` table → `ProductRow`
- `order_item` table → `OrderItemRow`
- `variant_expiration` table → `VariantExpirationRow`

**Why flat:** Entities are data structures that cross domain boundaries. ProductRow used in catalog, orders, inventory, and reporting contexts.

#### Entity Organization

**All entities in single App\Entity namespace** - avoid domain subdivision:

```
app/Entity/
├── ProductRow.php          ← Core business entities
├── OrderItemRow.php        ← Relationship entities
└── StockTransferRow.php    ← Operational entities
```

#### Entity Documentation Patterns

```php
/**
 * @property-read int $id
 * @property-read string $title
 * @property-read bool $active
 * @property-read ?CategoryRow $category        ← nullable relationship
 * @property-read UserRow $author               ← required relationship
 */
final class ProductRow extends Table\ActiveRow
{
}
```

**Documentation rules:**
1. Document ALL accessible properties (including inherit

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6557 chars