Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .agents/skills/igniteui-cli-ai-config-skills-refresh/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Mirrors each framework repository's `skills/` folder into the **bundled skills**
| webcomponents | `IgniteUI/igniteui-webcomponents` | `packages/cli/templates/webcomponents/igc-ts/projects/ai-config/files/skills` |
| blazor | `IgniteUI/igniteui-blazor` | `packages/cli/templates/blazor/igb/projects/ai-config/files/skills` |

In the bundled copy every `SKILL.md` is stored as `SKILL.md.template`, so `gh skill` and other tools that index `SKILL.md` files do not list this repository as a second source of the framework skills. `copyAISkillsToProject` writes it back as `SKILL.md` in the user's project. Both copy tools apply the rename; a file named `SKILL.md` under a bundled `skills/` folder is a mistake, and `spec/templates/*-spec.ts` fail on it.

The release build (`npm run build-pack`, run by `npm-publish.yml`) re-copies the same folders from `master` through `scripts/update-skills.ts`, so the published package always ships `master`'s skills. This workflow keeps the **committed** copies (used by local runs, specs and reviewers) in step with what ships, or pins them to another ref when asked.

---
Expand All @@ -34,7 +36,7 @@ If the frameworks are missing, stop and ask. A ref other than `master` is a deli
## Limits

- Your changes are the files under the bundled `skills/` folders in the table, nothing else. The `ai-config` templates' other files (`AGENTS.md`, instruction files, `index.ts`) stay as they are.
- The bundled copy is an exact mirror of the source `skills/` folder. Content problems (broken links, bad frontmatter) are reported for the framework repository to fix, not edited here.
- The bundled copy is an exact mirror of the source `skills/` folder, apart from the `SKILL.md.template` file name. Content problems (broken links, bad frontmatter) are reported for the framework repository to fix, not edited here.
- Do not run `scripts/update-skills.ts` or `npm run build:update-skills`: they `git fetch` and `git checkout -B` inside the documentation submodules, which writes to git and moves submodule pointers. Use the script below, which reads from GitHub over HTTPS and runs no git commands.

