@skilldeck/outreach 0.0.0-stage → 1.0.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/.claude-plugin/plugin.json +16 -0
- package/LICENSE +21 -0
- package/README.md +67 -2
- package/bin/outreach.mjs +29 -0
- package/index.mjs +19 -0
- package/package.json +40 -4
- package/skills/reddit-engage/SKILL.md +135 -0
- package/skills/reddit-engage/references/etiquette.md +65 -0
- package/skills/reddit-engage/references/modes.md +46 -0
- package/skills/reddit-engage/scripts/reddit.mjs +880 -0
- package/skills/reddit-setup/SKILL.md +92 -0
- package/skills/reddit-setup/references/oauth-app.md +66 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reddit-setup
|
|
3
|
+
description: Use when the user wants to connect a Reddit account for engagement, before the first search or reply, or when reddit.mjs reports missing env vars, a failed token, or a bad user agent. Creates a Reddit "script" OAuth app, puts credentials in environment variables only, and verifies them with a doctor check.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Reddit Setup
|
|
7
|
+
|
|
8
|
+
Before an agent reads or writes on Reddit for someone, three things have to be true: the account belongs to the user, the API access is a proper OAuth app registered to them, and the credentials live where the agent can use them without ever writing them down. This skill gets there and proves it with one command.
|
|
9
|
+
|
|
10
|
+
Announce: "Using reddit-setup to connect your Reddit account via a script OAuth app."
|
|
11
|
+
|
|
12
|
+
**Scope.** One real person, one account, used openly. This skill does not create accounts, rotate between accounts, buy or borrow aged accounts, or set up anything meant to get around a ban, a shadowban, or a subreddit's rules. If the user asks for any of that, decline and say why: it breaks Reddit's User Agreement and API terms, and it gets every account involved banned.
|
|
13
|
+
|
|
14
|
+
**Script location.** The checker is `reddit.mjs` in the sibling skill: `${CLAUDE_SKILL_DIR}/../reddit-engage/scripts/reddit.mjs`. If `CLAUDE_SKILL_DIR` is not set, use the absolute path of this folder's sibling. If only this skill is installed, run `npx @skilldeck/outreach doctor` instead. Below, `$R` is the script path. Node 20+, no dependencies.
|
|
15
|
+
|
|
16
|
+
## The Rule
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
Secrets go in environment variables, never in a file this skill writes.
|
|
20
|
+
Never echo, log, or paste a secret, not even to show that it is set.
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Checklist
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
- [ ] 1. Confirmed the account is the user's own and they accept Reddit's API terms
|
|
27
|
+
- [ ] 2. User created a "script" app at reddit.com/prefs/apps
|
|
28
|
+
- [ ] 3. User exported the five REDDIT_* env vars in their own shell or secret manager
|
|
29
|
+
- [ ] 4. doctor reports "authenticated as u/<name>"
|
|
30
|
+
- [ ] 5. Agreed what happens next: [[reddit-engage]], or read-only browsing
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 1. Confirm the account
|
|
34
|
+
|
|
35
|
+
Ask the user which account to use and confirm it is their own personal or brand account. Point out that Reddit requires a descriptive User-Agent, allows about 100 OAuth requests a minute per client, and expects bots and assisted accounts to follow each subreddit's rules. Accounts with very low karma or a recent creation date are often filtered by AutoModerator. That is a reason to take part normally for a while first, not a problem to work around.
|
|
36
|
+
|
|
37
|
+
## 2. Create the app
|
|
38
|
+
|
|
39
|
+
Walk the user through `references/oauth-app.md`. In short, go to https://www.reddit.com/prefs/apps, choose **create another app**, pick type **script**, set the redirect URI to `http://localhost:8080` (it isn't used), and save. The client id is the short string under the app name. The secret is labelled **secret**.
|
|
40
|
+
|
|
41
|
+
The user does this in their own browser. Do not ask them to paste the secret into the chat.
|
|
42
|
+
|
|
43
|
+
## 3. Set the environment
|
|
44
|
+
|
|
45
|
+
The user adds these to their shell profile, a `.envrc` they keep out of git, or their secret manager:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
export REDDIT_CLIENT_ID=...
|
|
49
|
+
export REDDIT_CLIENT_SECRET=...
|
|
50
|
+
export REDDIT_USERNAME=...
|
|
51
|
+
export REDDIT_PASSWORD=...
|
|
52
|
+
export REDDIT_USER_AGENT="macos:com.example.outreach:0.1.0 (by /u/<username>)"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The User-Agent format `<platform>:<app id>:<version> (by /u/<username>)` is required by Reddit's API rules. Generic agents like `python-requests` or `node` get throttled or blocked. Accounts with two-factor authentication cannot use the password grant. Use an account without 2FA, or wait until Reddit allows it, but never switch 2FA off on the user's behalf.
|
|
56
|
+
|
|
57
|
+
If the repo has a `.gitignore`, make sure `.envrc`, `.env*` and `.outreach/` are in it.
|
|
58
|
+
|
|
59
|
+
## 4. Verify
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
node $R doctor # human-readable
|
|
63
|
+
node $R doctor --json # for scripts
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`doctor` checks which variables are present (names only, never values), requests a token with the password grant from `https://www.reddit.com/api/v1/access_token`, calls `https://oauth.reddit.com/api/v1/me`, and reports the username, granted scope, karma and rate-limit headers. It warns if the User-Agent format is wrong or the token belongs to a different user. Exit codes: `0` authenticated, `1` auth failed (wrong secret, wrong app type, 2FA), `2` variables missing.
|
|
67
|
+
|
|
68
|
+
**Read-only fallback.** With no credentials, `search`, `rules` and `thread` still work through Reddit's public `.json` endpoints, at a lower rate limit. Posting is disabled. This is fine for scouting threads before the user commits to an account.
|
|
69
|
+
|
|
70
|
+
## 5. Hand off
|
|
71
|
+
|
|
72
|
+
Report the result and suggest the next step: [[reddit-engage]], which starts by asking whether replies should be reviewed one at a time or posted automatically within caps.
|
|
73
|
+
|
|
74
|
+
## Output
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
Reddit: authenticated as u/<name> (scope: *, karma <c>/<l>)
|
|
78
|
+
User-Agent: ok | needs "(by /u/<name>)"
|
|
79
|
+
Secrets: in env only; nothing written to disk
|
|
80
|
+
Next: reddit-engage (mode not chosen yet)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Red flags
|
|
84
|
+
|
|
85
|
+
| Thought | Reality |
|
|
86
|
+
|---|---|
|
|
87
|
+
| "I'll save the secret to .outreach/config.json so it persists." | Never. Config holds settings only. Secrets stay in the user's environment. |
|
|
88
|
+
| "Paste your password here and I'll set it up." | The user types secrets into their own shell. They never go in the chat. |
|
|
89
|
+
| "Let's make a second account for the product." | Several accounts pushing one product is ban evasion and vote manipulation in Reddit's eyes. One honest account. |
|
|
90
|
+
| "This account is shadowbanned, so we'll make a new one." | That is ban evasion. Stop, and tell the user to appeal at reddit.com/appeals. |
|
|
91
|
+
| "The default User-Agent is fine." | Reddit's API rules require a descriptive one. Generic ones get blocked. |
|
|
92
|
+
| "doctor failed, so I'll retry in a loop." | A 401 means bad credentials or the wrong app type. Fix the cause, don't hammer the token endpoint. |
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Creating a Reddit "script" OAuth app
|
|
2
|
+
|
|
3
|
+
A *script* app is Reddit's app type for a program that acts only as the developer's own account. It is the right type here: one person, their own account, running on their own machine. It uses the OAuth2 password grant, so no browser redirect is needed.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. Sign in to reddit.com as the account that will post.
|
|
8
|
+
2. Open https://www.reddit.com/prefs/apps and scroll to the bottom.
|
|
9
|
+
3. Click **are you a developer? create an app...** (or **create another app...**).
|
|
10
|
+
4. Fill in:
|
|
11
|
+
- **name**: something descriptive, e.g. `outreach-assistant`
|
|
12
|
+
- **type**: **script**
|
|
13
|
+
- **description**: optional
|
|
14
|
+
- **about url**: optional
|
|
15
|
+
- **redirect uri**: `http://localhost:8080` (required by the form, unused by the password grant)
|
|
16
|
+
5. Click **create app**.
|
|
17
|
+
6. Read off:
|
|
18
|
+
- **client id**: the 14 to 22 character string directly under the app name and "personal use script"
|
|
19
|
+
- **client secret**: the value next to **secret**
|
|
20
|
+
|
|
21
|
+
If Reddit asks you to register for API access or accept the Data API Terms first, do that. Using the API means agreeing to the [Data API Terms](https://www.redditinc.com/policies/data-api-terms) and the [Developer Terms](https://www.redditinc.com/policies/developer-terms). Reddit's policies for API builders also require honesty about automation and forbid spam and manipulation. Read the current version on redditinc.com before you start.
|
|
22
|
+
|
|
23
|
+
## Environment variables
|
|
24
|
+
|
|
25
|
+
| Variable | Value |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `REDDIT_CLIENT_ID` | client id from step 6 |
|
|
28
|
+
| `REDDIT_CLIENT_SECRET` | secret from step 6 |
|
|
29
|
+
| `REDDIT_USERNAME` | the account's username, without `u/` |
|
|
30
|
+
| `REDDIT_PASSWORD` | the account's password |
|
|
31
|
+
| `REDDIT_USER_AGENT` | `<platform>:<app id>:<version> (by /u/<username>)`, e.g. `macos:com.acme.outreach:0.1.0 (by /u/acme_dev)` |
|
|
32
|
+
|
|
33
|
+
Where to keep them, from best to acceptable:
|
|
34
|
+
|
|
35
|
+
1. A secret manager that injects env vars, such as 1Password CLI (`op run`), Doppler or a cloud secret store.
|
|
36
|
+
2. A `direnv` `.envrc` that is listed in `.gitignore`.
|
|
37
|
+
3. Your shell profile (`~/.zshrc`), if the machine is yours alone.
|
|
38
|
+
|
|
39
|
+
Never commit them, and never put them in `.outreach/`. That folder holds settings and the ledger, not secrets.
|
|
40
|
+
|
|
41
|
+
## How the token request works
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
POST https://www.reddit.com/api/v1/access_token
|
|
45
|
+
Authorization: Basic base64(client_id:client_secret)
|
|
46
|
+
User-Agent: <your UA>
|
|
47
|
+
Content-Type: application/x-www-form-urlencoded
|
|
48
|
+
|
|
49
|
+
grant_type=password&username=<user>&password=<pass>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The response contains `access_token`, `expires_in` (about 24h) and `scope`. Later calls go to `https://oauth.reddit.com` with `Authorization: bearer <token>`. `reddit.mjs` keeps the token in memory for one run and never writes it anywhere.
|
|
53
|
+
|
|
54
|
+
## Common failures
|
|
55
|
+
|
|
56
|
+
| Symptom | Cause |
|
|
57
|
+
|---|---|
|
|
58
|
+
| `401` from access_token | wrong client id or secret, or app type isn't *script* |
|
|
59
|
+
| `{"error": "invalid_grant"}` | wrong username or password, or the account has 2FA enabled |
|
|
60
|
+
| `403` or HTML instead of JSON | missing or generic User-Agent, or the IP is blocked |
|
|
61
|
+
| `429` | rate limited. Wait for `x-ratelimit-reset` seconds; don't retry in a loop |
|
|
62
|
+
| `/api/v1/me` returns a different name | the env vars belong to another account. Fix them before going on |
|
|
63
|
+
|
|
64
|
+
## Rate limits
|
|
65
|
+
|
|
66
|
+
OAuth clients get about 100 queries per minute, averaged over a 10-minute window. Every response carries `x-ratelimit-used`, `x-ratelimit-remaining` and `x-ratelimit-reset`. Unauthenticated `.json` reads get far less. Commenting has its own per-account limit ("you are doing that too much"), which is tighter for low-karma accounts. `reddit.mjs` records it and refuses to post until it clears.
|