@ngxtm/devkit 3.20.0 → 3.21.0

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.
@@ -0,0 +1,22 @@
1
+ ---
2
+ description: "\U0001F504 Recover context from a previous session checkpoint"
3
+ ---
4
+
5
+ Look for checkpoint files in `.claude/sessions/` directory and recover context from a previous session.
6
+
7
+ ## Workflow
8
+
9
+ 1. **Check git**: Run `git rev-parse --is-inside-work-tree 2>/dev/null` to detect git repo
10
+ 2. **Get branch**: If git repo, run `git branch --show-current` to get current branch
11
+ 3. **Find checkpoints**: Glob `.claude/sessions/*.md` to list all checkpoint files
12
+ 4. **Cleanup stale**: Delete any checkpoint files older than 7 days (abandoned sessions)
13
+ 5. **Check results**: If no checkpoints remain → tell user "No active checkpoints found"
14
+ 6. **Filter by branch**: If git repo, filter checkpoints matching `branch:{current-branch}` in the first line. If no match on current branch, show all checkpoints with branch labels.
15
+ 7. **Show recent**: Display max 5 most recent checkpoints (sorted by filename date prefix `YYMMDD-HHMM`)
16
+ 8. **Select**: If only 1 match → read it automatically. If multiple → always list them and let user pick using `AskUserQuestion`.
17
+ 9. **Validate**: Verify the checkpoint file has a `#` header line and a `## Next Action` section. If malformed, skip it and try the next one.
18
+ 10. **Display summary**: Show the checkpoint's task description, current phase, progress (done/pending), next action, and referenced plan file
19
+ 11. **Confirm**: Ask user "Continue from this checkpoint?"
20
+ 12. **Resume**: If yes → read the referenced plan file (if any) and proceed with the Next Action from the checkpoint
21
+
22
+ **IMPORTANT**: For non-git projects, skip branch filtering and show all checkpoints.
@@ -95,15 +95,31 @@ For each item in `external-skills`:
95
95
 
96
96
  ### Step 5: Evaluate Rules
97
97
 
98
+ **IMPORTANT:** Never overwrite or sync rules in `rules/base/`. Base rules are devkit-native and managed manually. Only evaluate rules in tech-specific directories.
99
+
98
100
  For each item in `rules.new`:
99
101
  1. Read the rule content from `path` field
100
102
  2. Classify: useful (covers new pattern) or skip (duplicate/too generic)
101
- 3. In `--auto` mode: sync all useful
102
- 4. In interactive mode: ask user
103
+ 3. Count lines if > 50 lines, flag as "verbose, needs compaction"
104
+ 4. In `--auto` mode: sync all useful (compact verbose ones automatically)
105
+ 5. In interactive mode: ask user
103
106
 
104
107
  For each item in `rules.updated`:
105
108
  1. Compare upstream and local content
106
109
  2. Accept meaningful updates, skip trivial ones
110
+ 3. Count lines — if > 50 lines, flag as "verbose, needs compaction"
111
+
112
+ **Note:** Size-based compaction applies to RULES only. Skills are loaded on-demand and do not need compaction.
113
+
114
+ ### Step 5.5: Compact Verbose Rules
115
+
116
+ For each rule flagged as verbose (> 50 lines):
117
+ 1. Read full content
118
+ 2. Compact while preserving: core patterns, conventions, do's/don'ts, lookup tables, key code examples (max 1-2)
119
+ 3. Remove: redundant explanations, excessive examples, sections repeating what Claude already knows, full example interactions/dialogs
120
+ 4. Target: ≤ 50 lines for tech rules
121
+ 5. In `--auto` mode: compact automatically
122
+ 6. In interactive mode: show line count before/after, ask user
107
123
 
108
124
  ### Step 6: Apply Changes
109
125
 
@@ -134,7 +150,7 @@ npm run build
134
150
 
135
151
  Stage and commit the changes:
136
152
  ```bash
137
- git add skills/ rules/ merged-commands/ SKILLS_INDEX.md skills-index.json skills-compact.json skills-graph.json rules-index.json
153
+ git add skills/ rules/ merged-commands/ templates/ SKILLS_INDEX.md skills-index.json skills-compact.json skills-graph.json rules-index.json
138
154
  ```
139
155
 
140
156
  Commit message format:
@@ -162,9 +178,17 @@ If stash was created earlier: `git stash pop` to restore user's changes.
162
178
  - Always update version tracking
163
179
  - Never overwrite devkit-specific frontmatter (`triggers`, `role`, `scope`, `output-format`)
