@samline/skills 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -61,7 +61,7 @@ node /path/to/skills/bin/skills.mjs add --profile site --dir .
61
61
  | `core` | workflow, qa, debugging |
62
62
  | `site` | workflow, catalog, kickoff, frontend, components, motion, i18n, qa, debugging |
63
63
  | `client-qa` | `site` + tasks |
64
- | `library` | workflow, library, qa, debugging, frontend, motion |
64
+ | `library` | workflow, library, qa, debugging |
65
65
 
66
66
  Names in the table omit the `samline-` prefix. `samline-voice` and `silence` are
67
67
  opt-in: `npx @samline/skills add samline-voice`.
package/bin/skills.mjs CHANGED
@@ -327,6 +327,25 @@ const check = (opts) => {
327
327
  if (state !== "ok") drift++;
328
328
  console.log(`${state.padEnd(28)} ${name}`);
329
329
  }
330
+ // Tool folders must only point into .agents; a real copy is a fork.
331
+ for (const tool of [".claude", ".codex"]) {
332
+ const folder = join(opts.dir, tool);
333
+ if (!existsSync(folder)) continue;
334
+ const walk = (dir) => {
335
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
336
+ const path = join(dir, entry.name);
337
+ if (entry.isSymbolicLink()) continue;
338
+ if (entry.isDirectory()) walk(path);
339
+ else if (!["settings.local.json", "launch.json"].includes(entry.name)) {
340
+ drift++;
341
+ console.log(
342
+ `${"real file in tool folder".padEnd(28)} ${relative(opts.dir, path)} (move it into .agents and link it)`,
343
+ );
344
+ }
345
+ }
346
+ };
347
+ walk(folder);
348
+ }
330
349
  process.exitCode = drift ? 1 : 0;
331
350
  };
332
351
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samline/skills",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Agent skills that work the way samline works: workflow, kickoff, frontend, components, QA and more, for any project and stack.",
5
5
  "license": "MIT",
6
6
  "author": "Samuel Olvera (samline)",
@@ -6,6 +6,15 @@ license: MIT
6
6
 
7
7
  # Pick a samline package before writing behavior
8
8
 
