Przejdź do treści
Biblioteka skilli
Programowanie · Przegląd i audyt

bagisto-coding-standards

/bagisto-coding-standards

Pilnuje konwencji kodu Bagisto w PHP i Blade: idiomy Laravel, komentarze, dostęp do bazy, bezpieczeństwo i lokalizacja.

Repozytorium
agent-skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
04.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
11
Skrypty
0
Komentarze HTML
1
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 04.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • SKILL.md zawiera komentarze HTML (1). Nie widać ich w podglądzie Markdown, a model je czyta.

Co robi i kiedy

Pilnuje konwencji kodu Bagisto w PHP i Blade: idiomy Laravel, komentarze, dostęp do bazy, bezpieczeństwo i lokalizacja.

Wyzwalacze z opisu

standardsconventionscode styledocblockcommentsrepository patternbladecomponent
Oryginalny opis (EN)

Use when writing, changing or reviewing any Bagisto PHP or Blade — the conventions this codebase holds to, covering Laravel idiom, code style, comments and docblocks, database access, Blade, security and localization. Trigger phrases include "standards", "conventions", "code style", "docblock", "comments", "repository pattern", "blade", "component", "binding", "event", "migration", "security", "XSS", "authorization", "escaping", "is this safe", "best practice".

Jak działa

  1. Reference files
  2. The rules in one screen
  3. Where the code and these files disagree
  4. Related
Sekcje z nagłówków SKILL.md, w oryginale · 91 linii, 903 słów
Podgląd SKILL.md
---
name: bagisto-coding-standards
description: Use when writing, changing or reviewing any Bagisto PHP or Blade — the conventions this codebase holds to, covering Laravel idiom, code style, comments and docblocks, database access, Blade, security and localization. Trigger phrases include "standards", "conventions", "code style", "docblock", "comments", "repository pattern", "blade", "component", "binding", "event", "migration", "security", "XSS", "authorization", "escaping", "is this safe", "best practice".
license: MIT
---

# Coding Standards

The canonical rules for all Bagisto code, in one place, so a change to a
DataGrid, a payment class or a theme is held to the same bar as a change to a
package.

**Pint decides the mechanical questions.** Run `vendor/bin/pint` and trust it for
spacing, import order, trailing commas and the rest. What follows is what Pint
cannot see — and what a reviewer will otherwise send back.

## Reference files

| File | Load when |
|---|---|
| [code-style.md](code-style.md) | Writing any PHP — multi-clause conditions, class member order |
| [comments.md](comments.md) | Any comment or docblock, in any language |
| [laravel.md](laravel.md) | Framework idiom — events, migrations, config, helpers, validation, queues |
| [data-access.md](data-access.md) | Reading or writing the database — the repository rule and its one exception |
| [database-compatibility.md](database-compatibility.md) | Any query, migration or raw SQL — MySQL, MariaDB and PostgreSQL all have to pass |
| [security.md](security.md) | Output, input, uploads, SQL, secrets, payments |
| [security-authorization.md](security-authorization.md) | Routes, permissions, guards, one user's access to another's data |
| [blade.md](blade.md) | Any `.blade.php` — namespaces, `:` versus `::`, components, page skeleton |
| [blade-formatting.md](blade-formatting.md) | Indentation, attribute layout, `@props` alignment, recipes |
| [localization.md](localization.md) | Any user-facing string, or a `Resources/lang/` change |

The PHP rules apply inside an `@php` block too, which Pint cannot reach.

## The rules in one screen

- **Every method and property carries a docblock**, whatever its visibility. The
  description is a capitalised sentence ending in a full stop, and it is **at most
  two lines**. Type information belongs in the signature; add `@param`/`@return`
  only for what a native type cannot express.
- **Class members run constants → properties → constructor → public →
  protected → private**, each visibility one contiguous block. A helper called
  by a public method still lives in the protected block at the bottom.
- **A condition with more than one clause goes multiline**, the boolean operator
  leading each line. Single-clause conditions stay inline. The rule keys off the
  number of clauses, not the line length.
- **No comments inside method bodies** or object literals — not even a one-line "why". A non-obvious reason belongs in the method's docblock or the commit message. If a line needs prose to be understood, extract a named method instead. **Markup takes HTML arrow comments, `<!-- -->`**, for labels and reasons alike, so do not convert them to `{{-- --}}`. See [comments.md](comments.md).
- **No docblock above the class**, ever — 98.7% of core classes have none. The
  docblock belongs on the method, property or constant, never on the class,
  interface, trait or enum.
