CLI Reference
AI Kit provides fourteen commands: init, update, reset, audit, tokens, doctor, diff, export, stats, health, patterns, dead-code, drift, and component-registry.
ai-kit init [path]
Scan a project and generate AI configuration files.
npx @mikulgohil/ai-kit init
npx @mikulgohil/ai-kit init ./path/to/projectWhat it does
- Scans the project directory for tech stack indicators (including design tokens, static site, and .aiignore)
- Checks for existing config — if found, shows saved profile and offers: Update (reuse settings), Re-configure, or Cancel
- Shows detected stack and asks clarification questions if needed (skipped in Update mode)
- Asks which AI tools to generate configs for — or reuses saved choice
- Asks strictness and hook profile — or reuses saved choices
- Generates all configuration files
- Writes
ai-kit.config.jsonto track what was generated including your tool/strictness/hook choices
Interactive Prompts
| Prompt | When it appears |
|---|---|
| What would you like to do? | ai-kit.config.json already exists — Update, Re-configure, or Cancel |
| Router type? | Next.js detected but router ambiguous (skipped in Update mode) |
| Which AI tools? | Fresh init or Re-configure — choose Claude, Cursor, or both |
| Strictness level? | Fresh init or Re-configure |
| Hook profile? | Fresh init or Re-configure — choose minimal, standard, or strict |
| Conflict strategy? | Existing CLAUDE.md or .cursorrules found (auto-overwrite in Update mode) |
Profile Persistence (v1.5.0+)
Your choices are saved in ai-kit.config.json under the tools field:
{
"tools": { "claude": true, "cursor": true },
"strictness": "standard",
"hookProfile": "standard"
}When a teammate clones the project and runs ai-kit init, they see the saved profile and can accept it with one keypress. This ensures consistent AI configuration across the team.
Generated Files
| File | Condition |
|---|---|
CLAUDE.md | Claude Code selected |
.cursorrules | Cursor selected |
.cursor/rules/*.mdc | Cursor selected |
.claude/skills/*/SKILL.md | Claude Code selected |
.cursor/skills/*/SKILL.md | Cursor selected |
.claude/commands/*.md | Claude Code selected (legacy, backward compat) |
.claude/agents/*.md | Claude Code selected — up to 10 specialized agents |
.claude/contexts/*.md | Claude Code selected — 3 context modes |
.claude/settings.local.json | Claude Code selected — automated hooks |
ai-kit/guides/*.md | Always |
docs/*.md | Always (won’t overwrite existing) |
ai-kit.config.json | Always |
ai-kit update [path]
Re-scan the project and update all generated files.
npx @mikulgohil/ai-kit update
npx @mikulgohil/ai-kit update ./path/to/projectWhat it does
- Reads existing
ai-kit.config.json(fails if not found) - Checks for version mismatch — warns if major version differs
- Re-scans the project for tech stack changes
- Updates
CLAUDE.mdand.cursorrulesusing safe merge — only content betweenAI-KIT:START/ENDmarkers is replaced, preserving your manual edits - Updates
.cursor/rules/*.mdcfiles - Refreshes slash commands, guides, agents, contexts, and hooks
- Updates
ai-kit.config.json
Safe Merge Behavior
Generated files contain markers:
<!-- AI-KIT:START -->
[generated content]
<!-- AI-KIT:END -->On update, only content between these markers is replaced. Anything you add above or below the markers is preserved.
If no markers exist (files from before v1.0.0), the entire file is replaced.
Version Mismatch Warning
⚠ Config was generated with ai-kit v1.0.0, but you're running v2.0.0.
Consider running `ai-kit init` to re-initialize.This appears when the major version differs. Minor/patch updates proceed silently.
ai-kit reset [path]
Remove all AI Kit generated files from a project.
npx @mikulgohil/ai-kit reset
npx @mikulgohil/ai-kit reset ./path/to/projectWhat it removes
| Item | Path |
|---|---|
| Claude Code rules | CLAUDE.md |
| Cursor rules | .cursorrules |
| Cursor scoped rules | .cursor/rules/ |
| Claude Code skills | .claude/skills/ |
| Cursor skills | .cursor/skills/ |
| Legacy slash commands | .claude/commands/ |
| AI Kit folder | ai-kit/ |
| Configuration | ai-kit.config.json |
Safety
- Shows a full list of what will be removed before proceeding
- Requires explicit confirmation (
Are you sure? This cannot be undone.) - Only removes files that AI Kit created — your source code and other configs are untouched
- Does NOT remove
docs/scaffolds (mistakes-log, decisions-log, time-log) since you may have added content to them
ai-kit audit [path]
Run a security and configuration health audit on your AI setup.
npx @mikulgohil/ai-kit audit
npx @mikulgohil/ai-kit audit ./path/to/projectWhat it checks
| Check | What It Verifies |
|---|---|
| Config file | ai-kit.config.json exists |
| CLAUDE.md | File exists with AI-KIT markers |
| Secrets in CLAUDE.md | Scans for API keys, tokens, passwords, GitHub/Slack tokens |
| Hooks | .claude/settings.local.json exists with hooks configured |
| Agents | .claude/agents/ has valid agent files with YAML frontmatter |
| Contexts | .claude/contexts/ has context mode files |
| Skills | .claude/skills/ has skill directories |
| .env gitignore | .env files are in .gitignore |
| Settings gitignore | settings.local.json is in .gitignore |
| MCP secrets | No hardcoded secrets in .claude/settings.json |
Output
AI Kit — Security & Configuration Audit
ℹ Auditing: /Users/you/projects/my-app
✓ Config file: ai-kit.config.json found
✓ CLAUDE.md: CLAUDE.md has AI-KIT markers
✓ Secrets in CLAUDE.md: No secrets detected
✓ Hooks: Hooks configured in settings.local.json
✓ Agents: 16 agent(s) configured
✓ Contexts: 3 context mode(s) available
✓ Skills: 48 skill(s) installed
✓ .env gitignore: .env files are gitignored
⚠ Settings gitignore: settings.local.json not in .gitignore
✓ MCP secrets: No hardcoded secrets in settings
Score
A (95/100)
10 passed · 1 warnings · 0 failuresScoring
The audit produces a letter grade based on checks passed:
| Grade | Score |
|---|---|
| A | 90–100 |
| B | 80–89 |
| C | 70–79 |
| D | 60–69 |
| F | Below 60 |
Warnings count as half a point. Failures count as zero. Fix all failures before proceeding.
ai-kit tokens
Show token usage summary, cost estimates, and analytics.
ai-kit tokens
ai-kit tokens --export
ai-kit tokens --csv
ai-kit tokens --budget 100Options
| Option | Description |
|---|---|
--export | Export data and open interactive HTML dashboard |
--csv | Export daily usage data to CSV file |
--budget <amount> | Set monthly budget in USD (default: $20) |
What it shows
- Period summaries: Today, this week, this month (sessions, tokens, cost)
- Budget progress: Visual progress bar with percentage used
- Budget alerts: Warnings at 50%, 75%, 90% thresholds
- Per-project breakdown: Cost per project ranked by usage
- Week-over-week trend: Cost comparison with previous week
- Model recommendations: Suggests Sonnet vs Opus usage optimization
- ROI estimate: Estimated time saved and developer cost offset
ai-kit doctor [path]
Diagnose your AI Kit setup and check for issues.
ai-kit doctor
ai-kit doctor ./path/to/projectWhat it checks
| Check | Description |
|---|---|
| Config file | Verifies ai-kit.config.json exists and is readable |
| Version match | Compares config version with installed CLI version |
| File integrity | Confirms all listed templates exist on disk |
| Skills check | Verifies all skills are present in .claude/skills/ and .cursor/skills/ |
| Guides check | Verifies all guides exist in ai-kit/guides/ |
| Staleness | Re-scans project and compares with saved config to detect stack changes |
| MCP servers | Checks configuration for Playwright, Context7, GitHub, Perplexity, Figma MCPs |
| Recommended tools | Checks for Playwright, ESLint, Prettier, axe-core, Knip, Bundle Analyzer |
Output
AI Kit — Doctor
✓ ai-kit.config.json found (v1.0.0)
✓ Version matches CLI (v1.0.0)
✓ CLAUDE.md exists and in sync
✓ .cursorrules exists and in sync
✓ 48/48 skills present
✓ 5/5 guides present
⚠ Stack may have changed — detected new styling: scss
⚠ Perplexity MCP not configured
Summary: 6 passed, 2 warnings, 0 issuesai-kit diff [path]
Preview what would change on ai-kit update without writing any files.
ai-kit diff
ai-kit diff ./path/to/projectWhat it shows
- Stack changes: New technologies detected, versions changed, or technologies removed
- File changes: Which generated files would be modified, added, or remain unchanged
- Fragment changes: Which template fragments would be added or removed
Output
AI Kit — Diff (dry run)
Stack Changes:
+ scss detected (styling)
~ Next.js version: 15.0.0 → 15.1.0
File Changes:
modified CLAUDE.md (template fragments changed: +monorepo)
modified .cursorrules (template fragments changed: +monorepo)
unchanged .claude/skills/ (48 skills)
unchanged ai-kit/guides/ (5 guides)
Summary: 2 files would be modified, 0 added, 0 removed
Run `ai-kit update` to apply these changes.ai-kit export [path]
Export your AI rules to other AI editor tools.
ai-kit export
ai-kit export --format windsurf
ai-kit export --format allOptions
| Option | Description |
|---|---|
--format <format> | Target format: windsurf, aider, cline, or all |
Supported Formats
| Format | Output File | Tool |
|---|---|---|
| Windsurf | .windsurfrules | Windsurf AI Editor |
| Aider | .aider.conf.yml | Aider CLI |
| Cline | .clinerules | Cline VS Code Extension |
The exported files contain the same rules as your CLAUDE.md, reformatted for each tool’s expected format. AI-KIT markers are stripped during export.
ai-kit stats [path]
Show project setup statistics and complexity analysis.
ai-kit stats
ai-kit stats ./path/to/projectWhat it shows
- Project overview: Name, version, generation date, package manager
- Stack complexity score: Weighted score (1-10) with label (Simple/Moderate/Complex/Enterprise)
- Active rules: Which template fragments are included
- Skills breakdown: Total count grouped by category
- Tools status: Detected vs missing development tools
- MCP servers: Configured vs missing MCP integrations
ai-kit health [path]
One-glance project health dashboard — combines setup integrity, security, stack detection, tools, and documentation checks into a single view.
ai-kit health
ai-kit health ./path/to/projectWhat it checks
The health command runs five diagnostic sections:
| Section | What It Checks |
|---|---|
| Setup Integrity | Config version, CLAUDE.md with markers, .cursorrules, skills, agents, hooks |
| Security | Secrets in CLAUDE.md, .env gitignored, hardcoded secrets in MCP config |
| Stack Detection | Framework, CMS, TypeScript, styling, monorepo |
| Tools & MCP | Playwright, ESLint, Prettier, axe-core, Knip, Bundle Analyzer, Storybook, GitHub/Figma/Context7/Perplexity MCPs |
| Documentation | Mistakes log, decisions log, time log — checks if they have entries or are empty |
Output
AI Kit — Project Health
/Users/you/projects/my-app
Setup Integrity
✓ Version: v1.3.0
✓ CLAUDE.md: Present with markers
✓ .cursorrules: Present
✓ Skills: 46 installed
✓ Agents: 10 configured
✓ Hooks: Configured
Security
✓ Secrets in CLAUDE.md: Clean
✓ .env gitignore: Protected
✓ MCP config: No hardcoded secrets
Stack Detection
✓ Framework: Next.js 15.1.0 (App Router)
✓ CMS: Sitecore XM Cloud (Content SDK v2)
✓ TypeScript: Enabled (strict)
✓ Styling: tailwind
Tools & MCP
✓ Playwright: Detected
✓ ESLint: Detected
⚠ Knip: Missing — npm i -D knip
⚠ Perplexity MCP: Not configured
Documentation
✓ Mistakes Log: Has entries
⚠ Decisions Log: Scaffolded but empty
⚠ Time Log: Scaffolded but empty
Overall: B (82/100)
████████████████░░░░ 18 passed · 4 warnings · 0 failures
Recommendations:
→ Improve: Knip — Missing — npm i -D knip
→ Improve: Perplexity MCP — Not configured
→ Improve: Decisions Log — Scaffolded but emptyScoring
The health check produces a letter grade based on all checks across all sections:
| Grade | Score |
|---|---|
| A | 90–100 |
| B | 80–89 |
| C | 70–79 |
| D | 60–69 |
| F | Below 60 |
Passed checks count as 1 point, warnings as 0.5, failures as 0. The top 3 actionable recommendations are shown at the bottom.
When to use
- After
ai-kit init— verify everything was set up correctly - Before a PR — quick health check that your AI setup is intact
- During onboarding — show a new developer the project’s AI health at a glance
- Instead of running
doctor+audit+statsseparately —healthcombines the most useful checks from each
ai-kit patterns [path]
Generate a pattern library from recurring code patterns found in your project.
ai-kit patterns
ai-kit patterns ./path/to/projectWhat it does
Scans your codebase for recurring code patterns and generates ai-kit/patterns.md — a reference document the AI uses to match new code to your established conventions.
Patterns detected
| Pattern Category | What It Finds |
|---|---|
| Data fetching | Repeated fetch/query patterns, SWR or React Query usage |
| Error handling | Error boundary placements, try/catch conventions |
| Forms | Form library usage, validation patterns, submission flows |
| Auth | Auth guards, session checks, redirect patterns |
| State | State management patterns, context usage, store shapes |
| API routes | Handler conventions, response shapes, middleware patterns |
Output
Writes ai-kit/patterns.md with categorized code pattern examples. The AI reads this file to ensure new code follows your project’s established conventions.
ai-kit dead-code [path]
Find unused components and dead code across your project.
ai-kit dead-code
ai-kit dead-code ./path/to/projectWhat it does
Runs the component scanner and cross-references all exports against import usage to identify code that is no longer referenced.
Output
AI Kit — Dead Code Report
/Users/you/projects/my-app
Components scanned: 84
UNUSED (never imported):
src/components/OldBanner.tsx
src/components/legacy/PromoWidget.tsx
TEST-ONLY (only imported in test files):
src/components/MockProvider.tsx
IN USE: 81 components
Summary: 2 unused · 1 test-only · 81 in useReports each component as used, unused, or test-only. Does not delete anything — review output and remove manually.
ai-kit drift [path]
Detect drift between component source code and their .ai.md documentation files.
ai-kit drift
ai-kit drift ./path/to/projectWhat it does
Compares each component’s current source code against its .ai.md documentation. Flags components where the props, exports, or Sitecore integration no longer match the documented state.
Output
AI Kit — Drift Report
/Users/you/projects/my-app
Components checked: 42
DRIFTED (code changed, docs not updated):
src/components/ProductCard.tsx — props added: discount, badge
src/components/Header.tsx — props removed: logoVariant
OUTDATED (no .ai.md file):
src/components/NewWidget.tsx
IN SYNC: 39 components
Summary: 2 drifted · 1 outdated · 39 in sync
Run `ai-kit update` to regenerate docs for drifted components.| Status | Meaning |
|---|---|
| In sync | Component code matches .ai.md documentation |
| Drifted | Component has changed since docs were last generated |
| Outdated | No .ai.md file exists for this component |
ai-kit component-registry [path]
Generate a component registry for AI agent discovery.
ai-kit component-registry
ai-kit component-registry ./path/to/projectWhat it does
Scans all React components in the project and generates two files:
| File | Format | Purpose |
|---|---|---|
ai-kit/component-registry.json | JSON | Machine-readable catalog with props, dependencies, Sitecore metadata, health scores |
ai-kit/component-registry.md | Markdown | Human-readable summary grouped by category, with health metrics |
Output
AI Kit — Component Registry
/Users/you/projects/my-app
Found 84 components in 12 directories
Categories:
28 ui
18 feature
14 content
9 navigation
8 layout
7 general
Health:
Average score: 62/100
With tests: 34/84
With stories: 22/84
With .ai.md docs: 15/84
✓ Registry written to ai-kit/component-registry.json
✓ Summary written to ai-kit/component-registry.mdWhen to use
- After creating new components — regenerate to keep the registry current
- Before asking AI to create a component — it checks the registry to avoid duplicates
- During project audits — the health scores highlight under-documented components
Global Options
ai-kit --version # Show version number
ai-kit --help # Show help
ai-kit init --help # Show command-specific help
ai-kit audit --help # Show audit command help
ai-kit tokens --help # Show tokens command help
ai-kit doctor --help # Show doctor command help
ai-kit diff --help # Show diff command help
ai-kit export --help # Show export command help
ai-kit stats --help # Show stats command help
ai-kit health --help # Show health command help
ai-kit patterns --help # Show patterns command help
ai-kit dead-code --help # Show dead-code command help
ai-kit drift --help # Show drift command help