node-lynx
Skill này làm gì
Cung cấp cho trợ lý một runtime Lynx cục bộ để render trang, chụp ảnh màn hình và chạy kiểm thử nhanh. Dành cho lập trình viên xây hoặc kiểm tra ứng dụng Lynx.
Khi nào nên dùng
- ✓Khi bạn muốn ảnh chụp màn hình của một bundle Lynx mà không cần mở thiết bị.
- ✓Khi bạn muốn xem trước ứng dụng Lynx trong một cửa sổ trên Mac.
- ✓Khi bạn cần tự động hóa kiểm tra một trang Lynx đã render từ Node.js.
Liên kết skill
https://github.com/lynx-family/lynx/blob/develop/oliver/node-lynx/skills/node-lynx/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Chụp ảnh màn hình ứng dụng Lynx mẫu gallery ở kích thước điện thoại và lưu vào một tệp.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Trợ lý chạy công cụ dòng lệnh node-lynx với chiều rộng, chiều cao và đường dẫn đầu ra. Nó cũng có thể render một bundle cục bộ, hoặc dùng giao diện JavaScript để kiểm tra sâu hơn.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Node Lynx
Use node-lynx as a local Lynx runtime for screenshots, preview windows, smoke tests, DebugRouter OpenCard sessions, and automation that needs to inspect or interact with a rendered Lynx page from Node.js.
Default sample template URL:
https://lynxjs.org/lynx-examples/gallery/dist/GalleryComplete.lynx.bundle
CLI
Prefer the CLI for one-off screenshots, quick template validation, and simple preview sessions.
Show available options:
node-lynx --help
Capture a headless screenshot and exit:
node-lynx render \
"https://lynxjs.org/lynx-examples/gallery/dist/GalleryComplete.lynx.bundle" \
--width 268 \
--height 469 \
--dpr 2 \
--output ./gallery.png \
--timeout 30000 \
--screenshot-delay 500 \
--no-debug-router
Render a local bundle:
node-lynx render \
--template ./dist/main/template.js \
--width 390 \
--height 844 \
--output ./node-lynx-local.png \
--no-debug-router
Open a visible preview window on macOS:
node-lynx preview \
"https://lynxjs.org/lynx-examples/gallery/dist/GalleryComplete.lynx.bundle" \
--width 268 \
--height 469 \
--dpr 2 \
--title "Node Lynx Preview"
Start a DebugRouter-backed session without an initial template:
node-lynx render
CLI rules:
- Use
renderfor headless screenshots and automation. - Use
previewonly on macOS; it creates an AppKit window. - Use
--template <path>for local bundles and--url <url>for remote bundles. A positionalhttp://orhttps://input is treated as a remote bundle URL. - Use
--widthand--heightas CSS pixel viewport values. - Use
--dpror--device-pixel-ratioto control output scale; the PNG pixel size iswidth * dprbyheight * dpr. - Use
--timeout <ms>for bundle download, template load, CDP calls, and first frame submission timeouts. - Use
--screenshot-delay <ms>to wait after the first frame before capture. This defaults to100; use a larger delay for image-heavy or network-heavy pages. - Pass
--no-debug-routerfor CI or one-shot screenshot commands that should exit immediately after writing the PNG. - Omit
--no-debug-routerwhen you need DebugRouter/OpenCard. Without an initial template,renderwaits for DebugRouter OpenCard.previewalso waits for OpenCard without creating an initial window. - OpenCard only loads public http(s) URLs by default. Pass
--allow-any-open-card-source(API:allowAnySource: true) to load local files or a loopback/private dev server, only on a trusted network.
TypeScript API
Prefer the API when the task needs programmatic setup, repeated captures, global props, CDP calls, input simulation, or custom lifecycle handling.
Import from the node-lynx package declared by the target project. For public npm usage this is typically:
import { HeadlessLynxView } from '@lynx-js/node-lynx';
Render a remote template to PNG:
import { writeFile } from 'node:fs/promises';
import { HeadlessLynxView } from '@lynx-js/node-lynx';
const templateUrl =
'https://lynxjs.org/lynx-examples/gallery/dist/GalleryComplete.lynx.bundle';
const view = new HeadlessLynxView({
width: 268,
height: 469,
devicePixelRatio: 2,
timeoutMs: 30000,
});
try {
await view.loadTemplateFromUrl(templateUrl, {
initialData: { source: 'node-lynx' },
globalProps: { theme: 'light' },
});
const png = await view.screenshot({ settleMs: 500 });
await writeFile('./gallery.png', png);
} finally {
view.destroy();
}
Render a local bundle buffer. Always pass a file URL so relative resources have the right base URL:
import { readFile, writeFile } from 'node:fs/promises';
import { resolve } from 'node:path';
import { pathToFileURL } from 'node:url';
import { HeadlessLynxView } from '@lynx-js/node-lynx';
const templatePath = resolve('./dist/main/template.js');
const view = new HeadlessLynxView({ width: 390, height: 844 });
try {
await view.loadTemplate(await readFile(templatePath), {
url: pathToFileURL(templatePath).href,
});
await writeFile('./node-lynx-local.png', await view.screenshot());
} finally {
view.destroy();
}
Inspect the DOM through CDP:
const responseText = await view.invokeCDPFromSDK(
JSON.stringify({
id: 1,
method: 'DOM.getDocument',
params: { depth: -1, pierce: true },
})
);
const response = JSON.parse(responseText);
Update runtime data after load:
view.updateData({ selected: true
Câu hỏi thường gặp
Tôi có cần Mac để dùng không?
Không cần cho ảnh chụp màn hình, vì chúng chạy headless. Cửa sổ xem trước chỉ có trên macOS.
Nó có render được ứng dụng cục bộ không?
Có. Nó có thể tải một tệp template cục bộ cũng như liên kết bundle trên web.
Mẫu mặc định hiển thị gì?
Mặc định nó tải một bundle mẫu gallery Lynx từ trang ví dụ của Lynx.
Chi tiết
Mô tả gốc của tác giả
Use this skill when a task needs to run Lynx bundles with the node-lynx CLI, capture screenshots, open a macOS preview window, use DebugRouter OpenCard, inspect rendered content through CDP, or integrate node-lynx through JavaScript or TypeScript APIs.
repo: lynx-family/lynx
Độ phổ biến
- Sao GitHub
- 15k
- Vị trí xếp hạng
- #10922
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.