Skip to content

Commit 42112f4

Browse files
committed
feat: add rstest-cdp skill
1 parent 765901a commit 42112f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3927
-65
lines changed

.gitignore

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# macOS
10+
.DS_Store
11+
**/.DS_Store
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
node_modules/
46+
jspm_packages/
47+
48+
# Snowpack dependency directory (https://snowpack.dev/)
49+
web_modules/
50+
51+
# TypeScript cache
52+
*.tsbuildinfo
53+
54+
# Optional npm cache directory
55+
.npm
56+
57+
# Optional eslint cache
58+
.eslintcache
59+
60+
# Optional stylelint cache
61+
.stylelintcache
62+
63+
# Optional REPL history
64+
.node_repl_history
65+
66+
# Output of 'npm pack'
67+
*.tgz
68+
69+
# Yarn Integrity file
70+
.yarn-integrity
71+
72+
# dotenv environment variable files
73+
.env
74+
.env.*
75+
!.env.example
76+
77+
# parcel-bundler cache (https://parceljs.org/)
78+
.cache
79+
.parcel-cache
80+
81+
# Next.js build output
82+
.next
83+
out
84+
85+
# Nuxt.js build / generate output
86+
.nuxt
87+
dist
88+
89+
# Gatsby files
90+
.cache/
91+
# Comment in the public line in if your project uses Gatsby and not Next.js
92+
# https://nextjs.org/blog/next-9-1#public-directory-support
93+
# public
94+
95+
# vuepress build output
96+
.vuepress/dist
97+
98+
# vuepress v2.x temp and cache directory
99+
.temp
100+
.cache
101+
102+
# Sveltekit cache directory
103+
.svelte-kit/
104+
105+
# Docusaurus cache and generated files
106+
.docusaurus
107+
108+
# Serverless directories
109+
.serverless/
110+
111+
# FuseBox cache
112+
.fusebox/
113+
114+
# DynamoDB Local files
115+
.dynamodb/
116+
117+
# Firebase cache directory
118+
.firebase/
119+
120+
# TernJS port file
121+
.tern-port
122+
123+
# Stores VSCode versions used for testing VSCode extensions
124+
.vscode-test
125+
126+
# yarn v3
127+
.pnp.*
128+
.yarn/*
129+
!.yarn/patches
130+
!.yarn/plugins
131+
!.yarn/releases
132+
!.yarn/sdks
133+
!.yarn/versions
134+

.nvmrc

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

AGENTS.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to AI coding agents working with code in this repository.
4+
5+
## Repository Overview
6+
7+
A collection of Agent Skills for the Rspack ecosystem (Rspack, Rsbuild, Rslib, Rstest, Rsdoctor). Skills are packaged instructions and scripts that extend agent capabilities for debugging, profiling, and development workflows.
8+
9+
## Creating a New Skill
10+
11+
### Directory Structure
12+
13+
```
14+
skills/
15+
{skill-name}/ # kebab-case directory name
16+
SKILL.md # Required: skill definition with YAML frontmatter
17+
scripts/ # Optional: executable scripts (.js, .cjs, .sh)
18+
references/ # Optional: detailed documentation loaded on-demand
19+
assets/ # Optional: templates, images, data files
20+
```
21+
22+
### Naming Conventions
23+
24+
- **Skill directory**: `kebab-case` (e.g., `rspack-debugging`, `rstest-cdp`)
25+
- **SKILL.md**: Always uppercase, always this exact filename
26+
- **Scripts**: `snake_case.js` or `snake_case.cjs` (e.g., `analyze_trace.js`, `setup_debug_deps.cjs`)
27+
28+
### SKILL.md Format
29+
30+
```markdown
31+
---
32+
name: { skill-name }
33+
description:
34+
{
35+
What the skill does AND when to use it. Include trigger phrases and error messages that should activate this skill.,
36+
}
37+
compatibility:
38+
{ Optional: environment requirements like Node version, CLI tools, etc. }
39+
---
40+
41+
# {Skill Title}
42+
43+
## When to Use This Skill
44+
45+
{Clear trigger conditions — error messages, scenarios, user requests}
46+
47+
## Workflow
48+
49+
{Numbered steps explaining how to use the skill}
50+
51+
## Detailed Guides
52+
53+
{Links to reference files for progressive disclosure}
54+
55+
## Troubleshooting
56+
57+
{Common issues and solutions}
58+
```
59+
60+
### Best Practices for Context Efficiency
61+
62+
Skills use progressive disclosure — only name and description load at startup. The full `SKILL.md` loads when the agent decides the skill is relevant.
63+
64+
- **Keep SKILL.md under 500 lines** — put detailed guides in `references/` directory
65+
- **Write specific descriptions** — include exact error messages and trigger phrases
66+
- **One level deep references** — link directly from SKILL.md to supporting files
67+
- **Prefer scripts over inline code** — script execution doesn't consume context (only output does)
68+
- **No time-sensitive information** — avoid dates or version-specific instructions that will become stale
69+
70+
### Script Requirements
71+
72+
- Use CommonJS (`require`/`module.exports`) for `.cjs` files
73+
- Include clear usage help: `console.error('Usage: node script.js <args>')`
74+
- Handle errors explicitly with actionable messages
75+
- Use emoji prefixes for user-facing logs: `📍`, ``, ``, `⚠️`, `👉`
76+
- Document magic constants: `const MIN_VERSION = '1.3.14'; // First version with debug symbols`
77+
78+
### Validating Skills
79+
80+
Use the [skills-ref](https://github.com/agentskills/agentskills/tree/main/skills-ref) library:
81+
82+
```bash
83+
npx skills-ref validate ./skills/{skill-name}
84+
```
85+
86+
## Resources
87+
88+
- [Agent Skills Specification](https://agentskills.io/specification)
89+
- [Skill Authoring Best Practices](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices)

biome.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"vcs": {
3+
"enabled": true,
4+
"clientKind": "git",
5+
"useIgnoreFile": true
6+
},
7+
"files": {
8+
"ignore": []
9+
},
10+
"formatter": {
11+
"enabled": true,
12+
"indentStyle": "space",
13+
"indentWidth": 2,
14+
"lineWidth": 100
15+
},
16+
"linter": {
17+
"enabled": false
18+
},
19+
"organizeImports": {
20+
"enabled": false
21+
},
22+
"javascript": {
23+
"formatter": {
24+
"quoteStyle": "single",
25+
"semicolons": "always",
26+
"trailingCommas": "all"
27+
}
28+
}
29+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"private": true,
3+
"name": "@agent-skills/cdp-fixture-basic-no-debug",
4+
"type": "module",
5+
"version": "1.0.0",
6+
"devDependencies": {
7+
"@rstest/core": "^0.8.2"
8+
}
9+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from '@rstest/core';
2+
3+
export default defineConfig({
4+
root: __dirname,
5+
tools: {
6+
rspack: (config) => {
7+
config.devtool = 'inline-source-map';
8+
},
9+
},
10+
dev: {
11+
writeToDisk: true,
12+
},
13+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const summarizeScores = (scores: number[]) => {
2+
const total = scores.reduce((sum, value) => sum + value, 0);
3+
const average = scores.length ? total / scores.length : 0;
4+
const weightedTotal = total + average * 0.25;
5+
const label = `${scores.length}-scores`;
6+
7+
return {
8+
total,
9+
average,
10+
weightedTotal,
11+
label,
12+
};
13+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export const formatUser = (name: string, role = 'member') => {
2+
const trimmed = name.trim();
3+
const [firstName = '', lastName = ''] = trimmed.split(' ');
4+
const normalized = `${firstName.toLowerCase()}-${lastName.toLowerCase()}`;
5+
const displayName = `${firstName} ${lastName}`.trim();
6+
7+
return {
8+
trimmed,
9+
firstName,
10+
lastName,
11+
normalized,
12+
displayName,
13+
role,
14+
};
15+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { describe, expect, it } from '@rstest/core';
2+
import { summarizeScores } from '../src/math';
3+
import { formatUser } from '../src/profile';
4+
5+
describe('combined tests', () => {
6+
it('formats user profile', () => {
7+
const profile = formatUser('Ada Lovelace', 'admin');
8+
9+
expect(profile.displayName).toBe('Ada Lovelace');
10+
expect(profile.normalized).toBe('ada-lovelace');
11+
});
12+
13+
it('summarizes scores', () => {
14+
const result = summarizeScores([12, 18, 30]);
15+
16+
expect(result.total).toBe(60);
17+
expect(result.average).toBe(20);
18+
expect(result.weightedTotal).toBe(65);
19+
});
20+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { describe, expect, it } from '@rstest/core';
2+
import { summarizeScores } from '../src/math';
3+
4+
describe('score summary', () => {
5+
it('computes totals', () => {
6+
const result = summarizeScores([12, 18, 30]);
7+
8+
expect(result.total).toBe(60);
9+
expect(result.average).toBe(20);
10+
expect(result.weightedTotal).toBe(65);
11+
});
12+
});

0 commit comments

Comments
 (0)