Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

add-page

/add-page

Dodaje stronę renderowaną po stronie serwera lub formularz z htmx do aplikacji Go templ, wraz z trasą i testami.

Repozytorium
stacks ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
08.11.2026

Ocena i bezpieczeństwo

86/ 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ść21 / 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
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

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

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Dodaje stronę renderowaną po stronie serwera lub formularz z htmx do aplikacji Go templ, wraz z trasą i testami.

Oryginalny opis (EN)

Add a server-rendered page, or a form that posts with htmx and swaps a partial, to this Go templ app, with its route, view types, error handling and tests. Use when the user asks for a new page, screen, form, partial, fragment or htmx interaction.

Jak działa

SKILL.md bez nagłówków drugiego poziomu · 12 linii, 282 słów

Podgląd SKILL.md
---
name: add-page
description: Add a server-rendered page, or a form that posts with htmx and swaps a partial, to this Go templ app, with its route, view types, error handling and tests. Use when the user asks for a new page, screen, form, partial, fragment or htmx interaction.
---

# Add a page or form

The notes page is the model to copy: `views.NotesPage` and `views.NoteForm` in `internal/views/notes.templ`, the `GET /{$}` and `POST /notes` routes in `internal/web/handler.go`, and their tests in `views_test.go` and `handler_test.go`.

1. Put the data in a domain package (`internal/<name>`) behind a context-aware `Store` interface. Validation returns `apperrors.Validation(map[string]string{"<field>": "<message for the person>"})`; a missing record returns `apperrors.New(apperrors.NotFound, ...)`.
2. Add the view types to `internal/views/models.go` (plain fields, no domain imports) and the component to a `.templ` file there. A full page renders inside `@Layout("<title>")`; a partial is its own component so the page and the htmx response share it. The hook regenerates `_templ.go` on save; run `make generate` if you renamed or deleted a component.
3. Register the route in `NewHandler` with a method pattern (`GET /things/{id}`) inside `endpoint(...)`, so a returned error renders the error page. Convert domain values to view types with a helper beside `viewNote`.
4. For a form: keep `action` and `method` beside `hx-post`, `hx-target` and `hx-swap`. On success, answer htmx with the fragment (200) and a plain post with `http.Redirect(..., http.StatusSeeOther)`. On a validation error, answer 422: htmx gets the form with `HX-Retarget`/`HX-Reswap` set, a plain post gets the whole page. Read the body with `readForm`'s pattern (`MaxBytesReader`, then `ParseForm`).
5. Test the component in `views_test.go` (goquery selectors on the rendered HTML) and the route in `handler_test.go`: the full page, the htmx and plain success paths, the 422 path with its headers and field errors, and a 404 or store failure. Add the page to the integration test when it changes what the binary serves.
6. Run `make generate-check templ-fmt-check fmt-check lint test test-integration`, then commit the `.templ`, `_templ.go` and Go files together.

Wersje

RepozytoriumWynikLicencja
Ta strona · steamfield/stacks86Apache-2.0
TurbineKit/turbinekit100MIT
steamfield/stacks96Apache-2.0
steamfield/stacks86Apache-2.0
steamfield/stacks86Apache-2.0

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

Pobrania w ostatnich 30 dniach: 2 · ranking

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

Podobne skille

  • 100templ-htmx
    Buduje aplikacje sterowane HTMX w templ: dynamiczne treści, aktualizacje na żywo i interakcje AJAX.
  • 95templ-htmx
    Buduje interaktywne aplikacje oparte na hipermediach z templ i HTMX: dynamiczne interfejsy, aktualizacje w czasie rzeczywistym i interakcje AJAX.
  • 100implement
    Implementuje przypadki użycia i naprawia błędy w aplikacji webowej w Go: zapytania sqlc, serwisy, walidacja formularzy, handlery net/http, widoki templ z htmx i trasy.
  • 100new-screen
    Generuje nowy ekran (lista, szczegóły, formularz, raport lub ustawienia) w aplikacji HTMX, PHP i Bootstrap 5.3, zgodny z systemem projektowym i zasadami mobilnymi.
  • 95goldr-app
    Tworzy i rozwija aplikacje w frameworku Goldr dla Go: trasy, układy, szablony templ, formularze, CSRF i HTMX.
  • 100playwright-test
    Tworzy testy end-to-end w przeglądarce dla aplikacji webowej w Go (templ i htmx) przez Playwright for Go, jako testy go test za tagiem budowania e2e, obejmujące pełne ścieżki użytkownika.

Uwagi i zgłoszenia

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