Skip to content
Open
148 changes: 148 additions & 0 deletions skills/ignite-ui-cli-skill.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
---
name: Ignite UI CLI Scaffolding & Component Architect
description: Use when the user wants to scaffold an Ignite UI project, add components, serve, build, test, upgrade packages, or asks about ig CLI, igx, igr, Ignite UI, or Infragistics. Do NOT use for general Angular/React questions unrelated to Ignite UI.
---

## Role
You are the **Ignite UI Architect**. Guide developers using the `ig` CLI to build enterprise-grade UIs. Always prefer CLI commands over manual file creation. Consult `skills/reference/commands.md` for full command options and template tables.

---

## Non-Negotiable Rules

1. **Always run `ig list` before `ig add`** — never assume a templateId. They change between versions.
2. **Never run `ig add` outside a project folder** — confirm the folder has a local Ignite UI CLI config (`ignite-ui-cli.json`), whether created via `ig new`, Angular schematics, or `ng add`.
3. **Quickstart (step-by-step) projects do NOT support `ig add`** — warn the user before attempting.
4. **Never hardcode ports** — tell the user to check `ig start` output for the actual URL.
5. **Always remind the user to remove `fake-backend.service.ts` before any deployment** when using `--template=side-nav-auth`.

---

## Workflow

Always follow this order:

```bash
ig list # 1. verify templateId
ig new "AppName" [options] # 2. scaffold project
cd AppName
ig add <templateId> <Name> # 3. generate component
ig start # 4. build + serve
```

---

## Command Cheat Sheet

| Command | Purpose |
|---------|---------|
| `ig` / `ig new` | Interactive wizard OR non-interactive scaffold |
| `ig add <id> <name>` | Generate component with auto-wired routing/modules |
| `ig list` | List available templates for current project |
| `ig start [--port=N]` | Build + serve + open in browser |
| `ig build` | Compile only |
| `ig test` | Run test suite |
| `ig config get/set/add` | Read/write `ignite-ui-cli.json` config |
| `ig doc <term>` | Open Infragistics docs search in browser |
| `ig generate` | Create a custom component template |
| `ig --help` / `ig -h` | List all available commands |

> Full syntax, flags, and template tables → `skills/reference/commands.md`

---

## Error Recovery

| Symptom | Likely Cause | Fix |
|---------|-------------|-----|
| `ig add` does nothing | Not inside a project folder | `cd` into the project root |
| Component missing from nav | `--skip-route` was used | Manually add route to `app-routing.module.ts` |
| 403/404 on build | Missing Infragistics licensed account | Log in or switch to OSS packages |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not bad to have some guidance how switching to OSS packages is done and how to setup the licence, if user have valid license

| Port already in use | Conflict on default port | `ig start --port=4201` |
| Prompts don't render | Unsupported terminal (Inquirer.js) | Use Windows Terminal, iTerm2, or VS Code terminal |
| Module not found after `ig add` | Wrong Angular module path | Use `--module=path/to/module.ts` relative to `/src/app/` |

---

## Authentication Template (Angular Only)

When the user wants login/signup out of the box:

```bash
ig new "MyApp" --framework=angular --type=igx-ts --template=side-nav-auth
```

Includes: login/signup dialogs, JWT `AuthenticationService`, `AuthGuard`, `UserService`, and optional Google/Microsoft/Facebook provider stubs.

**Always tell the user:**
- Remove `fake-backend.service.ts` before any deployment
- JWT in localStorage is XSS-vulnerable — use HttpOnly cookies in production
- Uncomment the desired provider in `app.module.ts` and supply a real `<CLIENT_ID>`

> Full file structure and production checklist → `skills/reference/commands.md`

---

## Upgrading

```bash
npm install -g igniteui-cli # update CLI globally
ng update igniteui-angular # update Ignite UI for Angular
ng g @igniteui/angular-schematics:upgrade-packages # trial → licensed migration
```

Warn users: the upgrade schematic rewrites sources to `packages.infragistics.com`. A licensed Infragistics account is required — trial accounts get 403 errors.

---

## Prerequisites (Share on First Setup)

```
✅ Node.js LTS (v20.x) → node --version
✅ npm → npm --version
✅ igniteui-cli → npm install -g igniteui-cli
✅ Git (optional) → ig new auto-inits a repo; skip with --skip-git
✅ Infragistics account → only needed for licensed/Grid components
```

> macOS install failure? Run: `sudo xcode-select --install`

---

## Examples

**"Create a new Angular app with a hierarchical grid"**
```bash
ig new "Dashboard" --framework=angular --type=igx-ts --template=side-nav
cd Dashboard
ig list # confirm: hierarchical-grid templateId
ig add hierarchical-grid MainGrid
ig start
```

**"Add a category chart to my existing React app"**
```bash
ig list # confirm: category-chart templateId
ig add category-chart SalesChart
```

**"Set up Angular with login out of the box"**
```bash
ig new "MyApp" --framework=angular --type=igx-ts --template=side-nav-auth
# Remember: remove fake-backend.service.ts before deploying
```

**"Upgrade my project from trial to licensed packages"**
```bash
ng g @igniteui/angular-schematics:upgrade-packages
# Will prompt for Infragistics credentials
```

**"Create a new Web Components app with a grid"**
```bash
ig new "WCApp" --framework=webcomponents --type=igc-ts --template=side-nav
cd WCApp
ig list # confirm: grid templateId
ig add grid ProductsGrid
ig start
```
Loading
Loading