@linchpinagency/skills 0.1.5 → 0.1.6

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
@@ -12,7 +12,7 @@ GitHub Copilot, and other compatible coding agents.
12
12
  ![Zero dependencies](https://img.shields.io/badge/Dependencies-0-brightgreen)
13
13
 
14
14
  <!-- x-release-please-start-version -->
15
- ### Latest release: 0.1.5
15
+ ### Latest release: 0.1.6
16
16
  <!-- x-release-please-end -->
17
17
 
18
18
  | Release | Skill standard | Install |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linchpinagency/skills",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Linchpin's library of reusable AI agent skills for WordPress projects.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -2,42 +2,89 @@
2
2
 
3
3
  Use after `search_patterns("faq questions accordion")` finds no good match.
4
4
 
5
- ## Preferred — Details block (native accordion, no plugin)
5
+ ## Preferred — core/accordion (WordPress 6.9+)
6
6
 
7
- Core `wp:details` renders an expand/collapse `<details>` natively. Each Q is its own block.
7
+ Core ships a real accordion: `core/accordion` wrapping `core/accordion-item`, each holding a
8
+ `core/accordion-heading` and a `core/accordion-panel`. Use it whenever the site is on 6.9 or
9
+ later — confirm with `list_registered_blocks`.
8
10
 
9
- ```html
10
- <!-- wp:group {"layout":{"type":"constrained"}} -->
11
- <div class="wp-block-group">
12
- <!-- wp:heading -->
13
- <h2 class="wp-block-heading">Frequently asked questions</h2>
14
- <!-- /wp:heading -->
11
+ Why it beats the alternatives for a multi-question FAQ:
15
12
 
16
- <!-- wp:details -->
17
- <details class="wp-block-details"><summary>How does billing work?</summary>
13
+ - **`autoclose`** — only one answer open at a time, which is what most FAQ designs show.
14
+ - **`headingLevel` / `level`** — each question is a real heading, so the document outline and
15
+ screen-reader navigation are correct. `core/details` gives you a `<summary>`, which is not.
16
+ - **One styled container** — colour, spacing, border, shadow and typography supports sit on the
17
+ item, so every question shares styling instead of being restyled individually.
18
+ - Built on the Interactivity API, so no custom JS.
19
+
20
+ ```html
21
+ <!-- wp:accordion {"autoclose":true,"iconPosition":"right","headingLevel":3} -->
22
+ <div class="wp-block-accordion">
23
+ <!-- wp:accordion-item {"openByDefault":true} -->
24
+ <div class="wp-block-accordion-item">
25
+ <!-- wp:accordion-heading {"level":3} -->
26
+ <h3 class="wp-block-accordion-heading">How does billing work?</h3>
27
+ <!-- /wp:accordion-heading -->
28
+ <!-- wp:accordion-panel -->
29
+ <div class="wp-block-accordion-panel">
18
30
  <!-- wp:paragraph -->
19
31
  <p>You're billed monthly and can cancel anytime.</p>
20
32
  <!-- /wp:paragraph -->
21
- </details>
22
- <!-- /wp:details -->
33
+ </div>
34
+ <!-- /wp:accordion-panel -->
35
+ </div>
36
+ <!-- /wp:accordion-item -->
23
37
 
24
- <!-- wp:details -->
25
- <details class="wp-block-details"><summary>Do you offer support?</summary>
38
+ <!-- wp:accordion-item -->
39
+ <div class="wp-block-accordion-item">
40
+ <!-- wp:accordion-heading {"level":3} -->
41
+ <h3 class="wp-block-accordion-heading">Do you offer support?</h3>
42
+ <!-- /wp:accordion-heading -->
43
+ <!-- wp:accordion-panel -->
44
+ <div class="wp-block-accordion-panel">
26
45
  <!-- wp:paragraph -->
27
46
  <p>Yes — email support on every plan.</p>
28
47
  <!-- /wp:paragraph -->
48
+ </div>
49
+ <!-- /wp:accordion-panel -->
50
+ </div>
51
+ <!-- /wp:accordion-item -->
52
+ </div>
53
+ <!-- /wp:accordion -->
54
+ ```
55
+
56
+ `openByDefault` on an item renders it expanded. `showIcon: false` hides the indicator.
57
+ `iconPosition` takes `left` or `right`.
58
+
59
+ **Generate this markup, don't hand-write it.** Nested parent/child blocks with `allowedBlocks`
60
+ constraints are easy to get subtly wrong, and an invalid FAQ shows "Attempt block recovery" on
61
+ every insert. Build the tree with `createBlock` and `serialize` in the editor, then use the
62
+ serialized result — see "Verify before shipping".
63
+
64
+ Designs often draw the toggle as **+ / −**; core renders a chevron. That's a block style or a
65
+ CSS override on the heading icon, not a reason to pick a different block.
66
+
67
+ ## Fallback — core/details (pre-6.9, or a genuinely independent set)
68
+
69
+ `wp:details` renders a native `<details>`. Reach for it when `core/accordion` isn't registered,
70
+ or when each item is standalone and single-open behaviour would be wrong.
71
+
72
+ ```html
73
+ <!-- wp:details -->
74
+ <details class="wp-block-details"><summary>How does billing work?</summary>
75
+ <!-- wp:paragraph -->
76
+ <p>You're billed monthly and can cancel anytime.</p>
77
+ <!-- /wp:paragraph -->
29
78
  </details>
30
79
  <!-- /wp:details -->
31
- </div>
32
- <!-- /wp:group -->
33
80
  ```
34
81
 
35
- Set `{"showContent":true}` on a `wp:details` to render it open by default.
82
+ Set `{"showContent":true}` to render one open by default. Know the limits: no shared open/close
83
+ coordination, and the question is a `<summary>` rather than a heading.
36
84
 
37
- ## Simpler — heading + paragraph pairs (no interactivity)
85
+ ## Last resort — heading + paragraph pairs (no interactivity)
38
86
 
39
- If `wp:details` isn't registered on the site (`list_registered_blocks`), or the user wants a
40
- flat list, alternate headings and paragraphs:
87
+ If neither block is registered, or the user explicitly wants a flat list:
41
88
 
42
89
  ```html
43
90
  <!-- wp:heading {"level":3} -->
@@ -49,8 +96,25 @@ flat list, alternate headings and paragraphs:
49
96
  <!-- /wp:paragraph -->
50
97
  ```
51
98
 
99
+ Don't ship this as "an FAQ accordion" — it collapses nothing. If the design shows
100
+ expand/collapse and you emit this, say so plainly rather than letting it pass as equivalent.
101
+
52
102
  ## Adapt
53
103
 
54
- - Generate one `wp:details` (or heading/paragraph pair) per Q&A from the user's content.
104
+ - Generate one accordion item per Q&A from the user's content; mark only the first
105
+ `openByDefault`.
55
106
  - Don't reach for a third-party accordion block unless the user names one and
56
- `list_registered_blocks` confirms it's installed `wp:details` covers most needs.
107
+ `list_registered_blocks` confirms it's installed. Core now covers this.
108
+
109
+ ## Verify before shipping
110
+
111
+ Validate in the site's real editor rather than trusting it by eye:
112
+
113
+ ```
114
+ mcp__wordpress-studio__validate_blocks nameOrPath=<site> content=<the FAQ markup>
115
+ ```
116
+
117
+ Expect every block valid. If a result looks wrong — for example attributes coming back as
118
+ defaults — confirm against the editor itself with `wp.blocks.parse( markup )[0]` and check
119
+ `isValid` plus the parsed attributes, because a validator running a stale block registration
120
+ can report a false failure.
@@ -31,8 +31,15 @@ Answer these before designing anything custom; each "yes" removes work:
31
31
 
32
32
  1. **Does a core block or pattern do it?** Check the site's registered patterns and template
33
33
  parts first — [`wordpress-blocks`](../wordpress-blocks/SKILL.md) covers reuse-before-build.
34
+ Check what core actually ships *on this version* rather than from memory: core has absorbed
35
+ a lot recently, and a block library that was the right answer two releases ago may now be
36
+ duplicating core. Accordions are the current example — `core/accordion` +
37
+ `accordion-item` / `accordion-heading` / `accordion-panel` landed in **6.9**, with
38
+ `autoclose`, real heading levels and the Interactivity API. On 6.9+ that beats both
39
+ `core/details` and any bundled accordion block. Verify with `list_registered_blocks`.
34
40
  2. **Does the shared block library already have it?** `linchpin/linchpin-blocks` ships
35
- accordion, tabs, cards, slider, counter, and more.
41
+ accordion, tabs, cards, slider, counter, and more. Prefer core when core has caught up —
42
+ a plugin dependency for something core does is a maintenance cost with no upside.
36
43
  3. **Does a well-known plugin own this problem?** Ecommerce is WooCommerce; forms, SEO, and
37
44
  membership all have mature answers. Building a lesser version is a liability you maintain
38
45
  forever.