Skip to content

Commit b68bfc4

Browse files
committed
chore: migrate skills to RPLayout, purge em dashes, prep v1.0.0-beta.0
@react-pdf-kit/viewer v2.0.0 deprecates RPDefaultLayout in favor of RPLayout (with its structured toolbar prop and RPHorizontalBar / RPVerticalBar slot customization). All six framework-and-layout skills are updated to teach RPLayout. RPDefaultLayout is preserved only as a Gotcha entry explaining the deprecation so agents migrating existing projects pick the right target. The toolbar-customization skill is rewritten to teach the canonical partial-customization path (RPLayout.toolbar.topbar.component = <RPHorizontalBar slots={{...}} />), with the fully-custom-bar recipe (composing individual *Tool exports) preserved as step 4. The custom-layout skill reframes the headless replacement around RPLayout instead of RPDefaultLayout. Catalog prose (all SKILL.md bodies, README, CLAUDE.md, MAINTENANCE.md, CHANGELOG.md) no longer uses the em dash character. Voice tightened across all authored content. CHANGELOG.md now has a [1.0.0-beta.0] section, validated against @react-pdf-kit/viewer >=1.0.0 <2.0.0. The previous [Unreleased] content rolls into the beta. Catalog versioning is independent of the library; per-skill metadata.react_pdf_kit_version ranges carry the actual compatibility signal. Live sample-build trials (T026 through T031, T033, T041) remain pending; beta release is for feedback on skill accuracy and the install workflow before v1.0.0. Conformance: scripts/verify-all.sh passes 8/8 against the v1 catalog. scripts/check-changelog.sh v1.0.0-beta.0 passes.
1 parent 9754a65 commit b68bfc4

12 files changed

Lines changed: 379 additions & 224 deletions

File tree

CHANGELOG.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,25 @@ range under a **Validated against** line.
1919

2020
## [Unreleased]
2121

22-
**Validated against**: `@react-pdf-kit/viewer` *TBD on first release.*
22+
(No changes yet since v1.0.0-beta.0.)
23+
24+
## [1.0.0-beta.0] - 2026-05-14
25+
26+
First public pre-release for testing. The catalog and verification
27+
scripts are feature-complete for v1, but the live build-verification
28+
trials documented in the spec (T026 through T031, T033, T041) have
29+
not yet been executed end to end against real `pnpm create next-app`
30+
and `pnpm create vite` projects. Feedback wanted on skill accuracy,
31+
agent activation behavior, and the install workflow before promoting
32+
to v1.0.0.
33+
34+
**Validated against**: `@react-pdf-kit/viewer` `>=1.0.0 <2.0.0`
2335

2436
### Added
2537

2638
- Initial scaffolding: LICENSE (MIT), README, MAINTENANCE,
2739
.gitignore. (CONTRIBUTING and CODEOWNERS were authored and then
28-
removed before first release — see Removed below.)
40+
removed before first release. See Removed below.)
2941
- Conformance scripts: `scripts/verify-skill.sh`,
3042
`scripts/verify-all.sh`, `scripts/apply-skill-to-sample.sh`,
3143
`scripts/check-changelog.sh`.
@@ -45,7 +57,20 @@ range under a **Validated against** line.
4557

4658
### Changed
4759

48-
- (none yet)
60+
- All skills and the README now teach `RPLayout` as the canonical
61+
layout component. `RPDefaultLayout` is deprecated in
62+
`@react-pdf-kit/viewer` v2.0.0 and will be removed in a future
63+
release. Each affected skill (setup, vite, nextjs-app-router,
64+
nextjs-pages-router, toolbar-customization, custom-layout) ships
65+
an explicit Gotcha entry calling out the deprecation, and the
66+
toolbar-customization skill is rewritten to teach
67+
`RPLayout`'s `toolbar` prop with `RPHorizontalBar` /
68+
`RPVerticalBar` slot customization. The "fully custom bar"
69+
fallback (composing individual `*Tool` exports) is preserved as
70+
step 4 of that skill.
71+
- Catalog prose (SKILL.md bodies, README, CLAUDE.md, MAINTENANCE.md)
72+
no longer uses the em dash character. Voice tightened across all
73+
authored content.
4974

