# daily_hacker_news_digest

Adopt this skill: https://proskills.md/skills/other/just-claw-it-n8n-to-claw-examples-daily-hacker-news-digest

Page: https://proskills.md/skills/other/just-claw-it-n8n-to-claw-examples-daily-hacker-news-digest
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: examples/daily-hacker-news-digest/SKILL.md
size: 935
upstream: https://github.com/just-claw-it/n8n-to-claw/blob/main/examples/daily-hacker-news-digest/SKILL.md

````text
---
name: daily_hacker_news_digest
description: Fetch the top 10 Hacker News stories and send a daily email digest.
metadata: {"openclaw":{"requires":{"bins":["node"],"env":["SMTP_HOST","SMTP_PORT","SMTP_USER","SMTP_PASS","DIGEST_TO_EMAIL"]},"emoji":"📰"}}
---

# Daily Hacker News Digest

Fetches the top 10 stories from the Hacker News API, formats them into a
readable digest, and sends an email via SMTP.

## Usage

```bash
node {baseDir}/skill.ts
```

## Environment variables

- `SMTP_HOST` — SMTP server hostname
- `SMTP_PORT` — SMTP port (e.g. `587`)
- `SMTP_USER` — SMTP username
- `SMTP_PASS` — SMTP password
- `DIGEST_TO_EMAIL` — recipient email address

## Examples

```bash
SMTP_HOST=smtp.gmail.com SMTP_PORT=587 \
SMTP_USER=bot@example.com SMTP_PASS=app-password \
DIGEST_TO_EMAIL=team@example.com \
node {baseDir}/skill.ts
```

## Output

Prints the digest to stdout and sends the email. Exits 0 on success.
````

## File: README.md
upstream: https://github.com/just-claw-it/n8n-to-claw/blob/main/README.md

````text
<div align="center">
  <img src="./docs/images/n8n-to-claw.png" alt="n8n workflow to OpenClaw skill" width="600" />
  <h1>n8n-to-claw</h1>
  <p><strong>Turn n8n workflows into OpenClaw skills</strong></p>
  <p>
    A <strong>CLI</strong> that converts <a href="https://n8n.io">n8n</a> workflow JSON into <a href="https://openclaw.ai">OpenClaw</a>-compatible skills (<code>SKILL.md</code> + <code>skill.ts</code>). An LLM handles transpilation; the main interface is the CLI, with an optional <strong>web UI</strong> (see below) for the same pipeline in the browser.
  </p>
  <p>
    <a href="https://github.com/just-claw-it/n8n-to-claw/actions/workflows/ci.yml?branch=main">
      <img src="https://github.com/just-claw-it/n8n-to-claw/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI" />
    </a>
    <a href="LICENSE">
      <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" />
    </a>
  </p>
</div>

## Requirements