164
180
 
165
- ### Rules
166
- - **Accept**: Rule covers useful pattern not in existing rules
181
+ ### Rules (loaded every turn — context cost matters)
182
+ - **Accept**: Useful pattern, 50 lines
183
+ - **Compact**: Useful but > 50 lines → reduce while preserving core content
167
184
  - **Skip**: Duplicate or too generic
185
+ - **Protect**: Never touch rules/base/ (devkit-native)
186
+
187
+ ### Skills (loaded on-demand — no compaction needed)
188
+ - **Useful**: Covers distinct domain, well-structured SKILL.md, actionable patterns/commands
189
+ - **Duplicate**: Similar name or description to existing skill in skills-compact.json
190
+ - **Skip**: Too niche, low quality, just "be a senior X engineer" boilerplate
191
+ - No size-based compaction — verbose skills are acceptable
168
192
 
169
193
  ## Important
170
194
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngxtm/devkit",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "Per-project AI skills with smart tech detection - lightweight and context-optimized",
5
5
  "main": "cli/index.js",
6
6
  "bin": {
@@ -0,0 +1,60 @@
1
+ # Auto-Skill Detection
2
+
3
+ > Automatically detect and suggest relevant skills based on user's task
4
+
5
+ ## When to Activate
6
+
7
+ Before starting ANY coding task, check if a relevant skill exists:
8
+
9
+ 1. **Analyze** the user's request — extract key technologies, patterns, or domains
10
+ 2. **Search** `skills-compact.json` for matching skill names/descriptions
11
+ 3. **Suggest** top 1-3 matching skills with name and category
12
+ 4. **Load** on user confirmation — read full skill from `skills/{name}/SKILL.md`
13
+
14
+ ## 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 |
29
+
30
+ ## How to Search
31
+
32
+ 1. Read `skills-compact.json` — format: `{ "skills": { "name": { "c": "category", "d": "description" } } }`
33
+ 2. Match skills whose name or description contains user's keywords
34
+ 3. If no direct match, suggest skills from the matching category
35
+ 4. On confirmation, read `skills/{skill-name}/SKILL.md`
36
+
37
+ ## Auto-Activate Triggers
38
+
39
+ | User says... | Suggest skill |
40
+ |--------------|---------------|
41
+ | "create PR", "pull request" | /git-advanced-workflows |
42
+ | "code review" | /code-review |
43
+ | "write tests", "add tests" | /test-master |
44
+ | "fix bug", "debug" | /systematic-debugging |
45
+ | "learn", "teach me" | /learn |
46
+ | "react component" | /react-expert |
47
+ | "nextjs", "next.js" | /nextjs-best-practices |
48
+ | "docker", "container" | /docker-expert |
49
+ | "api design" | /api-design-principles |
50
+ | "database schema" | /database-design |
51
+ | "authentication", "auth" | /auth-implementation-patterns |
52
+ | "mcp server" | /mcp-developer |
53
+
54
+ ## Rules
55
+
56
+ 1. **Don't auto-load** — always ask before loading a skill
57
+ 2. **Max 3 suggestions** — don't overwhelm user
58
+ 3. **Be concise** — one-line per skill suggestion
59
+ 4. **Remember context** — if user said "none", don't suggest again for same task
60
+ 5. **On-demand only** — only read full SKILL.md when user confirms
@@ -0,0 +1,58 @@
1
+ # Command Routing Guide
2
+
3
+ > Help Claude choose the right command and execution mode for each task.
4
+
5
+ ## Decision Tree
6
+
7
+ ```
8
+ Is this a learning/educational request?
9
+ → /learn
10
+
11
+ Is this brainstorming/ideation only (no code)?
12
+ → /brainstorm
13
+
14
+ Is this just planning (no implementation)?
15
+ → /plan
16
+
17
+ Is this a bug fix?
18
+ → /fix (simple) or /fix:hard (complex)
19
+
20
+ Is this a small, well-defined task?
21
+ → /cook:fast
22
+
23
+ Is this a medium task with clear requirements?
24
+ → /cook:auto (auto: plan → code → commit)
25
+ → OR /plan → /code (manual control)
26
+
27
+ Is this a complex, full-lifecycle feature?
28
+ → /cook:hard (includes brainstorm+research+plan+code+test+review)
29
+ → OR /brainstorm → /plan → /code (manual, more control)
30
+ ```
31
+
32
+ ## Anti-Patterns
33
+
34
+ - **NEVER** chain `/brainstorm` → `/plan` before `/cook:hard` — it already includes both internally, causing duplicate work
35
+ - **NEVER** use `/cook:hard` for trivial fixes — overkill, wastes context
36
+ - **NEVER** use `/cook:fast` for complex features — skips research/design, leads to rework
37
+
38
+ ## Command Reference
39
+
40
+ | Command | Complexity | Multi-Agent | Best For |
41
+ |---------|-----------|-------------|----------|
42
+ | `/cook:fast` | Low | Light (scouter, engineer) | Well-defined small tasks |
43
+ | `/cook` | Medium | Yes (full team) | Standard feature work |
44
+ | `/cook:auto` | Medium | Yes (plan → code → git) | Autonomous implementation |
45
+ | `/cook:hard` | High | Full (8 phases, all agents) | Complex features from scratch |
46
+ | `/brainstorm` | N/A | No | Ideation, design exploration |
47
+ | `/plan` | N/A | Optional (researcher) | Creating implementation plans |
48
+ | `/code` | Medium | Yes (tester, reviewer) | Executing an existing plan |
49
+ | `/learn` | N/A | No | Interactive tutorials |
50
+ | `/fix` | Low | No | Quick bug fixes |
51
+ | `/fix:hard` | Medium | Yes (debugger, tester) | Complex debugging |
52
+
53
+ ## When to Suggest Skills
54
+
55
+ After choosing the right command, check if a domain-specific skill would help:
56
+ - User says "react" → suggest `/react-expert` skill alongside chosen command
57
+ - User says "auth" → suggest `/auth-implementation-patterns` skill
58
+ - See `auto-skill.md` for full detection flow
@@ -0,0 +1,38 @@
1
+ # Context Checkpoint
2
+
3
+ Auto-save session state to `.claude/sessions/` for context recovery.
4
+
5
+ ## When to Checkpoint
6
+ After completing a subtask: implementing a feature step, running tests, phase transitions,
7
+ receiving Task agent results, making key decisions.
8
+ Do NOT checkpoint per individual file edit — wait until the subtask is complete.
9
+
10
+ ## Skip Checkpoint
11
+ Simple Q&A, exploration reads, brainstorming, tasks completing in < 3 steps.
12
+
13
+ ## Protocol
14
+ 1. First checkpoint → ensure `.claude/sessions` is covered by `.gitignore`
15
+ (skip if `.claude/` or `.claude/sessions` already in gitignore), then create
16
+ `.claude/sessions/{YYMMDD-HHMM-desc}.md`
17
+ 2. Include `branch:{branch}` in header if in a git repo. Omit if not git.
18
+ 3. Update same file at each subsequent trigger. Silent — don't announce.
19
+ 4. Keep each section to 10 items max. Summarize older items if needed.
20
+ 5. On task completion → delete the checkpoint file.
21
+
22
+ ## Recovery
23
+ If you recall working on a task but notice gaps in your prior context (earlier messages
24
+ seem compressed or summarized), check `.claude/sessions/` for a matching checkpoint
25
+ to restore state. Verify checkpoint has a `#` header and `## Next Action` before using.
26
+ Say: "Resumed from checkpoint. Continuing..."
27
+ Do NOT auto-load checkpoints in a fresh session — use `/recover` for cross-session.
28
+
29
+ ## Format
30
+ ```
31
+ # {desc} | {command} | {phase} | branch:{branch}
32
+ ## Plan — {path or "none"}
33
+ ## Done — {bullets}
34
+ ## Pending — {bullets}
35
+ ## Decisions — {bullets}
36
+ ## Next Action — {exact step}
37
+ ## Files — Modified: {list} | Remaining: {list}
38
+ ```
package/rules-index.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "1.0.0",
3
- "generatedAt": "2026-02-27T15:08:44.475Z",
3
+ "generatedAt": "2026-02-28T03:44:29.823Z",
4
4
  "templates": {
5
5
  "dart": {
6
6
  "path": "templates/dart/rules",
@@ -109,6 +109,7 @@ function organizeRules() {
109
109
  const stats = {};
110
110
 
111
111
  for (const ruleDir of rulesDirs) {
112
+ if (ruleDir === 'base') continue; // base rules handled by createBaseTemplate
112
113
  const srcDir = path.join(RULES_DIR, ruleDir);
113
114
  const tech = RULES_MAPPING[ruleDir] || ruleDir;
114
115
  const destDir = path.join(TEMPLATES_DIR, tech, 'rules', ruleDir);
@@ -171,6 +172,14 @@ function createBaseTemplate() {
171
172
  }
172
173
 
173
174
  console.log(' Created base template with essential hooks');
175
+
176
+ // Copy base rules from rules/base/ to templates/base/rules/
177
+ const baseRulesSource = path.join(RULES_DIR, 'base');
178
+ const baseRulesDest = path.join(baseDir, 'rules');
179
+ if (fs.existsSync(baseRulesSource)) {
180
+ const count = copyDir(baseRulesSource, baseRulesDest);
181
+ console.log(` Copied ${count} base rules`);
182
+ }
174
183
  }
175
184
 
176
185
  /**
package/skills-graph.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "_meta": {
3
3
  "version": 2,
4
- "lastUpdated": "2026-02-27",
4
+ "lastUpdated": "2026-02-28",
5
5
  "stats": {
6
6
  "totalSkills": 1127,
7
7
  "graphedSkills": 1070,
@@ -4,14 +4,14 @@
4
4
 
5
5
  ## When to Activate
6
6
 
7
- Before starting ANY coding task, you SHOULD check if a relevant skill exists:
7
+ Before starting ANY coding task, check if a relevant skill exists:
8
8
 
9
- 1. **Analyze the user's request** - Extract key technologies, patterns, or domains
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`
9
+ 1. **Analyze** the user's request extract key technologies, patterns, or domains
10
+ 2. **Search** `skills-compact.json` for matching skill names/descriptions
11
+ 3. **Suggest** top 1-3 matching skills with name and category
12
+ 4. **Load** on user confirmation read full skill from `skills/{name}/SKILL.md`
13
13
 
14
- ## Quick Reference: Skill Categories
14
+ ## Skill Categories
15
15
 
16
16
  | Code | Category | Examples |
17
17
  |------|----------|----------|
@@ -27,69 +27,15 @@ Before starting ANY coding task, you SHOULD check if a relevant skill exists:
27
27
  | `py` | Python | django, flask, fastapi, pandas |
28
28
  | `go` | Golang | gin, echo, fiber, concurrency |
29
29
 
30
- ## Detection Flow
31
-
32
- ```
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
44
- ```
45
-
46
30
  ## How to Search
47
31
 
48
- ### Step 1: Read Compact Index
49
- ```
50
- Read: .claude/skills-compact.json
51
- Format: { "_categories": {...}, "skills": { "skill-name": { "c": "category", "d": "short description" } } }
52
- Note: Some skills may be just a category string if no description available.
53
- ```
54
-
55
- ### Step 2: Match by Name/Keyword
56
- Look for skills whose name OR description contains user's keywords:
57
- - User says "react" → find skills with "react" in name
58
- - User says "authentication" → find "auth" skills
59
- - User says "docker" → find "docker" skills
60
-
61
- ### Step 3: Load Full Skill
62
- When user confirms, read the full skill:
63
- ```
64
- Read: .claude/skills/{skill-name}/SKILL.md
65
- ```
66
-
67
- ## Suggestion Format
68
-
69
- **Single match:**
70
- ```
71
- I found a skill that might help:
72
-
73
- 📌 /skill-name - [category]
74
-
75
- Load this skill? It has specialized patterns for your task.
76
- ```
77
-
78
- **Multiple matches (max 3):**
79
- ```
80
- I found skills that might help:
81
-
82
- 1. /skill-1 - [category]
83
- 2. /skill-2 - [category]
84
- 3. /skill-3 - [category]
85
-
86
- Which one should I use? (or "none" to proceed without)
87
- ```
32
+ 1. Read `skills-compact.json` — format: `{ "skills": { "name": { "c": "category", "d": "description" } } }`
33
+ 2. Match skills whose name or description contains user's keywords
34
+ 3. If no direct match, suggest skills from the matching category
35
+ 4. On confirmation, read `skills/{skill-name}/SKILL.md`
88
36
 
89
37
  ## Auto-Activate Triggers
90
38
 
91
- Some patterns should auto-suggest specific skills:
92
-
93
39
  | User says... | Suggest skill |
94
40
  |--------------|---------------|
95
41
  | "create PR", "pull request" | /git-advanced-workflows |
@@ -105,36 +51,10 @@ Some patterns should auto-suggest specific skills:
105
51
  | "authentication", "auth" | /auth-implementation-patterns |
106
52
  | "mcp server" | /mcp-developer |
107
53
 
108
- ## Important Rules
109
-
110
- 1. **Don't auto-load** - Always ask before loading a skill
111
- 2. **Max 3 suggestions** - Don't overwhelm user
112
- 3. **Be concise** - One-line per skill
113
- 4. **Remember context** - If user said "none", don't suggest again for same task
114
- 5. **On-demand loading** - Only read full SKILL.md when user confirms
115
- 6. **Core commands available** - /learn, /react-expert, /docker-expert, etc. are pre-loaded
116
-
117
- ## File Locations
118
-
119
- | File | Purpose | Size |
120
- |------|---------|------|
121
- | `skills-compact.json` | Quick lookup index | ~20KB |
122
- | `skills/{name}/SKILL.md` | Full skill content | varies |
123
- | `commands/*.md` | Core commands (pre-loaded) | ~400KB |
124
-
125
- ## Example Interaction
126
-
127
- **User:** "Help me add JWT authentication to my Express API"
128
-
129
- **Claude:** (reads skills-compact.json, finds "auth-implementation-patterns")
130
- ```
131
- I found a skill that matches your task:
132
-
133
- 📌 /auth-implementation-patterns - security
134
-
135
- This skill has JWT, OAuth2, and session patterns. Load it?
136
- ```
137
-
138
- **User:** "yes"
54
+ ## Rules
139
55
 
140
- **Claude:** (reads skills/auth-implementation-patterns/SKILL.md and applies it)
56
+ 1. **Don't auto-load** always ask before loading a skill
57
+ 2. **Max 3 suggestions** — don't overwhelm user
58
+ 3. **Be concise** — one-line per skill suggestion
59
+ 4. **Remember context** — if user said "none", don't suggest again for same task
60
+ 5. **On-demand only** — only read full SKILL.md when user confirms
@@ -50,19 +50,6 @@ Is this a complex, full-lifecycle feature?
50
50
  | `/fix` | Low | No | Quick bug fixes |
51
51
  | `/fix:hard` | Medium | Yes (debugger, tester) | Complex debugging |
52
52
 
53
- ## Multi-Agent Phases in /cook:hard
54
-
55
- ```
56
- Phase 1: brainstormer → Requirements discovery
57
- Phase 2: researcher → Best practices research
58
- Phase 3: scouter → Codebase analysis
59
- Phase 4: designer → UI/UX design (if needed)
60
- Phase 5: planner → Implementation plan
61
- Phase 6: tech-lead → Routes to specialist engineers
62
- Phase 7: tester → Testing
63
- Phase 8: reviewer → Code review
64
- ```
65
-
66
53
  ## When to Suggest Skills
67
54
 
68
55
  After choosing the right command, check if a domain-specific skill would help:
@@ -0,0 +1,38 @@
1
+ # Context Checkpoint
2
+
3
+ Auto-save session state to `.claude/sessions/` for context recovery.
4
+
5
+ ## When to Checkpoint
6
+ After completing a subtask: implementing a feature step, running tests, phase transitions,
7
+ receiving Task agent results, making key decisions.
8
+ Do NOT checkpoint per individual file edit — wait until the subtask is complete.
9
+
10
+ ## Skip Checkpoint
11
+ Simple Q&A, exploration reads, brainstorming, tasks completing in < 3 steps.
12
+
13
+ ## Protocol
14
+ 1. First checkpoint → ensure `.claude/sessions` is covered by `.gitignore`
15
+ (skip if `.claude/` or `.claude/sessions` already in gitignore), then create
16
+ `.claude/sessions/{YYMMDD-HHMM-desc}.md`
17
+ 2. Include `branch:{branch}` in header if in a git repo. Omit if not git.
18
+ 3. Update same file at each subsequent trigger. Silent — don't announce.
19
+ 4. Keep each section to 10 items max. Summarize older items if needed.
20
+ 5. On task completion → delete the checkpoint file.
21
+
22
+ ## Recovery
23
+ If you recall working on a task but notice gaps in your prior context (earlier messages
24
+ seem compressed or summarized), check `.claude/sessions/` for a matching checkpoint
25
+ to restore state. Verify checkpoint has a `#` header and `## Next Action` before using.
26
+ Say: "Resumed from checkpoint. Continuing..."
27
+ Do NOT auto-load checkpoints in a fresh session — use `/recover` for cross-session.
28
+
29
+ ## Format
30
+ ```
31
+ # {desc} | {command} | {phase} | branch:{branch}
32
+ ## Plan — {path or "none"}
33
+ ## Done — {bullets}
34
+ ## Pending — {bullets}
35
+ ## Decisions — {bullets}
36
+ ## Next Action — {exact step}
37
+ ## Files — Modified: {list} | Remaining: {list}
38
+ ```