small-skill 0.0.1 → 0.0.3
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/README.md +9 -4
- package/SKILL.md +40 -0
- package/package.json +1 -1
- package/references/jobs.md +62 -50
package/README.md
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
# small-skill
|
|
2
2
|
|
|
3
|
-
The agent skill for [small-deploy](https://github.com/
|
|
3
|
+
The agent skill for [small-deploy](https://github.com/yudhisteer/small-deploy):
|
|
4
4
|
teaches Claude Code / Codex to deploy the Python tool it just built behind a
|
|
5
5
|
work-email login in one command — and, when the tool needs AWS, to create and
|
|
6
6
|
maintain the IAM role itself with least privilege.
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
|
+
Two packages: the [small-deploy](https://www.npmjs.com/package/small-deploy)
|
|
11
|
+
CLI does the deploying; this skill teaches your agent to drive it.
|
|
12
|
+
|
|
10
13
|
```
|
|
11
|
-
|
|
12
|
-
npx small-skill
|
|
14
|
+
npm i -g small-deploy # the CLI (the agent runs `small ...` through it)
|
|
15
|
+
npx small-skill # the skill, into this project's .claude/skills/small
|
|
16
|
+
npx small-skill --global # or into ~/.claude/skills/small for every project
|
|
13
17
|
```
|
|
14
18
|
|
|
15
|
-
Or, with the CLI already installed: `small skill
|
|
19
|
+
Or, with the CLI already installed: `small skill` installs the skill copy it
|
|
20
|
+
ships with.
|
|
16
21
|
|
|
17
22
|
## What the agent learns
|
|
18
23
|
|
package/SKILL.md
CHANGED
|
@@ -51,6 +51,11 @@ debugging around it.
|
|
|
51
51
|
Dockerfile, do not suggest hosting options, do not add auth — small already
|
|
52
52
|
put the app behind a work-email login.
|
|
53
53
|
|
|
54
|
+
7. Write AGENT.md (created empty by `small init`, uploaded with every deploy):
|
|
55
|
+
things the dashboard's Ask agent should know that the code doesn't say —
|
|
56
|
+
what the app is for, gotchas, who to contact. Two paragraphs, plain
|
|
57
|
+
English. You built the tool, so you write it.
|
|
58
|
+
|
|
54
59
|
To give someone access when visibility is private, or edit rights:
|
|
55
60
|
|
|
56
61
|
```
|
|
@@ -58,6 +63,41 @@ small share alice@company.com # view
|
|
|
58
63
|
small share bob@company.com --edit # can redeploy
|
|
59
64
|
```
|
|
60
65
|
|
|
66
|
+
## The code already exists (a script that works locally or on Lambda)
|
|
67
|
+
|
|
68
|
+
Do not rewrite it and do not require it to know about small. Keep the working
|
|
69
|
+
file untouched and add a thin adapter as the entry:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
# job.py — adapter. Each [inputs] field in small.toml arrives as an env var:
|
|
73
|
+
# source -> SMALL_INPUT_SOURCE. Files written to $SMALL_OUTPUTS become run outputs.
|
|
74
|
+
import os
|
|
75
|
+
from mytool import main # the user's file, unchanged
|
|
76
|
+
|
|
77
|
+
result = main(
|
|
78
|
+
source=os.environ["SMALL_INPUT_SOURCE"],
|
|
79
|
+
limit=int(os.environ.get("SMALL_INPUT_LIMIT", "10")),
|
|
80
|
+
)
|
|
81
|
+
result.save(os.path.join(os.environ["SMALL_OUTPUTS"], "result.csv"))
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For a Lambda handler, the adapter builds the `event` dict from the
|
|
85
|
+
`SMALL_INPUT_*` vars and calls `handler(event, None)`.
|
|
86
|
+
|
|
87
|
+
The entry file name is free — `entry` in `small.toml` points at whatever you
|
|
88
|
+
wrote (adapter or the original file if the user is fine editing it). Leave the
|
|
89
|
+
two contract comments in the adapter: they are how the next human learns the
|
|
90
|
+
wiring without reading platform source.
|
|
91
|
+
|
|
92
|
+
## The run contract, in one breath
|
|
93
|
+
|
|
94
|
+
`[inputs]` in `small.toml` defines the fields once. Every trigger — the
|
|
95
|
+
dashboard Run form, `small run`, `/small run` in Slack, the chat agent's Run
|
|
96
|
+
button, a cron schedule, Run again — delivers the values the same way:
|
|
97
|
+
`SMALL_INPUT_<NAME>` env vars (files land under `$SMALL_INPUTS`). Every file
|
|
98
|
+
the script writes to `$SMALL_OUTPUTS` becomes a run output on the dashboard,
|
|
99
|
+
regardless of trigger. The script never knows who started it.
|
|
100
|
+
|
|
61
101
|
If `small` is not installed: `npm i -g small-deploy`. If not logged in the
|
|
62
102
|
deploy fails with "run small login" — have the user run `small login`
|
|
63
103
|
interactively (it emails them a 6-digit code).
|
package/package.json
CHANGED
package/references/jobs.md
CHANGED
|
@@ -1,50 +1,62 @@
|
|
|
1
|
-
# Jobs — inputs and outputs
|
|
2
|
-
|
|
3
|
-
Read this when the tool is a script that runs on demand (`kind = "job"`).
|
|
4
|
-
|
|
5
|
-
Every non-secret `os.environ` read in a job is an input — declare it in
|
|
6
|
-
`small.toml` instead of leaving it an undeclared env var:
|
|
7
|
-
|
|
8
|
-
```toml
|
|
9
|
-
[inputs]
|
|
10
|
-
image = { type = "file", required = true, accept = ".jpg,.png", help = "Photo to analyse" }
|
|
11
|
-
threshold = { type = "number", default = 0.5, min = 0, max = 1 }
|
|
12
|
-
|
|
13
|
-
[outputs]
|
|
14
|
-
annotated = { path = "annotated.jpg", label = "Annotated image" }
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Six types: `file`, `number`, `select`, `date`, `text`, `bool`. Callers pass
|
|
18
|
-
them as flags — `small run app --image ./photo.jpg --threshold 0.7` — and the
|
|
19
|
-
dashboard renders a Run form from the same declaration.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
`
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
# Jobs — inputs and outputs
|
|
2
|
+
|
|
3
|
+
Read this when the tool is a script that runs on demand (`kind = "job"`).
|
|
4
|
+
|
|
5
|
+
Every non-secret `os.environ` read in a job is an input — declare it in
|
|
6
|
+
`small.toml` instead of leaving it an undeclared env var:
|
|
7
|
+
|
|
8
|
+
```toml
|
|
9
|
+
[inputs]
|
|
10
|
+
image = { type = "file", required = true, accept = ".jpg,.png", help = "Photo to analyse" }
|
|
11
|
+
threshold = { type = "number", default = 0.5, min = 0, max = 1 }
|
|
12
|
+
|
|
13
|
+
[outputs]
|
|
14
|
+
annotated = { path = "annotated.jpg", label = "Annotated image" }
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Six types: `file`, `number`, `select`, `date`, `text`, `bool`. Callers pass
|
|
18
|
+
them as flags — `small run app --image ./photo.jpg --threshold 0.7` — and the
|
|
19
|
+
dashboard renders a Run form from the same declaration. Slack (`/small run`),
|
|
20
|
+
the chat agent's Run proposals, cron, and Run again all feed the same
|
|
21
|
+
declaration too: the script receives identical env vars no matter who or what
|
|
22
|
+
started the run. In the script:
|
|
23
|
+
|
|
24
|
+
- scalars arrive as `SMALL_INPUT_<NAME>` env vars (uppercase; bools are the
|
|
25
|
+
strings `true`/`false`)
|
|
26
|
+
- file paths come from `$SMALL_INPUTS/inputs.json` (each file value is the
|
|
27
|
+
path it was fetched to)
|
|
28
|
+
|
|
29
|
+
Anything the script saves for the user goes in `$SMALL_OUTPUTS` — every file
|
|
30
|
+
written there is captured on the run, shown in the dashboard, and fetched with
|
|
31
|
+
`small run app --download ./out`. Do not print results to stdout when a file
|
|
32
|
+
would serve better, and do not write user-facing files anywhere else in the
|
|
33
|
+
container: only `$SMALL_OUTPUTS` survives the machine.
|
|
34
|
+
|
|
35
|
+
## Schedules
|
|
36
|
+
|
|
37
|
+
A job that should run itself carries a standard 5-field cron expression, UTC:
|
|
38
|
+
|
|
39
|
+
```toml
|
|
40
|
+
kind = "job"
|
|
41
|
+
schedule = "0 9 * * 1-5"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Deploy validates it (bad or never-firing expressions stop with a one-line
|
|
45
|
+
fix) and prints the next run. `small schedule pause app` /
|
|
46
|
+
`small schedule resume app` flip it without losing the expression; `small
|
|
47
|
+
runs` shows cron runs with a `⏱ cron` marker. Scheduled runs pass **no
|
|
48
|
+
inputs at all** (not even defaults — those are applied by the CLI): a
|
|
49
|
+
scheduled job's script must fall back in code,
|
|
50
|
+
`os.environ.get("SMALL_INPUT_THRESHOLD", "0.5")`, or not be scheduled.
|
|
51
|
+
|
|
52
|
+
S3 in/out: declare the URI and destination bucket as `text` inputs and use
|
|
53
|
+
boto3 in the script — see references/aws-role.md for the role.
|
|
54
|
+
|
|
55
|
+
## Existing scripts
|
|
56
|
+
|
|
57
|
+
When the working code predates small (local script, Lambda handler), keep it
|
|
58
|
+
untouched and write a thin adapter as the entry — SKILL.md, "The code already
|
|
59
|
+
exists". The adapter is the only file that reads `SMALL_INPUT_*` or writes to
|
|
60
|
+
`$SMALL_OUTPUTS`; the original stays runnable everywhere it already runs.
|
|
61
|
+
Always leave the two contract comments in the adapter so the next reader
|
|
62
|
+
learns the env-var mapping from the code itself.
|