用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/caffeinelabs/skills --skill extension-qr-code命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
MANDATORY recipe for every Caffeine build that calls an LLM, chatbot, GPT, or ChatGPT **on Caffeine Inference** (no user-pasted OpenAI key). The ONLY supported path is the `caffeineai-inference-client` mops package with `Config.fromEnv<system>()`, which hands the canister a ready-to-use authenticated config — the app never asks for, stores, or returns a key. Hand-rolling `ic.http_request` to `inference.caffeine.ai` (or `api.openai.com`) is a FORBIDDEN anti-pattern. Load this skill whenever the user, spec, or any prior task wants an LLM in a Caffeine app — and BEFORE writing any code that talks to an LLM host. Use `extension-openai` only when the spec explicitly requires a user- or admin-pasted `sk-...` key against `api.openai.com`.
MANDATORY recipe for every Caffeine build that calls OpenAI (ChatGPT, GPT-4o, an LLM, a chatbot, embeddings). The ONLY supported path is the `openai-client` mops package with a canister-side API-key bearer. Hand-rolling `ic.http_request` to `api.openai.com/v1/...` is a FORBIDDEN anti-pattern — it leaks the bearer across replicated outcalls (security + 13× billing impact), bypasses the typed request/response bindings, and forces hand-rolled JSON on a language with poor JSON support. Load this skill whenever the user, spec, or any prior task mentions ChatGPT, GPT (any version), OpenAI, an LLM, a chatbot, or embeddings — and BEFORE writing any code that touches `api.openai.com`.
EXPERIMENTAL, UNTESTED recipe for posting messages to a Slack workspace from a Caffeine canister via the `slack-client` mops package (Slack Web API). Use it when the user wants their app to send a message to a Slack channel — "post to Slack", "notify a channel", "send a Slack message", or equivalent. The client is a pre-release 0.1.0 drop (bot `xoxb-` or user `xoxp-` token): its request path is verified against the live Slack API (a real message posts), but the success-response decode is not yet runtime-confirmed, so treat it as a starting point and do NOT present Slack as a fully supported platform feature yet. Hand-rolling `ic.http_request` calls to `slack.com/api` is still the wrong move — prefer the generated client so bearer auth, percent-encoding, and JSON parsing come for free.
基于 SOC 职业分类
| name | extension-qr-code |
| description | QR code scanner using the camera. |
| version | 0.1.4 |
| compatibility | {"npm":{"@caffeineai/qr-code":"~0.1.1","@caffeineai/camera":"~0.1.1"}} |
| caffeineai-subscription | ["none"] |
QR code scanner extension for Caffeine AI.
This skill adds QR code scanning using the device camera. Built on top of the camera component with jsQR for decoding.
For QR code scanner support:
There is a prefabricated React hook imported from @caffeinelabs/qr-code that cannot be modified.
import { RefObject } from 'react';
import { CameraConfig, CameraError } from '@caffeineai/camera';
export interface QRResult {
// The decoded QR code data
data: string;
// Timestamp when the QR code was scanned
timestamp: number;
}
export interface QRScannerConfig extends CameraConfig {
// How often to scan for QR codes in milliseconds (default: 100)
scanInterval?: number;
// Maximum number of results to keep in history (default: 10)
maxResults?: number;
// URL to load jsQR library from (default: jsdelivr CDN)
jsQRUrl?: string;
}
export interface UseQRScannerReturn {
// Array of scanned QR codes (newest first)
qrResults: QRResult[];
// Whether currently scanning for QR codes
isScanning: boolean;
// Whether jsQR library has been loaded
jsQRLoaded: boolean;
// Camera state (pass-through from useCamera)
isActive: boolean;
isSupported: boolean | null;
error: CameraError | null;
isLoading: boolean;
currentFacingMode: 'user' | 'environment';
// Start camera and begin scanning - returns true on success
startScanning: () => Promise<boolean>;
// Stop scanning and camera
stopScanning: () => Promise<void>;
// Switch camera facing mode - returns true on success
switchCamera: () => Promise<boolean>;
// Clear all scan results
clearResults: () => void;
// Reset scanner state (stop scanning and clear results)
reset: () => void;
// Retry camera initialization after error - returns true on success
retry: () => Promise<boolean>;
// Ref to attach to video element for camera preview
videoRef: RefObject<HTMLVideoElement>;
// Ref to attach to canvas element used for QR processing (can be hidden)
canvasRef: RefObject<HTMLCanvasElement>;
// Computed state
// Whether scanner is ready to use (jsQR loaded and camera supported)
isReady: boolean;
// Whether scanning can be started (ready + not loading)
canStartScanning: boolean;
}
export declare function useQRScanner(config?: QRScannerConfig): UseQRScannerReturn;
Usage example:
import { useQRScanner } from '@caffeineai/qr-code';
function QRScannerComponent() {
const {
qrResults,
isScanning,
isActive,
isSupported,
error,
isLoading,
canStartScanning,
startScanning,
stopScanning,
switchCamera,
clearResults,
videoRef,
canvasRef
} = useQRScanner({
facingMode: 'environment',
scanInterval: 100,
maxResults: 5
});
if (isSupported === false) {
return <div>Camera not supported</div>;
}
return (
<div>
<video
ref={videoRef}
style={{ width: '100%', height: 'auto' }}
playsInline
muted
/>
<canvas ref={canvasRef} style={{ display: 'none' }} />
{error && <div>Error: {error.message}</div>}
Start Scanning
Stop Scanning
{/* Only show switch camera on mobile */}
{/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && (
Switch Camera
)}
Results {qrResults.length > 0 && Clear}
{qrResults.map(result => (
{new Date(result.timestamp).toLocaleTimeString()}
{result.data}
))}
);
}
Properly display QR scanner error messages in the app.