Skip to content

Commit f72e39b

Browse files
committed
chore: update
1 parent 6e15d11 commit f72e39b

File tree

5 files changed

+234
-8
lines changed

5 files changed

+234
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Setup Node.js
3030
uses: actions/setup-node@v6
3131
with:
32-
node-version: 20.20.0
32+
node-version: 24.13.0
3333
cache: pnpm
3434

3535
- name: Install dependencies

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v24.13.0

.prettierignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ dist
33
doc_build
44
pnpm-lock.yaml
55

6-
skills/**/*.js
7-
skills/**/*.cjs
8-
skills/**/*.mjs
6+
skills/**/scripts/*.js
7+
skills/**/scripts/*.cjs
8+
skills/**/scripts/*.mjs

AGENTS.md

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
---
2+
name: project-overview
3+
description: Introduces the agent-skills project structure, directory explanations, and how to create new Skills and write scripts. Use when users ask about project structure, how to create a new Skill, or how to write Skill scripts.
4+
---
5+
6+
# Agent Skills Project Overview
7+
8+
## Introduction
9+
10+
agent-skills is a collection of Agent Skills for the Rstack ecosystem. Using Vercel's skills toolkit, AI Agents can gain specialized capabilities in specific domains.
11+
12+
## Project Structure
13+
14+
```
15+
agent-skills/
16+
├── skills/ # Skills directory, contains all Skills
17+
├── packages/ # Source code projects for complex scripts
18+
├── scripts/ # Project-level configurations and tools
19+
│ └── config/ # Common configurations (rslib, tsconfig, etc.)
20+
├── biome.json # Biome code formatting configuration
21+
├── pnpm-workspace.yaml # pnpm workspace configuration
22+
├── pnpm-lock.yaml # Dependency lock file
23+
├── package.json # Project configuration file
24+
└── README.md # Project documentation
25+
```
26+
27+
### Directory Explanations
28+
29+
- **skills/**: Contains all Skills, each Skill is an independent folder
30+
- Each Skill includes `SKILL.md` (required), `scripts/` (optional), `references/` (optional), `assets/` (optional)
31+
- **packages/**: Contains source code for complex scripts that need compilation
32+
- Corresponds to Skills with the same name in the skills directory
33+
- Compiled by Rslib and output to the corresponding `skills/{skill-name}/scripts/` directory
34+
- **scripts/config/**: Contains project-level common configurations
35+
- `rslib.config.ts`: Rslib base configuration
36+
- `tsconfig.json`: TypeScript base configuration
37+
38+
## Creating a New Skill
39+
40+
### 1. Initialize Skill Template
41+
42+
Execute in the `skills/` directory:
43+
44+
```bash
45+
cd skills
46+
npx skills init my-skill
47+
```
48+
49+
This will generate a `SKILL.md` file with YAML frontmatter and Markdown content.
50+
51+
### 2. Configure Frontmatter
52+
53+
Configure in the YAML frontmatter at the top of the `SKILL.md` file:
54+
55+
```yaml
56+
---
57+
name: my-skill
58+
description: Feature description and trigger scenarios, which is key for Agents to determine whether to use this Skill
59+
---
60+
```
61+
62+
**Field Descriptions**:
63+
64+
- **name** (required)
65+
- Unique identifier for the Skill
66+
- Maximum 64 characters
67+
- Only lowercase letters, numbers, and hyphens
68+
- Must not start or end with a hyphen
69+
- Example: `rspack-tracing`
70+
71+
- **description** (required)
72+
- Feature description and trigger scenarios
73+
- Maximum 1024 characters
74+
- Recommended to include trigger keywords, such as "when user encounters segmentation fault in Rspack"
75+
76+
### 3. Write Skill Content
77+
78+
Standard Skill structure:
79+
80+
```
81+
my-skill/
82+
├── SKILL.md # Required: instructions + metadata
83+
├── scripts/ # Optional: executable scripts
84+
├── references/ # Optional: reference documentation
85+
└── assets/ # Optional: templates, resource files
86+
```
87+
88+
Write in `SKILL.md`:
89+
90+
- **Use Cases**: Explain when to use this Skill
91+
- **Workflow**: Detailed operation steps
92+
- **Code Examples**: Provide code examples
93+
- **Reference Documentation**: Link to detailed documentation in the `references/` directory
94+
95+
## Writing Skill Scripts
96+
97+
### Simple Scripts
98+
99+
For simple scripts (such as single-file scripts), create them directly in the `skills/{skill-name}/scripts/` directory.
100+
101+
Example:
102+
103+
```javascript
104+
// skills/my-skill/scripts/simple.js
105+
console.log('Hello from simple script');
106+
```
107+
108+
### Complex Scripts (Requiring Bundling)
109+
110+
For complex scenarios requiring dependencies, TypeScript, etc.:
111+
112+
#### 1. Create a Project with the Same Name in packages Directory
113+
114+
```
115+
packages/my-skill/
116+
├── package.json
117+
├── rslib.config.ts
118+
├── tsconfig.json
119+
└── src/
120+
└── index.ts
121+
```
122+
123+
#### 2. Configure package.json
124+
125+
```json
126+
{
127+
"name": "@rstackjs/my-skill",
128+
"version": "0.0.1",
129+
"type": "module",
130+
"scripts": {
131+
"build": "rslib build",
132+
"test": "rstest"
133+
},
134+
"dependencies": {
135+
// Your dependencies
136+
}
137+
}
138+
```
139+
140+
#### 3. Configure rslib.config.ts
141+
142+
```typescript
143+
import { basename, join } from 'node:path';
144+
import { defineConfig } from '@rslib/core';
145+
import { baseConfig } from '@rstackjs/config/rslib.config.ts';
146+
147+
const pkgName = basename(import.meta.dirname);
148+
149+
export default defineConfig({
150+
lib: [
151+
{
152+
...baseConfig,
153+
output: {
154+
distPath: join(import.meta.dirname, `../../skills/${pkgName}/scripts`),
155+
},
156+
},
157+
],
158+
});
159+
```
160+
161+
#### 4. Configure tsconfig.json
162+
163+
```json
164+
{
165+
"extends": "@rstackjs/config/tsconfig",
166+
"compilerOptions": {},
167+
"include": ["src"]
168+
}
169+
```
170+
171+
#### 5. Write Source Code
172+
173+
Write code in `src/index.ts`:
174+
175+
```typescript
176+
export function myFunction() {
177+
// Your logic
178+
}
179+
```
180+
181+
#### 6. Build Script
182+
183+
```bash
184+
cd packages/my-skill
185+
pnpm build
186+
```
187+
188+
After building, the bundled files will be automatically output to the `skills/my-skill/scripts/` directory.
189+
190+
### Testing Scripts
191+
192+
Write tests using Rstest:
193+
194+
```typescript
195+
// packages/my-skill/src/index.test.ts
196+
import { describe, it, expect } from '@rstest/core';
197+
import { myFunction } from './index';
198+
199+
describe('myFunction', () => {
200+
it('should work correctly', () => {
201+
expect(myFunction()).toBe(expected);
202+
});
203+
});
204+
```
205+
206+
Run tests:
207+
208+
```bash
209+
pnpm test
210+
```
211+
212+
## Using Skills
213+
214+
Install a specific Skill:
215+
216+
```bash
217+
npx skills add rstackjs/agent-skills --skill my-skill
218+
```
219+
220+
## References
221+
222+
- [Agent Skills Specification](https://agentskills.io/specification)
223+
- [Skill Authoring Best Practices](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices)
224+
- [Rspack Documentation](https://rspack.rs)
225+
- [Rslib Documentation](https://rslib.rs)
226+
- [Rstest Documentation](https://rslib.rs)

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
"private": true,
44
"scripts": {
55
"build": "pnpm --parallel --filter ./packages/** build",
6-
"format": "prettier --experimental-cli --write .",
6+
"format": "prettier --write .",
77
"lint": "biome check",
88
"prepare": "simple-git-hooks && pnpm build"
99
},
1010
"simple-git-hooks": {
1111
"pre-commit": "pnpm exec nano-staged"
1212
},
1313
"nano-staged": {
14-
"*.{md,mdx,json,css,less,scss}": "prettier --experimental-cli --write",
14+
"*.{md,mdx,json,css,less,scss}": "prettier --write",
1515
"*.{js,jsx,ts,tsx,mjs,cjs}": [
1616
"biome check --write --no-errors-on-unmatched",
17-
"prettier --experimental-cli --write"
17+
"prettier --write"
1818
]
1919
},
2020
"devDependencies": {
@@ -29,7 +29,6 @@
2929
},
3030
"packageManager": "pnpm@10.28.2",
3131
"engines": {
32-
"node": ">=22.18.0",
3332
"pnpm": ">=10.28.2"
3433
}
3534
}

0 commit comments

Comments
 (0)