Skip to content

Commit f06ad2a

Browse files
fix(inertia-sails): inject inertiaContext middleware when order is not configured (#194)
* feat: added skills for beautiful-ui * fix(inertia-sails): inject inertiaContext middleware when order is not configured When sails.config.http.middleware.order is not explicitly defined (the default for all Sails apps), the hook skipped injecting the inertiaContext middleware entirely. This caused sails.inertia.share() calls in routes.before handlers to run outside AsyncLocalStorage context, silently dropping shared props. Initialize the middleware order with Sails' defaults when undefined, then inject inertiaContext before the router as intended. Closes #193
1 parent 0af459d commit f06ad2a

10 files changed

Lines changed: 3890 additions & 1 deletion

File tree

packages/inertia-sails/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,22 @@ module.exports = function defineInertiaHook(sails) {
128128
// the request is already wrapped in AsyncLocalStorage context.
129129
if (sails.config.http && sails.config.http.middleware) {
130130
const mw = sails.config.http.middleware
131-
if (mw.order && mw.order.indexOf('inertiaContext') === -1) {
131+
// When order is not explicitly configured, Sails uses a default order
132+
// internally. We need to set it here so we can inject inertiaContext
133+
// before the router middleware.
134+
if (!mw.order) {
135+
mw.order = [
136+
'cookieParser',
137+
'session',
138+
'bodyParser',
139+
'compress',
140+
'poweredBy',
141+
'router',
142+
'www',
143+
'favicon'
144+
]
145+
}
146+
if (mw.order.indexOf('inertiaContext') === -1) {
132147
const routerIdx = mw.order.indexOf('router')
133148
if (routerIdx !== -1) {
134149
mw.order.splice(routerIdx, 0, 'inertiaContext')

skills/beautiful-ui/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Beautiful UI Skills for Claude Code
2+
3+
Write meaningful, accessible, responsive markup in The Boring JavaScript Stack with Claude Code.
4+
5+
## Installation
6+
7+
```bash
8+
npx skills add sailscastshq/boring-stack/skills/beautiful-ui
9+
```
10+
11+
## Usage
12+
13+
After installing, Claude will automatically apply beautiful UI best practices when you build page layouts, forms, and component markup:
14+
15+
> "Build a settings page with a sidebar navigation"
16+
17+
> "Create a pricing page with feature comparison"
18+
19+
> "Add a blog post layout with author info and related articles"
20+
21+
> "Build a responsive dashboard with stats cards and a data table"
22+
23+
> "Add a signup form with validation"
24+
25+
## Skills Included
26+
27+
- **semantic-html** - Element selection guide: when to use which HTML element and why
28+
- **accessibility** - ARIA roles, live regions, skip links, focus management, keyboard navigation, contrast, reduced motion
29+
- **responsive-patterns** - Mobile-first breakpoints, container queries, responsive grids, navigation, tables, touch targets, viewport units
30+
- **typography** - Type scale, font stacks, line height, line length, letter spacing, font weight hierarchy, text color, prose, truncation, tabular numbers
31+
- **form-ux** - Form layout, labels, validation timing, error presentation, submit buttons, optional fields, destructive actions
32+
33+
## What is Beautiful UI?
34+
35+
Beautiful UI means building interfaces that are meaningful, accessible, and structurally correct. A `<nav>` tells screen readers "this is navigation." An `<article>` tells Reader Mode "this is the main content." A top-aligned label is completed fastest. A `tabular-nums` class aligns your pricing table. A `min-h-svh` replaces `h-screen` so mobile users don't have content hidden behind the address bar.
36+
37+
The goal is to eliminate div soup, fix accessibility gaps, make layouts responsive by default, establish typographic hierarchy, and build forms that are fast to complete and forgiving of mistakes. These patterns draw from Refactoring UI, Nielsen Norman Group, WCAG, and MDN best practices.
38+
39+
## Links
40+
41+
- [The Boring JavaScript Stack](https://docs.sailscasts.com/boring-stack)
42+
- [MDN HTML Elements Reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Element)
43+
- [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/)
44+
- [Tailwind CSS Documentation](https://tailwindcss.com/docs)
45+
46+
## License
47+
48+
MIT

skills/beautiful-ui/SKILL.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
name: beautiful-ui
3+
description: >
4+
Beautiful UI patterns for modern web development — semantic HTML, accessible markup, responsive design, typography,
5+
and form UX. Use this skill when building page layouts, structuring content, choosing semantic elements, implementing
6+
navigation, building forms, creating data tables, handling accessibility, designing responsive layouts, establishing
7+
typographic hierarchy, or any markup and styling that should be meaningful, accessible, and well-structured.
8+
Works with React, Vue, and Svelte with Tailwind CSS.
9+
metadata:
10+
author: sailscastshq
11+
version: '1.0.0'
12+
tags: beautiful-ui, semantic-html, accessibility, a11y, responsive, typography, form-ux, landmarks, aria, navigation, forms, tables, headings, tailwind, mobile-first, container-queries
13+
---
14+
15+
# Beautiful UI
16+
17+
Beautiful UI is the practice of building interfaces that are meaningful, accessible, and structurally correct. Every element should carry semantic weight — describing what content _is_, not just how it _looks_. Every layout should respond to the user's device. Every form should be fast to complete and forgiving of mistakes. Beautiful UI fills the gap between "it looks right" and "it _is_ right."
18+
19+
## When to Use
20+
21+
Use this skill when:
22+
23+
- Building page layouts with `<header>`, `<main>`, `<aside>`, `<footer>` landmarks
24+
- Structuring content sections with `<article>`, `<section>`, `<nav>`
25+
- Choosing between `<div>` / `<span>` and a more meaningful element
26+
- Writing navigation menus, breadcrumbs, and pagination
27+
- Building forms with proper labels, fieldsets, validation timing, and error presentation
28+
- Creating data tables with `<thead>`, `<tbody>`, `<caption>`, and `<scope>`
29+
- Establishing heading hierarchy (`<h1>` through `<h6>`)
30+
- Using interactive elements like `<details>`, `<dialog>`, `<menu>`
31+
- Embedding media with `<figure>`, `<figcaption>`, `<picture>`, `<video>`
32+
- Adding ARIA roles, live regions, skip links, or focus management
33+
- Making keyboard navigation work for tabs, menus, and custom widgets
34+
- Respecting `prefers-reduced-motion` and color contrast requirements
35+
- Building responsive layouts with Tailwind breakpoints and container queries
36+
- Creating responsive navigation (hamburger menus, off-canvas sidebars)
37+
- Making tables responsive (scroll, card transformation, priority columns)
38+
- Establishing typographic hierarchy with size, weight, and color
39+
- Using `tabular-nums` for data alignment, `text-balance` for headings
40+
- Configuring font stacks, custom fonts, and the prose/typography plugin
41+
- Designing form layouts (single-column, multi-column for related fields)
42+
- Implementing "reward early, punish late" validation with Inertia.js
43+
- Choosing between radio buttons and select menus
44+
- Building destructive action confirmations (type-to-confirm)
45+
46+
## Rules
47+
48+
Read individual rule files for detailed explanations and code examples:
49+
50+
- [rules/semantic-html.md](rules/semantic-html.md) - Element selection guide: when to use which HTML element and why
51+
- [rules/accessibility.md](rules/accessibility.md) - ARIA roles, live regions, skip links, focus management, keyboard navigation, screen reader announcements, contrast, and reduced motion
52+
- [rules/responsive-patterns.md](rules/responsive-patterns.md) - Mobile-first breakpoints, container queries, responsive grids, navigation, tables, forms, touch targets, and viewport units
53+
- [rules/typography.md](rules/typography.md) - Type scale, font stacks, line height, line length, letter spacing, font weight hierarchy, text color, prose styling, truncation, tabular numbers, and dark mode
54+
- [rules/form-ux.md](rules/form-ux.md) - Form layout, label placement, input sizing, validation timing, error presentation, submit buttons, optional fields, help text, and destructive action confirmation
55+
- [rules/spacing-over-dividers.md](rules/spacing-over-dividers.md) - Default to spacing over borders and dividers — fewer lines, more whitespace, cleaner interfaces

skills/beautiful-ui/metadata.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0",
3+
"organization": "Sailscasts",
4+
"date": "March 2026",
5+
"abstract": "Beautiful UI patterns for modern web development with React, Vue, and Svelte using Tailwind CSS. Covers semantic HTML element selection, document landmarks, heading hierarchy, navigation patterns, form structure, data tables, interactive disclosure elements, media embedding, accessibility (ARIA roles, live regions, skip links, focus management, keyboard navigation, screen reader announcements, color contrast, reduced motion), responsive design (mobile-first breakpoints, container queries, responsive grids, navigation, tables, touch targets, viewport units), typography (type scale, font stacks, line height, line length, letter spacing, font weight hierarchy, text color, prose styling, truncation, tabular numbers, dark mode), and form UX (layout, labels, validation timing, error presentation, submit buttons, optional fields, destructive actions).",
6+
"references": [
7+
"https://developer.mozilla.org/en-US/docs/Web/HTML/Element",
8+
"https://developer.mozilla.org/en-US/docs/Learn/Accessibility/HTML",
9+
"https://www.w3.org/WAI/tutorials/page-structure/",
10+
"https://html.spec.whatwg.org/multipage/sections.html",
11+
"https://www.w3.org/WAI/ARIA/apg/",
12+
"https://www.w3.org/WAI/WCAG21/Understanding/",
13+
"https://tailwindcss.com/docs/responsive-design",
14+
"https://tailwindcss.com/docs/font-size",
15+
"https://github.com/tailwindlabs/tailwindcss-typography",
16+
"https://www.nngroup.com/articles/web-form-design/",
17+
"https://refactoringui.com/",
18+
"https://inertiajs.com"
19+
]
20+
}

0 commit comments

Comments
 (0)