@trawlme/skills 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pierre Brisorgueil
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # @trawlme/skills
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@trawlme/skills.svg)](https://www.npmjs.com/package/@trawlme/skills)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Claude Code skills for [Trawl](https://trawl.me). Teaches Claude how to manage scraps via `@trawlme/cli` — listing, creating, running, watching, debugging.
7
+
8
+ Follows the [Anthropic Agent Skills](https://github.com/anthropics/skills) layout: each skill lives in `skills/<name>/SKILL.md`.
9
+
10
+ ## Bundled skills
11
+
12
+ | Skill | What it does |
13
+ |---|---|
14
+ | `trawl` | Use the `trawl` CLI to manage scraps (auth, list, run, watch, debug) |
15
+
16
+ ## Install
17
+
18
+ ### Option 1 — via npx (no global install)
19
+
20
+ ```bash
21
+ npx @trawlme/skills install
22
+ ```
23
+
24
+ Installs all bundled skills into `~/.claude/skills/<name>/` (user-level, available across all projects).
25
+
26
+ For project-level install:
27
+
28
+ ```bash
29
+ npx @trawlme/skills install --local
30
+ ```
31
+
32
+ Install a specific skill only:
33
+
34
+ ```bash
35
+ npx @trawlme/skills install trawl
36
+ ```
37
+
38
+ ### Option 2 — via the Trawl CLI
39
+
40
+ If you already have `@trawlme/cli` installed:
41
+
42
+ ```bash
43
+ npm install -g @trawlme/cli
44
+ trawl skills install
45
+ ```
46
+
47
+ The CLI bundles the skills and keeps them in sync with the CLI version.
48
+
49
+ ## Usage
50
+
51
+ Once installed, restart Claude Code. Skills auto-trigger when you ask Claude about Trawl, scraps, scheduling jobs, or use the `trawl` CLI.
52
+
53
+ Example prompts:
54
+ - "list my failed scraps from last week"
55
+ - "create a scrap that scrapes example.com daily at 9am"
56
+ - "why did scrap 64a... fail?"
57
+ - "show me the data from my latest run"
58
+
59
+ ## Commands
60
+
61
+ ```
62
+ trawlme-skills install [<skill>] [--local] Install one or all skills
63
+ trawlme-skills uninstall [<skill>] [--local] Remove one or all skills
64
+ trawlme-skills update [<skill>] [--local] Reinstall over existing
65
+ trawlme-skills list List bundled skills
66
+ trawlme-skills version Print version
67
+ trawlme-skills help Print usage
68
+ ```
69
+
70
+ ## Prerequisites
71
+
72
+ The `trawl` skill assumes `@trawlme/cli` is installed and the user is authenticated:
73
+
74
+ ```bash
75
+ npm install -g @trawlme/cli
76
+ trawl login
77
+ ```
78
+
79
+ ## Editing the skills
80
+
81
+ Each skill lives in [`skills/<name>/SKILL.md`](./skills/). PRs to improve invocation accuracy or coverage are welcome.
82
+
83
+ ## License
84
+
85
+ MIT — see [LICENSE](./LICENSE).
package/bin/install.js ADDED
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env node
2
+ import { mkdirSync, copyFileSync, existsSync, rmSync, readFileSync, readdirSync, statSync, cpSync } from 'node:fs';
3
+ import { join, dirname } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { homedir } from 'node:os';
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const PACKAGE_ROOT = join(__dirname, '..');
9
+ const SKILLS_SOURCE = join(PACKAGE_ROOT, 'skills');
10
+
11
+ function getSkillsBase(scope) {
12
+ const base = scope === 'local' ? join(process.cwd(), '.claude') : join(homedir(), '.claude');
13
+ return join(base, 'skills');
14
+ }
15
+
16
+ function listSourceSkills() {
17
+ if (!existsSync(SKILLS_SOURCE)) return [];
18
+ return readdirSync(SKILLS_SOURCE).filter((name) => {
19
+ const dir = join(SKILLS_SOURCE, name);
20
+ return statSync(dir).isDirectory() && existsSync(join(dir, 'SKILL.md'));
21
+ });
22
+ }
23
+
24
+ function getVersion() {
25
+ const pkg = JSON.parse(readFileSync(join(PACKAGE_ROOT, 'package.json'), 'utf8'));
26
+ return pkg.version;
27
+ }
28
+
29
+ function installOne(name, scope) {
30
+ const src = join(SKILLS_SOURCE, name);
31
+ const dest = join(getSkillsBase(scope), name);
32
+ if (existsSync(dest)) rmSync(dest, { recursive: true, force: true });
33
+ mkdirSync(dest, { recursive: true });
34
+ cpSync(src, dest, { recursive: true });
35
+ return dest;
36
+ }
37
+
38
+ function uninstallOne(name, scope) {
39
+ const dest = join(getSkillsBase(scope), name);
40
+ if (!existsSync(dest)) return null;
41
+ rmSync(dest, { recursive: true, force: true });
42
+ return dest;
43
+ }
44
+
45
+ function pickSkills(arg) {
46
+ const all = listSourceSkills();
47
+ if (!arg || arg === 'all') return all;
48
+ if (!all.includes(arg)) {
49
+ console.error(`Unknown skill "${arg}". Available: ${all.join(', ')}`);
50
+ process.exit(1);
51
+ }
52
+ return [arg];
53
+ }
54
+
55
+ function printUsage() {
56
+ const all = listSourceSkills();
57
+ console.log(`@trawlme/skills ${getVersion()}
58
+
59
+ Usage:
60
+ trawlme-skills install [<skill>] [--local] Install one or all skills
61
+ trawlme-skills uninstall [<skill>] [--local] Remove one or all skills
62
+ trawlme-skills update [<skill>] [--local] Reinstall over existing
63
+ trawlme-skills list List bundled skills
64
+ trawlme-skills version Print version
65
+ trawlme-skills help Print this message
66
+
67
+ Options:
68
+ --local Install to ./.claude/skills/ instead of ~/.claude/skills/
69
+
70
+ Available skills: ${all.join(', ') || '(none)'}
71
+ `);
72
+ }
73
+
74
+ const args = process.argv.slice(2);
75
+ const cmd = args[0];
76
+ const scope = args.includes('--local') ? 'local' : 'user';
77
+ const positional = args.filter((a) => !a.startsWith('-') && a !== cmd);
78
+ const skillArg = positional[0];
79
+
80
+ switch (cmd) {
81
+ case 'install':
82
+ case 'update': {
83
+ const skills = pickSkills(skillArg);
84
+ if (!skills.length) {
85
+ console.error('No skills found in package.');
86
+ process.exit(1);
87
+ }
88
+ for (const name of skills) {
89
+ const dest = installOne(name, scope);
90
+ console.log(`✓ Installed "${name}" at ${dest}`);
91
+ }
92
+ console.log(` Restart Claude Code if it was already running.`);
93
+ break;
94
+ }
95
+ case 'uninstall': {
96
+ const skills = pickSkills(skillArg);
97
+ for (const name of skills) {
98
+ const dest = uninstallOne(name, scope);
99
+ if (dest) console.log(`✓ Removed "${name}" from ${dest}`);
100
+ else console.log(` No "${name}" found in ${getSkillsBase(scope)}`);
101
+ }
102
+ break;
103
+ }
104
+ case 'list':
105
+ for (const name of listSourceSkills()) console.log(name);
106
+ break;
107
+ case 'version':
108
+ console.log(getVersion());
109
+ break;
110
+ case 'help':
111
+ case undefined:
112
+ printUsage();
113
+ break;
114
+ default:
115
+ console.error(`Unknown command: ${cmd}`);
116
+ printUsage();
117
+ process.exit(1);
118
+ }
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@trawlme/skills",
3
+ "version": "0.1.0",
4
+ "description": "Claude Code skills for the Trawl CLI — teaches Claude how to manage scraps via @trawlme/cli",
5
+ "type": "module",
6
+ "bin": {
7
+ "trawlme-skills": "bin/install.js"
8
+ },
9
+ "files": [
10
+ "skills",
11
+ "bin",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
18
+ "scripts": {
19
+ "install-skill": "node bin/install.js"
20
+ },
21
+ "keywords": [
22
+ "trawl",
23
+ "claude",
24
+ "claude-code",
25
+ "skill",
26
+ "scraping",
27
+ "cli"
28
+ ],
29
+ "author": "Pierre Brisorgueil",
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/comes-io/trawl_skills.git"
34
+ },
35
+ "homepage": "https://trawl.me",
36
+ "bugs": {
37
+ "url": "https://github.com/comes-io/trawl_skills/issues"
38
+ }
39
+ }
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: trawl
3
+ description: Use this skill when the user wants to manage Trawl scraps (scraping jobs) — listing, creating, running, watching, or inspecting them — or when working with the `trawl` command-line tool from the `@trawlme/cli` package. Trawl is a hosted scraping platform where each "scrap" is a Puppeteer-based scraping job that can run on a cron schedule and emit data.
4
+ ---
5
+
6
+ # Trawl CLI
7
+
8
+ The `trawl` CLI is the command-line client for [Trawl](https://trawl.me), a hosted scraping platform. Each scrap is a Puppeteer script that runs on a worker and produces structured data, optionally on a cron schedule.
9
+
10
+ ## When to use this skill
11
+
12
+ Trigger when the user mentions:
13
+ - Trawl, scraps, or trawl.me
14
+ - Scheduled scraping jobs they own on Trawl
15
+ - The `trawl` CLI command (e.g. `trawl scraps list`)
16
+ - Wanting to create / run / inspect a scraping job
17
+
18
+ Do NOT trigger for generic "scrape this URL" requests with no Trawl context — point them at a generic Puppeteer/Playwright approach instead.
19
+
20
+ ## Prerequisites
21
+
22
+ The user must have `@trawlme/cli` installed:
23
+
24
+ ```bash
25
+ npm install -g @trawlme/cli
26
+ ```
27
+
28
+ And be authenticated. Three auth paths:
29
+
30
+ 1. **Interactive** — `trawl login` (prompts email/password, stores JWT in `~/.config/trawl-cli/`)
31
+ 2. **Env var** — `export TRAWL_TOKEN=<jwt>` (overrides stored token, ideal for CI)
32
+ 3. **Token flag** — `trawl login --token <jwt>`
33
+
34
+ Custom API base: `trawl login --url https://self-hosted.example.com`. Default is `https://api.trawl.me`.
35
+
36
+ If the user gets `Session expired or invalid. Run: trawl login`, their stored JWT is dead — re-run `trawl login`.
37
+
38
+ ## Core commands
39
+
40
+ All commands accept `--json` (where listed) for machine-readable output. Use `--json` whenever you need to pipe into other commands or parse the result.
41
+
42
+ ### List scraps
43
+
44
+ ```bash
45
+ trawl scraps list # human-readable table
46
+ trawl scraps list --json # JSON array
47
+ trawl scraps list --status failure # filter by last-run status
48
+ trawl scraps list --status success
49
+ trawl scraps list --status never # never run
50
+ ```
51
+
52
+ ### Inspect a single scrap
53
+
54
+ ```bash
55
+ trawl scraps get <id> # human-readable
56
+ trawl scraps get <id> --json # full scrap object
57
+ trawl scraps data <id> --json # last run output (the scraped data)
58
+ ```
59
+
60
+ ### Create a scrap
61
+
62
+ ```bash
63
+ trawl scraps create -t "Daily prices" -u "https://example.com/products" \
64
+ -r '<puppeteer script>' -s puppeteer
65
+ ```
66
+
67
+ Flags:
68
+ - `-t, --title` (required) — display name
69
+ - `-u, --url` — target URL (also exposed as `TRAWL.url` in the script)
70
+ - `-r, --request` — the Puppeteer script body (must call `returnData(arr)`)
71
+ - `-s, --scrapper` — engine, defaults to `puppeteer`
72
+
73
+ Minimal Puppeteer request body:
74
+
75
+ ```js
76
+ var page = await browser.newPage();
77
+ await page.goto(TRAWL.url, { waitUntil: 'domcontentloaded' });
78
+ var items = await page.$$eval('a', els => els.map(e => ({ title: e.textContent })));
79
+ returnData(items);
80
+ ```
81
+
82
+ ### Update a scrap
83
+
84
+ ```bash
85
+ trawl scraps update <id> -t "New title" --cron "0 9 * * *"
86
+ trawl scraps update <id> --no-cron # disable schedule
87
+ trawl scraps update <id> --alert ops@example.com # email on failure
88
+ trawl scraps update <id> --no-alert # disable alerts
89
+ trawl scraps update <id> -p '{"key":"page","value":"2"}' # add a param (JSON object)
90
+ trawl scraps update <id> --params-file ./params.json # bulk params from file
91
+ ```
92
+
93
+ ### Run / trigger / watch
94
+
95
+ - `trawl scraps run <id>` — synchronous run, blocks until done
96
+ - `trawl scraps run <id> --watch` — same but streams activity logs
97
+ - `trawl scraps trigger <id>` — fire-and-forget (returns immediately)
98
+ - `trawl scraps watch <id>` — attach to an in-progress run's activity stream
99
+
100
+ ### Delete
101
+
102
+ ```bash
103
+ trawl scraps rm <id> # prompts for confirmation
104
+ trawl scraps rm <id> --force # no prompt, useful in scripts
105
+ ```
106
+
107
+ ## Scrap accounts (per-scrap auth)
108
+
109
+ When the target site requires login, attach credentials to a scrap:
110
+
111
+ ```bash
112
+ trawl scraps account set <id> -u user@example.com -p '<password>'
113
+ trawl scraps account status <id> --json # check session validity
114
+ trawl scraps account clear-session <id> # force re-login on next run
115
+ trawl scraps account delete <id> --force # remove stored creds
116
+ ```
117
+
118
+ ## Common patterns
119
+
120
+ **"Run my X scrap and show me the result"**
121
+ ```bash
122
+ ID=$(trawl scraps list --json | jq -r '.[] | select(.title=="X") | ._id')
123
+ trawl scraps run "$ID" --watch
124
+ trawl scraps data "$ID" --json
125
+ ```
126
+
127
+ **"Why did this scrap fail?"**
128
+ ```bash
129
+ trawl scraps get <id> --json | jq '.lastRun'
130
+ trawl scraps watch <id> # if running, see live errors
131
+ ```
132
+
133
+ **"Create a job that runs every morning"**
134
+ ```bash
135
+ trawl scraps create -t "Morning crawl" -u "https://..." -r '...' -s puppeteer
136
+ trawl scraps update <new-id> --cron "0 8 * * *"
137
+ ```
138
+
139
+ **"Test my changes without scheduling"**
140
+ ```bash
141
+ trawl scraps update <id> -r '<new script>'
142
+ trawl scraps run <id> --watch
143
+ ```
144
+
145
+ ## Output shapes (JSON)
146
+
147
+ A scrap object has at minimum:
148
+
149
+ ```json
150
+ {
151
+ "_id": "507f1f77bcf86cd799439011",
152
+ "title": "...",
153
+ "url": "https://...",
154
+ "request": "var page = ...",
155
+ "scrapper": "puppeteer",
156
+ "cron": "0 9 * * *" ,
157
+ "params": [{"key": "...", "value": "..."}],
158
+ "lastRun": { "status": "success" | "failure", "duration": 1234, "error": "..." },
159
+ "createdAt": "...",
160
+ "updatedAt": "..."
161
+ }
162
+ ```
163
+
164
+ `trawl scraps data <id> --json` returns whatever array the user's script passed to `returnData(...)`.
165
+
166
+ ## Errors to recognize
167
+
168
+ - `Session expired or invalid. Run: trawl login` → token dead, re-auth
169
+ - `Invalid credentials` → wrong email/password on `trawl login`
170
+ - HTTP 403 → user doesn't own the scrap
171
+ - HTTP 404 → wrong scrap ID
172
+ - HTTP 422 on create/update → missing required field or invalid cron expression
173
+
174
+ ## What this skill does NOT do
175
+
176
+ - Doesn't write the Puppeteer scraping logic for the user — that's their domain. Suggest patterns but let them iterate.
177
+ - Doesn't bypass site anti-bot measures. If a scrap fails because of bot detection, the answer is on Trawl's side (worker fingerprint, sessions), not the CLI.
178
+ - Doesn't manage billing, organizations, or workers. Those live on the web app at trawl.me.