---
Expand All @@ -49,8 +51,8 @@ node .agents/skills/igniteui-cli-ai-config-skills-refresh/scripts/sync-skills.mj
```

- Resolves the ref to a commit, lists `skills/` through the GitHub tree API and compares each file's git blob hash with the bundled copy (CRLF in the working tree is ignored). Only changed or new files are downloaded.
- Prints `+` added, `~` modified, `-` deleted per framework, with the source commit.
- `!` lines are content issues in the result: a `SKILL.md` without frontmatter, `name` or `description`; a `name` that differs from its folder; relative Markdown links that point to a missing file or outside the `skills/` folder (they break once copied into a project).
- Prints `+` added, `~` modified, `-` deleted per framework, with the source commit. These paths are the bundled file names (`SKILL.md.template`); a stray `SKILL.md` in the bundled copy is listed as deleted.
- `!` lines are content issues in the result, with the upstream file name (`SKILL.md`): a `SKILL.md` without frontmatter, `name` or `description`; a `name` that differs from its folder; relative Markdown links that point to a missing file or outside the `skills/` folder (they break once copied into a project).
- Without `--apply` nothing is written. `--apply` writes added and modified files, deletes removed ones and prunes empty folders.

---
Expand Down Expand Up @@ -79,7 +81,7 @@ Run the script again with `--apply` and the same arguments. Then run it once mor
```bash
node <repo>/packages/cli/bin/execute.js ai-config --framework <fw> --agents claude --assistants none
```
It must report `<n> AI skill file(s) created or updated`, with `<n>` equal to the number of files in that framework's bundled `skills/` folder, and `.claude/skills/` must contain them. Delete the temporary directory afterwards.
It must report `<n> AI skill file(s) created or updated`, with `<n>` equal to the number of files in that framework's bundled `skills/` folder, and `.claude/skills/` must contain them, each skill with a `SKILL.md` and no `.template` file. Delete the temporary directory afterwards.

The smoke test does not cover `ai-config` (hidden project), so it is not part of this workflow.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ const SOURCES = {
blazor: { repo: "IgniteUI/igniteui-blazor", dest: "packages/cli/templates/blazor/igb/projects/ai-config/files/skills" }
};

// The bundled copy stores each SKILL.md as SKILL.md.template; in memory paths keep the upstream name.
const SKILL_FILE = "SKILL.md";
const BUNDLED_SUFFIX = ".template";
const onDisk = (path) => (posix.basename(path) === SKILL_FILE ? path + BUNDLED_SUFFIX : path);
const fromDisk = (path) => (posix.basename(path) === SKILL_FILE + BUNDLED_SUFFIX ? path.slice(0, -BUNDLED_SUFFIX.length) : path);

const args = process.argv.slice(2);
const value = (name, def) => {
const i = args.indexOf(name);
Expand Down Expand Up @@ -139,11 +145,13 @@ for (const fw of frameworks) {
.map((e) => [e.path.slice("skills/".length), e.sha]));
if (!Object.keys(remote).length) throw new Error(`no skills/ folder at ${ref}`);

const local = new Set(walk(destAbs));
const disk = walk(destAbs);
const stray = disk.filter((p) => posix.basename(p) === SKILL_FILE);
const local = new Set(disk.filter((p) => !stray.includes(p)).map(fromDisk));
const files = {};
const fetchList = [];
for (const [path, sha] of Object.entries(remote)) {
const abs = join(destAbs, path);
const abs = join(destAbs, onDisk(path));
if (local.has(path)) {
const buf = readFileSync(abs);
if (sameAsRemote(buf, sha)) {
Expand All @@ -155,7 +163,7 @@ for (const fw of frameworks) {
} else result.added.push(path);
fetchList.push([path, sha]);
}
result.deleted = [...local].filter((p) => !(p in remote)).sort();
result.deleted = [...[...local].filter((p) => !(p in remote)).map(onDisk), ...stray].sort();
await pool(fetchList, 6, async ([path, sha]) => {
const buf = await raw(repo, result.commit, path);
if (blobSha(buf) !== sha) throw new Error(`content of skills/${path} does not match its tree entry`);
Expand All @@ -169,12 +177,14 @@ for (const fw of frameworks) {
for (const path of result.deleted) unlinkSync(join(destAbs, path));
if (existsSync(destAbs)) pruneEmptyDirs(destAbs, true);
for (const path of [...result.added, ...result.modified]) {
const abs = join(destAbs, path);
const abs = join(destAbs, onDisk(path));
mkdirSync(dirname(abs), { recursive: true });
writeFileSync(abs, files[path]);
}
result.applied = true;
}
result.added = result.added.map(onDisk);
result.modified = result.modified.map(onDisk);
} catch (e) {
result.error = (e.stderr || e.message || String(e)).toString().trim();
}
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Unreleased

## What's Changed
* **chore(templates):** The AI skills bundled with `ig ai-config` are now stored as `SKILL.md.template`, so `gh skill` no longer lists this repository as a second source of the Ignite UI framework skills. `ig ai-config` still writes them as `SKILL.md`.

# 16.0.1 (2026-11-24)

## What's Changed
Expand Down
8 changes: 7 additions & 1 deletion packages/core/util/ai-skills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export type SkillsSource =
export const AGENTS_TEMPLATE_FILE = "AGENTS.md";
export const AI_CONFIG_PROJECT_ID = "ai-config";
export const AI_SKILLS_DIR_NAME = "skills";
export const AI_SKILL_FILE = "SKILL.md";
/** Name of a skill file in the bundled templates, so tools that index SKILL.md don't list the copies as a skill source */
export const AI_BUNDLED_SKILL_FILE = `${AI_SKILL_FILE}.template`;

/**
* Returns the `files/` directory of the ai-config project template for the
Expand Down Expand Up @@ -174,7 +177,10 @@ export function copyAISkillsToProject(agents: AIAgentTarget[], framework: string
result.found++;
// Strip the leading '/' of tree-rooted paths (NgTreeFileSystem) so both sides resolve against
// the same base; native path.relative is case-insensitive on Windows, where glob upper-cases the drive letter
const rel = path.relative(skillsRoot.replace(/^\//, ""), p.replace(/^\//, "")).replace(/\\/g, "/");
let rel = path.relative(skillsRoot.replace(/^\//, ""), p.replace(/^\//, "")).replace(/\\/g, "/");
if (source.type === "bundled" && path.posix.basename(rel) === AI_BUNDLED_SKILL_FILE) {
rel = rel.slice(0, -AI_BUNDLED_SKILL_FILE.length) + AI_SKILL_FILE;
}
const dest = multiRoot
? `${outputDir}/${pkgDirName}/${rel}`
: `${outputDir}/${rel}`;
Expand Down
9 changes: 7 additions & 2 deletions scripts/update-skills.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { execFileSync } from "child_process";
import { cpSync, existsSync, rmSync } from "fs";
import { join, relative, resolve } from "path";
import { cpSync, existsSync, readdirSync, renameSync, rmSync } from "fs";
import { basename, join, relative, resolve } from "path";

const root = resolve(__dirname, "..");
const branch = process.argv[2] || "master";
Expand Down Expand Up @@ -65,6 +65,11 @@ for (const { name, repo, src, dest } of mappings) {
rmSync(dest, { recursive: true, force: true });
}
cpSync(src, dest, { recursive: true });
for (const entry of readdirSync(dest, { recursive: true, encoding: "utf8" })) {
if (basename(entry) === "SKILL.md") {
renameSync(join(dest, entry), join(dest, `${entry}.template`));
}
}
// eslint-disable-next-line no-console
console.log(`[update-skills] Updated ${name} skills`);
}
9 changes: 8 additions & 1 deletion spec/templates/angular-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AGENTS_TEMPLATE_FILE, AI_CONFIG_PROJECT_ID, AI_SKILLS_DIR_NAME, App, Framework, Template, Util } from "@igniteui/cli-core";
import { AGENTS_TEMPLATE_FILE, AI_BUNDLED_SKILL_FILE, AI_CONFIG_PROJECT_ID, AI_SKILL_FILE, AI_SKILLS_DIR_NAME, App, Framework, Template, Util } from "@igniteui/cli-core";
import { IGNITEUI_ANGULAR_PACKAGE } from "../../packages/igx-templates/constants";
import path from "path";
import * as fs from "fs";
Expand Down Expand Up @@ -83,5 +83,12 @@ describe("Angular templates", () => {
.withContext(`Missing ${AI_SKILLS_DIR_NAME}/ in ${filesDir}`)
.toBeTrue();
});

it("bundled skills must be stored as SKILL.md.template", () => {
const names = (fs.readdirSync(path.join(filesDir, AI_SKILLS_DIR_NAME), { recursive: true }) as string[])
.map(f => path.basename(f));
expect(names).not.toContain(AI_SKILL_FILE);
expect(names).toContain(AI_BUNDLED_SKILL_FILE);
});
});
});
9 changes: 8 additions & 1 deletion spec/templates/blazor-spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
AGENTS_TEMPLATE_FILE, AI_CONFIG_PROJECT_ID, AI_SKILLS_DIR_NAME, App, DotnetTemplateManager, Framework
AGENTS_TEMPLATE_FILE, AI_BUNDLED_SKILL_FILE, AI_CONFIG_PROJECT_ID, AI_SKILL_FILE, AI_SKILLS_DIR_NAME, App, DotnetTemplateManager, Framework
} from "@igniteui/cli-core";
import path from "path";
import * as fs from "fs";
Expand Down Expand Up @@ -65,6 +65,13 @@ describe("Blazor templates", () => {
.withContext(`Missing ${AI_SKILLS_DIR_NAME}/ in ${filesDir}`)
.toBeTrue();
});

it("bundled skills must be stored as SKILL.md.template", () => {
const names = (fs.readdirSync(path.join(filesDir, AI_SKILLS_DIR_NAME), { recursive: true }) as string[])
.map(f => path.basename(f));
expect(names).not.toContain(AI_SKILL_FILE);
expect(names).toContain(AI_BUNDLED_SKILL_FILE);
});
});

describe("dotnet-scaffolded project", () => {
Expand Down
9 changes: 8 additions & 1 deletion spec/templates/react-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AGENTS_TEMPLATE_FILE, AI_CONFIG_PROJECT_ID, AI_SKILLS_DIR_NAME, App, Framework, Template, Util } from "@igniteui/cli-core";
import { AGENTS_TEMPLATE_FILE, AI_BUNDLED_SKILL_FILE, AI_CONFIG_PROJECT_ID, AI_SKILL_FILE, AI_SKILLS_DIR_NAME, App, Framework, Template, Util } from "@igniteui/cli-core";
import {
IGNITEUI_REACT_CHARTS_PACKAGE, IGNITEUI_REACT_GAUGES_PACKAGE, IGNITEUI_REACT_GRIDS_PACKAGE, IGNITEUI_REACT_PACKAGE
} from "../../packages/cli/templates/react/igr-ts/constants";
Expand Down Expand Up @@ -98,5 +98,12 @@ describe("React templates", () => {
.withContext(`Missing ${AI_SKILLS_DIR_NAME}/ in ${filesDir}`)
.toBeTrue();
});

it("bundled skills must be stored as SKILL.md.template", () => {
const names = (fs.readdirSync(path.join(filesDir, AI_SKILLS_DIR_NAME), { recursive: true }) as string[])
.map(f => path.basename(f));
expect(names).not.toContain(AI_SKILL_FILE);
expect(names).toContain(AI_BUNDLED_SKILL_FILE);
});
});
});
9 changes: 8 additions & 1 deletion spec/templates/webcomponents-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AGENTS_TEMPLATE_FILE, AI_CONFIG_PROJECT_ID, AI_SKILLS_DIR_NAME, App, Framework, Template, Util } from "@igniteui/cli-core";
import { AGENTS_TEMPLATE_FILE, AI_BUNDLED_SKILL_FILE, AI_CONFIG_PROJECT_ID, AI_SKILL_FILE, AI_SKILLS_DIR_NAME, App, Framework, Template, Util } from "@igniteui/cli-core";
import path from "path";
import * as fs from "fs";
import { BaseIgcProject } from "../../packages/cli/templates/webcomponents/igc-ts/projects/_base";
Expand Down Expand Up @@ -103,5 +103,12 @@ describe("Web Components templates", () => {
.withContext(`Missing ${AI_SKILLS_DIR_NAME}/ in ${filesDir}`)
.toBeTrue();
});

it("bundled skills must be stored as SKILL.md.template", () => {
const names = (fs.readdirSync(path.join(filesDir, AI_SKILLS_DIR_NAME), { recursive: true }) as string[])
.map(f => path.basename(f));
expect(names).not.toContain(AI_SKILL_FILE);
expect(names).toContain(AI_BUNDLED_SKILL_FILE);
});
});
});
67 changes: 67 additions & 0 deletions spec/unit/ai-skills-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,73 @@ describe("Unit - copyAISkillsToProject", () => {
expect(destFs.writeFile).toHaveBeenCalledWith(".claude/skills/grids/SKILL.md", content);
});

it("should write a bundled SKILL.md.template as SKILL.md", () => {
const skillFilePath = path.join(FAKE_SKILLS_ROOT, "grids", "SKILL.md.template");
const referencePath = path.join(FAKE_SKILLS_ROOT, "grids", "references", "paging.md");
const content = "# Grid skill";

spySrcFs({
glob: spyOn(FsFileSystem.prototype, "glob").and.callFake((dir: string) =>
dir === FAKE_SKILLS_ROOT ? [skillFilePath, referencePath] : []
),
readFile: spyOn(FsFileSystem.prototype, "readFile").and.returnValue(content)
});

const destFs = makeDestFs();
App.container.set(FS_TOKEN, destFs);
mockTemplateManager([FAKE_TEMPLATE_PATH]);

const result = copyAISkillsToProject(["claude"], "angular");

expect(result.details).toEqual([
{ path: ".claude/skills/grids/SKILL.md", action: "created" },
{ path: ".claude/skills/grids/references/paging.md", action: "created" }
]);
expect(destFs.writeFile).toHaveBeenCalledWith(".claude/skills/grids/SKILL.md", content);
});

it("should skip a bundled SKILL.md.template when the project's SKILL.md is identical", () => {
const skillFilePath = path.join(FAKE_SKILLS_ROOT, "grids", "SKILL.md.template");
const content = "# Grid skill";

spySrcFs({
glob: spyOn(FsFileSystem.prototype, "glob").and.callFake((dir: string) =>
dir === FAKE_SKILLS_ROOT ? [skillFilePath] : []
),
readFile: spyOn(FsFileSystem.prototype, "readFile").and.returnValue(content)
});

const destFs = makeDestFs({
fileExists: jasmine.createSpy("destFs.fileExists").and.callFake((p: string) =>
p === ".claude/skills/grids/SKILL.md"
),
readFile: jasmine.createSpy("destFs.readFile").and.returnValue(content)
});
App.container.set(FS_TOKEN, destFs);
mockTemplateManager([FAKE_TEMPLATE_PATH]);

const result = copyAISkillsToProject(["claude"], "angular");

expect(destFs.writeFile).not.toHaveBeenCalled();
expect(result.details).toEqual([{ path: ".claude/skills/grids/SKILL.md", action: "skipped" }]);
});

it("should not rename a SKILL.md.template that comes from a package", () => {
const dir = skillsDir("igniteui-angular");
const file = skillFile("igniteui-angular", "grids/SKILL.md.template");

const destFs = makeDestFs({
directoryExists: jasmine.createSpy("destFs.directoryExists").and.callFake((p: string) => p === dir),
glob: jasmine.createSpy("destFs.glob").and.callFake((d: string) => d === dir ? [file] : []),
readFile: jasmine.createSpy("destFs.readFile").and.returnValue("content")
});
App.container.set(FS_TOKEN, destFs);

copyAISkillsToProject(["claude"], "angular");

expect(destFs.writeFile).toHaveBeenCalledWith(".claude/skills/grids/SKILL.md.template", "content");
});

it("should read bundled skill sources from real disk FS even when destFs is virtual", () => {
// Simulates the schematics scenario: template files outside the project are read from disk,
// destFs (NgTreeFileSystem) writes into the virtual Tree.
Expand Down