5075
### Deprecated
5176

CLAUDE.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ It is a content/documentation repo, not a JavaScript application.
3333
└── .github/workflows/ # verify.yml, samples.yml, release.yml
3434
```
3535

36-
External contributions are **not currently accepted** — see the
36+
External contributions are **not currently accepted**. See the
3737
"Contributions" section in `README.md`. The author workflow below is
3838
for maintainers.
3939

@@ -70,7 +70,7 @@ scripts/check-changelog.sh v1.0.0
7070
---
7171
```
7272

73-
Allow-listed fields only `verify-skill.sh` rule R-15 fails on
73+
Allow-listed fields only. `verify-skill.sh` rule R-15 fails on
7474
unknown keys. Optional: `metadata.tags`, `metadata.deprecated_in`,
7575
`metadata.internal`.
7676

@@ -104,16 +104,16 @@ The library that this catalog teaches is governed by a project
104104
constitution that lives in the React PDF Kit workspace (not in this
105105
repo). Skills MUST NOT contradict its five principles:
106106

107-
1. Viewer-First Experience never advise patterns that degrade
107+
1. Viewer-First Experience: never advise patterns that degrade
108108
reader UX (text selection, keyboard nav, a11y).
109-
2. Integrator Respect no globals, no peer-dep bundling, no
109+
2. Integrator Respect: no globals, no peer-dep bundling, no
110110
bundler monkey-patching.
111-
3. Composable & Headless-Capable default-layout skills use the
111+
3. Composable & Headless-Capable: default-layout skills use the
112112
full provider chain; customization skills use documented hooks
113113
only.
114-
4. Performance & Rendering Discipline no instruction breaks
114+
4. Performance & Rendering Discipline: no instruction breaks
115115
virtualization or moves PDF.js off the worker.
116-
5. Peer Dependency & Compatibility Stewardship every skill
116+
5. Peer Dependency & Compatibility Stewardship: every skill
117117
declares `metadata.react_pdf_kit_version` and
118118
`metadata.pdfjs_dist_version` matching the sample that verified it.
119119

MAINTENANCE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ version range** the skills were exercised against.
6060

6161
## Deprecation flow
6262

63-
To deprecate a skill **without** removing it (preferred — gives
64-
consumers time to migrate):
63+
To deprecate a skill **without** removing it (preferred, since it
64+
gives consumers time to migrate):
6565

6666
1. Add `metadata.deprecated_in: <next-release-version>` to the skill's
6767
frontmatter.
@@ -109,7 +109,7 @@ release after v1.0.0.
109109

110110
| Date | Action | Notes |
111111
|------|--------|-------|
112-
| | | First entry will be added on submission. |
112+
| | | First entry will be added on submission. |
113113

114114
## Sample inventory
115115

@@ -131,8 +131,8 @@ end-to-end to ensure the runbook stays accurate. Record each walk here.
131131

132132
| Date | Flow | Outcome |
133133
|------|------|---------|
134-
| | Deprecation drill (per tasks T038) | TBD |
135-
| | First release (v1.0.0, per tasks T045) | TBD |
134+
| | Deprecation drill (per tasks T038) | TBD |
135+
| | First release (v1.0.0, per tasks T045) | TBD |
136136

137137
## Security review
138138

README.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# @react-pdf-kit/agent-skills
22