9
+ Precedence: installed project features and recorded decisions win. If the
10
+ project already has an owner for a behavior (a local runtime, a starter recipe,
11
+ an installed feature), use it and use this table only when no owner exists.
12
+ Never swap a working owner for a package. The user's instructions, the project's
13
+ `AGENTS.md`, `DESIGN.md` and `.agents/memory` and the stack skill rank above this
14
+ skill; in a @samline/* repository `samline-package` and the repository's
15
+ `AGENTS.md` are authoritative, and this table is not a checklist for building a
16
+ package.
17
+
9
18
  Every package does one job, has zero runtime dependencies, works without a
10
19
  framework and keeps content usable without JavaScript. Before writing a
11
20
  controller, check this table. Reuse a package instead of recreating its
@@ -40,9 +49,9 @@ install it in a site.
40
49
  1. Check whether it is already installed and which version (`package.json`, the
41
50
  lockfile). In a project generated by `@samline/astro`, Forms and Formatter
42
51
  come with the `forms` feature.
43
- 2. Install with the project's package manager (`pnpm add`, `npm install` or
44
- `bun add` as the project already uses). In samline's own repositories,
45
- install with pnpm.
52
+ 2. Install with the project's install tool from its `AGENTS.md`; with split
53
+ install and run tools, install with the install tool. Never switch the
54
+ project's package manager for a package.
46
55
  3. Read the package's own skill for its API: it is served at
47
56
  `https://samline.github.io/<name>/skills/<name>/SKILL.md` (docs at
48
57
  `https://samline.github.io/<name>/`). Verify the installed version against
@@ -66,5 +75,6 @@ install it in a site.
66
75
  ## Reporting defects
67
76
 
68
77
  A package bug goes to `.local/upstream/<package>.md` with the installed version,
69
- a sanitized reproduction and expected versus actual behavior. Post it as an
70
- issue only when the user asks.
78
+ a sanitized reproduction and expected versus actual behavior. Check current
79
+ releases and existing issues first: the defect may already be fixed. Post it as
80
+ an issue only when the user asks.
@@ -1,20 +1,27 @@
1
1
  ---
2
2
  name: samline-components
3
- description: How to structure pages, layouts, sections and reusable components in any stack: the ownership chain, component folders with co-located assets and explicit registration, interaction states in variants, severity decoupled from visual type, and inventory before markup. Use when creating or refactoring a page, layout, section, component or its props, or before writing markup that a package or existing component might cover. The project's AGENTS.md and stack skill win over it.
3
+ description: "How to structure pages, layouts, sections and reusable components in any stack: the ownership chain, component folders with co-located assets and explicit registration, interaction states in variants, severity decoupled from visual type, and inventory before markup. Use when creating or refactoring a page, layout, section, component or its props, or before writing markup that a package or existing component might cover. The project's AGENTS.md and stack skill win over it."
4
4
  license: MIT
5
5
  ---
6
6
 
7
7
  # Build components with clear owners
8
8
 
9
+ Precedence: the user's current instructions, then the project's `AGENTS.md`,
10
+ `DESIGN.md` and `.agents/memory`, then the stack skill (and `samline-package`
11
+ in @samline/* repositories), then this skill. When this skill disagrees with
12
+ them, follow them and mention the conflict once. An absolute "never" below
13
+ defers to `DESIGN.md` or a recorded owner decision.
14
+
9
15
  The stack skill (samline-astro, …) defines file extensions, folder roots and
10
16
  framework APIs; this skill defines who owns what. Examples are kept tiny and
11
17
  interchangeable. HTML, CSS and platform rules live in `samline-frontend`; motion
12
- in `samline-motion`; copy in `samline-i18n`.
18
+ in `samline-motion`; copy in `samline-i18n` (each when installed).
13
19
 
14
20
  ## Inventory before markup
15
21
 
16
22
  Before writing markup or behavior, list what already exists: the project's
17
- components, its helpers, and the packages in `samline-catalog`. Reuse before
23
+ components, its helpers, and the packages in `samline-catalog` (when installed;
24
+ an owner the project already has wins over it). Reuse before
18
25
  creating a wrapper, a barrel or a second API for the same job. Record which
19
26
  package or component was chosen for each design pattern and what it replaced.
20
27
  Never wrap a package in a component that re-implements its state.
@@ -68,6 +75,8 @@ sections/Hero -> private: HeroMedia; public: Button, Container
68
75
  - Register assets explicitly (an import or registry entry in the component
69
76
  that needs them), not by each component pulling its own build tags. Explicit
70
77
  registration makes the asset graph readable and the load order reviewable.
78
+ Unless the stack's convention is a script co-located in the component (for
79
+ example an Astro `<script>`); the stack skill decides.
71
80
  - Arrow functions and closures, no classes or `this`, in scripts. A browser
72
81
  controller handles multiple instances, owns its listeners and cleanup, and
73
82
  does not mount twice across navigation.
@@ -87,7 +96,16 @@ sections/Hero -> private: HeroMedia; public: Button, Container
87
96
  with dictionary copy. An indicator inside a result (check, badge, color) must
88
97
  come from the real outcome, never decorate.
89
98
  - Mark the active navigation item from the real route, and show current state
90
- with `aria-current`, not only color.
99
+ with `aria-current`, not only color: `aria-current="page"` for the exact
100
+ match and `aria-current="location"` for ancestors. The home root matches
101
+ exactly. Match on whole path segments, ignore the query and trailing slash,
102
+ and let the most specific entry win, so `/shop` never marks `/shopping`.
103
+ - Copy-to-clipboard controls replace the label ("Copy" to "Copied", about two
104
+ seconds) at a fixed width, so the layout does not shift. This is a default;
105
+ the project's component wins.
106
+ - Hover-only effects sit under `@media (hover: hover) and (pointer: fine)`;
107
+ interactive targets are at least 2.75rem; inputs at least 1rem; no
108
+ title-only affordances (`samline-frontend`).
91
109
 
92
110
  ## Severity versus type
93
111
 
@@ -107,7 +125,9 @@ is `warning`. Changing the icon does not change the button's severity.
107
125
  - No wrapper `tabindex` on a card. When one main link represents the whole
108
126
  item, reflect its `:focus-visible` on the card with `:has()`; keep the link
109
127
  as the tab stop, secondary controls keep their own focus.
110
- - A modal's initial focus must not open an on-screen keyboard unless typing is
111
- the task; keep focus contained and return it on close.
128
+ - A drawer or dialog focuses its container by default and never autofocuses an
129
+ editable field, because that opens the on-screen keyboard; unless typing is
130
+ the whole task, or `DESIGN.md` decides otherwise. Keep focus contained and
131
+ return it on close.
112
132
  - Blade only: `<x-*>` inside a JS comment breaks compilation; `@json` inside a
113
133
  component attribute is not compiled — pass the value with `@js` or a prop.
@@ -1,13 +1,18 @@
1
1
  ---
2
2
  name: samline-debugging
3
- description: Investigate before concluding. Read the whole method before claiming a gap, trace callers and dynamic imports before calling code dead, measure layout in document coordinates, separate desired from applied state, remove conflicting constraints instead of adding offsets, patch dependencies only through pnpm patch with an upstream note, and check the target before destructive commands. Use when diagnosing a bug, auditing code, declaring code unused, fixing layout or scroll offsets, patching a dependency, or running reset/delete/migrate commands. Project AGENTS.md wins.
3
+ description: Investigate before concluding. Read the whole method before claiming a gap, trace callers and dynamic imports before calling code dead, measure layout in document coordinates, separate desired from applied state, remove conflicting constraints instead of adding offsets, patch dependencies only with the package manager's patch tool and an upstream note, and check the target before destructive commands. Use when diagnosing a bug, auditing code, declaring code unused, fixing layout or scroll offsets, patching a dependency, or running reset/delete/migrate commands. Project AGENTS.md wins.
4
4
  license: MIT
5
5
  ---
6
6
 
7
7
  # Debugging: investigate before concluding
8
8
 
9
- Complements the triage list in `samline-workflow` (`evidence-and-qa.md`). The
10
- project's `AGENTS.md` and the user's instructions win.
9
+ Complements the triage list in `samline-workflow` (`evidence-and-qa.md`).
10
+
11
+ Precedence: the user's current instructions, then the project's `AGENTS.md`,
12
+ `DESIGN.md` and `.agents/memory`, then the stack skill (and `samline-package` in
13
+ @samline/* repositories), then this skill. When this skill disagrees with them,
14
+ follow them and mention the conflict once. In a @samline/* repository,
15
+ `samline-package` and the repository's `AGENTS.md` are authoritative.
11
16
 
12
17
  ## Rules
13
18
 
@@ -53,14 +58,19 @@ project's `AGENTS.md` and the user's instructions win.
53
58
 
54
59
  Patch only for a confirmed defect in the installed version, never for taste.
55
60
 
56
- 1. Reproduce the defect with the smallest case and confirm it exists upstream.
57
- 2. Use `pnpm patch <package>` and keep the change as small as possible. Never
58
- edit `node_modules` by hand: the next install erases it.
59
- 3. Record the finding in `.local/upstream/<package>.md` (private, ignored by
60
- Git): the symptom, the cause, the patch, and the upstream issue or the text of
61
- the report you will file.
62
- 4. Name the upstream issue in the patch commit and remove the patch when a fixed
63
- version is released.
61
+ 1. Check current releases and existing issues first: a newer version may already
62
+ fix it. Reproduce the defect with the smallest case and confirm it upstream.
63
+ 2. Use the patch tool that matches the project's package manager (`pnpm patch`,
64
+ `bun patch`, or `patch-package` under npm) and keep the change as small as
65
+ possible. Never edit `node_modules` by hand: the next install erases it.
66
+ 3. Commit the patch file. Record the upstream issue and the patched version in
67
+ the project's `todos.md`, so the patch is removed when a fix is released.
68
+ 4. Keep the private finding in `.local/upstream/<package>.md` (ignored by Git):
69
+ symptom, cause, patch and the text of the report you will file. Post it only
70
+ when the user asks.
71
+ 5. An npm `overrides` entry for a direct dependency is rejected unless the
72
+ specifier matches the declared one exactly: change the dependency itself
73
+ instead.
64
74
 
65
75
  ## Destructive commands
66
76
 
@@ -1,11 +1,23 @@
1
1
  ---
2
2
  name: samline-frontend
3
- description: HTML, CSS and platform rules for any site: design tokens, breakpoints, progressive enhancement, selector precedence, SVG icons, spacing ownership, image geometry and LCP, sanitizing external HTML, and native-first forms. Use when writing or reviewing markup, styles, client scripts, images, icons or forms, before adding a one-off style. The project's AGENTS.md, DESIGN.md and stack skill win over it.
3
+ description: "HTML, CSS and platform rules for any site: design tokens, breakpoints, progressive enhancement, selector precedence, SVG icons, spacing ownership, image geometry and LCP, sanitizing external HTML, and native-first forms. Use when writing or reviewing markup, styles, client scripts, images, icons or forms, before adding a one-off style. The project's AGENTS.md, DESIGN.md and stack skill win over it."
4
4
  license: MIT
5
5
  ---
6
6
 
7
7
  # Frontend rules (stack-neutral)
8
8
 
9
+ Precedence: the user's current instructions, then the project's `AGENTS.md`,
10
+ `DESIGN.md` and `.agents/memory`, then the stack skill (and `samline-package`
11
+ in @samline/* repositories), then this skill. When this skill disagrees with
12
+ them, follow them and mention the conflict once. An absolute "never" below
13
+ defers to `DESIGN.md` or a recorded owner decision.
14
+
15
+ Scope: these rules govern how a site or app uses markup, styles and motion. A
16
+ package that owns an element (drawer panel, toast, ticker track) animates its
17
+ own nodes; its closed and exit states are not hidden start states as long as
18
+ content is not hidden without JavaScript. The package ships its own
19
+ `prefers-reduced-motion` handling in its stylesheet.
20
+
9
21
  Before any HTML, CSS or client-side JavaScript, search `modern-web-guidance`:
10
22
  platform APIs change faster than memory. The stack skill (samline-astro, …)
11
23
  defines the file layout, token file and framework APIs; the project's
@@ -22,7 +34,9 @@ evidence rules live in `samline-workflow`.
22
34
  would not share it.
23
35
  - Author lengths in `rem` (and unitless zero); keep native asset dimensions and
24
36
  values a library requires as numbers. Viewport dimensions are test inputs, not
25
- authored lengths.
37
+ authored lengths. Derive library-required distances and speeds from `rem` at
38
+ the API boundary; never hardcode `px` in script config, so enlarged root text
39
+ scales them.
26
40
  - Normalize values observed in a design explicitly; do not treat a measured
27
41
  value as an approved token.
28
42
  - A preference that is not a token is decided once and recorded in `DESIGN.md`.
@@ -32,15 +46,17 @@ evidence rules live in `samline-workflow`.
32
46
  - Content is visible and usable without JavaScript. A script adds behavior; it
33
47
  never reveals content that is hidden by default.
34
48
  - No hidden start states: do not set `opacity: 0` or `display: none` in
35
- authored CSS for content that JavaScript will show. `samline-motion` owns the
36
- one permitted pending state.
49
+ authored CSS for content that JavaScript will show. `samline-motion` (when
50
+ installed) owns the one permitted pending state.
37
51
  - Reserve geometry before JavaScript runs (dimensions, `aspect-ratio`,
38
- `min-height`) so hydration causes no shift. To hide a not-yet-ready region
39
- and keep its space, use `visibility: hidden` plus `inert`, not `display: none`.
52
+ `min-height`) so hydration causes no shift. Use `visibility: hidden` plus
53
+ `inert` (not `display: none`) only when the script itself applies the hidden
54
+ state, or for a region with no content without JavaScript (data loaded by
55
+ JS). Never make it an authored-CSS default for content present in the HTML.
40
56
  - Semantics and keyboard support are part of the feature: native elements
41
57
  first, visible `:focus-visible`, names for every control.
42
58
  - Without a DOM (server, tests) scripts are no-ops; no DOM access at import.
43
- - Respect `prefers-reduced-motion`; see `samline-motion`.
59
+ - Respect `prefers-reduced-motion`; see `samline-motion` when installed.
44
60
 
45
61
  ## CSS
46
62
 
@@ -48,7 +64,8 @@ evidence rules live in `samline-workflow`.
48
64
  stylesheet order or load order, because order breaks when a bundle reorders.
49
65
  - Spacing: the container owns horizontal padding, parents space children with
50
66
  `gap`, children carry no outer margins. A child's margin leaks into every
51
- parent that reuses it.
67
+ parent that reuses it. Exception: `margin-block-start: auto` and
68
+ `margin-inline: auto` for remaining-space alignment and centering.
52
69
  - Prefer `min-height` and wrapping over fixed heights; use `minmax(0, 1fr)`
53
70
  in grids and `min-inline-size: 0` on flex or grid children so long text
54
71
  cannot widen a column. Never hide overflow to silence a defect.
@@ -57,7 +74,16 @@ evidence rules live in `samline-workflow`.
57
74
  - Remove the constraint that conflicts rather than adding page-specific
58
75
  offsets; offsets multiply with every new page.
59
76
  - Contrast: body and placeholder text at least 4.5:1; large text and control
60
- borders at least 3:1, in every theme and state.
77
+ borders at least 3:1, in every theme and state. On colored surfaces derive
78
+ secondary text from that surface, not a generic gray.
79
+ - Type: line length about 65-75ch; about a 1.25x step between heading and body
80
+ sizes so hierarchy reads; letter-spacing no tighter than -0.04em; no justified
81
+ body text (uneven word gaps hurt reading).
82
+ - Depth: a border or a shadow, never both, so elevation has one signal.
83
+ - Hover-only effects go under `@media (hover: hover) and (pointer: fine)`
84
+ because touch has no hover. Interactive targets are at least 2.75rem (44px).
85
+ Inputs are at least 1rem so mobile browsers do not zoom. Never rely on a
86
+ `title` alone as an affordance: touch and keyboard users never see it.
61
87
 
62
88
  ## Icons
63
89
 
@@ -73,31 +99,39 @@ render differently per platform and cannot be sized, colored or named reliably.
73
99
  deferred; below-the-fold images are.
74
100
  - Inspect supplied artwork for embedded text or numbers before adding
75
101
  decoration on top.
102
+ - Never replace a block with an image-only composite. Use real HTML text and
103
+ buttons over separate photos: text baked into an image cannot be read,
104
+ translated, selected or clicked.
76
105
  - Which image pipeline to use is a per-project decision recorded in the
77
106
  project's decisions; check generated output and the deployed endpoint, not
78
107
  only the static build.
79
108
 
80
109
  ## Security at the boundary
81
110
 
82
- - Sanitize external HTML (CMS, commerce, API) with one sanitizer the project
83
- owns, at the output boundary. Never `innerHTML` external data; use text
84
- nodes or templates.
111
+ - In sites and apps: sanitize external HTML (CMS, commerce, API) with one
112
+ sanitizer the project owns, at the output boundary. Never `innerHTML`
113
+ external data; use text nodes or templates. A library never ships a
114
+ sanitizer (see `samline-library`).
85
115
  - Secrets live only in the environment or the provider, never in Git, client
86
116
  bundles, screenshots or evidence files. Every variable is declared in
87
117
  `.env.example`.
88
118
  - Third-party embeds own their markup and transport: do not claim CSS control
89
119
  of a cross-origin frame, and do not rebuild a vendor's submission path just
90
- to restyle it.
120
+ to restyle it. Register the vendor's ready callbacks before loading its SDK
121
+ (it may fire immediately), use its exact field names even when misspelled,
122
+ and do not gate the form on a read-back. An SDK that observes `body` breaks
123
+ under client routers that swap the body; check it after navigation.
91
124
 
92
125
  ## Forms
93
126
 
94
- - One library owns validation and formatting (`@samline/forms`, with
95
- `@samline/formatter` for masks; see `samline-catalog` when installed). Do not build a
96
- parallel state or validation engine.
127
+ - In sites and apps: if the project already has a form or validation owner,
128
+ use it. Otherwise one library owns validation and formatting (`@samline/forms`
129
+ with `@samline/formatter` for masks, per `samline-catalog` when installed).
130
+ Do not build a parallel state or validation engine.
97
131
  - Native constraints (`required`, `type`, `pattern`) are the no-JavaScript
98
132
  fallback; the library enhances them.
99
133
  - Each field owns its label, help text and error message; errors name the
100
- problem and the recovery, and live in the dictionary (`samline-i18n`).
134
+ problem and the recovery, and live in the dictionary (`samline-i18n`, when installed).
101
135
  - Errors keep what the user typed; never clear input on a failed submit.
102
136
  - Keep submit logic with the form that owns it. Never retry an uncertain
103
137
  submission that is not idempotent.
@@ -106,5 +140,5 @@ render differently per platform and cannot be sized, colored or named reliably.
106
140
 
107
141
  - `vw`, `vh` and `vmax` units are percentages: `2.6vmax` is about 33px on a
108
142
  1280px-wide viewport, not thousands. Mask and gradient positions in `%` are relative to free space.
109
- - Viewport rect versus document offset: see `samline-debugging`.
143
+ - Viewport rect versus document offset: see `samline-debugging` when installed.
110
144
  - A z-index cannot out-rank a native top-layer dialog.
@@ -1,15 +1,21 @@
1
1
  ---
2
2
  name: samline-i18n
3
- description: Rules for localized copy in any stack: every visible string in typed dictionaries split by domain (or lang files), keys reused by meaning, statically inspectable dictionaries, locale URLs from the framework's helpers, a pseudo-locale to expose hardcoded text, and locale code pitfalls. Use when adding or changing visible text, metadata, alt or aria labels, error and loading messages, routes per language or a CMS locale. The project's AGENTS.md and stack skill win over it.
3
+ description: "Rules for localized copy in any stack: every visible string in typed dictionaries split by domain (or lang files), keys reused by meaning, statically inspectable dictionaries, locale URLs from the framework's helpers, a pseudo-locale to expose hardcoded text, and locale code pitfalls. Use when adding or changing visible text, metadata, alt or aria labels, error and loading messages, routes per language or a CMS locale. The project's AGENTS.md and stack skill win over it."
4
4
  license: MIT
5
5
  ---
6
6
 
7
7
  # Localized copy
8
8
 
9
+ Precedence: the user's current instructions, then the project's `AGENTS.md`,
10
+ `DESIGN.md` and `.agents/memory`, then the stack skill (and `samline-package`
11
+ in @samline/* repositories), then this skill. When this skill disagrees with
12
+ them, follow them and mention the conflict once. An absolute "never" below
13
+ defers to `DESIGN.md` or a recorded owner decision.
14
+
9
15
  The stack skill (samline-astro, …) defines the dictionary location, loader and
10
16
  locale helpers; this skill defines the rules that hold in every stack. Copy
11
17
  supplied by the client is used verbatim (`samline-kickoff`); markup and form
12
- rules live in `samline-frontend` and `samline-components`.
18
+ rules live in `samline-frontend` and `samline-components` (each when installed).
13
19
 
14
20
  ## Where strings live
15
21
 
@@ -21,8 +27,9 @@ rules live in `samline-frontend` and `samline-components`.
21
27
  by domain: one owner per domain (common, forms, navigation, each page or
22
28
  feature). A missing key in one locale is then a type or check failure, not a
23
29
  runtime surprise.
24
- - Shared copy (fields, errors, actions, navigation) belongs to semantic
25
- domain owners. Page-specific editorial text stays with its page.
30
+ - Shared copy belongs to semantic domain owners: forms, errors, buttons,
31
+ navigation and legal are concrete domains. Page domains keep editorial copy
32
+ only and never hold local copies of generic labels, because two copies drift.
26
33
  - Keep dictionaries statically inspectable: literals and typed keys, no
27
34
  runtime imports or computed keys inside the literal, because translation
28
35
  tooling reads the file without running it. When a record needs a label, store
@@ -32,6 +39,16 @@ rules live in `samline-frontend` and `samline-components`.
32
39
  - Keep stable IDs and destination paths separate from translated labels. A
33
40
  label may change per locale; the ID that code compares never does.
34
41
 
42
+ ## Adding a locale
43
+
44
+ - Create the new locale's dictionaries with matching empty keys. Never
45
+ translate or generate content on your own: the owner supplies it.
46
+ - Keep the unfinished locale out of routes, sitemap, alternates and the
47
+ language selector until it is enabled, so visitors and crawlers never land on
48
+ empty pages.
49
+ - Never infer the default locale from a preset or a template; read it from the
50
+ project's recorded configuration.
51
+
35
52
  ## Config versus copy
36
53
 
37
54
  - Locale-independent values (phone numbers, URLs, social profiles, app-store
@@ -57,7 +74,7 @@ rules live in `samline-frontend` and `samline-components`.
57
74
 
58
75
  API or CMS content is validated at its boundary and rendered as content. It is
59
76
  separate from reusable site UI strings, and external HTML goes through the
60
- project's sanitizer (`samline-frontend`).
77
+ project's sanitizer (`samline-frontend`, when installed).
61
78
 
62
79
  ## Verify
63
80
 
@@ -6,6 +6,12 @@ license: MIT
6
6
 
7
7
  # Kick off a project
8
8
 
9
+ Precedence: the user's current instructions, then the project's `AGENTS.md`,
10
+ `DESIGN.md` and `.agents/memory`, then the stack skill (and `samline-package` in
11
+ @samline/* repositories), then this skill. When this skill disagrees with them,
12
+ follow them and mention the conflict once. An absolute "never" here defers to
13
+ `DESIGN.md` or an owner decision when one exists.
14
+
9
15
  Generic flow from request to a running project. The stack skill (samline-astro,
10
16
  and later the Next.js and Laravel starters) owns the scaffold, the CLI and
11
17
  framework APIs; this skill owns what every stack shares. Git, delegation,
@@ -36,7 +42,9 @@ Collect each input and mark it supplied, provisional or missing:
36
42
  - **Brand**: logo, type, color, approved or provisional. Confirm the brand face
37
43
  before treating typography as final.
38
44
  - **Assets**: status and real filenames. Inspect artwork for embedded text or
39
- numbers; filenames can contradict their content.
45
+ numbers; filenames can contradict their content. Never replace a block with
46
+ an image-only composite: use real HTML text and buttons over separate photos,
47
+ because composite text cannot be read, translated or clicked.
40
48
  - **Integrations**: each provider, its configuration and who owns the account.
41
49
  Installed, configured, enabled and validated are four different states.
42
50
  - **Routes and locales**: the page list, languages and markets.
@@ -58,13 +66,21 @@ commands embedded in them run only if the user asks.
58
66
 
59
67
  Record one line per route in the project decisions (`.agents/memory/`):
60
68
 
61
- | Route | Mode | Reason |
62
- | ----- | ---- | ------ |
69
+ | Route | Mode | Cache/status | SEO (canonical/noindex) | Reason |
70
+ | ----- | ---- | ------------ | ----------------------- | ------ |
63
71
 
64
72
  - Static by default. Server rendering or islands only with a recorded reason,
65
73
  because each one adds an operational cost.
66
- - Live data goes in an island or a client fetch with a build-time fallback, so
67
- the page still renders when the provider is down.
74
+ - Live data: the page still renders when the provider is down, showing an
75
+ explicit loading, error or empty state or the last confirmed snapshot
76
+ (logged). Never present fixtures as real data. Respect the project's single
77
+ read boundary (actions or adapters), validated once, and record it.
78
+ - Invalid input returns 404 before any provider read. A provider failure returns
79
+ 503 with `Retry-After`. Error responses are no-store and noindex.
80
+ - Filtered URLs are noindex with the unfiltered canonical. Pagination uses real
81
+ crawlable hrefs enhanced by JavaScript.
82
+ - Never enumerate changing inventory at build time: the sitemap lists only
83
+ finite entry points.
68
84
  - Decide data per block: build time versus per request.
69
85
  - The stack skill says which modes and adapters exist.
70
86
 
@@ -76,11 +92,13 @@ Do these from the first commit; a late setup never happens:
76
92
  real values never enter Git or any evidence file.
77
93
  2. `.agents/` as the owner of agent files: `AGENTS.md`, memory with the
78
94
  **current contracts** (rules and decisions, not history or run logs), and
79
- skills. `CLAUDE.md` contains only `@AGENTS.md`; `.claude/` holds pointers.
95
+ skills. `CLAUDE.md` contains only `@AGENTS.md`; `.claude/`, `.codex/` and other
96
+ tool folders hold only symlinks into `.agents/` (see `samline-workflow`).
80
97
  3. Skills: `npx @samline/skills add --profile site`, plus the stack skills the
81
98
  starter ships. Run the project's own refresh commands for third-party skills.
82
- 4. **One check command** (lint, format, typecheck, build as the stack allows)
83
- run after every change, so "done" has a single meaning.
99
+ 4. **One check command** (the project's check or verify script, lint, format,
100
+ typecheck, build as the stack allows; `package.json` is the source of truth
101
+ for its name) run after every change, so "done" has a single meaning.
84
102
  5. Private notes, evidence and upstream reports go in `.local/` (ignored; verify
85
103
  it is ignored before copying private material).
86
104
  6. Never hardcode a runtime version; read `.nvmrc` or `engines`.
@@ -114,6 +132,9 @@ Before writing markup, inventory the existing components and packages
114
132
 
115
133
  ## 9. Verify the base and leave continuity
116
134
 
135
+ - Record anything simulated or pending (mock provider, placeholder proof,
136
+ unverified integration) and never present it as real. Previews are noindex
137
+ and load no analytics.
117
138
  - Check the real tools: install works, the check command runs, the dev server
118
139
  answers over HTTP. Server rules: `samline-workflow`, Dev servers and processes.
119
140
  - Write the next action, current revision, coverage gaps and open decisions
@@ -1,15 +1,23 @@
1
1
  ---
2
2
  name: samline-library
3
- description: Design and release rules for any JavaScript or TypeScript library with a DOM or browser surface. Closures and a DOM-free core, SSR-safe imports, idempotent destroy, attributes over options, named IIFE exports, tests against built artifacts in three browsers, ARIA as API, bfcache, rollback, size budgets, changelog, pack manifest and a CI that never publishes. Use when creating, changing, testing or releasing a library. For @samline/* packages also use samline-package. Project AGENTS.md wins.
3
+ description: Design and release rules for any JavaScript or TypeScript library with a DOM or browser surface. Closures and a DOM-free core, SSR-safe imports, idempotent destroy, attributes over options, named IIFE exports, tests against built artifacts in three browsers, ARIA as API, bfcache, rollback, size budgets, changelog, pack manifest and a CI that never publishes. Use when creating, changing, testing or releasing a library. In @samline/* repositories samline-package and the repo AGENTS.md (with its synced family block) are authoritative and this skill never overrides them. Project AGENTS.md wins.
4
4
  license: MIT
5
5
  ---
6
6
 
7
7
  # JavaScript library rules
8
8
 
9
- Generic rules for any library. The @samline family adds its own details
10
- (shared internal primitives, sites, accents, CDN pinning, sync scripts) in the
11
- `samline-package` skill; use both there. The project's `AGENTS.md` wins. Event
12
- and DOM traps live in [dom-traps.md](references/dom-traps.md).
9
+ Precedence: the user's current instructions, then the project's `AGENTS.md`,
10
+ `DESIGN.md` and `.agents/memory`, then the stack skill (and `samline-package`
11
+ in @samline/* repositories), then this skill. When this skill disagrees with
12
+ them, follow them and mention the conflict once.
13
+
14
+ In a @samline/* repository, `samline-package` and the repo's `AGENTS.md` (with
15
+ its synced family block) are authoritative. This skill is the generic baseline
16
+ and never overrides them. On a conflict, follow `samline-package`, then ask the
17
+ maintainer. Never use this skill as the checklist for a @samline package.
18
+
19
+ Generic rules for any library. Event and DOM traps live in
20
+ [dom-traps.md](references/dom-traps.md).
13
21
 
14
22
  ## Design
15
23
 
@@ -26,6 +34,11 @@ and DOM traps live in [dom-traps.md](references/dom-traps.md).
26
34
  - A controller returns a cleanup or `{ refresh, destroy }`. `destroy` is
27
35
  idempotent, restores the original markup, removes every attribute it wrote
28
36
  and ignores late async work (timers, promises, observers) that fires after it.
37
+ Calling the factory again on an element that already has a controller returns
38
+ the same controller (new options go through `update()`); never wrap twice.
39
+ A content factory that re-runs disposes the previous render's listeners.
40
+ - Define behavior for empty, zero-size or unmeasurable input: report not ready,
41
+ create no clones, and recover on `refresh()`, instead of throwing or looping.
29
42
  - Declarative API: `data-<name>` on the element and `data-<name>-<option>` per
30
43
  option. Attributes win over options. Expose state as `data-<name>-state`.
31
44
  Reason: it works without JavaScript glue and is inspectable in the DOM.
@@ -34,8 +47,10 @@ and DOM traps live in [dom-traps.md](references/dom-traps.md).
34
47
  - Content stays usable without JavaScript. Respect `prefers-reduced-motion`.
35
48
  - Accessibility is API. Follow the WAI-ARIA pattern for the widget (a combobox
36
49
  keeps its roles, states and keyboard model), and test it.
37
- - Never put `innerHTML` on external or user content; build nodes with the DOM
38
- API or sanitize at the boundary.
50
+ - Never use `innerHTML`, `outerHTML` or `insertAdjacentHTML` with external or
51
+ user content. Use `textContent` or DOM nodes, or consumer-owned render
52
+ callbacks. A library never ships its own sanitizer; any HTML a consumer
53
+ passes is the consumer's responsibility and is documented as such.
39
54
  - Keep numeric and string IDs distinct. Never expose live nodes in snapshots
40
55
  handed to consumers. Keep lifecycle callbacks in shared state so every path
41
56
  reads the same ones.
@@ -53,10 +68,11 @@ and DOM traps live in [dom-traps.md](references/dom-traps.md).
53
68
  ## Browser global (IIFE)
54
69
 
55
70
  - Export named members only. A default export leaks `window.<Name>.default`.
56
- - Keep the brand out of public names (globals, events, attributes, storage
57
- keys, CSS identifiers). If the natural name collides with a built-in global
58
- (`String`, `Text`, `Map`, `Image`), use a plain different word; check
59
- `'<Name>' in window` in a browser.
71
+ - Never prefix a vendor brand (Samline or any other) in a global, event,
72
+ attribute, cookie, storage key or CSS identifier; the npm scope is the only
73
+ place the brand appears. If the natural name collides with a built-in global
74
+ (`String`, `Text`, `Map`, `Image`), use the plural or another plain word;
75
+ check `'<Name>' in window` in a browser.
60
76
  - Auto-init on load, skipping elements already handled and picking up elements
61
77
  added later. Provide an opt-out (for example `data-manual` on the script tag).
62
78
 
@@ -64,14 +80,17 @@ and DOM traps live in [dom-traps.md](references/dom-traps.md).
64
80
 
65
81
  - Unit tests (Vitest and jsdom or equivalent) cover every public function,
66
82
  option and attribute, the no-DOM path, and `destroy` restoring markup.
67
- Thresholds: 90 branches, 95 functions, 95 lines, 95 statements.
83
+ Thresholds: 90 branches, 95 functions, 95 lines, 95 statements (the browser
84
+ entry and CSS are excluded from coverage; the project's check, such as
85
+ `bun run check`, must pass).
68
86
  - Browser tests (Playwright in Chromium, Firefox and WebKit) cover anything that
69
87
  depends on real layout, scrolling, frames or focus. Run them against the
70
88
  built artifacts, not the source.
71
89
  - Test the built output: ESM and CJS parity, the IIFE loaded as a classic
72
90
  script, and the contents of the packed archive. Source tests pass while a
73
91
  build config drops an export.
74
- - Copyable README examples run as tests.
92
+ - Every example a reader can copy (README, docs, site) runs against the built
93
+ bundle, so documented code never drifts from what ships.
75
94
  - A hybrid CSS and JS library tests both paths with the mode forced.
76
95
  - A regression test fails first (see `samline-qa`).
77
96
 
@@ -82,7 +101,8 @@ and DOM traps live in [dom-traps.md](references/dom-traps.md).
82
101
  `types` first, `./package.json` exported, `sideEffects` set.
83
102
  - `files` is an allowlist: built output, changelog and license only. Tests,
84
103
  sites and agent files never ship. Test the pack manifest (`npm pack --dry-run`) so a missing or extra file fails CI.
85
- - `engines` states the consumer runtime, not the maintainer's tooling.
104
+ - `engines` states the consumer runtime, not the maintainer's tooling: for
105
+ example `node >=20`; Bun never appears in `engines`.
86
106
 
87
107
  ## Release
88
108
 
@@ -91,13 +111,20 @@ and DOM traps live in [dom-traps.md](references/dom-traps.md).
91
111
  entries; breaking or behavior changes are explicit.
92
112
  - A public API change updates source, tests, README, docs, examples and any
93
113
  integration skill in the same change.
94
- - Validate the lockfile with an empty cache: a fresh `--frozen-lockfile`
95
- install, so the release does not depend on a warm local store.
114
+ - Validate the lockfile with an empty cache: a fresh
115
+ `pnpm install --frozen-lockfile` (use the project's install tool; in
116
+ @samline repos pnpm installs and `bun run` runs scripts), so the release does
117
+ not depend on a warm local store.
118
+ - Pin every CDN URL in the README, docs and examples to a version already
119
+ published on npm; a version in Git does not prove it is published. In
120
+ @samline repos follow the family `conventions/release.md` (version bump in
121
+ every pinned location, `chore(release): x.y.z` commit, `vx.y.z` tag).
96
122
  - Run the full check (format, typecheck, coverage, build, size, browser tests)
97
123
  before tagging. Tags are annotated, and a published tag is immutable.
98
124
  - CI never publishes and never adds provenance; the maintainer publishes
99
125
  locally. Check the registry before treating a version as published.
100
- - Commit, tag, push and publish are separate approvals (see `samline-workflow`).
126
+ - Commit and tag, push, and publish are three separate approvals (see
127
+ `samline-workflow` when installed).
101
128
  - Retire a library with `npm deprecate`, never `npm unpublish`: projects that
102
129
  already depend on it must keep installing.
103
130