- Node.js ≥ 20
- An OpenAI-compatible LLM API (OpenAI, [Groq](https://console.groq.com/docs/models), OpenRouter, Ollama, etc.)

## Install

Install from a clone of this repository (the package is not published to npm yet):

```bash
git clone https://github.com/just-claw-it/n8n-to-claw.git
cd n8n-to-claw
npm install
npm run build
```

Run the CLI:

```bash
node dist/cli/index.js convert workflow.json
```

Optional — install the `n8n-to-claw` command globally from the repo:

```bash
npm install -g .
n8n-to-claw convert workflow.json
```

## Usage

**From a local workflow JSON file:**
```bash
n8n-to-claw convert workflow.json
```

**From the n8n REST API:**
```bash
n8n-to-claw convert \
  --n8n-url https://my-n8n.example.com \
  --api-key <n8n-api-key> \
  --workflow-id <workflow-id>
```

**Useful flags:**
```bash
# Parse only — summarise nodes/warnings, skip LLM
n8n-to-claw convert workflow.json --dry-run

# Print full IR + prompt + known node list, then exit (no LLM call)
n8n-to-claw convert workflow.json --inspect

# Write a reproducible debug bundle (IR + prompts + LLM + validation traces)
n8n-to-claw convert workflow.json --debug-bundle

# Print LLM prompt + raw response + tsc output to stderr
n8n-to-claw convert workflow.json --verbose

# Override output directory
n8n-to-claw convert workflow.json --output-dir ~/my-skills

# Overwrite an existing skill output without prompting
n8n-to-claw convert workflow.json --force

# Print CLI version
n8n-to-claw --version

# Verify LLM_* and that the OpenAI-compatible endpoint is reachable (use before convert, especially local Ollama)
n8n-to-claw check-llm
```

**Debug logging:**
```bash
DEBUG=n8n-to-claw n8n-to-claw convert workflow.json
```

**Debug bundle artifacts (`--debug-bundle`):**
- `debug-bundle/meta.json` — source, status, model/timeouts, retry history
- `debug-bundle/ir.json` — normalized IR snapshot (raw payload stripped)
- `debug-bundle/warnings.parse.json` + `warnings.transpile.json`
- `debug-bundle/prompt-attempt-<n>.txt` + `llm-response-attempt-<n>.txt`
- `debug-bundle/validation-attempt-<n>.json`

## Environment variables

Required:

| Variable | Description |
|---|---|
| `LLM_BASE_URL` | OpenAI-compatible API base URL (e.g. `https://api.openai.com/v1`) |
| `LLM_API_KEY` | API key |
| `LLM_MODEL` | Model name (e.g. `gpt-4o`, `llama-3.3-70b-versatile` on Groq, `anthropic/claude-3.5-sonnet` via OpenRouter) |

Optional:

| Variable | Default | Description |
|---|---|---|
| `LLM_TIMEOUT_MS` | `60000` | Per-request LLM timeout in milliseconds |
| `LLM_MAX_RETRIES` | `3` | Max retries on 429 rate-limit or 5xx errors |
| `LLM_MAX_TOKENS` | `4096` | Max completion tokens per request; lower values can finish sooner on slow local models (Ollama) but may truncate output |
| `DEBUG` | — | Set to `n8n-to-claw` to enable structured debug logging |
| `N8N_TO_CLAW_FORCE_LLM` | — | If `1`, skip deterministic templates and always call the LLM |

Copy [`.env.example`](.env.example) to `.env`, fill in values, then `source .env` (or export the variables in your shell).

After setting `LLM_*`, run `n8n-to-claw check-llm` to confirm connectivity. That uses the same env as `convert` and fails fast with hints if the URL is wrong, Ollama is not running, or a remote agent cannot reach your machine’s `localhost`.

Example (OpenAI):
```bash
export LLM_BASE_URL=https://api.openai.com/v1
export LLM_API_KEY=sk-...
export LLM_MODEL=gpt-4o
```

Example ([Groq / GroqCloud](https://console.groq.com/docs/models) — not xAI Grok):
```bash
export LLM_BASE_URL=https://api.groq.com/openai/v1
export LLM_API_KEY=gsk_...
export LLM_MODEL=llama-3.3-70b-versatile
```

Example (local **Ollama** — transpile sends a **large** system prompt + workflow; an 8B CPU model can take many minutes per attempt. `ollama run "ping"` is not comparable workload.)

```bash
export LLM_BASE_URL=http://127.0.0.1:11434/v1
export LLM_API_KEY=ollama
export LLM_MODEL=llama3.1:8b
export LLM_TIMEOUT_MS=900000
# Optional: cap output length to reduce generation time (may truncate; retry may still help)
# export LLM_MAX_TOKENS=2048
```

## Output

Skills are written to `~/.openclaw/workspace/skills/<workflow-name>/`:

```
~/.openclaw/workspace/skills/my-workflow/
├── SKILL.md                  # OpenClaw skill descriptor
├── skill.ts                  # Node.js implementation
├── credentials.example.env   # Generated if the workflow uses credentials
├── warnings.json             # List of every degraded/stubbed node
└── skill-meta.json           # Provenance: tool version, workflow fingerprint, transpile status
```

If the generated `skill.ts` fails TypeScript validation after two LLM attempts, the output goes to `draft/` instead:

```
~/.openclaw/workspace/skills/my-workflow/
├── draft/
│   ├── SKILL.md
│   └── skill.ts              # Fix TypeScript errors, then move up one level
├── warnings.json
└── skill-meta.json           # Still at skill root (includes status: draft when applicable)
```

## Model recommendation

**Minimum:** GPT-4o or Claude Sonnet tier.

Small Ollama models (7B–13B) will produce syntactically broken or logically incorrect `skill.ts` output. The tool will catch compilation errors and retry once with the error injected into the prompt, but logical correctness is not guaranteed even with large models — always review generated skills before using them.

## Pipeline

```
┌─────────┐    ┌─────────────────┐    ┌───────────────────────┐    ┌─────────┐
│  Input  │───▶│  Parse (IR)     │───▶│  Transpile (LLM)      │───▶│ Package │
│ file/   │    │  normalize n8n  │    │  prompt → SKILL.md +  │    │ write   │
│ n8n API │    │  JSON to IR     │    │  skill.ts → tsc check │    │ to disk │
└─────────┘    └─────────────────┘    └───────────────────────┘    └─────────┘
```

### Graceful degradation

| Node situation | Behaviour |
|---|---|
| Unknown node type | Emits a stub with the original node JSON and a `TODO` comment |
| Credential references | Generates `credentials.example.env` with placeholder env var names |
| Webhook trigger | Maps to OpenClaw native webhook support |
| Database node (`postgres`, `mysql`, etc.) | Attempts bash CLI fallback (`psql`, `sqlite3`); falls back to `TODO` stub |
| n8n expression (`={{ ... }}`) | Annotated in generated code as requiring runtime resolution |
| Broken TypeScript (attempt 1) | Retries once with the compiler error injected into the prompt |
| Broken TypeScript (attempt 2) | Written to `draft/` with a warning |

All degraded nodes are listed in `warnings.json` with name, type, and reason.

## Node coverage

A **[generated dashboard](docs/node-coverage.md)** lists every node type that appears in `test-fixtures/`, its resolved category, and whether it was mapped via `EXACT_MAP`, a prefix/suffix fallback, or `unknown`. Regenerate it with `npm run coverage:nodes` (requires a successful `npm run build`). After `npm run build`, you can refresh only the markdown with `npm run coverage:nodes:write`. CI fails if the committed file does not match a fresh regeneration.

**479 node t
````
