Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .claude/skills/doc-check/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
name: doc-check
description: Documentation update checklist. Run after API changes to find documentation that needs updating. Use for doc check, documentation review, docs update, API change docs.
allowed-tools:
- Read
- Grep
- Glob
- Bash(pnpm:*)
- Bash(node:*)
- Bash(git:*)
---

# Documentation Update Checklist

After any API change, verify all documentation is in sync. This checklist is ordered by priority.

## How to Use

1. Identify what changed (new field, new method, changed signature, etc.)
2. Walk through each section below
3. Check only items relevant to the change scope (core, react, or both)
4. Mark items as done or N/A

## 1. Package LLM Docs (bundled in npm)

These are the primary references for AI coding agents.

- [ ] `packages/durably/docs/llms.md` — Core API docs
- [ ] `packages/durably-react/docs/llms.md` — React hooks docs

## 2. Website API Reference

### Core API

| File | Content |
| ------------------------------- | ------------------------------------------------------ |
| `website/api/index.md` | Quick reference / cheat sheet (covers ALL APIs) |
| `website/api/create-durably.md` | `createDurably()`, instance methods, types |
| `website/api/define-job.md` | `defineJob()`, job config |
| `website/api/step.md` | Step context (`step.run`, `step.progress`, `step.log`) |
| `website/api/events.md` | Event types and their fields |
| `website/api/http-handler.md` | `createDurablyHandler()`, request/response types |

### React API

| File | Content |
| -------------------------------------- | ---------------------------------------------- |
| `website/api/durably-react/index.md` | React hooks overview |
| `website/api/durably-react/browser.md` | Browser-mode hooks (`useJob`, `useRuns`, etc.) |
| `website/api/durably-react/client.md` | Client-mode hooks (server-connected) |
| `website/api/durably-react/types.md` | Shared type definitions |

### Guides (check if examples use changed API)

| File | Content |
| ---------------------------------- | ------------------------- |
| `website/guide/concepts.md` | Core concepts explanation |
| `website/guide/getting-started.md` | Getting started tutorial |
| `website/guide/csv-import.md` | CSV import example |
| `website/guide/background-sync.md` | Background sync example |
| `website/guide/offline-app.md` | Offline app example |

## 3. Generated Files

These are derived from package docs and must be regenerated:

```bash
pnpm --filter durably-website generate:llms
```

- [ ] `website/public/llms.txt` — Concatenation of core + react `llms.md`

## 4. Scope Guide

Use this table to quickly determine which docs to check based on what changed:

| Change Type | Docs to Check |
| -------------------------------- | ------------------------------------------------------------------------------------------ |
| New field on `Run` / `RunFilter` | llms.md (core), create-durably.md, index.md, http-handler.md, react browser.md + client.md |
| New event field | llms.md (core), events.md, index.md |
| New step method | llms.md (core), step.md, index.md |
| New trigger option | llms.md (core), index.md, http-handler.md, create-durably.md |
| React hook change | llms.md (react), browser.md, client.md, index.md (react section) |
| HTTP handler change | llms.md (core), http-handler.md, client.md |
| New config option | llms.md (core), create-durably.md, index.md |

## 5. Common Oversights

- **`website/api/index.md`** is a cheat sheet — it duplicates key info from other pages and is easy to forget
- **Event field additions** must be added to every event type comment block in `events.md`
- **Browser and Client mode** hooks often have parallel options tables — update both
- **Type definitions** in `website/api/durably-react/types.md` may need new type exports
- **`website/public/llms.txt`** is generated — don't edit directly, regenerate instead
- **Code examples** in guides may use the changed API — grep for the symbol name in `website/guide/`

## 6. Verification

```bash
pnpm format:fix
pnpm --filter durably-website generate:llms
pnpm validate
```
13 changes: 7 additions & 6 deletions .claude/skills/release-check/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ Verify package integrity for API changes and spec updates.
### Core

- [ ] `packages/durably/docs/llms.md` - LLM docs (bundled in npm)
- [ ] `docs/spec.md` - Core specification

### React

- [ ] `packages/durably-react/docs/llms.md` - LLM docs (bundled in npm)
- [ ] `docs/spec-react.md` - React specification
- [ ] `website/api/durably-react/index.md` - Overview
- [ ] `website/api/durably-react/browser.md` - Browser hooks
- [ ] `website/api/durably-react/client.md` - Client hooks
Expand Down Expand Up @@ -95,19 +93,21 @@ Check `git status` for uncommitted changes.

When React hooks should provide the same API in both Browser and Client modes:

