@harshitj183/ai-skills 2.2.7 → 2.2.8
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/README.md +29 -209
- package/SKILL.md +162 -160
- package/history/CONTEXT.md +15 -0
- package/index.js +8 -0
- package/package.json +38 -43
- package/registry/skill_bank.json +1038 -1167
- package/roles/backend_expert.md +23 -23
- package/roles/code_reviewer.md +28 -28
- package/roles/frontend_expert.md +30 -30
- package/roles/gpt5_core.md +34 -34
- package/roles/hinglish_native.md +30 -0
- package/roles/product_manager.md +24 -24
- package/roles/security_auditor.md +31 -22
- package/roles/subagent_orchestrator.md +26 -26
- package/roles/technical_writer.md +25 -25
- package/roles/ui_ux_designer.md +22 -22
- package/roles/wisdom_extractor.md +29 -29
- package/skills/ai_history_maintenance.md +46 -41
- package/skills/anthropic_documents.md +16 -16
- package/skills/antigravity_mastery.md +15 -15
- package/skills/azure_graph_integrator.md +12 -12
- package/skills/coderabbit_review.md +36 -0
- package/skills/composio_integrator.md +16 -16
- package/skills/github_automation.md +17 -17
- package/skills/hashicorp_terraform.md +16 -16
- package/skills/letta_agent_memory.md +15 -15
- package/skills/lifecycle/brainstorming.md +58 -24
- package/skills/lifecycle/review_protocol.md +36 -25
- package/skills/mcp_master.md +17 -17
- package/skills/memory_cycle.md +45 -0
- package/skills/openai_structured_outputs.md +12 -12
- package/skills/orchestration/external_skill_retrieval.md +46 -30
- package/skills/orchestration/parallel_agent_dispatcher.md +38 -32
- package/skills/orchestration/plan_architect.md +32 -22
- package/skills/orchestration/plan_executor.md +34 -20
- package/skills/playwright_testing.md +15 -15
- package/skills/progressive_disclosure.md +26 -26
- package/skills/prompt_reasoning_trees.md +12 -12
- package/skills/react_best_practices.md +16 -16
- package/skills/react_native_performance.md +16 -16
- package/skills/sanity_architecture.md +16 -16
- package/skills/stripe_integration.md +17 -17
- package/skills/supabase_architect.md +17 -17
- package/skills/systematic_debugging.md +34 -34
- package/skills/tdd_mastery.md +32 -32
- package/skills/vercel_cloudflare_deploy.md +17 -17
- package/skills/writing_skills.md +26 -26
- package/LICENSE +0 -21
- package/bin/cli.js +0 -345
package/skills/tdd_mastery.md
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: "TDD Mastery"
|
|
3
|
-
description: "Rigorous Test-Driven Development workflow for high-reliability code."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 1. The Red-Green-Refactor Cycle
|
|
7
|
-
Every code change MUST follow this exact sequence:
|
|
8
|
-
|
|
9
|
-
```mermaid
|
|
10
|
-
graph LR;
|
|
11
|
-
A[Red: Write failing test] --> B[Green: Make it pass];
|
|
12
|
-
B --> C[Refactor: Clean & Optimize];
|
|
13
|
-
C --> A;
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
# 2. Strict Standards
|
|
17
|
-
- **Isolation**: Each test should verify a single unit of logic.
|
|
18
|
-
- **Mocking**: Use standard mocking for external dependencies (DBs, APIs).
|
|
19
|
-
- **Naming**: Tests should read like documentation (e.g., `test_should_reject_invalid_email`).
|
|
20
|
-
|
|
21
|
-
# 3. Execution Protocol
|
|
22
|
-
1. **Red**: Run the test suite first; it must fail with a specific, expected error.
|
|
23
|
-
2. **Green**: Implement the *minimal* code to make that exact test pass. Avoid "future-proofing".
|
|
24
|
-
3. **Refactor**: Only after passing can you clean up the code. Ensure the test remains green.
|
|
25
|
-
|
|
26
|
-
# 4. Success Criteria
|
|
27
|
-
- Test coverage for all logical branches.
|
|
28
|
-
- No "side-effects" in tests.
|
|
29
|
-
- Clear, readable assertions.
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
⚡ Smart AI Skills Library | v2.2.
|
|
1
|
+
---
|
|
2
|
+
name: "TDD Mastery"
|
|
3
|
+
description: "Rigorous Test-Driven Development workflow for high-reliability code."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 1. The Red-Green-Refactor Cycle
|
|
7
|
+
Every code change MUST follow this exact sequence:
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
graph LR;
|
|
11
|
+
A[Red: Write failing test] --> B[Green: Make it pass];
|
|
12
|
+
B --> C[Refactor: Clean & Optimize];
|
|
13
|
+
C --> A;
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
# 2. Strict Standards
|
|
17
|
+
- **Isolation**: Each test should verify a single unit of logic.
|
|
18
|
+
- **Mocking**: Use standard mocking for external dependencies (DBs, APIs).
|
|
19
|
+
- **Naming**: Tests should read like documentation (e.g., `test_should_reject_invalid_email`).
|
|
20
|
+
|
|
21
|
+
# 3. Execution Protocol
|
|
22
|
+
1. **Red**: Run the test suite first; it must fail with a specific, expected error.
|
|
23
|
+
2. **Green**: Implement the *minimal* code to make that exact test pass. Avoid "future-proofing".
|
|
24
|
+
3. **Refactor**: Only after passing can you clean up the code. Ensure the test remains green.
|
|
25
|
+
|
|
26
|
+
# 4. Success Criteria
|
|
27
|
+
- Test coverage for all logical branches.
|
|
28
|
+
- No "side-effects" in tests.
|
|
29
|
+
- Clear, readable assertions.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
⚡ Smart AI Skills Library | v2.2.8 | Active
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: "Vercel & Cloudflare Deployment Master"
|
|
3
|
-
description: "Rules for Next.js, Edge Functions, Vercel configs, and Cloudflare Workers."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Vercel Next.js Rules
|
|
7
|
-
1. **Edge Runtime:** Prefer edge runtime for middleware and lightweight route handlers. Understand Edge limits (1MB code size, 50ms startup).
|
|
8
|
-
2. **Caching:** Strategically use Incremental Static Regeneration (ISR) with `revalidate` over pure SSR or Client-side fetching for speed.
|
|
9
|
-
3. **Environment Variables:** Map to `production`, `preview`, and `development` safely. Never leak `NEXT_PUBLIC_` secrets.
|
|
10
|
-
|
|
11
|
-
# Cloudflare Workers
|
|
12
|
-
- Do not use Node.js specific standard libraries (like `fs`, `path`) in Cloudflare workers without compatibility flags.
|
|
13
|
-
- Rely on Workers KV for high-read low-write data, and Durable Objects for state orchestration.
|
|
14
|
-
- Respond rapidly. Execution limits exist. Keep it minimal and fetch externally optimally asynchronously.
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
⚡ Smart AI Skills Library | v2.2.
|
|
1
|
+
---
|
|
2
|
+
name: "Vercel & Cloudflare Deployment Master"
|
|
3
|
+
description: "Rules for Next.js, Edge Functions, Vercel configs, and Cloudflare Workers."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Vercel Next.js Rules
|
|
7
|
+
1. **Edge Runtime:** Prefer edge runtime for middleware and lightweight route handlers. Understand Edge limits (1MB code size, 50ms startup).
|
|
8
|
+
2. **Caching:** Strategically use Incremental Static Regeneration (ISR) with `revalidate` over pure SSR or Client-side fetching for speed.
|
|
9
|
+
3. **Environment Variables:** Map to `production`, `preview`, and `development` safely. Never leak `NEXT_PUBLIC_` secrets.
|
|
10
|
+
|
|
11
|
+
# Cloudflare Workers
|
|
12
|
+
- Do not use Node.js specific standard libraries (like `fs`, `path`) in Cloudflare workers without compatibility flags.
|
|
13
|
+
- Rely on Workers KV for high-read low-write data, and Durable Objects for state orchestration.
|
|
14
|
+
- Respond rapidly. Execution limits exist. Keep it minimal and fetch externally optimally asynchronously.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
⚡ Smart AI Skills Library | v2.2.8 | Active
|
package/skills/writing_skills.md
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: "Meta-Skill Architect"
|
|
3
|
-
description: "Authoring and refining high-fidelity agentic superpowers for this library."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# 1. Authoring Protocol
|
|
7
|
-
When requested to create/modify a "Mega-Skill":
|
|
8
|
-
- **Constraint-First Design**: Define what the AI *cannot* do first.
|
|
9
|
-
- **Hierarchical Instruction**: Use `---` for metadata headers and `⚡ Smart AI Skills Library` for signatures.
|
|
10
|
-
- **Workflow Visualization**: Every complex skill MUST have a Mermaid flow charting its logic.
|
|
11
|
-
|
|
12
|
-
# 2. Design Thinking
|
|
13
|
-
- **Compression**: Minimize instruction token count without losing fidelity. Use bullet points and headers strategically.
|
|
14
|
-
- **Trigger Logic**: Use the `description` in the Metadata header as the primary trigger for LLM automatic skill adoption.
|
|
15
|
-
- **Best Practices Integration**: Refer to `anthropic_best_practices.md` and `google_standard_logic.md` (if available) for every new skill.
|
|
16
|
-
|
|
17
|
-
# 3. Validation
|
|
18
|
-
- Run `tests/validate_skills.py` after creating any new skill.
|
|
19
|
-
- Check for duplication or overlap with existing skills in the library.
|
|
20
|
-
|
|
21
|
-
# 4. Success Metrics
|
|
22
|
-
- 100% adherence to instructions in first-pass generation.
|
|
23
|
-
- No "hallucination" during skill-based workflows.
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
⚡ Smart AI Skills Library | v2.2.
|
|
1
|
+
---
|
|
2
|
+
name: "Meta-Skill Architect"
|
|
3
|
+
description: "Authoring and refining high-fidelity agentic superpowers for this library."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 1. Authoring Protocol
|
|
7
|
+
When requested to create/modify a "Mega-Skill":
|
|
8
|
+
- **Constraint-First Design**: Define what the AI *cannot* do first.
|
|
9
|
+
- **Hierarchical Instruction**: Use `---` for metadata headers and `⚡ Smart AI Skills Library` for signatures.
|
|
10
|
+
- **Workflow Visualization**: Every complex skill MUST have a Mermaid flow charting its logic.
|
|
11
|
+
|
|
12
|
+
# 2. Design Thinking
|
|
13
|
+
- **Compression**: Minimize instruction token count without losing fidelity. Use bullet points and headers strategically.
|
|
14
|
+
- **Trigger Logic**: Use the `description` in the Metadata header as the primary trigger for LLM automatic skill adoption.
|
|
15
|
+
- **Best Practices Integration**: Refer to `anthropic_best_practices.md` and `google_standard_logic.md` (if available) for every new skill.
|
|
16
|
+
|
|
17
|
+
# 3. Validation
|
|
18
|
+
- Run `tests/validate_skills.py` after creating any new skill.
|
|
19
|
+
- Check for duplication or overlap with existing skills in the library.
|
|
20
|
+
|
|
21
|
+
# 4. Success Metrics
|
|
22
|
+
- 100% adherence to instructions in first-pass generation.
|
|
23
|
+
- No "hallucination" during skill-based workflows.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
⚡ Smart AI Skills Library | v2.2.8 | Active
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Harshit Jaiswal
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/bin/cli.js
DELETED
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require('fs-extra');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { program } = require('commander');
|
|
6
|
-
const inquirer = require('inquirer');
|
|
7
|
-
|
|
8
|
-
// ANSI Terminal Colors
|
|
9
|
-
const colors = {
|
|
10
|
-
reset: "\x1b[0m",
|
|
11
|
-
bright: "\x1b[1m",
|
|
12
|
-
green: "\x1b[32m",
|
|
13
|
-
blue: "\x1b[34m",
|
|
14
|
-
cyan: "\x1b[36m",
|
|
15
|
-
yellow: "\x1b[33m",
|
|
16
|
-
red: "\x1b[31m"
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const targetDir = process.cwd();
|
|
20
|
-
const sourceDir = path.join(__dirname, '..');
|
|
21
|
-
const targetDirBase = path.join(targetDir, 'smart-instructions');
|
|
22
|
-
|
|
23
|
-
program
|
|
24
|
-
.name('ai-skills')
|
|
25
|
-
.description('The Ultimate AI Skill Library CLI')
|
|
26
|
-
.version('2.2.7');
|
|
27
|
-
|
|
28
|
-
program
|
|
29
|
-
.command('init')
|
|
30
|
-
.description('Installs the Smart AI Skills Library')
|
|
31
|
-
.option('-i, --interactive', 'Run interactively to select specific roles/skills')
|
|
32
|
-
.option('-r, --roles <roles>', 'Comma-separated list of roles to install')
|
|
33
|
-
.option('-s, --skills <skills>', 'Comma-separated list of skills to install')
|
|
34
|
-
.action(async (options) => {
|
|
35
|
-
console.log(`${colors.bright}${colors.cyan}Initializing Smart AI Skills Library...${colors.reset}\n`);
|
|
36
|
-
|
|
37
|
-
const availableRoles = fs.existsSync(path.join(sourceDir, 'roles')) ? fs.readdirSync(path.join(sourceDir, 'roles')) : [];
|
|
38
|
-
const availableSkills = fs.existsSync(path.join(sourceDir, 'skills')) ? fs.readdirSync(path.join(sourceDir, 'skills')) : [];
|
|
39
|
-
|
|
40
|
-
let selectedRoles = availableRoles;
|
|
41
|
-
let selectedSkills = availableSkills;
|
|
42
|
-
|
|
43
|
-
if (options.interactive) {
|
|
44
|
-
const { installType } = await inquirer.prompt([
|
|
45
|
-
{
|
|
46
|
-
type: 'list',
|
|
47
|
-
name: 'installType',
|
|
48
|
-
message: 'How would you like to install the skills?',
|
|
49
|
-
choices: [
|
|
50
|
-
'Install Everything (All 8 Roles, 17 Mega-Skills)',
|
|
51
|
-
'Custom Pick (Select specific roles and skills)'
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
]);
|
|
55
|
-
|
|
56
|
-
if (installType.startsWith('Custom')) {
|
|
57
|
-
const answers = await inquirer.prompt([
|
|
58
|
-
{
|
|
59
|
-
type: 'checkbox',
|
|
60
|
-
name: 'roles',
|
|
61
|
-
message: 'Select the Master Roles you need:',
|
|
62
|
-
choices: availableRoles.filter(f => f.endsWith('.md'))
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
type: 'checkbox',
|
|
66
|
-
name: 'skills',
|
|
67
|
-
message: 'Select the Mega-Skills you need:',
|
|
68
|
-
choices: availableSkills.filter(f => f.endsWith('.md'))
|
|
69
|
-
}
|
|
70
|
-
]);
|
|
71
|
-
selectedRoles = answers.roles;
|
|
72
|
-
selectedSkills = answers.skills;
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
if (options.roles) {
|
|
76
|
-
const rList = options.roles.split(',').map(r => r.trim());
|
|
77
|
-
selectedRoles = availableRoles.filter(r => rList.includes(r) || rList.includes(r.replace('.md', '')));
|
|
78
|
-
}
|
|
79
|
-
if (options.skills) {
|
|
80
|
-
const sList = options.skills.split(',').map(s => s.trim());
|
|
81
|
-
selectedSkills = availableSkills.filter(s => sList.includes(s) || sList.includes(s.replace('.md', '')));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (!fs.existsSync(targetDirBase)) {
|
|
86
|
-
fs.mkdirSync(targetDirBase, { recursive: true });
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
console.log(`\n${colors.blue}[+] Securing source control (.gitignore)...${colors.reset}`);
|
|
90
|
-
const ignoreRules = "\n\n# Smart AI Skills Library (Context Only)\nsmart-instructions/\n";
|
|
91
|
-
const gitignorePath = path.join(targetDir, '.gitignore');
|
|
92
|
-
if (fs.existsSync(gitignorePath)) {
|
|
93
|
-
const currentIgnore = fs.readFileSync(gitignorePath, 'utf8');
|
|
94
|
-
if (!currentIgnore.includes('# Smart AI Skills Library')) {
|
|
95
|
-
fs.appendFileSync(gitignorePath, ignoreRules);
|
|
96
|
-
}
|
|
97
|
-
} else {
|
|
98
|
-
fs.writeFileSync(gitignorePath, ignoreRules.trim() + "\n");
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
console.log(`${colors.blue}[+] Copying SKILL.md Master Rulebook...${colors.reset}`);
|
|
102
|
-
const targetSkillMd = path.join(targetDirBase, 'SKILL.md');
|
|
103
|
-
if (fs.existsSync(path.join(sourceDir, 'SKILL.md'))) {
|
|
104
|
-
fs.copyFileSync(path.join(sourceDir, 'SKILL.md'), targetSkillMd);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (selectedRoles.length > 0) {
|
|
108
|
-
console.log(`${colors.blue}[+] Extracting ${selectedRoles.length} Master Roles...${colors.reset}`);
|
|
109
|
-
fs.ensureDirSync(path.join(targetDirBase, 'roles'));
|
|
110
|
-
selectedRoles.forEach(role => {
|
|
111
|
-
fs.copySync(path.join(sourceDir, 'roles', role), path.join(targetDirBase, 'roles', role));
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (selectedSkills.length > 0) {
|
|
116
|
-
console.log(`${colors.blue}[+] Extracting ${selectedSkills.length} Mega-Skills...${colors.reset}`);
|
|
117
|
-
fs.ensureDirSync(path.join(targetDirBase, 'skills'));
|
|
118
|
-
selectedSkills.forEach(skill => {
|
|
119
|
-
fs.copySync(path.join(sourceDir, 'skills', skill), path.join(targetDirBase, 'skills', skill));
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
if (fs.existsSync(path.join(sourceDir, 'registry'))) {
|
|
123
|
-
console.log(`${colors.blue}[+] Embedding Global Skill Registry...${colors.reset}`);
|
|
124
|
-
fs.ensureDirSync(path.join(targetDirBase, 'registry'));
|
|
125
|
-
fs.copySync(path.join(sourceDir, 'registry'), path.join(targetDirBase, 'registry'));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Add History tracking for consumer context (Fresh Templates)
|
|
130
|
-
console.log(`${colors.blue}[+] Initializing History tracking logs (Fresh Templates)...${colors.reset}`);
|
|
131
|
-
const targetHistoryDir = path.join(targetDirBase, 'history');
|
|
132
|
-
fs.ensureDirSync(targetHistoryDir);
|
|
133
|
-
|
|
134
|
-
const historyTemplates = {
|
|
135
|
-
'CONTEXT.md': `# 📖 Project Context & History\n\nWelcome to your project's AI context hub. Maintain this file to ensure AI assistants understand the project state.\n\n## 🏃 Active Session\n- **Task**: Initialized Smart AI Skills Library (v${program.version()}).\n- **Date**: ${new Date().toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}\n\n## 🏆 Milestones\n- **Initialization**: Integrated AI Skills Library.\n\n---\n*Last updated by: AI Assistant (init)*`
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
Object.entries(historyTemplates).forEach(([filename, content]) => {
|
|
139
|
-
fs.writeFileSync(path.join(targetHistoryDir, filename), content);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
console.log(`\n${colors.bright}${colors.green}[Success] The 'smart-instructions' folder has been added to your project!${colors.reset}`);
|
|
143
|
-
console.log(`${colors.yellow}Tip: Let your AI Agent pick skills natively, or run 'npx ai-skills configure' to setup your IDE!${colors.reset}\n`);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
program
|
|
147
|
-
.command('configure')
|
|
148
|
-
.description('Auto-configures your IDE to use the skills')
|
|
149
|
-
.action(async () => {
|
|
150
|
-
console.log(`${colors.bright}${colors.cyan}IDE Auto-Configuration${colors.reset}\n`);
|
|
151
|
-
|
|
152
|
-
const targetSkillMd = path.join(targetDir, 'smart-instructions', 'SKILL.md');
|
|
153
|
-
if (!fs.existsSync(targetSkillMd)) {
|
|
154
|
-
console.error(`${colors.red}[Error] 'smart-instructions/SKILL.md' not found. Please run 'npx ai-skills init' first.${colors.reset}`);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const { ideSelection } = await inquirer.prompt([
|
|
159
|
-
{
|
|
160
|
-
type: 'list',
|
|
161
|
-
name: 'ideSelection',
|
|
162
|
-
message: 'Which AI IDE or tool are you using?',
|
|
163
|
-
choices: [
|
|
164
|
-
'Cursor (.cursorrules)',
|
|
165
|
-
'Windsurf (.windsurfrules)',
|
|
166
|
-
'Claude Code (CLAUDE.md)',
|
|
167
|
-
'GitHub Copilot (.github/copilot-instructions.md)',
|
|
168
|
-
'Cline (.clinerules)',
|
|
169
|
-
'Cancel'
|
|
170
|
-
]
|
|
171
|
-
}
|
|
172
|
-
]);
|
|
173
|
-
|
|
174
|
-
let destPath = '';
|
|
175
|
-
if (ideSelection.startsWith('Cursor')) destPath = '.cursorrules';
|
|
176
|
-
else if (ideSelection.startsWith('Windsurf')) destPath = '.windsurfrules';
|
|
177
|
-
else if (ideSelection.startsWith('Claude')) destPath = 'CLAUDE.md';
|
|
178
|
-
else if (ideSelection.startsWith('GitHub')) destPath = '.github/copilot-instructions.md';
|
|
179
|
-
else if (ideSelection.startsWith('Cline')) destPath = '.clinerules';
|
|
180
|
-
else {
|
|
181
|
-
console.log(`${colors.yellow}Configuration cancelled.${colors.reset}`);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const fullDestPath = path.join(targetDir, destPath);
|
|
186
|
-
if (destPath.includes('/')) {
|
|
187
|
-
fs.ensureDirSync(path.dirname(fullDestPath));
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Fix pathing inside SKILL.md so the IDE can find the roles and skills
|
|
191
|
-
const ruleContent = fs.readFileSync(targetSkillMd, 'utf8')
|
|
192
|
-
.replace(/roles\//g, 'smart-instructions/roles/')
|
|
193
|
-
.replace(/skills\//g, 'smart-instructions/skills/')
|
|
194
|
-
.replace(/registry\//g, 'smart-instructions/registry/')
|
|
195
|
-
.replace(/history\//g, 'smart-instructions/history/');
|
|
196
|
-
|
|
197
|
-
if (fs.existsSync(fullDestPath)) {
|
|
198
|
-
const { overwrite } = await inquirer.prompt([
|
|
199
|
-
{
|
|
200
|
-
type: 'confirm',
|
|
201
|
-
name: 'overwrite',
|
|
202
|
-
message: `${destPath} already exists. Do you want to overwrite it?`,
|
|
203
|
-
default: false
|
|
204
|
-
}
|
|
205
|
-
]);
|
|
206
|
-
if (!overwrite) {
|
|
207
|
-
console.log(`${colors.yellow}Configuration skipped.${colors.reset}`);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
fs.writeFileSync(fullDestPath, ruleContent);
|
|
213
|
-
console.log(`\n${colors.bright}${colors.green}[Success] ${destPath} has been successfully configured!${colors.reset}\n`);
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
program
|
|
217
|
-
.command('create <skill_name>')
|
|
218
|
-
.description('Scaffolds a new custom Mega-Skill')
|
|
219
|
-
.action(async (skillName) => {
|
|
220
|
-
console.log(`${colors.bright}${colors.cyan}Custom Skill Scaffolding${colors.reset}\n`);
|
|
221
|
-
|
|
222
|
-
const { audience, format } = await inquirer.prompt([
|
|
223
|
-
{
|
|
224
|
-
type: 'input',
|
|
225
|
-
name: 'audience',
|
|
226
|
-
message: 'Who is this skill for? (e.g., Frontend React Devs, Backend Node Devs):',
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
type: 'confirm',
|
|
230
|
-
name: 'format',
|
|
231
|
-
message: 'Include strict JSON formatting rules?',
|
|
232
|
-
default: true
|
|
233
|
-
}
|
|
234
|
-
]);
|
|
235
|
-
|
|
236
|
-
const customDir = path.join(targetDir, 'smart-instructions', 'custom');
|
|
237
|
-
fs.ensureDirSync(customDir);
|
|
238
|
-
|
|
239
|
-
const destFile = path.join(customDir, `${skillName.replace('.md', '')}.md`);
|
|
240
|
-
|
|
241
|
-
const template = `# ${skillName} Mega-Skill\n\n## Objective\nProvide expert-level instructions for ${audience}.\n\n## Rules\n- Always prioritize clarity and performance.\n- Write modern, maintainable code.\n${format ? '- ALWAYS output responses in strict JSON format when requested.\n' : ''}\n## Architecture Guidelines\n1. Keep functions small and focused.\n2. Ensure rigorous error handling.\n`;
|
|
242
|
-
|
|
243
|
-
fs.writeFileSync(destFile, template);
|
|
244
|
-
console.log(`\n${colors.bright}${colors.green}[Success] Scaffolded new custom skill at ${destFile}!${colors.reset}\n`);
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
program
|
|
248
|
-
.command('fetch <skill_name>')
|
|
249
|
-
.description('Fetches an external skill from the global registry')
|
|
250
|
-
.action(async (skillName) => {
|
|
251
|
-
console.log(`${colors.bright}${colors.cyan}Fetching External Skill: ${skillName}${colors.reset}\n`);
|
|
252
|
-
|
|
253
|
-
const registryPath = path.join(targetDir, 'smart-instructions', 'registry', 'skill_bank.json');
|
|
254
|
-
if (!fs.existsSync(registryPath)) {
|
|
255
|
-
console.error(`${colors.red}[Error] Registry not found. Run 'npx ai-skills init' first.${colors.reset}`);
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const registry = fs.readJsonSync(registryPath);
|
|
260
|
-
const skill = registry.registries.find(s => s.name.toLowerCase().includes(skillName.toLowerCase()));
|
|
261
|
-
|
|
262
|
-
if (!skill) {
|
|
263
|
-
console.error(`${colors.red}[Error] Skill matching '${skillName}' not found in registry.${colors.reset}`);
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
console.log(`${colors.blue}[+] Found skill '${skill.name}' in category '${skill.category}'. Fetching from: ${skill.url}${colors.reset}`);
|
|
268
|
-
|
|
269
|
-
// Convert github blob URL to raw URL for downloading
|
|
270
|
-
const rawUrl = skill.url.replace('github.com', 'raw.githubusercontent.com').replace('/blob/', '/');
|
|
271
|
-
|
|
272
|
-
try {
|
|
273
|
-
const response = await fetch(rawUrl);
|
|
274
|
-
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
|
275
|
-
const text = await response.text();
|
|
276
|
-
|
|
277
|
-
fs.ensureDirSync(path.join(targetDir, 'smart-instructions', 'skills', 'external'));
|
|
278
|
-
const safeName = skill.name.toLowerCase().replace(/[^a-z0-9]/g, '_') + '.md';
|
|
279
|
-
const destFile = path.join(targetDir, 'smart-instructions', 'skills', 'external', safeName);
|
|
280
|
-
|
|
281
|
-
// Wrap the raw text with our standard header
|
|
282
|
-
const formattedContent = `---\nname: "${skill.name}"\ndescription: "External skill fetched from ${skill.url}"\n---\n\n${text}\n\n---\n⚡ Smart AI Skills Library | v${program.version()} | Active`;
|
|
283
|
-
|
|
284
|
-
fs.writeFileSync(destFile, formattedContent);
|
|
285
|
-
console.log(`\n${colors.bright}${colors.green}[Success] Downloaded and standardized to: ${destFile}${colors.reset}\n`);
|
|
286
|
-
} catch (error) {
|
|
287
|
-
console.error(`${colors.red}[Error] Failed to fetch skill: ${error.message}${colors.reset}`);
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
program
|
|
292
|
-
.command('update')
|
|
293
|
-
.description('Updates the official skills without overwriting custom ones in /custom/')
|
|
294
|
-
.action(async () => {
|
|
295
|
-
console.log(`${colors.bright}${colors.cyan}Updating Official Skills${colors.reset}\n`);
|
|
296
|
-
const { proceed } = await inquirer.prompt([
|
|
297
|
-
{
|
|
298
|
-
type: 'confirm',
|
|
299
|
-
name: 'proceed',
|
|
300
|
-
message: 'This will safely copy the latest official skills into smart-instructions/ overriding existing ones. Custom folders will be preserved. Proceed?',
|
|
301
|
-
default: true
|
|
302
|
-
}
|
|
303
|
-
]);
|
|
304
|
-
|
|
305
|
-
if (!proceed) {
|
|
306
|
-
console.log(`${colors.yellow}Update cancelled.${colors.reset}`);
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
try {
|
|
311
|
-
fs.ensureDirSync(path.join(targetDir, 'smart-instructions', 'roles'));
|
|
312
|
-
fs.ensureDirSync(path.join(targetDir, 'smart-instructions', 'skills'));
|
|
313
|
-
|
|
314
|
-
const rDir = path.join(sourceDir, 'roles');
|
|
315
|
-
if (fs.existsSync(rDir)) fs.copySync(rDir, path.join(targetDir, 'smart-instructions', 'roles'));
|
|
316
|
-
|
|
317
|
-
const sDir = path.join(sourceDir, 'skills');
|
|
318
|
-
if (fs.existsSync(sDir)) fs.copySync(sDir, path.join(targetDir, 'smart-instructions', 'skills'));
|
|
319
|
-
|
|
320
|
-
const regDir = path.join(sourceDir, 'registry');
|
|
321
|
-
if (fs.existsSync(regDir)) fs.copySync(regDir, path.join(targetDir, 'smart-instructions', 'registry'));
|
|
322
|
-
|
|
323
|
-
const targetHistoryDir = path.join(targetDir, 'smart-instructions', 'history');
|
|
324
|
-
if (!fs.existsSync(targetHistoryDir)) {
|
|
325
|
-
fs.ensureDirSync(targetHistoryDir);
|
|
326
|
-
fs.writeFileSync(path.join(targetHistoryDir, 'CONTEXT.md'), `# 📖 Project Context & History\n\nWelcome to your project's AI context hub.\n\n---\n*Last updated by: AI Assistant (update)*`);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
const targetSkillMd = path.join(targetDir, 'smart-instructions', 'SKILL.md');
|
|
330
|
-
if (fs.existsSync(path.join(sourceDir, 'SKILL.md'))) {
|
|
331
|
-
fs.copyFileSync(path.join(sourceDir, 'SKILL.md'), targetSkillMd);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
console.log(`\n${colors.bright}${colors.green}[Success] Official library updated!${colors.reset}\n`);
|
|
335
|
-
} catch (e) {
|
|
336
|
-
console.error(`${colors.red}[Error] Update failed: ${e.message}${colors.reset}`);
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
// Handle no arguments gracefully
|
|
341
|
-
if (process.argv.length === 2) {
|
|
342
|
-
process.argv.push('--help');
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
program.parse(process.argv);
|