- **A docblock is at most two lines.** One is the norm. If it does not fit in
  two, it is not docblock material — cut it or move it to the commit message.
- **All database access goes through a repository.** No `DB::` and no model
  queries in controllers, listeners, jobs or services. The single sanctioned
  exception is a DataGrid's `prepareQueryBuilder()`.
- **Every query has to run on MySQL, MariaDB and PostgreSQL.** Reach for `db_grammar()`
  rather than a literal `'like'` or a hand-written SQL function, and never resolve a conflict
  by catching a constraint violation — a failed statement aborts the whole PostgreSQL
  transaction. See [database-compatibility.md](database-compatibility.md).
- **Events are dot-delimited strings**, not classes — `catalog.product.update.after`
  — and fire in `before`/`after` pairs. See [laravel.md](laravel.md).
- **`:` binds a PHP value, `::` passes a literal `:` through to Vue**, and `::`
  only works on a Blade component tag. Getting this wrong fails silently. See
  [blade.md](blade.md).
- **Authorize on the server and escape at the point of interpolation.** Hiding a
  control is presentation; the route and the controller decide what is allowed,
  and a value is safe in element text yet dangerous inside an attribute. See
  [security.md](security.md).
- **Scope every storefront query to its owner.** An id from the request never
  selects a row on its own — that is the easiest real vulnerability to introduce
  here. See [security-authorization.md](security-authorization.md).
- **Every user-facing string goes through `trans()`**, with the key added to all
  23 locales and verified by `php artisan bagisto:translations:check`.
- **Translation keys are kebab-case, route names are snake_case** — the same
  feature is `admin::app.eu-withdrawal.view.received-at` as a key and
  `admin.sales.eu_withdrawals.index` as a route, so never rename one by searching
  for the other's spelling. A URL path is governed by neither. See
  [localization.md](localization.md).
- **Fix what you touch.** A pre-existing violation in a file you edit is yours —
  scan the whole class's member order and docblocks, not just your own lines.

## Where the code and these files disagree

The checkout wins. Follow the surrounding code, say so in your summary, and
raise the drift — these files are a snapshot, not the source of truth.

That is different from a file that is simply wrong: a missing docblock in an
untouched class is debt, not a convention. Match the *rule*, not the worst
example of it.

**Measure before a rule here changes existing code.** Count what the checkout does across the package, not in one file, with `git grep -c` or a short script. A rule the code follows overwhelmingly is the rule. One it ignores overwhelmingly is drift to raise, not code to rewrite. AGENTS.md outranks these files where the two disagree.

## Related

- **`bagisto-code-review`** — applying all of this to someone else's change.
- **`bagisto-package-development`** — the structure these rules are written inside.
Pliki w paczce (11)
  • SKILL.md 6 KB
  • blade-formatting.md 4 KB
  • blade.md 11 KB
  • code-style.md 4 KB
  • comments.md 11 KB
  • data-access.md 3 KB
  • database-compatibility.md 3 KB
  • laravel.md 5 KB
  • localization.md 2 KB
  • security-authorization.md 5 KB
  • security.md 10 KB

Wersje

W bazie nie ma innych skilli o nazwie bagisto-coding-standards.

Migawka bazy z 13.11.2026 · wersja paczki f89a4a945128 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100laravel-review
    Przegląda kod PHP, Laravel, Livewire i Blade pod kątem architektury, zapytań, OWASP i utrzymania, z gotowymi poprawkami.
  • 100spatie-laravel-php
    Stosuje standardy kodowania Spatie dla Laravela i PHP przy kontrolerach, modelach, migracjach, testach i szablonach Blade.
  • 95developing-with-laravel
    Opisuje wzorce frameworka Laravel dla aplikacji PHP: Eloquent ORM, migracje, routing, kolejki i szablony Blade.
  • 100laravel-blade-style
    Ustala konwencje projektów Laravel z Blade, Bootstrapem i prostym JS dla paneli, katalogów, sklepów i małych systemów.
  • 90php-laravel
    Opisuje nowoczesne wzorce PHP 8.4 i Laravel: architekturę, Eloquent, migracje, kolejki i testowanie, przy pracy z Blade, artisan i aplikacjami PHP opartymi na frameworku.
  • 90php-laravel
    Pisze aplikacje w PHP 8.2+ i Laravelu: Eloquent, kolejki, widoki Blade, migracje i testy w Pest.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.