Skip to content

docs(skill): canonical vocabulary, trim SKILL.md, emphasize the partial loop#28

Merged
jackielii merged 10 commits into
mainfrom
docs/skill-vocabulary
Jun 10, 2026
Merged

docs(skill): canonical vocabulary, trim SKILL.md, emphasize the partial loop#28
jackielii merged 10 commits into
mainfrom
docs/skill-vocabulary

Conversation

@jackielii

Copy link
Copy Markdown
Owner

Summary

Establishes a canonical vocabulary for the structpages skill and applies it consistently through SKILL.md, with React/Next terms used as cross-references only (Go wins where Go owns the concept: ServeHTTP is a handler method, not a "server action").

Vocabulary

  • New Vocabulary section: core nouns (page, page group, component, page component, children, partial), the props cluster (Props method / props struct / props), methods on a page, and a loose-comparisons matrix for readers arriving from React/Next
  • New Request Lifecycle blurb: route match → Props method (RenderTarget) → page component render; handler methods bypass
  • Pattern A/B/C/D letters retired in favor of named shapes

Partial rendering emphasized

  • §4 now opens with the central loop: one method reference (MyPage.UserList) drives three agreeing sites — composition id={ID(…)}, trigger hx-target={IDTarget(…)}, server sel.Is(…) — so renames can't desynchronize them. Backed by new Key Rule 14
  • New §5c Nested swap levels (Page → Content → Detail): one page component per independently-swappable region; embed/target the innermost chrome-less level (corrected to exact-id matching per htmx.go, not "deepest method")

Trims (SKILL.md 612 → 486 lines; it loads whole on every trigger)

  • URL-validation listings → examples.md §14 (8-line summary + pointer remains)
  • Lint details defer to reference.md §Lint Tool (added the missing url-attr allowlist there)
  • Dropped redundant code blocks (interleaving wrong/right pair, static-assets listing duplicated by examples.md §12, local-wrapper suggestion removed as an anti-pattern)
  • Key Rules 5/10/11 tersened; Content de-emphasized to what it is — a naming convention, not a framework concept

…al loop

Establish canonical terms for recurring patterns (page, page group,
component, page component, partial, Props method / props struct,
handler method) with React/Next as cross-reference only, and apply
them consistently:

- Add Vocabulary and Request Lifecycle sections; retire Pattern A-D
  letters in favor of named shapes
- Open §4 with the central partial-rendering loop: one method
  reference drives composition id={ID(…)}, trigger
  hx-target={IDTarget(…)}, and server sel.Is(…) (new Key Rule 14)
- Add §5c nested swap levels (Page → Content → Detail), upstreamed
  and generalized; corrected to exact id match, not deepest-method
- Trim SKILL.md 612→486 lines: URL-validation listings move to
  examples.md §14, lint details defer to reference.md §Lint Tool,
  drop redundant code blocks, tersen Key Rules 5/10/11
- De-emphasize Content (naming convention, not framework concept);
  drop local wrapper suggestion
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.66%. Comparing base (e9b5d82) to head (551bea1).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #28   +/-   ##
=======================================
  Coverage   94.66%   94.66%           
=======================================
  Files          15       15           
  Lines        1594     1594           
=======================================
  Hits         1509     1509           
  Misses         51       51           
  Partials       34       34           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Trim the Validating URLs section to two sentences: lint catches the
static cases in CI; the boot-time validator and integration test in
examples.md §14 are for what static analysis can't see.
…t placement

Four pattern corrections from real-world usage:

- Redirects: never http.Redirect from a handler — an HTMX XHR follows
  the 3xx and swaps the target page's body into the partial's swap
  target. Return a Redirect control-flow signal; WithErrorHandler sends
  HX-Redirect for HTMX, 303 otherwise (full wiring in examples.md §13;
  middleware does the check inline)
- RenderComponent: pass a constructed component result, zero-value
  receiver for sibling pages (pages are stateless); the reflective
  method-expression form is reserved for DI-injected params, not
  'when you don't have the receiver'
- must(): only for plain-string contexts inside templ such as
  templ.Attributes values — attribute expressions take (string, error)
- §4 loop example now shows all three sites in code, including the
  server-side sel.Is branch
…o _ discards

must() stays only in its sanctioned spot: templ.Attributes values inside
templ files. The middleware example handles the URLFor error properly,
and the Props/template.Clone examples propagate errors instead of
discarding them.
…odies

http.Error now appears only as the documented anti-pattern (Rule 1) and
one annotated middleware escape hatch outside structpages' error
handling. The no-return API form shows a writeJSONError helper instead:
text/plain fits neither an API client nor an HTMX swap.
Per the htmx 4 reference: HX-Location is ajax navigation (like a
boosted link) and the right default within an htmx app; HX-Redirect
forces a full browser load and is only for non-htmx endpoints or pages
with different <head> content. Also document the 2xx requirement —
htmx ignores response headers on 3xx.
Nested routes compose into one ServeMux pattern: duplicate wildcard
names panic at mount, and URLFor's map params couldn't distinguish two
{id}s. Examples across all three files now model specific names.
@jackielii jackielii merged commit 31bf37a into main Jun 10, 2026
6 checks passed
@jackielii jackielii deleted the docs/skill-vocabulary branch June 10, 2026 20:24
jackielii added a commit that referenced this pull request Jun 17, 2026
docs(skill): canonical vocabulary, trim SKILL.md, emphasize the partial loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant