makecc 0.2.4 → 0.2.5

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.
@@ -1,87 +1,63 @@
1
1
  import Anthropic from '@anthropic-ai/sdk';
2
2
  import * as fs from 'fs/promises';
3
3
  import * as path from 'path';
4
- const SYSTEM_PROMPT = `당신은 Claude Code 스킬 생성 전문가입니다.
4
+ const SYSTEM_PROMPT = `You are a Claude Code skill generator. You MUST respond with ONLY a valid JSON object. No markdown, no code blocks, no explanations - just pure JSON.
5
5
 
6
- 사용자의 요청을 분석하여 완전히 작동하는 Claude Code 스킬을 생성합니다.
7
-
8
- ## Claude Code 스킬 구조
9
-
10
- 스킬은 다음 구조로 생성됩니다:
11
- \`\`\`
12
- .claude/skills/[skill-name]/
13
- ├── SKILL.md # 스킬 정의 (필수)
14
- ├── scripts/ # 스크립트 폴더
15
- │ └── main.py # 메인 스크립트
16
- └── requirements.txt # Python 의존성 (필요시)
17
- \`\`\`
18
-
19
- ## SKILL.md 형식
20
-
21
- \`\`\`markdown
22
- ---
23
- name: skill-name
24
- description: 스킬 설명 (한 줄)
25
- ---
26
-
27
- # 스킬 이름
28
-
29
- ## 사용 시점
30
- 이 스킬은 다음 상황에서 사용됩니다:
31
- - 상황 1
32
- - 상황 2
33
-
34
- ## 사용 방법
35
-
36
- \\\`\\\`\\\`bash
37
- ~/.claude/venv/bin/python ~/.claude/skills/[skill-name]/scripts/main.py [인자들]
38
- \\\`\\\`\\\`
39
-
40
- ## 파라미터
41
- - \`param1\`: 설명
42
- - \`param2\`: 설명
43
-
44
- ## 예시
45
- [사용 예시]
46
- \`\`\`
47
-
48
- ## 응답 형식 (JSON)
49
-
50
- 반드시 아래 형식의 JSON으로 응답하세요:
6
+ Your response must follow this exact JSON schema:
51
7
 
52
8
  {
53
- "skillName": "스킬 이름 (한글 가능)",
54
- "skillId": "skill-id-kebab-case",
55
- "description": "스킬 설명",
9
+ "skillName": "Human readable skill name",
10
+ "skillId": "skill-id-in-kebab-case",
11
+ "description": "Brief description of what this skill does",
56
12
  "files": [
57
13
  {
58
14
  "path": "SKILL.md",
59
- "content": "SKILL.md 전체 내용",
15
+ "content": "Full SKILL.md content here",
60
16
  "language": "markdown"
61
17
  },
62
18
  {
63
19
  "path": "scripts/main.py",
64
- "content": "Python 스크립트 전체 내용",
20
+ "content": "Full Python script content here",
65
21
  "language": "python"
66
22
  },
67
23
  {
68
24
  "path": "requirements.txt",
69
- "content": "의존성 목록 (필요한 경우)",
25
+ "content": "package1\\npackage2",
70
26
  "language": "text"
71
27
  }
72
28
  ]
73
29
  }
74
30
 
75
- ## 중요 규칙
31
+ SKILL.md must follow this format:
32
+ ---
33
+ name: skill-id
34
+ description: One line description
35
+ ---
36
+
37
+ # Skill Name
38
+
39
+ ## When to use
40
+ - Use case 1
41
+ - Use case 2
42
+
43
+ ## Usage
44
+ \`\`\`bash
45
+ ~/.claude/venv/bin/python ~/.claude/skills/skill-id/scripts/main.py [args]
46
+ \`\`\`
47
+
48
+ ## Parameters
49
+ - \`--param1\`: Description
50
+
51
+ ## Example
52
+ [Usage example]
76
53
 
77
- 1. **완전한 코드 생성**: 실제로 동작하는 완전한 코드를 작성하세요
78
- 2. **에러 처리 포함**: try-except로 에러 처리를 포함하세요
79
- 3. **한글 지원**: 출력 메시지는 한글로 작성하세요
80
- 4. **환경 고려**:
81
- - Python 스크립트는 \`~/.claude/venv/bin/python\`으로 실행됩니다
82
- - 필요한 패키지는 requirements.txt에 명시하세요
83
- 5. **JSON 반환**: 설명 없이 JSON만 반환하세요
84
- `;
54
+ RULES:
55
+ 1. Generate COMPLETE, WORKING code - no placeholders
56
+ 2. Include proper error handling with try-except
57
+ 3. Use Korean for user-facing messages
58
+ 4. Scripts run with ~/.claude/venv/bin/python
59
+ 5. List all required packages in requirements.txt
60
+ 6. RESPOND WITH JSON ONLY - NO OTHER TEXT`;
85
61
  export class SkillGeneratorService {
86
62
  projectRoot;
87
63
  constructor(projectRoot) {
@@ -105,16 +81,18 @@ export class SkillGeneratorService {
105
81
  }
106
82
  async generate(prompt, settings) {
107
83
  const client = this.getClient(settings);
108
- const userPrompt = `다음 스킬을 생성해주세요: "${prompt}"
84
+ const userPrompt = `Create a skill for: "${prompt}"
109
85
 
110
- 완전히 동작하는 코드를 포함한 스킬을 생성하세요.
111
- 반드시 JSON만 반환하세요.`;
86
+ Generate complete, working code. Respond with JSON only.`;
112
87
  try {
113
88
  const response = await client.messages.create({
114
89
  model: 'claude-sonnet-4-20250514',
115
90
  max_tokens: 8192,
116
91
  system: SYSTEM_PROMPT,
117
- messages: [{ role: 'user', content: userPrompt }],
92
+ messages: [
93
+ { role: 'user', content: userPrompt },
94
+ { role: 'assistant', content: '{' } // Prefill to force JSON
95
+ ],
118
96
  });
119
97
  let responseText = '';
120
98
  for (const block of response.content) {
@@ -125,15 +103,14 @@ export class SkillGeneratorService {
125
103
  if (!responseText) {
126
104
  return { success: false, error: 'AI 응답을 받지 못했습니다.' };
127
105
  }
128
- // JSON 추출
129
- const jsonMatch = responseText.match(/```(?:json)?\s*([\s\S]*?)```/);
130
- const rawJson = jsonMatch ? jsonMatch[1].trim() : responseText.trim();
106
+ // Prefill로 '{'를 보냈으니 응답 앞에 '{'를 붙임
107
+ const fullJson = '{' + responseText;
131
108
  let skill;
132
109
  try {
133
- skill = JSON.parse(rawJson);
110
+ skill = JSON.parse(fullJson);
134
111
  }
135
112
  catch {
136
- console.error('Failed to parse skill response:', rawJson.slice(0, 500));
113
+ console.error('Failed to parse skill response:', fullJson.slice(0, 500));
137
114
  return { success: false, error: 'AI 응답을 파싱할 수 없습니다. 다시 시도해주세요.' };
138
115
  }
139
116
  // 파일 저장
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makecc",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "description": "Visual workflow builder for Claude Code agents and skills",
6
6
  "keywords": [
@@ -21,87 +21,63 @@ export interface SkillGenerationResult {
21
21
  error?: string;
22
22
  }
23
23
 
24
- const SYSTEM_PROMPT = `당신은 Claude Code 스킬 생성 전문가입니다.
24
+ const SYSTEM_PROMPT = `You are a Claude Code skill generator. You MUST respond with ONLY a valid JSON object. No markdown, no code blocks, no explanations - just pure JSON.
25
25
 
26
- 사용자의 요청을 분석하여 완전히 작동하는 Claude Code 스킬을 생성합니다.
27
-
28
- ## Claude Code 스킬 구조
29
-
30
- 스킬은 다음 구조로 생성됩니다:
31
- \`\`\`
32
- .claude/skills/[skill-name]/
33
- ├── SKILL.md # 스킬 정의 (필수)
34
- ├── scripts/ # 스크립트 폴더
35
- │ └── main.py # 메인 스크립트
36
- └── requirements.txt # Python 의존성 (필요시)
37
- \`\`\`
38
-
39
- ## SKILL.md 형식
40
-
41
- \`\`\`markdown
42
- ---
43
- name: skill-name
44
- description: 스킬 설명 (한 줄)
45
- ---
46
-
47
- # 스킬 이름
48
-
49
- ## 사용 시점
50
- 이 스킬은 다음 상황에서 사용됩니다:
51
- - 상황 1
52
- - 상황 2
53
-
54
- ## 사용 방법
55
-
56
- \\\`\\\`\\\`bash
57
- ~/.claude/venv/bin/python ~/.claude/skills/[skill-name]/scripts/main.py [인자들]
58
- \\\`\\\`\\\`
59
-
60
- ## 파라미터
61
- - \`param1\`: 설명
62
- - \`param2\`: 설명
63
-
64
- ## 예시
65
- [사용 예시]
66
- \`\`\`
67
-
68
- ## 응답 형식 (JSON)
69
-
70
- 반드시 아래 형식의 JSON으로 응답하세요:
26
+ Your response must follow this exact JSON schema:
71
27
 
72
28
  {
73
- "skillName": "스킬 이름 (한글 가능)",
74
- "skillId": "skill-id-kebab-case",
75
- "description": "스킬 설명",
29
+ "skillName": "Human readable skill name",
30
+ "skillId": "skill-id-in-kebab-case",
31
+ "description": "Brief description of what this skill does",
76
32
  "files": [
77
33
  {
78
34
  "path": "SKILL.md",
79
- "content": "SKILL.md 전체 내용",
35
+ "content": "Full SKILL.md content here",
80
36
  "language": "markdown"
81
37
  },
82
38
  {
83
39
  "path": "scripts/main.py",
84
- "content": "Python 스크립트 전체 내용",
40
+ "content": "Full Python script content here",
85
41
  "language": "python"
86
42
  },
87
43
  {
88
44
  "path": "requirements.txt",
89
- "content": "의존성 목록 (필요한 경우)",
45
+ "content": "package1\\npackage2",
90
46
  "language": "text"
91
47
  }
92
48
  ]
93
49
  }
94
50
 
95
- ## 중요 규칙
51
+ SKILL.md must follow this format:
52
+ ---
53
+ name: skill-id
54
+ description: One line description
55
+ ---
56
+
57
+ # Skill Name
58
+
59
+ ## When to use
60
+ - Use case 1
61
+ - Use case 2
62
+
63
+ ## Usage
64
+ \`\`\`bash
65
+ ~/.claude/venv/bin/python ~/.claude/skills/skill-id/scripts/main.py [args]
66
+ \`\`\`
67
+
68
+ ## Parameters
69
+ - \`--param1\`: Description
70
+
71
+ ## Example
72
+ [Usage example]
96
73
 
97
- 1. **완전한 코드 생성**: 실제로 동작하는 완전한 코드를 작성하세요
98
- 2. **에러 처리 포함**: try-except로 에러 처리를 포함하세요
99
- 3. **한글 지원**: 출력 메시지는 한글로 작성하세요
100
- 4. **환경 고려**:
101
- - Python 스크립트는 \`~/.claude/venv/bin/python\`으로 실행됩니다
102
- - 필요한 패키지는 requirements.txt에 명시하세요
103
- 5. **JSON 반환**: 설명 없이 JSON만 반환하세요
104
- `;
74
+ RULES:
75
+ 1. Generate COMPLETE, WORKING code - no placeholders
76
+ 2. Include proper error handling with try-except
77
+ 3. Use Korean for user-facing messages
78
+ 4. Scripts run with ~/.claude/venv/bin/python
79
+ 5. List all required packages in requirements.txt
80
+ 6. RESPOND WITH JSON ONLY - NO OTHER TEXT`;
105
81
 
106
82
  export class SkillGeneratorService {
107
83
  private projectRoot: string;
@@ -133,17 +109,19 @@ export class SkillGeneratorService {
133
109
  async generate(prompt: string, settings?: ApiSettings): Promise<SkillGenerationResult> {
134
110
  const client = this.getClient(settings);
135
111
 
136
- const userPrompt = `다음 스킬을 생성해주세요: "${prompt}"
112
+ const userPrompt = `Create a skill for: "${prompt}"
137
113
 
138
- 완전히 동작하는 코드를 포함한 스킬을 생성하세요.
139
- 반드시 JSON만 반환하세요.`;
114
+ Generate complete, working code. Respond with JSON only.`;
140
115
 
141
116
  try {
142
117
  const response = await client.messages.create({
143
118
  model: 'claude-sonnet-4-20250514',
144
119
  max_tokens: 8192,
145
120
  system: SYSTEM_PROMPT,
146
- messages: [{ role: 'user', content: userPrompt }],
121
+ messages: [
122
+ { role: 'user', content: userPrompt },
123
+ { role: 'assistant', content: '{' } // Prefill to force JSON
124
+ ],
147
125
  });
148
126
 
149
127
  let responseText = '';
@@ -157,15 +135,14 @@ export class SkillGeneratorService {
157
135
  return { success: false, error: 'AI 응답을 받지 못했습니다.' };
158
136
  }
159
137
 
160
- // JSON 추출
161
- const jsonMatch = responseText.match(/```(?:json)?\s*([\s\S]*?)```/);
162
- const rawJson = jsonMatch ? jsonMatch[1].trim() : responseText.trim();
138
+ // Prefill로 '{'를 보냈으니 응답 앞에 '{'를 붙임
139
+ const fullJson = '{' + responseText;
163
140
 
164
141
  let skill: GeneratedSkill;
165
142
  try {
166
- skill = JSON.parse(rawJson);
143
+ skill = JSON.parse(fullJson);
167
144
  } catch {
168
- console.error('Failed to parse skill response:', rawJson.slice(0, 500));
145
+ console.error('Failed to parse skill response:', fullJson.slice(0, 500));
169
146
  return { success: false, error: 'AI 응답을 파싱할 수 없습니다. 다시 시도해주세요.' };
170
147
  }
171
148