marketingjuliancongdanh79-pixel/skill-generator
skill-creator-ultra
VerifiedTạo AI Skill mới từ ý tưởng hoặc quy trình công việc. Kết hợp phỏng vấn thông minh, pattern detection, và quantitative evaluation để tạo skill chất lượng production. Dùng khi user nói "tạo skill", "biến quy trình thành skill", "make a new skill", "tự động hóa công việc này", hoặc mô tả quy trình lặp lại mà họ muốn AI tự làm. Cũng dùng khi user muốn cải thiện, test, hoặc optimize skill hiện có.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 14.4 KB |
| agents/analyzer.md | markdown | 10.1 KB |
| agents/comparator.md | markdown | 7.1 KB |
| agents/grader.md | markdown | 8.8 KB |
| assets/eval_review.html | other | 6.9 KB |
| examples/example_anthropic_frontend.md | markdown | 4.9 KB |
| examples/example_anthropic_pdf.md | markdown | 4.5 KB |
| examples/example_api_docs.md | markdown | 5.3 KB |
| examples/example_db_migration.md | markdown | 8.8 KB |
| examples/example_git_commit.md | markdown | 4.1 KB |
| scripts/ci_eval.py | script | 6.4 KB |
| scripts/package_skill.py | script | 4.9 KB |
| scripts/simulate_skill.py | script | 14.2 KB |
| scripts/skill_audit.py | script | 22.7 KB |
| scripts/skill_compare.py | script | 9.3 KB |
| scripts/skill_export.py | script | 9.6 KB |
| scripts/skill_scaffold.py | script | 11.7 KB |
| scripts/skill_stats.py | script | 11.6 KB |
| scripts/validate_skill.py | script | 15.0 KB |
scripts/skill_scaffold.py
View on GitHub#!/usr/bin/env python3
"""
skill_scaffold.py — Tạo skeleton thư mục + files cho Skill mới
Sử dụng:
python skill_scaffold.py my-new-skill
python skill_scaffold.py my-new-skill --output ./path/to/skills/
python skill_scaffold.py my-new-skill --with-scripts
python skill_scaffold.py my-new-skill --full
python skill_scaffold.py my-new-skill --interactive
Modes:
(default) → Chỉ tạo SKILL.md cơ bản
--with-scripts → Thêm scripts/ với template
--full → Tạo đầy đủ: SKILL.md + scripts/ + resources/ + examples/
--interactive → Hỏi từng bước tên, mô tả, trigger...
Developed by Thân Công Hải — Skill Generator v3.2 Expert
"""
import sys
import os
import re
from datetime import datetime
class Colors:
PASS = '\033[92m'
FAIL = '\033[91m'
WARN = '\033[93m'
INFO = '\033[96m'
BOLD = '\033[1m'
DIM = '\033[2m'
RESET = '\033[0m'
@staticmethod
def enable_windows():
if os.name == 'nt':
try:
import ctypes
kernel32 = ctypes.windll.kernel32
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
except Exception:
pass
Colors.enable_windows()
# ============================================================
# TEMPLATES
# ============================================================
SKILL_TEMPLATE = '''---
name: {name}
description: |
{description}
Kích hoạt khi user yêu cầu "{trigger}".
---
# Goal
{goal}
# Instructions
## Bước 1: Tiếp nhận yêu cầu
Phân tích yêu cầu của user:
- Xác định input chính
- Xác nhận output mong muốn
- Hỏi lại nếu thiếu thông tin
## Bước 2: Xử lý
1. [Mô tả bước xử lý cụ thể]
2. [Bước tiếp theo]
3. [Bước cuối]
> 🛡️ **Error Recovery:**
> - Nếu input không hợp lệ → Hỏi lại user
> - Nếu kết quả không chắc chắn → Hiển thị cảnh báo
## Bước 3: Trả kết quả
Hiển thị kết quả theo format trong Examples.
# Examples
## Ví dụ 1: Happy Path
**Input:**
```
[Mô tả input mẫu]
```
**Thought Process:**
- Phân tích: [...]
- Quyết định: [...]
**Output:**
```
[Mô tả output mẫu]
```
## Ví dụ 2: Edge Case
**Input:**
```
[Input đặc biệt / thiếu thông tin]
```
**Output:**
```
[Cách xử lý edge case]
```
# Constraints
## DOs (Luôn luôn)
- LUÔN LUÔN xác nhận lại yêu cầu trước khi xử lý
- LUÔN LUÔN hiển thị kết quả theo format trong Examples
- LUÔN LUÔN thông báo nếu có uncertainty
## DON'Ts (Không được)
- KHÔNG ĐƯỢC bịa dữ liệu khi thiếu input
- KHÔNG ĐƯỢC bỏ qua edge cases
- KHÔNG ĐƯỢC thay đổi format output
<!-- Generated by Skill Generator v3.2 -->
'''
SCRIPT_TEMPLATE = '''#!/usr/bin/env python3
"""
{filename} — [Mô tả script]
Sử dụng:
python {filename} [arguments]
python {filename} --help
python {filename} --dry-run [arguments]
"""
import sys
import os
import argparse
def main():
parser = argparse.ArgumentParser(
description="{name} — Script hỗ trợ cho skill",
formatter_class=argparse.RawDescriptionHelpFormatter
)
parser.add_argument('input', nargs='?', help='Input file hoặc data')
parser.add_argument('--dry-run', action='store_true', help='Chạy thử không thực thi')
parser.add_argument('--verbose', '-v', action='store_true', help='Hiển thị chi tiết')
args = parser.parse_args()
if args.dry_run:
print("[DRY RUN] Sẽ xử lý:", args.input)
return
# TODO: Implement logic
print(f"Processing: {{args.input}}")
if __name__ == '__main__':
main()
'''
RESOURCE_TEMPLATE = '''# {title}
> Tài liệu tham khảo cho skill `{name}`
## Nội dung
[Thêm nội dung tham khảo ở đây]
## Nguồn tham khảo
- [Link 1]
- [Link 2]
'''
EXAMPLE_TEMPLATE = '''# Ví dụ: {title}
> Ví dụ chi tiết cho skill `{name}`
## Tình huống
[Mô tả tình huống]
## Input
```
[Dữ liệu input]
```
## Expected Output
```
[Kết quả mong đợi]
```
## Giải thích
[Tại sao output là như vậy]
'''
# ============================================================
# INTERACTIVE MODE
# ============================================================
def interactive_mode():
"""Hỏi user từng bước để tạo skill."""
print()
print(f"{Colors.BOLD} 🧩 Skill Scaffold — Chế độ tương tác{Colors.RESET}")
print(f" {Colors.DIM}Trả lời các câu hỏi để tạo skill mới{Colors.RESET}")
print()
name = input(f" 📌 Tên skill (kebab-case, ví dụ: price-quoter): ").strip()
if not name:
print(f" {Colors.FAIL}❌ Tên không được trống!{Colors.RESET}")
return None
# Validate name
if not re.match(r'^[a-z0-9][a-z0-9-]*$', name):
print(f" {Colors.WARN}⚠️ Tên nên dùng kebab-case (ví dụ: my-skill-name){Colors.RESET}")
name = re.sub(r'[^a-z0-9-]', '-', name.lower()).strip('-')
print(f" {Colors.INFO} → Đã sửa thành: {name}{Colors.RESET}")
description = input(f" 📝 Mô tả ngắn (1-2 câu): ").strip() or f"Skill {name}"
trigger = input(f" 🎯 Trigger phrase (user nói gì để kích hoạt?): ").strip() or name
goal = input(f" 🏁 Goal (skill làm gì — 1 câu): ").strip() or f"Thực hiện {name}"
with_scripts = input(f" 🔧 Có cần scripts không? (y/n, mặc định n): ").strip().lower() == 'y'
with_resources = input(f" 📚 Có cần resources không? (y/n, mặc định n): ").strip().lower() == 'y'
with_examples = input(f" 🎯 Có cần example files không? (y/n, mặc định n): ").strip().lower() == 'y'
return {
'name': name,
'description': description,
'trigger': trigger,
'goal': goal,
'with_scripts': with_scripts,
'with_resources': with_resources,
'with_examples': with_examples,
}
# ============================================================
# SCAFFOLD
# ============================================================
def scaffold_skill(name, output_dir=None, full=False, with_scripts=False,
interactive_data=None):
"""Tạo skeleton skill."""
if output_dir is None:
output_dir = '.'
skill_dir = os.path.join(output_dir, name)
if os.path.exists(skill_dir):
print(f"{Colors.FAIL}❌ Thư mục đã tồn tại: {skill_dir}{Colors.RESET}")
print(f" Xóa hoặc đổi tên thư mục cũ trước khi tạo mới.")
return False
# Get data
if interactive_data:
data = interactive_data
else:
data = {
'name': name,
'description': f'Skill {name} — [Mô tả ngắn]',
'trigger': name.replace('-', ' '),
'goal': f'[Mô tả goal cho {name}]',
'with_scripts': with_scripts or full,
'with_resources': full,
'with_examples': full,
}
created_files = []
# Create directories
os.makedirs(skill_dir, exist_ok=True)
# SKILL.md
skill_content = SKILL_TEMPLATE.format(
name=data['name'],
description=data['description'],
trigger=data['trigger'],
goal=data['goal'],
)
skill_path = os.path.join(skill_dir, 'SKILL.md')
with open(skill_path, 'w', encoding='utf-8') as f:
f.write(skill_content)
created_files.append(('SKILL.md', 'Bộ não chính của skill'))
# Scripts
if data.get('with_scripts') or full:
scripts_dir = os.path.join(skill_dir, 'scripts')
os.makedirs(scripts_dir, exist_ok=True)
script_content = SCRIPT_TEMPLATE.format(
filename=f'{name.replace("-", "_")}_helper.py',
name=name,
)
script_path = os.path.join(scripts_dir, f'{name.replace("-", "_")}_helper.py')
with open(script_path, 'w', encoding='utf-8') as f:
f.write(script_content)
created_files.append((f'scripts/{name.replace("-", "_")}_helper.py', 'Script hỗ trợ (template)'))
# Resources
if data.get('with_resources') or full:
resources_dir = os.path.join(skill_dir, 'resources')
os.makedirs(resources_dir, exist_ok=True)
resource_content = RESOURCE_TEMPLATE.format(title='Tài liệu tham khảo', name=name)
resource_path = os.path.join(resources_dir, 'reference.md')
with open(resource_path, 'w', encoding='utf-8') as f:
f.write(resource_content)
created_files.append(('resources/reference.md', 'Tài liệu tham khảo (template)'))
# Examples
if data.get('with_examples') or full:
examples_dir = os.path.join(skill_dir, 'examples')
os.makedirs(examples_dir, exist_ok=True)
example_content = EXAMPLE_TEMPLATE.format(title='Happy Path', name=name)
example_path = os.path.join(examples_dir, 'example_happy_path.md')
with open(example_path, 'w', encoding='utf-8') as f:
f.write(example_content)
created_files.append(('examples/example_happy_path.md', 'Ví dụ Happy Path (template)'))
# Output
print()
print(f"{Colors.BOLD}{'=' * 50}{Colors.RESET}")
print(f"{Colors.BOLD} 🧩 SKILL SCAFFOLD — Tạo skill mới{Colors.RESET}")
print(f"{Colors.BOLD}{'=' * 50}{Colors.RESET}")
print()
print(f" {Colors.PASS}✅ Đã tạo skill: {Colors.BOLD}{name}{Colors.RESET}")
print(f" {Colors.DIM}📁 Vị trí: {os.path.abspath(skill_dir)}{Colors.RESET}")
print()
# File tree
print(f" {Colors.BOLD}📂 Cấu trúc:{Colors.RESET}")
print(f" {name}/")
for i, (filepath, desc) in enumerate(created_files):
is_last = i == len(created_files) - 1
prefix = '└──' if is_last else '├──'
print(f" {prefix} {Colors.INFO}{filepath}{Colors.RESET} — {Colors.DIM}{desc}{Colors.RESET}")
print()
# Next steps
print(f" {Colors.BOLD}💡 Tiếp theo:{Colors.RESET}")
print(f" 1. Mở {Colors.INFO}{skill_dir}/SKILL.md{Colors.RESET} và điền nội dung")
print(f" 2. Chạy: {Colors.INFO}python skill_audit.py {skill_dir}/{Colors.RESET} để kiểm tra")
print(f" 3. Chạy: {Colors.INFO}python simulate_skill.py {skill_dir}/{Colors.RESET} để test")
print()
print(f"{Colors.BOLD}{'=' * 50}{Colors.RESET}")
print()
return True
if __name__ == '__main__':
if len(sys.argv) < 2:
print("Sử dụng: python skill_scaffold.py <skill-name> [options]")
print()
print("Options:")
print(" --output <dir> Thư mục output (mặc định: ./)")
print(" --with-scripts Thêm scripts/ với template")
print(" --full Tạo đầy đủ (scripts + resources + examples)")
print(" --interactive Chế độ tương tác hỏi từng bước")
print()
print("Ví dụ:")
print(" python skill_scaffold.py price-quoter")
print(" python skill_scaffold.py price-quoter --full")
print(" python skill_scaffold.py price-quoter --interactive")
print(" python skill_scaffold.py my-skill --output ./skills/")
sys.exit(1)
name = sys.argv[1]
output = None
full = '--full' in sys.argv
with_scripts = '--with-scripts' in sys.argv
interactive = '--interactive' in sys.argv
for i, arg in enumerate(sys.argv):
if arg == '--output' and i + 1 < len(sys.argv):
output = sys.argv[i + 1]
if interactive:
data = interactive_mode()
if data is None:
sys.exit(1)
success = scaffold_skill(data['name'], output, interactive_data=data)
else:
success = scaffold_skill(name, output, full=full, with_scripts=with_scripts)
sys.exit(0 if success else 1)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |