Best use case
wasm-constraints is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
wasm constraints
Teams using wasm-constraints should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/wasm-constraints/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How wasm-constraints Compares
| Feature / Agent | wasm-constraints | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
wasm constraints
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
AI Agents for Marketing
Discover AI agents for marketing workflows, from SEO and content production to campaign research, outreach, and analytics.
SKILL.md Source
## priority: high
# WASM Build Constraints
## Overview
WASM target in `crates/kreuzberg-wasm/`. Uses wasm-bindgen with sync-only internal APIs.
## Feature Flags
```toml
[features]
wasm-target = ["pdf", "html", "xml", "email", "language-detection", "chunking", "quality", "office"]
wasm-threads = ["dep:wasm-bindgen-rayon"] # Optional
```
## Critical Constraints
### 1. No Tokio Runtime
All operations must be synchronous internally. Use `#[cfg(not(feature = "tokio-runtime"))]` paths.
### 2. SyncExtractor Required
Every WASM-compatible extractor MUST implement `SyncExtractor`:
```rust
impl SyncExtractor for MyExtractor {
fn extract_sync(&self, content: &[u8], mime_type: &str, config: &ExtractionConfig)
-> Result<ExtractionResult> { /* sync implementation */ }
}
impl DocumentExtractor for MyExtractor {
fn as_sync_extractor(&self) -> Option<&dyn SyncExtractor> {
Some(self) // MUST return Some for WASM
}
}
```
### 3. HTML Size Limit
```rust
const MAX_HTML_SIZE: usize = 2 * 1024 * 1024; // 2MB - stack constraint
```
### 4. PDFium Initialization (from JS)
```typescript
import init, { initialize_pdfium_render } from './kreuzberg_wasm.js';
const wasm = await init();
const pdfium = await pdfiumModule();
initialize_pdfium_render(pdfium, wasm, false); // REQUIRED for PDF
```
## Build Config
```toml
[lib]
crate-type = ["cdylib", "rlib"]
[profile.release.package.kreuzberg-wasm]
opt-level = "z" # Size optimization
codegen-units = 1
```
## API Pattern
```rust
#[wasm_bindgen]
pub async fn extract_from_bytes(content: Vec<u8>, config: JsValue) -> Result<JsValue, JsValue> {
let config: ExtractionConfig = serde_wasm_bindgen::from_value(config)?;
let result = extract_bytes_sync(&content, mime_type, &config)?;
Ok(serde_wasm_bindgen::to_value(&result)?)
}
```
Functions can be `async` for JS compatibility, but internal extraction is sync.
## Critical Rules
1. **No tokio** — all operations synchronous
2. **Implement SyncExtractor** for all WASM-compatible extractors
3. **HTML limited to 2MB** due to stack constraints
4. **PDFium requires** manual JS initialization
5. **Size optimization** via `opt-level = "z"`
6. **Feature gate** with `#[cfg(target_arch = "wasm32")]`Related Skills
kreuzberg
Extract text, tables, metadata, and images from 91+ document formats (PDF, Office, images, HTML, email, archives, academic) using Kreuzberg. Use when writing code that calls Kreuzberg APIs in Python, Node.js/TypeScript, Rust, or CLI. Covers installation, extraction (sync/async), configuration (OCR, chunking, output format), batch processing, error handling, and plugins.
test-execution-patterns
test execution patterns
security-limits-dos-protection
security limits dos protection
plugin-architecture-patterns
plugin architecture patterns
ocr-backend-management
ocr uackend management
mime-detection-routing
mime detection routing
format-specific-extraction
format specific extraction
extraction-pipeline-patterns
extraction pipeline patterns
config-loading-precedence
config loading precedence
chunking-embeddings
chunking emueddings
api-server-mcp
api server mcp
registry-implementation
registry implementation