Skip to content

Commit 41eb7c9

Browse files
committed
feat(cli): support cli skills
Signed-off-by: Cory Rylan <crylan@nvidia.com>
1 parent bfcb1fc commit 41eb7c9

25 files changed

Lines changed: 382 additions & 71 deletions

projects/cli/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ Skills provide persistent context to AI agents for building UI with Elements.
115115
| Skill | Description |
116116
| ----- | ----------- |
117117
| `elements` | Build UI with NVIDIA Elements (NVE). Provides authoring guidelines, workflow steps, and API best practices for creating, editing, or reviewing HTML templates that use nve-* components. |
118+
| `authoring` | Authoring workflow guidance for creating, editing, or reviewing HTML templates that use nve-* components. |
119+
| `migration` | Migration guidance for moving projects from deprecated Elements APIs to current packages and tools. |
118120

119121
### Tools
120122

@@ -130,6 +132,8 @@ Skills provide persistent context to AI agents for building UI with Elements.
130132
| `packages_changelogs_get` | Retrieve changelog details by package name. |
131133
| `examples_list` | Get list of available Elements (nve-*) patterns and examples. |
132134
| `examples_get` | Get the full template of a known example or pattern by id. |
135+
| `skills_list` | Get a list of available Elements agent skills and context fragments. |
136+
| `skills_get` | Get a bundled Elements agent skill or context fragment by name. |
133137
| `playground_validate` | Validates HTML templates specifically for playground examples. |
134138
| `playground_create` | Create a shareable playground URL from an HTML template. |
135139
| `project_create` | Create a new starter project. |
@@ -141,4 +145,4 @@ Skills provide persistent context to AI agents for building UI with Elements.
141145
- [Documentation](https://NVIDIA.github.io/elements/docs/cli/)
142146
- [Changelog](https://NVIDIA.github.io/elements/docs/changelog/)
143147
- [GitHub Repo](https://github.com/NVIDIA/elements)
144-
- [npm](https://www.npmjs.com/package/@nvidia-elements/cli)
148+
- [npm](https://www.npmjs.com/package/@nvidia-elements/cli)

projects/cli/src/index.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ describe('index', () => {
3737
expect(output).toContain('nve examples.get <id> [format]');
3838
});
3939

40+
it('should provide skills.list', () => {
41+
expect(output).toContain('nve skills.list [format]');
42+
});
43+
44+
it('should provide skills.get', () => {
45+
expect(output).toContain('nve skills.get <name> [format]');
46+
});
47+
4048
it('should conditionally provide playground.validate when url is available', () => {
4149
const hasPlayground = output.includes('nve playground.validate');
4250
expect(typeof hasPlayground).toBe('boolean');

projects/internals/tools/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This package provides:
1010
- **Playground creation** and validation utilities
1111
- **Project management** tools for scaffolding and health checks
1212
- **Example template** management and search
13+
- **Agent skill** and context-fragment access
1314
- **Changelog and version** information services
1415
- **Design token** access and formatting
1516

@@ -21,12 +22,13 @@ The project uses a **decorator-based service architecture** that enables dynamic
2122

2223
### Service Modules
2324

24-
Seven main service modules organized by functionality:
25+
Main service modules organized by functionality:
2526

2627
```
2728
projects/internals/tools/src/
2829
├── api/ # Component API documentation service
2930
├── examples/ # Example templates and patterns service
31+
├── skills/ # Agent skills and context fragments service
3032
├── playground/ # Playground creation and validation service
3133
├── project/ # Project creation, update, and health checks
3234
├── changelogs/ # Release notes and changelog service
@@ -48,6 +50,11 @@ projects/internals/tools/src/
4850
- `search()` - Search example templates by name or description
4951
- Pulls from `@internals/metadata`
5052

53+
#### **SkillsService** (`/skills/service.ts`)
54+
- `list()` - Get available bundled agent skills and context fragments
55+
- `get()` - Get a skill or context fragment by name
56+
- Uses bundled markdown so CLI/MCP users can access guidance even when skills are not installed on disk
57+
5158
#### **PlaygroundService** (`/playground/service.ts`)
5259
- `validate()` - Lint and check HTML templates for playground compliance
5360
- `create()` - Generate shareable playground URLs with framework support
@@ -125,6 +132,7 @@ The package provides modular entry points for tree-shaking:
125132
".": "./dist/index.js", // All tools
126133
"./api": "./dist/api/index.js", // API service only
127134
"./examples": "./dist/examples/index.js", // Examples service only
135+
"./skills": "./dist/skills/index.js",
128136
"./playground": "./dist/playground/index.js",
129137
"./project": "./dist/project/index.js",
130138
"./changelogs": "./dist/changelogs/index.js",

projects/internals/tools/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@
4848
"types": "./dist/examples/index.d.ts",
4949
"default": "./dist/examples/index.js"
5050
},
51+
"./skills": {
52+
"types": "./dist/skills/index.d.ts",
53+
"default": "./dist/skills/index.js"
54+
},
55+
"./skills/index.js": {
56+
"types": "./dist/skills/index.d.ts",
57+
"default": "./dist/skills/index.js"
58+
},
5159
"./playground": {
5260
"types": "./dist/playground/index.d.ts",
5361
"default": "./dist/playground/index.js"

projects/internals/tools/src/context/search.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

projects/internals/tools/src/index.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@ describe('tools', () => {
88
it('should be defined', () => {
99
expect(tools).toBeDefined();
1010
});
11+
12+
it('should include skills tools', () => {
13+
expect(tools.some(tool => tool.metadata.command === 'skills.list')).toBe(true);
14+
expect(tools.some(tool => tool.metadata.command === 'skills.get')).toBe(true);
15+
});
1116
});

projects/internals/tools/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ApiService } from './api/service.js';
77
import { PackagesService } from './packages/service.js';
88
import { ProjectService } from './project/service.js';
99
import { CliService } from './cli/service.js';
10+
import { SkillsService } from './skills/service.js';
1011
import { loadTools } from './internal/tools.js';
1112

1213
declare const __ELEMENTS_PLAYGROUND_BASE_URL__: string;
@@ -28,7 +29,7 @@ export { readNveConfig, saveNveConfig, type NveConfig, type UpdateConfig } from
2829
export { type Report, type ReportCheck } from './internal/types.js';
2930

3031
// eslint-disable-next-line @typescript-eslint/no-explicit-any
31-
const services: any[] = [ApiService, CliService, ExamplesService, ProjectService, PackagesService];
32+
const services: any[] = [ApiService, CliService, ExamplesService, ProjectService, PackagesService, SkillsService];
3233

3334
if (__ELEMENTS_PLAYGROUND_BASE_URL__) {
3435
services.push(PlaygroundService);
@@ -40,4 +41,4 @@ export { MAX_CONTEXT_CHARS, MAX_CONTEXT_TOKENS, isDebug } from './internal/utils
4041

4142
// temporary exports
4243
export { getElementImports } from './internal/utils.js';
43-
export { prompts, skills } from './context/index.js';
44+
export { prompts, skills, type Prompt, type Skill } from './skills/index.js';

projects/internals/tools/src/project/setup-agent.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,24 @@ vi.mock('./starters.js', () => ({
2727
claudeProjectSettings: {
2828
$schema: 'https://json.schemastore.org/claude-code-settings.json',
2929
permissions: {
30-
allow: ['mcp__elements__api_list', 'mcp__elements__api_get']
30+
allow: [
31+
'mcp__elements__api_list',
32+
'mcp__elements__api_get',
33+
'mcp__elements__skills_list',
34+
'mcp__elements__skills_get'
35+
]
3136
},
3237
enabledMcpjsonServers: ['elements']
3338
}
3439
}));
3540

36-
vi.mock('../context/index.js', () => ({
41+
vi.mock('../skills/index.js', () => ({
3742
skills: [
3843
{
3944
name: 'elements',
4045
title: 'Elements Design System (nve)',
4146
description: 'Build UI with NVIDIA Elements',
47+
kind: 'skill',
4248
context: '## Elements Context'
4349
}
4450
]
@@ -346,6 +352,8 @@ describe('setup-mcp', () => {
346352

347353
const written = JSON.parse(vi.mocked(writeFileSync).mock.calls[0][1] as string);
348354
expect(written.permissions.allow).toContain('mcp__elements__api_list');
355+
expect(written.permissions.allow).toContain('mcp__elements__skills_list');
356+
expect(written.permissions.allow).toContain('mcp__elements__skills_get');
349357
});
350358

351359
it('should return the settings file path', async () => {

projects/internals/tools/src/project/setup-agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { join, resolve } from 'node:path';
66
import { getNPMClient } from '../internal/node.js';
77
import type { Report } from '../internal/types.js';
88
import { claudeProjectSettings } from './starters.js';
9-
import { skills } from '../context/index.js';
9+
import { skills } from '../skills/index.js';
1010

1111
type IDE = 'cursor' | 'claude-code' | 'codex' | 'all';
1212

projects/internals/tools/src/project/starters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ export const claudeProjectSettings = {
327327
'mcp__elements__api_tokens_list',
328328
'mcp__elements__examples_list',
329329
'mcp__elements__examples_get',
330+
'mcp__elements__skills_list',
331+
'mcp__elements__skills_get',
330332
'mcp__elements__project_create',
331333
'mcp__elements__project_setup',
332334
'mcp__elements__project_validate',

0 commit comments

Comments
 (0)