@ngxtm/devkit 3.9.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/init.js +21 -18
- package/cli/update.js +11 -17
- package/package.json +1 -1
- package/templates/base/rules/auto-skill.md +85 -77
package/cli/init.js
CHANGED
|
@@ -85,18 +85,22 @@ function installForTool(toolId, tool, projectDir, options = {}) {
|
|
|
85
85
|
let totalFiles = 0;
|
|
86
86
|
const stats = {};
|
|
87
87
|
|
|
88
|
-
// 1. Install commands (if tool supports it)
|
|
88
|
+
// 1. Install core commands (if tool supports it) - optimized size ~400KB
|
|
89
89
|
if (tool.commandsPath) {
|
|
90
|
-
const
|
|
90
|
+
const coreCommandsDir = path.join(PACKAGE_ROOT, 'core-commands');
|
|
91
91
|
const commandsDir = path.join(targetDir, tool.commandsPath);
|
|
92
92
|
|
|
93
|
-
if (fs.existsSync(
|
|
94
|
-
const count = copyDir(
|
|
93
|
+
if (fs.existsSync(coreCommandsDir)) {
|
|
94
|
+
const count = copyDir(coreCommandsDir, commandsDir);
|
|
95
95
|
stats.commands = count;
|
|
96
96
|
totalFiles += count;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
// Note: Skills are loaded on-demand from skills-compact.json
|
|
101
|
+
// Full skills are NOT copied to reduce installation size
|
|
102
|
+
// User can run "devkit add-skills" to install specific skill packs
|
|
103
|
+
|
|
100
104
|
// 2. Install rules
|
|
101
105
|
if (tool.rulesPath && options.rules && options.rules.length > 0) {
|
|
102
106
|
const rulesDir = path.join(targetDir, tool.rulesPath);
|
|
@@ -136,19 +140,11 @@ function installForTool(toolId, tool, projectDir, options = {}) {
|
|
|
136
140
|
}
|
|
137
141
|
}
|
|
138
142
|
|
|
139
|
-
// 4. Install
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
'skills-
|
|
143
|
-
|
|
144
|
-
'skills-triggers.json'
|
|
145
|
-
];
|
|
146
|
-
for (const indexFile of indexFiles) {
|
|
147
|
-
const src = path.join(PACKAGE_ROOT, indexFile);
|
|
148
|
-
if (fs.existsSync(src)) {
|
|
149
|
-
fs.copyFileSync(src, path.join(targetDir, indexFile));
|
|
150
|
-
totalFiles++;
|
|
151
|
-
}
|
|
143
|
+
// 4. Install compact skill index (for auto-detection, ~20KB only)
|
|
144
|
+
const compactIndex = path.join(PACKAGE_ROOT, 'skills-compact.json');
|
|
145
|
+
if (fs.existsSync(compactIndex)) {
|
|
146
|
+
fs.copyFileSync(compactIndex, path.join(targetDir, 'skills-compact.json'));
|
|
147
|
+
totalFiles++;
|
|
152
148
|
}
|
|
153
149
|
|
|
154
150
|
// 5. Install base rules (including auto-skill detection)
|
|
@@ -366,12 +362,19 @@ if (require.main === module) {
|
|
|
366
362
|
const toolsArg = args.find(a => a.startsWith('--tools='));
|
|
367
363
|
const tools = toolsArg ? toolsArg.split('=')[1].split(',') : [];
|
|
368
364
|
|
|
365
|
+
// Parse --path=value format
|
|
366
|
+
const pathArg = args.find(a => a.startsWith('--path='));
|
|
367
|
+
const pathValue = pathArg ? pathArg.split('=')[1] : null;
|
|
368
|
+
|
|
369
|
+
// Fallback to positional argument (first non-flag argument)
|
|
370
|
+
const positionalPath = args.find(a => !a.startsWith('-') && !a.includes('='));
|
|
371
|
+
|
|
369
372
|
const options = {
|
|
370
373
|
force: args.includes('--force') || args.includes('-f'),
|
|
371
374
|
update: args.includes('--update') || args.includes('-u'),
|
|
372
375
|
all: args.includes('--all') || args.includes('-a'),
|
|
373
376
|
tools: tools,
|
|
374
|
-
path:
|
|
377
|
+
path: pathValue || positionalPath || process.cwd()
|
|
375
378
|
};
|
|
376
379
|
|
|
377
380
|
if (args.includes('--uninstall')) {
|
package/cli/update.js
CHANGED
|
@@ -56,15 +56,17 @@ function updateToolInstallation(toolId, tool, projectDir, options = {}) {
|
|
|
56
56
|
|
|
57
57
|
let updatedCount = 0;
|
|
58
58
|
|
|
59
|
-
// 1. Update commands (if tool supports it)
|
|
59
|
+
// 1. Update core commands (if tool supports it) - optimized size ~400KB
|
|
60
60
|
if (tool.commandsPath) {
|
|
61
|
-
const
|
|
61
|
+
const coreCommandsDir = path.join(PACKAGE_ROOT, 'core-commands');
|
|
62
62
|
const commandsDir = path.join(targetDir, tool.commandsPath);
|
|
63
|
-
if (fs.existsSync(
|
|
64
|
-
updatedCount += copyDir(
|
|
63
|
+
if (fs.existsSync(coreCommandsDir)) {
|
|
64
|
+
updatedCount += copyDir(coreCommandsDir, commandsDir);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// Note: Skills are loaded on-demand, not copied to project
|
|
69
|
+
|
|
68
70
|
// 2. Update rules
|
|
69
71
|
if (tool.rulesPath && options.rules && options.rules.length > 0) {
|
|
70
72
|
const rulesDir = path.join(targetDir, tool.rulesPath);
|
|
@@ -97,19 +99,11 @@ function updateToolInstallation(toolId, tool, projectDir, options = {}) {
|
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
|
|
100
|
-
// 5. Update
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
'skills-
|
|
104
|
-
|
|
105
|
-
'skills-triggers.json'
|
|
106
|
-
];
|
|
107
|
-
for (const indexFile of indexFiles) {
|
|
108
|
-
const src = path.join(PACKAGE_ROOT, indexFile);
|
|
109
|
-
if (fs.existsSync(src)) {
|
|
110
|
-
fs.copyFileSync(src, path.join(targetDir, indexFile));
|
|
111
|
-
updatedCount++;
|
|
112
|
-
}
|
|
102
|
+
// 5. Update compact skill index (for auto-detection, ~20KB only)
|
|
103
|
+
const compactIndex = path.join(PACKAGE_ROOT, 'skills-compact.json');
|
|
104
|
+
if (fs.existsSync(compactIndex)) {
|
|
105
|
+
fs.copyFileSync(compactIndex, path.join(targetDir, 'skills-compact.json'));
|
|
106
|
+
updatedCount++;
|
|
113
107
|
}
|
|
114
108
|
|
|
115
109
|
// 6. Update base rules (including auto-skill detection)
|
package/package.json
CHANGED
|
@@ -4,128 +4,136 @@
|
|
|
4
4
|
|
|
5
5
|
## When to Activate
|
|
6
6
|
|
|
7
|
-
Before starting ANY coding task, you
|
|
7
|
+
Before starting ANY coding task, you SHOULD check if a relevant skill exists:
|
|
8
8
|
|
|
9
9
|
1. **Analyze the user's request** - Extract key technologies, patterns, or domains
|
|
10
|
-
2. **
|
|
11
|
-
3. **
|
|
12
|
-
4. **
|
|
10
|
+
2. **Check compact index** - Read `skills-compact.json` (~20KB) for skill names and categories
|
|
11
|
+
3. **Suggest to user** - Present top 1-3 matching skills
|
|
12
|
+
4. **Load on-demand** - When user confirms, read full skill from `skills/{name}/SKILL.md`
|
|
13
|
+
|
|
14
|
+
## Quick Reference: Skill Categories
|
|
15
|
+
|
|
16
|
+
| Code | Category | Examples |
|
|
17
|
+
|------|----------|----------|
|
|
18
|
+
| `fe` | Frontend | react, vue, nextjs, tailwind, ui/ux |
|
|
19
|
+
| `be` | Backend | node, express, nestjs, fastapi, api |
|
|
20
|
+
| `db` | Database | postgres, mysql, mongodb, redis, prisma |
|
|
21
|
+
| `ai` | AI/ML | llm, agents, rag, mcp, embeddings |
|
|
22
|
+
| `ops` | DevOps | docker, k8s, ci/cd, aws, terraform |
|
|
23
|
+
| `test` | Testing | jest, playwright, tdd, e2e |
|
|
24
|
+
| `sec` | Security | auth, oauth, jwt, owasp, pentest |
|
|
25
|
+
| `git` | Git/Workflow | pr, review, commit, branching |
|
|
26
|
+
| `mob` | Mobile | react-native, flutter, ios, android |
|
|
27
|
+
| `py` | Python | django, flask, fastapi, pandas |
|
|
28
|
+
| `go` | Golang | gin, echo, fiber, concurrency |
|
|
13
29
|
|
|
14
30
|
## Detection Flow
|
|
15
31
|
|
|
16
32
|
```
|
|
17
|
-
User Request → Extract
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
User Request → Extract keywords (react, auth, test, etc.)
|
|
34
|
+
↓
|
|
35
|
+
Read skills-compact.json
|
|
36
|
+
↓
|
|
37
|
+
Match skill names containing keywords
|
|
38
|
+
↓
|
|
39
|
+
Found? → Suggest: "I found /skill-name. Use it?"
|
|
40
|
+
↓ No
|
|
41
|
+
Check category (fe, be, ai, etc.)
|
|
42
|
+
↓
|
|
43
|
+
Suggest skills in that category
|
|
26
44
|
```
|
|
27
45
|
|
|
28
46
|
## How to Search
|
|
29
47
|
|
|
30
|
-
### Step 1:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
48
|
+
### Step 1: Read Compact Index
|
|
49
|
+
```
|
|
50
|
+
Read: .claude/skills-compact.json
|
|
51
|
+
Format: { "_categories": {...}, "skills": { "skill-name": "category-code" } }
|
|
52
|
+
```
|
|
35
53
|
|
|
36
|
-
### Step 2: Keyword
|
|
54
|
+
### Step 2: Match by Name/Keyword
|
|
55
|
+
Look for skills whose name contains user's keywords:
|
|
56
|
+
- User says "react" → find skills with "react" in name
|
|
57
|
+
- User says "authentication" → find "auth" skills
|
|
58
|
+
- User says "docker" → find "docker" skills
|
|
59
|
+
|
|
60
|
+
### Step 3: Load Full Skill
|
|
61
|
+
When user confirms, read the full skill:
|
|
37
62
|
```
|
|
38
|
-
Read: .claude/skills-
|
|
39
|
-
Find: keywords from user request
|
|
40
|
-
Result: List of matching skill names
|
|
63
|
+
Read: .claude/skills/{skill-name}/SKILL.md
|
|
41
64
|
```
|
|
42
65
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- `backend` - Node, API, REST, GraphQL
|
|
47
|
-
- `database` - SQL, Postgres, MongoDB, Redis
|
|
48
|
-
- `ai-ml` - LLM, Agents, RAG, Embeddings
|
|
49
|
-
- `devops` - Docker, K8s, CI/CD, Cloud
|
|
50
|
-
- `testing` - Jest, Playwright, TDD
|
|
51
|
-
- `security` - Auth, OAuth, OWASP
|
|
52
|
-
- `mobile` - React Native, Flutter, iOS
|
|
53
|
-
- `git-workflow` - PR, Code Review, Branching
|
|
54
|
-
|
|
55
|
-
### Step 4: Suggest
|
|
56
|
-
|
|
57
|
-
**Format for suggestion:**
|
|
66
|
+
## Suggestion Format
|
|
67
|
+
|
|
68
|
+
**Single match:**
|
|
58
69
|
```
|
|
59
|
-
I found a skill that might help
|
|
70
|
+
I found a skill that might help:
|
|
60
71
|
|
|
61
|
-
📌 /skill-name -
|
|
72
|
+
📌 /skill-name - [category]
|
|
62
73
|
|
|
63
|
-
|
|
74
|
+
Load this skill? It has specialized patterns for your task.
|
|
64
75
|
```
|
|
65
76
|
|
|
66
|
-
**
|
|
77
|
+
**Multiple matches (max 3):**
|
|
67
78
|
```
|
|
68
|
-
I found
|
|
79
|
+
I found skills that might help:
|
|
69
80
|
|
|
70
|
-
1. /skill-1 -
|
|
71
|
-
2. /skill-2 -
|
|
72
|
-
3. /skill-3 -
|
|
81
|
+
1. /skill-1 - [category]
|
|
82
|
+
2. /skill-2 - [category]
|
|
83
|
+
3. /skill-3 - [category]
|
|
73
84
|
|
|
74
|
-
Which one should I use? (or
|
|
85
|
+
Which one should I use? (or "none" to proceed without)
|
|
75
86
|
```
|
|
76
87
|
|
|
77
88
|
## Auto-Activate Triggers
|
|
78
89
|
|
|
79
|
-
Some
|
|
90
|
+
Some patterns should auto-suggest specific skills:
|
|
80
91
|
|
|
81
|
-
|
|
|
82
|
-
|
|
83
|
-
| "create PR", "pull request" | /
|
|
92
|
+
| User says... | Suggest skill |
|
|
93
|
+
|--------------|---------------|
|
|
94
|
+
| "create PR", "pull request" | /git-advanced-workflows |
|
|
84
95
|
| "code review" | /code-review |
|
|
85
96
|
| "write tests", "add tests" | /test-master |
|
|
86
97
|
| "fix bug", "debug" | /systematic-debugging |
|
|
87
|
-
| "
|
|
88
|
-
| "
|
|
98
|
+
| "learn", "teach me" | /learn |
|
|
99
|
+
| "react component" | /react-expert |
|
|
100
|
+
| "nextjs", "next.js" | /nextjs-best-practices |
|
|
101
|
+
| "docker", "container" | /docker-expert |
|
|
102
|
+
| "api design" | /api-design-principles |
|
|
89
103
|
| "database schema" | /database-design |
|
|
104
|
+
| "authentication", "auth" | /auth-implementation-patterns |
|
|
105
|
+
| "mcp server" | /mcp-developer |
|
|
90
106
|
|
|
91
107
|
## Important Rules
|
|
92
108
|
|
|
93
|
-
1. **Don't
|
|
94
|
-
2. **
|
|
95
|
-
3. **
|
|
109
|
+
1. **Don't auto-load** - Always ask before loading a skill
|
|
110
|
+
2. **Max 3 suggestions** - Don't overwhelm user
|
|
111
|
+
3. **Be concise** - One-line per skill
|
|
96
112
|
4. **Remember context** - If user said "none", don't suggest again for same task
|
|
97
|
-
5. **
|
|
113
|
+
5. **On-demand loading** - Only read full SKILL.md when user confirms
|
|
114
|
+
6. **Core commands available** - /learn, /react-expert, /docker-expert, etc. are pre-loaded
|
|
98
115
|
|
|
99
|
-
##
|
|
116
|
+
## File Locations
|
|
100
117
|
|
|
101
118
|
| File | Purpose | Size |
|
|
102
119
|
|------|---------|------|
|
|
103
|
-
| `skills-
|
|
104
|
-
| `skills
|
|
105
|
-
| `
|
|
106
|
-
| `skills-index.json` | Full skill list | ~200KB |
|
|
120
|
+
| `skills-compact.json` | Quick lookup index | ~20KB |
|
|
121
|
+
| `skills/{name}/SKILL.md` | Full skill content | varies |
|
|
122
|
+
| `commands/*.md` | Core commands (pre-loaded) | ~400KB |
|
|
107
123
|
|
|
108
|
-
## Example
|
|
124
|
+
## Example Interaction
|
|
109
125
|
|
|
110
|
-
**User:** "
|
|
126
|
+
**User:** "Help me add JWT authentication to my Express API"
|
|
111
127
|
|
|
112
|
-
**Claude:**
|
|
128
|
+
**Claude:** (reads skills-compact.json, finds "auth-implementation-patterns")
|
|
113
129
|
```
|
|
114
|
-
I found
|
|
130
|
+
I found a skill that matches your task:
|
|
115
131
|
|
|
116
|
-
📌 /auth-patterns -
|
|
117
|
-
📌 /express-expert - Express.js best practices and middleware
|
|
132
|
+
📌 /auth-implementation-patterns - security
|
|
118
133
|
|
|
119
|
-
|
|
134
|
+
This skill has JWT, OAuth2, and session patterns. Load it?
|
|
120
135
|
```
|
|
121
136
|
|
|
122
|
-
**User:** "
|
|
137
|
+
**User:** "yes"
|
|
123
138
|
|
|
124
|
-
**Claude:**
|
|
125
|
-
```
|
|
126
|
-
I found a relevant skill:
|
|
127
|
-
|
|
128
|
-
📌 /react-performance - React optimization patterns, memo, lazy loading, profiling
|
|
129
|
-
|
|
130
|
-
Want me to apply these optimization patterns?
|
|
131
|
-
```
|
|
139
|
+
**Claude:** (reads skills/auth-implementation-patterns/SKILL.md and applies it)
|