@arcjet/skills 1.12.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 +201 -0
- package/README.md +153 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +62 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.js +5 -0
- package/docs/choose-protections.md +70 -0
- package/docs/cli.md +65 -0
- package/docs/guard.md +142 -0
- package/docs/mcp.md +74 -0
- package/docs/protect.md +186 -0
- package/package.json +67 -0
- package/skills/choose-protections/SKILL.md +44 -0
- package/skills/cli/SKILL.md +44 -0
- package/skills/guard/SKILL.md +85 -0
- package/skills/mcp/SKILL.md +44 -0
- package/skills/protect/SKILL.md +121 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<!-- trunk-ignore-all(markdownlint/MD024) -->
|
|
2
|
+
<!-- trunk-ignore-all(markdownlint/MD001) -->
|
|
3
|
+
|
|
4
|
+
<a href="https://arcjet.com" target="_arcjet-home">
|
|
5
|
+
<picture>
|
|
6
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://arcjet.com/logo/arcjet-dark-lockup-voyage-horizontal.svg">
|
|
7
|
+
<img src="https://arcjet.com/logo/arcjet-light-lockup-voyage-horizontal.svg" alt="Arcjet Logo" height="128" width="auto">
|
|
8
|
+
</picture>
|
|
9
|
+
</a>
|
|
10
|
+
|
|
11
|
+
# `@arcjet/skills`
|
|
12
|
+
|
|
13
|
+
<p>
|
|
14
|
+
<a href="https://www.npmjs.com/package/@arcjet/skills">
|
|
15
|
+
<picture>
|
|
16
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/%40arcjet%2Fskills?style=flat-square&label=%E2%9C%A6Aj&labelColor=000000&color=5C5866">
|
|
17
|
+
<img alt="npm badge" src="https://img.shields.io/npm/v/%40arcjet%2Fskills?style=flat-square&label=%E2%9C%A6Aj&labelColor=ECE6F0&color=ECE6F0">
|
|
18
|
+
</picture>
|
|
19
|
+
</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
Versioned [Agent Skills](https://agentskills.io) for the Arcjet JavaScript SDK,
|
|
23
|
+
shipped with [TanStack Intent](https://tanstack.com/intent).
|
|
24
|
+
|
|
25
|
+
- [npm package (`@arcjet/skills`)](https://www.npmjs.com/package/@arcjet/skills)
|
|
26
|
+
- [GitHub source code (`arcjet-skills/` in `arcjet/arcjet-js`)](https://github.com/arcjet/arcjet-js/tree/main/arcjet-skills)
|
|
27
|
+
|
|
28
|
+
Skills travel with the installed package version. They are not a copy-pasted
|
|
29
|
+
rules file and they are not the model's training cutoff.
|
|
30
|
+
|
|
31
|
+
The standalone marketplace install (`npx skills add arcjet/skills`) still
|
|
32
|
+
works from [`arcjet/skills`](https://github.com/arcjet/skills). Prefer this
|
|
33
|
+
package when you want skills that match the SDK version in `node_modules`.
|
|
34
|
+
|
|
35
|
+
## What is this?
|
|
36
|
+
|
|
37
|
+
A TypeScript package that publishes:
|
|
38
|
+
|
|
39
|
+
- `skills/*/SKILL.md` — agent guidance, one skill per task
|
|
40
|
+
- `docs/*.md` — the source documentation those skills were derived from
|
|
41
|
+
- a small typed manifest (`skills`, `skillIdentity`) for the shipped leaf names
|
|
42
|
+
|
|
43
|
+
TanStack Intent discovers the `SKILL.md` files as static files. It does not
|
|
44
|
+
import or execute this package (or any other package) to find them.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
This package is ESM only.
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npm install @arcjet/skills
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Framework adapters that depend on `arcjet` also install this package
|
|
55
|
+
transitively, so a typical `@arcjet/next` app already has the files on disk.
|
|
56
|
+
|
|
57
|
+
Guard integration skills ship in [`@arcjet/guard`](../arcjet-guard/README.md)
|
|
58
|
+
next to that package's README. Allow both packages if you use Guard.
|
|
59
|
+
|
|
60
|
+
## Use with TanStack Intent
|
|
61
|
+
|
|
62
|
+
Intent scans installed dependencies for `skills/**/SKILL.md`. Discovery is
|
|
63
|
+
not trust. Put an explicit allowlist in the **application** `package.json`:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"intent": {
|
|
68
|
+
"skills": ["@arcjet/skills", "@arcjet/guard"],
|
|
69
|
+
"exclude": []
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`intent.skills` permits packages, not individual skills. Use `intent.exclude`
|
|
75
|
+
to drop a package or one skill (`@arcjet/guard#integrate-arcjet-guard-eve`).
|
|
76
|
+
|
|
77
|
+
An omitted `intent.skills` key currently surfaces every discovered package
|
|
78
|
+
and prints a deprecation notice. Do not use `"skills": ["*"]` unless you
|
|
79
|
+
accept unvetted skills from the whole tree.
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
npx @tanstack/intent@latest install
|
|
83
|
+
npx @tanstack/intent@latest list
|
|
84
|
+
npx @tanstack/intent@latest load @arcjet/skills#protect
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`install` writes loading guidance to `AGENTS.md` (or an existing agent
|
|
88
|
+
config). `list` shows what the allowlist permits. `load` prints one
|
|
89
|
+
`SKILL.md` — load only the skill the current task needs.
|
|
90
|
+
|
|
91
|
+
| Task | Load |
|
|
92
|
+
| --- | --- |
|
|
93
|
+
| HTTP routes, APIs, middleware | `@arcjet/skills#protect` |
|
|
94
|
+
| Which rules to apply | `@arcjet/skills#choose-protections` |
|
|
95
|
+
| Sign in and write `ARCJET_KEY` | `@arcjet/skills#cli` |
|
|
96
|
+
| MCP server setup | `@arcjet/skills#mcp` |
|
|
97
|
+
| Tool calls, MCP handlers, jobs | `@arcjet/skills#guard` |
|
|
98
|
+
| A specific Guard vendor SDK | `@arcjet/guard#integrate-arcjet-guard-*` |
|
|
99
|
+
|
|
100
|
+
### Trust model
|
|
101
|
+
|
|
102
|
+
- Intent reads package metadata and skill files. It does not execute package
|
|
103
|
+
code to discover or load a skill.
|
|
104
|
+
- The allowlist and exclusions are the trust decision.
|
|
105
|
+
- `intent load` returning content means the file resolved under current
|
|
106
|
+
policy. It does not mean the skill was relevant or that the model followed
|
|
107
|
+
it.
|
|
108
|
+
- `npx @tanstack/intent@latest hooks install` can add session catalogs and
|
|
109
|
+
edit gates for some agents. Treat those hooks as convenience, not a
|
|
110
|
+
security boundary. They can observe a load command; they cannot prove the
|
|
111
|
+
agent used the guidance.
|
|
112
|
+
|
|
113
|
+
## Typed manifest
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import {
|
|
117
|
+
PACKAGE_NAME,
|
|
118
|
+
VERSION,
|
|
119
|
+
getSkill,
|
|
120
|
+
skillIdentity,
|
|
121
|
+
skills,
|
|
122
|
+
} from "@arcjet/skills";
|
|
123
|
+
|
|
124
|
+
skillIdentity("protect"); // "@arcjet/skills#protect"
|
|
125
|
+
getSkill("cli")?.file; // "skills/cli/SKILL.md"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
This list is for this package only. It does not scan other dependencies.
|
|
129
|
+
|
|
130
|
+
## Maintainers
|
|
131
|
+
|
|
132
|
+
Skill files live beside the docs they were derived from (`docs/` in this
|
|
133
|
+
package; `README.md` for `@arcjet/guard` skills). Each `SKILL.md` declares
|
|
134
|
+
those paths in `sources`.
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
npx @tanstack/intent@latest validate
|
|
138
|
+
npx @tanstack/intent@latest stale --json
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`validate` is required in CI. `stale` is conservative: a changed source is a
|
|
142
|
+
review signal, not proof the skill is wrong. CI fails a pull request when a
|
|
143
|
+
declared source changes and the matching `SKILL.md` does not.
|
|
144
|
+
|
|
145
|
+
The `tanstack-intent` keyword and the `skills/` `files` entry put the skills
|
|
146
|
+
in the npm tarball so the registry can index them.
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
[Apache License, Version 2.0][apache-license] © [Arcjet Labs, Inc.][arcjet]
|
|
151
|
+
|
|
152
|
+
[apache-license]: http://www.apache.org/licenses/LICENSE-2.0
|
|
153
|
+
[arcjet]: https://arcjet.com
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { VERSION } from "./version.js";
|
|
2
|
+
//#region src/index.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* npm package name that TanStack Intent discovers as a skill source.
|
|
5
|
+
*/
|
|
6
|
+
declare const PACKAGE_NAME: "@arcjet/skills";
|
|
7
|
+
/**
|
|
8
|
+
* Leaf skill names shipped in this package. Each matches
|
|
9
|
+
* `skills/<name>/SKILL.md`.
|
|
10
|
+
*/
|
|
11
|
+
type SkillName = "choose-protections" | "cli" | "guard" | "mcp" | "protect";
|
|
12
|
+
/**
|
|
13
|
+
* Static manifest for one shipped skill. Intent reads the `SKILL.md` files
|
|
14
|
+
* themselves; this export is for TypeScript consumers who want identities
|
|
15
|
+
* without scanning `node_modules`.
|
|
16
|
+
*/
|
|
17
|
+
interface SkillManifest {
|
|
18
|
+
readonly name: SkillName;
|
|
19
|
+
/**
|
|
20
|
+
* When to load this skill. Kept in sync with the `SKILL.md` description.
|
|
21
|
+
*/
|
|
22
|
+
readonly description: string;
|
|
23
|
+
/**
|
|
24
|
+
* Path to `SKILL.md` relative to the published package root.
|
|
25
|
+
*/
|
|
26
|
+
readonly file: string;
|
|
27
|
+
/**
|
|
28
|
+
* Documentation this skill was derived from, relative to the package root.
|
|
29
|
+
* Conservative stale checks flag these files when they change.
|
|
30
|
+
*/
|
|
31
|
+
readonly sources: readonly string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Skills shipped in this package version. Load only the entry that matches
|
|
35
|
+
* the current task (`@arcjet/skills#<name>`).
|
|
36
|
+
*/
|
|
37
|
+
declare const skills: readonly SkillManifest[];
|
|
38
|
+
/**
|
|
39
|
+
* Format a TanStack Intent load identity (`@arcjet/skills#protect`).
|
|
40
|
+
*/
|
|
41
|
+
declare function skillIdentity(name: SkillName): string;
|
|
42
|
+
/**
|
|
43
|
+
* Look up one shipped skill by leaf name.
|
|
44
|
+
*/
|
|
45
|
+
declare function getSkill(name: SkillName): SkillManifest | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Package version these skills were published with.
|
|
48
|
+
*/
|
|
49
|
+
declare function skillLibraryVersion(): string;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { PACKAGE_NAME, SkillManifest, SkillName, VERSION, getSkill, skillIdentity, skillLibraryVersion, skills };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { VERSION } from "./version.js";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* npm package name that TanStack Intent discovers as a skill source.
|
|
5
|
+
*/
|
|
6
|
+
const PACKAGE_NAME = "@arcjet/skills";
|
|
7
|
+
/**
|
|
8
|
+
* Skills shipped in this package version. Load only the entry that matches
|
|
9
|
+
* the current task (`@arcjet/skills#<name>`).
|
|
10
|
+
*/
|
|
11
|
+
const skills = [
|
|
12
|
+
{
|
|
13
|
+
name: "protect",
|
|
14
|
+
description: "Add Arcjet request protection to JavaScript and TypeScript HTTP handlers. Use when protecting Next.js, Express, Fastify, SvelteKit, Remix, Astro, Nuxt, Bun, Deno, NestJS, or Node.js routes with rate limiting, bot detection, Shield, email validation, or sensitive info detection.",
|
|
15
|
+
file: "skills/protect/SKILL.md",
|
|
16
|
+
sources: ["docs/protect.md"]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "choose-protections",
|
|
20
|
+
description: "Choose which Arcjet rules address a security problem. Use when deciding between detectBot, shield, rate limits, detectPromptInjection, sensitiveInfo, validateEmail, filter, or Guard-only content moderation.",
|
|
21
|
+
file: "skills/choose-protections/SKILL.md",
|
|
22
|
+
sources: ["docs/choose-protections.md"]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "cli",
|
|
26
|
+
description: "Connect a project to Arcjet with the CLI: sign in, pick a team and site, and write ARCJET_KEY. Use when bootstrapping Arcjet, listing requests or guards, or managing remote rules from a terminal.",
|
|
27
|
+
file: "skills/cli/SKILL.md",
|
|
28
|
+
sources: ["docs/cli.md"]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "mcp",
|
|
32
|
+
description: "Connect an AI coding client to the Arcjet MCP server at https://api.arcjet.com/mcp. Use when the client has built-in MCP support or the CLI is not available.",
|
|
33
|
+
file: "skills/mcp/SKILL.md",
|
|
34
|
+
sources: ["docs/mcp.md"]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "guard",
|
|
38
|
+
description: "Add Arcjet Guard to non-HTTP JavaScript: agent tool calls, MCP handlers, queue workers, and background jobs. Use when there is no HTTP request object, or when the user asks to guard tools, rate-limit agent actions, or block prompt injection on tool arguments.",
|
|
39
|
+
file: "skills/guard/SKILL.md",
|
|
40
|
+
sources: ["docs/guard.md"]
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
/**
|
|
44
|
+
* Format a TanStack Intent load identity (`@arcjet/skills#protect`).
|
|
45
|
+
*/
|
|
46
|
+
function skillIdentity(name) {
|
|
47
|
+
return `${PACKAGE_NAME}#${name}`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Look up one shipped skill by leaf name.
|
|
51
|
+
*/
|
|
52
|
+
function getSkill(name) {
|
|
53
|
+
return skills.find((skill) => skill.name === name);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Package version these skills were published with.
|
|
57
|
+
*/
|
|
58
|
+
function skillLibraryVersion() {
|
|
59
|
+
return VERSION;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { PACKAGE_NAME, VERSION, getSkill, skillIdentity, skillLibraryVersion, skills };
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Choose Arcjet protections
|
|
2
|
+
|
|
3
|
+
Map a product problem to Arcjet rules. JavaScript and TypeScript SDK names.
|
|
4
|
+
|
|
5
|
+
## Automated traffic and bot abuse
|
|
6
|
+
|
|
7
|
+
**Rule:** `detectBot` (request-based only). Pass exactly one of `allow` or
|
|
8
|
+
`deny`. `allow` is a safelist. `deny` blocks listed categories. Empty
|
|
9
|
+
`allow: []` blocks every detected bot. Combine with rate limiting.
|
|
10
|
+
|
|
11
|
+
Bot rules can also be configured as remote rules via the CLI or MCP server.
|
|
12
|
+
|
|
13
|
+
## Cost explosion and budget control
|
|
14
|
+
|
|
15
|
+
**Rules:** `tokenBucket`, `fixedWindow`, `slidingWindow` (request-based and
|
|
16
|
+
Guard).
|
|
17
|
+
|
|
18
|
+
Token bucket fits variable-cost AI work — set `requested` per call. Fixed
|
|
19
|
+
window is a hard cap at period boundaries. Sliding window avoids boundary
|
|
20
|
+
bursts.
|
|
21
|
+
|
|
22
|
+
Request-based rate limits default to the client IP. Use
|
|
23
|
+
`characteristics: ["userId"]` to key by something else. Guard rate limits
|
|
24
|
+
always need an explicit `key` and `bucket`.
|
|
25
|
+
|
|
26
|
+
## Prompt injection
|
|
27
|
+
|
|
28
|
+
**Rule:** `detectPromptInjection` (request-based and Guard). Use on untrusted
|
|
29
|
+
text before it reaches a model or tool argument, and on tool results that
|
|
30
|
+
fetch untrusted content. The rule is a binary detect — there is no
|
|
31
|
+
`threshold` or `score`.
|
|
32
|
+
|
|
33
|
+
## Unsafe content
|
|
34
|
+
|
|
35
|
+
**Rule:** Guard `moderateContent` only (not available on `protect()`). The
|
|
36
|
+
result is `{ detected, billing? }` (`text_units` when present). Check
|
|
37
|
+
`hasFailedOpen()` when evaluation is incomplete.
|
|
38
|
+
|
|
39
|
+
## Data loss prevention
|
|
40
|
+
|
|
41
|
+
Detection runs locally. The default WebAssembly backend finds exactly four
|
|
42
|
+
structured types: card numbers, email addresses, phone numbers, and IP
|
|
43
|
+
addresses. Names, addresses, and government or financial identifiers need
|
|
44
|
+
`@arcjet/sensitive-info-rampart` (`rampart()`), which needs a server runtime
|
|
45
|
+
with filesystem access. Listing a Rampart-only entity without that backend
|
|
46
|
+
never matches.
|
|
47
|
+
|
|
48
|
+
**Rules:** `sensitiveInfo` (request-based) and `localDetectSensitiveInfo`
|
|
49
|
+
(Guard).
|
|
50
|
+
|
|
51
|
+
## Unauthorized tool invocation
|
|
52
|
+
|
|
53
|
+
Guard protection with per-tool rate limits and labels. `capture()` records
|
|
54
|
+
that an action happened; it is not a protection rule.
|
|
55
|
+
|
|
56
|
+
## Common web attacks
|
|
57
|
+
|
|
58
|
+
**Rule:** `shield` (request-based only). Include it on the shared client as a
|
|
59
|
+
base rule. Omitted `mode` is dry run — pass `LIVE` to enforce.
|
|
60
|
+
|
|
61
|
+
## Signup abuse
|
|
62
|
+
|
|
63
|
+
**Rules:** `validateEmail` plus `protectSignup` (request-based only).
|
|
64
|
+
`protectSignup` is one composite rule: bot detection, email validation, and
|
|
65
|
+
rate limiting.
|
|
66
|
+
|
|
67
|
+
## IP-based filtering
|
|
68
|
+
|
|
69
|
+
**Rule:** `filter` (request-based only). Can also be a remote rule via CLI or
|
|
70
|
+
MCP.
|
package/docs/cli.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Arcjet CLI
|
|
2
|
+
|
|
3
|
+
The CLI is the preferred way to connect to the Arcjet platform from a terminal.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx -y @arcjet/cli@latest <command>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For frequent use:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g @arcjet/cli
|
|
15
|
+
# or
|
|
16
|
+
brew install arcjet/tap/arcjet
|
|
17
|
+
# or (macOS Apple Silicon/Intel, Linux x86_64/arm64)
|
|
18
|
+
curl -sSfL https://arcjet.com/cli/install.sh | bash
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or download a release from https://github.com/arcjet/cli/releases.
|
|
22
|
+
|
|
23
|
+
Verify: `arcjet version`
|
|
24
|
+
|
|
25
|
+
## Authentication
|
|
26
|
+
|
|
27
|
+
Most users will not have `ARCJET_TOKEN` set. Use the browser device flow:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx -y @arcjet/cli@latest auth status
|
|
31
|
+
npx -y @arcjet/cli@latest auth login
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The CLI prints a one-time code and opens a URL. Do not prompt the user for a
|
|
35
|
+
token. Check `auth status` before continuing.
|
|
36
|
+
|
|
37
|
+
## Agent flags
|
|
38
|
+
|
|
39
|
+
- `--output json` — machine-readable JSON
|
|
40
|
+
- `--fields a,b,c` — limit output to listed top-level keys
|
|
41
|
+
|
|
42
|
+
## Bootstrap a project
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx -y @arcjet/cli@latest teams list --output json --fields id,name
|
|
46
|
+
npx -y @arcjet/cli@latest sites list --team-id <team_id> --output json --fields id,name
|
|
47
|
+
# if needed:
|
|
48
|
+
npx -y @arcjet/cli@latest sites create --team-id <team_id> --name "<project>"
|
|
49
|
+
npx -y @arcjet/cli@latest sites get-key --site-id <site_id> --output json --fields key
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Write the `key` value to the project's env file as `ARCJET_KEY=ajkey_...`.
|
|
53
|
+
Match existing env-file conventions. Never hardcode the key in source.
|
|
54
|
+
|
|
55
|
+
## Investigate
|
|
56
|
+
|
|
57
|
+
- Requests: `requests list` → `requests details` → `requests explain`
|
|
58
|
+
- Guards: `guards list` → `guards explain`
|
|
59
|
+
- Briefing: `briefing --site-id <id>`
|
|
60
|
+
- Remote rules: `rules list` → `rules create` (DRY_RUN) → `analyze dry-run-impact` → `rules promote`
|
|
61
|
+
|
|
62
|
+
Mutating commands require `--confirm`. Confirm with the user before
|
|
63
|
+
write or delete operations.
|
|
64
|
+
|
|
65
|
+
Site IDs use `site_` TypeID format. Team IDs use `team_`.
|