3-
> Agent skills for [@react-pdf-kit/viewer](https://github.com/react-pdf-kit/viewer)
4-
> — install with `npx skills add react-pdf-kit/agent-skills` and let your
3+
> Agent skills for [@react-pdf-kit/viewer](https://github.com/react-pdf-kit/viewer).
4+
> Install with `npx skills add react-pdf-kit/agent-skills` and let your
55
> AI coding agent integrate the React PDF Kit library correctly on the
66
> first attempt.
77
88
This repository is a curated catalog of [agent skills](https://agentskills.io)
9-
that teach AI coding agents (Claude Code, Cursor, OpenCode, Codex, …) how
10-
to set up, customize, and troubleshoot the React PDF Kit viewer across
11-
the React, Next.js, and Vite ecosystems. Skills are installed via the
12-
open-source [vercel-labs/skills](https://github.com/vercel-labs/skills)
13-
CLI.
9+
that teach AI coding agents (Claude Code, Cursor, OpenCode, Codex, and
10+
anything else that follows the same convention) how to set up,
11+
customize, and troubleshoot the React PDF Kit viewer across the React,
12+
Next.js, and Vite ecosystems. Skills are installed via the open-source
13+
[vercel-labs/skills](https://github.com/vercel-labs/skills) CLI.
1414

1515
## Who is this for?
1616

@@ -102,15 +102,15 @@ These behaviors are governed by the upstream
102102
[vercel-labs/skills](https://github.com/vercel-labs/skills) CLI; reading
103103
them here helps you interpret errors quickly.
104104

105-
- **`no matching skill` after `npx skills add <name>`** the name is
105+
- **`no matching skill` after `npx skills add <name>`**: the name is
106106
wrong or the skill has been renamed. Symptom: CLI exits non-zero with
107107
a "no matching skill" line. Response: run `npx skills find <keyword>`
108108
and pick the exact `name` from the result list.
109-
- **Network failure during `add`** the CLI fails fast with the
109+
- **Network failure during `add`**: the CLI fails fast with the
110110
underlying transport error and does **not** leave a partial install.
111111
Response: retry once the network is restored. There is no recovery
112112
step needed.
113-
- **Re-install of an already-installed skill** the CLI prompts before
113+
- **Re-install of an already-installed skill**: the CLI prompts before
114114
overwriting (or refuses if `--yes` is not set). Response: either
115115
confirm overwrite (you lose local edits to the installed copy) or
116116
decline and uninstall the existing copy first with
@@ -122,23 +122,22 @@ gotchas, stale version range), open an issue in this repository.
122122
## How an AI agent discovers and uses this repo
123123

124124
The transcript below is a representative session showing the
125-
discoverinstall ask flow. It is the same flow the spec's SC-001
125+
discover, install, ask flow. It is the same flow the spec's SC-001
126126
trial protocol exercises (see
127-
`specs/001-react-pdf-kit-skills/tasks.md` T041); replace this
128-
example with an anonymized real session captured during T041 once
129-
that runs.
127+
`specs/001-react-pdf-kit-skills/tasks.md` T041). Replace this example
128+
with an anonymized real session captured during T041 once that runs.
130129

131130
```text
132131
$ pnpm create next-app@latest my-pdf-app -- --ts --eslint --app --no-tailwind --no-src-dir --turbo
133-
(Next.js scaffold completes)
132+
... (Next.js scaffold completes)
134133
135134
$ cd my-pdf-app
136135
137136
$ npx skills find "react pdf kit next.js"
138-
react-pdf-kit-nextjs-app-router Integrate @react-pdf-kit/viewer (>=1.0.0 <2.0.0) into a Next.js
139-
react-pdf-kit-nextjs14-pdfjs-override Override pdfjs-dist to v4 to work around the Next.js 14 + pdfjs-dist v5
140-
react-pdf-kit-nextjs-pages-router Integrate @react-pdf-kit/viewer (>=1.0.0 <2.0.0) into a Next.js Pages
141-
react-pdf-kit-worker-config Configure the PDF.js worker URL across supported bundlers
137+
react-pdf-kit-nextjs-app-router Integrate @react-pdf-kit/viewer (>=1.0.0 <2.0.0) into a Next.js...
138+
react-pdf-kit-nextjs14-pdfjs-override Override pdfjs-dist to v4 to work around the Next.js 14 + pdfjs-dist v5...
139+
react-pdf-kit-nextjs-pages-router Integrate @react-pdf-kit/viewer (>=1.0.0 <2.0.0) into a Next.js Pages...
140+
react-pdf-kit-worker-config Configure the PDF.js worker URL across supported bundlers...
142141
143142
$ npx skills add react-pdf-kit/agent-skills#react-pdf-kit-nextjs-app-router
144143
Installed react-pdf-kit-nextjs-app-router into .claude/skills/
@@ -154,7 +153,7 @@ $ # Open Claude Code (or your agent of choice) and ask:
154153
# the first PDF page.
155154
```
156155

157-
The same shape works under Cursor, OpenCode, and Codex — the CLI
156+
The same shape works under Cursor, OpenCode, and Codex. The CLI
158157
routes the install into the right per-agent directory automatically.
159158

160159
## Contributions
@@ -176,10 +175,10 @@ versioning policy, deprecation flow, and skills.sh submission tracker.
176175

177176
## Related projects
178177

179-
- [react-pdf-kit/viewer](https://github.com/react-pdf-kit/viewer) the
178+
- [react-pdf-kit/viewer](https://github.com/react-pdf-kit/viewer): the
180179
React PDF Kit library this catalog teaches.
181-
- [agentskills.io](https://agentskills.io) the agent-skills standard.
182-
- [vercel-labs/skills](https://github.com/vercel-labs/skills) the
180+
- [agentskills.io](https://agentskills.io): the agent-skills standard.
181+
- [vercel-labs/skills](https://github.com/vercel-labs/skills): the
183182
open-source `npx skills` CLI implementing the standard.
184183

185184
## License

skills/react-pdf-kit-custom-layout/SKILL.md

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: react-pdf-kit-custom-layout
3-
description: Build a fully headless / custom layout for @react-pdf-kit/viewer (>=1.0.0 <2.0.0) using only documented hooks (useDocumentContext, useZoomContext, usePaginationContext, etc.) — replace RPDefaultLayout entirely.
3+
description: Build a fully headless / custom layout for @react-pdf-kit/viewer (>=1.0.0 <2.0.0) using only documented hooks (useDocumentContext, useZoomContext, usePaginationContext, etc.), replacing RPLayout entirely.
44
metadata:
55
react_pdf_kit_version: ">=1.0.0 <2.0.0"
66
pdfjs_dist_version: ">=5.0.0 <6.0.0"
@@ -11,20 +11,21 @@ metadata:
1111
# react-pdf-kit-custom-layout
1212

1313
**Use this skill when**: the developer asks to replace the default
14-
viewer layout entirely with their own — embedded inline preview, a
15-
sidebar-only minimal reader, an enterprise UI with a custom toolbar
16-
on the side instead of the top, etc. For small toolbar tweaks while
17-
keeping the default layout, use `react-pdf-kit-toolbar-customization`.
14+
viewer layout entirely with their own. Examples: embedded inline
15+
preview, a sidebar-only minimal reader, an enterprise UI with a
16+
custom toolbar on the side instead of the top. For small toolbar
17+
tweaks while keeping the default layout, use
18+
`react-pdf-kit-toolbar-customization`.
1819

19-
The viewer is composable: `RPProvider` and `RPPages` are the minimum
20-
required. Everything else (`RPDefaultLayout`, `RPTheme`, individual
21-
toolbar tools) can be swapped or omitted. State and actions are
22-
exposed via documented hooks.
20+
The viewer is composable. `RPProvider` and `RPPages` are the minimum
21+
required. Everything else (`RPLayout`, `RPTheme`, individual toolbar
22+
tools) can be swapped or omitted. State and actions are exposed via
23+
documented hooks.
2324

2425
## Gotchas
2526

2627
- **`RPProvider` and `RPPages` are required.** `RPProvider` mounts
27-
the document and makes the contexts available; `RPPages` renders
28+
the document and makes the contexts available. `RPPages` renders
2829
the virtualized page list. Removing either breaks the viewer.
2930
- **Use only documented hooks.** Reaching into internal contexts via
3031
`React.useContext(InternalContext)` is unsupported and will break
@@ -37,13 +38,19 @@ exposed via documented hooks.
3738
ancestor that doesn't have a measurable height (no `flex: 1` /
3839
`min-height: 0`, no fixed height) makes the virtualizer mount with
3940
0 rows. Always give it a real viewport.
40-
- **Provider order matters.** `RPConfig` must be outermost,
41-
`RPProvider` next, `RPTheme` (optional but harmless) inside that.
41+
- **Provider order matters.** `RPConfig` must be outermost, then
42+
`RPProvider`, then `RPTheme` (optional but harmless) inside that.
4243
Anywhere inside `RPProvider` you can call the hooks.
4344
- **`RPTheme` is still recommended** even in custom layouts. It
4445
provides CSS custom properties that built-in components (page
4546
layers, text selection highlight) read. Skipping it works visually
4647
but loses dark-mode and theming.
48+
- **Note on `RPLayout` vs `RPDefaultLayout`**: this skill *replaces*
49+
the default layout component, so neither appears in the final
50+
composition. Older code that imports `RPDefaultLayout` should
51+
migrate to `RPLayout` first (it is deprecated in
52+
`@react-pdf-kit/viewer` v2.0.0) before headless migration, so the
53+
two refactors don't get tangled.
4754

4855
## Procedure
4956

@@ -73,7 +80,7 @@ export function HeadlessPdfViewer({ src }: { src: string }) {
7380
```
7481

7582
`CustomShell` (next step) is where YOU place `RPPages` next to your
76-
own toolbar / sidebar / status bar.
83+
own toolbar, sidebar, or status bar.
7784

7885
### 2. Build the shell using documented hooks
7986

@@ -112,7 +119,7 @@ export function CustomShell() {
112119
borderBottom: '1px solid var(--rp-border, #e5e7eb)',
113120
}}
114121
>
115-
<span>{isLoading ? 'Loading' : `${numPages} pages`}</span>
122+
<span>{isLoading ? 'Loading...' : `${numPages} pages`}</span>
116123
<button
117124
type="button"
118125
onClick={() => setZoom(zoom + 0.1)}
@@ -125,15 +132,15 @@ export function CustomShell() {
125132
onClick={() => setZoom(zoom - 0.1)}
126133
aria-label="Zoom out"
127134
>
128-
135+
-
129136
</button>
130137
<span style={{ flex: 1 }} />
131138
<button
132139
type="button"
133140
onClick={toggleDarkMode}
134141
aria-pressed={isDarkMode}
135142
>
136-
{isDarkMode ? 'Light' : 'Dark'}
143+
{isDarkMode ? 'Light' : 'Dark'}
137144
</button>
138145
</header>
139146

@@ -171,20 +178,20 @@ parent has a measurable height.
171178

172179
### 3. Memoize where it matters
173180

174-
If you compute derived state to pass into `RPProvider` (e.g., a
175-
file-loading callback or options object), memoize it. The provider
181+
If you compute derived state to pass into `RPProvider` (for example,
182+
a file-loading callback or options object), memoize it. The provider
176183
re-renders all children on identity changes, so a new object every
177184
render disables virtualization gains.
178185

179186
```tsx
180187
const options = useMemo(() => ({ withCredentials: true }), [])
181-
return <RPProvider src={src} options={options}></RPProvider>
188+
return <RPProvider src={src} options={options}>...</RPProvider>
182189
```
183190

184191
### 4. (Optional) Add search, rotation, view modes
185192

186-
Same pattern: import the hook, call it, render UI bound to its
187-
state/actions. `useSearchContext`, `useHighlightContext`,
193+
Same pattern: import the hook, call it, render UI bound to its state
194+
and actions. `useSearchContext`, `useHighlightContext`,
188195
`useRotationContext`, `useViewModeContext` are all documented.
189196

190197
## Verify
@@ -202,13 +209,13 @@ Open the page. Confirm:
202209
`aria-current` indicator).
203210
- Zoom buttons resize pages without remounting the viewer.
204211
- Dark-mode toggle flips the theme.
205-
- Scrolling still virtualizes — only mounted pages should be in the
206-
DOM (DevToolsElements; `RPPages` should render a windowed
207-
subset).
212+
- Scrolling still virtualizes. Only mounted pages should be in the
213+
DOM (DevTools, Elements panel: `RPPages` should render a windowed
214+
subset, not all pages at once).
208215

209216
## References
210217

211218
- Companion skills:
212-
- `react-pdf-kit-setup` first-time setup.
213-
- `react-pdf-kit-toolbar-customization` for keeping the default
219+
- `react-pdf-kit-setup`: first-time setup.
220+
- `react-pdf-kit-toolbar-customization`: for keeping the default
214221
layout but tweaking toolbar contents.

0 commit comments

Comments
 (0)