| File | Mode |
| --------------------- | ------------- |
| `hooks/use-job.ts` | Browser mode |
| `client/use-job.ts` | Client mode |
| File | Mode |
| ------------------- | ------------ |
| `hooks/use-job.ts` | Browser mode |
| `client/use-job.ts` | Client mode |

Ensure consistency in:

- Interface definitions
- Return values
- Options

### Code Examples in Documentation

Verify code examples in docs match actual API:

- Return value properties
- Option parameters
- Type definitions
Expand All @@ -125,5 +125,6 @@ pnpm typecheck # Includes all examples
```

Key components to check:

- `dashboard.tsx` - useRuns, useRunActions
- `*-progress.tsx` - useJob return values (status booleans)
18 changes: 0 additions & 18 deletions AGENTS.md

This file was deleted.

23 changes: 2 additions & 21 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
<!-- OPENSPEC:START -->
# OpenSpec Instructions

These instructions are for AI assistants working in this project.

Always open `@/openspec/AGENTS.md` when the request:
- Mentions planning or proposals (words like proposal, spec, change, plan)
- Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work
- Sounds ambiguous and you need the authoritative spec before coding

Use `@/openspec/AGENTS.md` to learn:
- How to create and apply change proposals
- Spec format and conventions
- Project structure and guidelines

Keep this managed block so 'openspec update' can refresh the instructions.

<!-- OPENSPEC:END -->

# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Expand All @@ -27,13 +8,12 @@ Durably is a step-oriented batch execution framework for Node.js and browsers. I

## Documentation

- `docs/spec.md` - Core specification
- `docs/spec-streaming.md` - Streaming extension for AI Agent workflows
- `packages/durably/docs/llms.md` - LLM/AI agent documentation (bundled in npm package)

### LLM Documentation Maintenance

When API changes are made, update `packages/durably/docs/llms.md` to keep it in sync. This file is:

- Bundled in the npm package for coding agents to read from `node_modules`
- Symlinked to `website/public/llms.txt` for web access

Expand Down Expand Up @@ -83,3 +63,4 @@ pnpm lint:fix # Fix lint issues
## Skills

- **release-check** - Pre-release integrity check for API changes and spec updates (`.claude/skills/release-check/`)
- **doc-check** - Documentation update checklist after API changes (`.claude/skills/doc-check/`)
25 changes: 14 additions & 11 deletions examples/browser-react-router-spa/app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export async function clientAction({ request }: { request: Request }) {
if (intent === 'image') {
const filename = formData.get('filename') as string
const width = Number(formData.get('width'))
const run = await durably.jobs.processImage.trigger({ filename, width })
const run = await durably.jobs.processImage.trigger(
{ filename, width },
{ labels: { source: 'browser' } },
)
return { intent: 'image', runId: run.id }
}

Expand All @@ -59,22 +62,22 @@ export default function Index() {

return (
<div className="min-h-screen bg-gray-50">
<div className="max-w-6xl mx-auto p-6">
<div className="mx-auto max-w-6xl p-6">
<header className="mb-8">
<h1 className="text-3xl font-bold text-gray-900">
Durably - Browser-Only SPA
</h1>
<p className="text-gray-600 mt-2">
<p className="mt-2 text-gray-600">
React Router v7 SPA mode with clientAction + Form
</p>
</header>

<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div className="grid grid-cols-1 gap-6 lg:grid-cols-2">
{/* Left: Job Trigger + Progress */}
<div className="space-y-4">
{/* Job Selection */}
<section className="bg-white rounded-lg shadow p-6">
<div className="flex items-center justify-between mb-4">
<section className="rounded-lg bg-white p-6 shadow">
<div className="mb-4 flex items-center justify-between">
<h2 className="text-lg font-semibold">Run Job</h2>
<div className="flex gap-2">
<button
Expand All @@ -97,25 +100,25 @@ export default function Index() {
</div>
</div>

<div className="flex border-b border-gray-200 mb-4">
<div className="mb-4 flex border-b border-gray-200">
<button
type="button"
onClick={() => setActiveJob('image')}
className={`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${
className={`border-b-2 px-4 py-2 text-sm font-medium transition-colors ${
activeJob === 'image'
? 'border-blue-600 text-blue-600'
: 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'
: 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'
}`}
>
Image Processing
</button>
<button
type="button"
onClick={() => setActiveJob('sync')}
className={`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${
className={`border-b-2 px-4 py-2 text-sm font-medium transition-colors ${
activeJob === 'sync'
? 'border-blue-600 text-blue-600'
: 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'
: 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700'
}`}
>
Data Sync
Expand Down
Loading