claude-everything-workflow 0.1.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.
- package/AGENTS.md +36 -0
- package/CLAUDE.md +7 -0
- package/LICENSE +22 -0
- package/README.md +369 -0
- package/agents/architect.md +59 -0
- package/agents/code-reviewer.md +57 -0
- package/agents/database-reviewer.md +44 -0
- package/agents/e2e-runner.md +153 -0
- package/agents/harness-optimizer.md +92 -0
- package/agents/planner.md +124 -0
- package/agents/refactor-cleaner.md +54 -0
- package/agents/security-reviewer.md +47 -0
- package/agents/tdd-guide.md +101 -0
- package/bin/claude-everything-workflow.js +91 -0
- package/commands/code-review.md +27 -0
- package/commands/e2e.md +28 -0
- package/commands/evolve.md +42 -0
- package/commands/harness-audit.md +27 -0
- package/commands/instinct-status.md +38 -0
- package/commands/learn-eval.md +91 -0
- package/commands/pr.md +88 -0
- package/commands/projects.md +27 -0
- package/commands/promote.md +29 -0
- package/commands/prune.md +46 -0
- package/commands/tdd.md +27 -0
- package/commands/verify.md +93 -0
- package/homunculus/instincts/personal/always-test-first.md +28 -0
- package/homunculus/instincts/personal/pr-ci-quality-gate.md +30 -0
- package/hooks/check-console-log.js +37 -0
- package/hooks/commit-quality.js +143 -0
- package/hooks/evaluate-session.js +59 -0
- package/hooks/pre-compact.js +92 -0
- package/hooks/runtime/hook-flags.js +40 -0
- package/hooks/runtime/run-with-flags.js +141 -0
- package/hooks/runtime/session-utils.js +45 -0
- package/hooks/session-end.js +62 -0
- package/hooks/session-start.js +60 -0
- package/package.json +48 -0
- package/references/agents/database-reviewer.md +657 -0
- package/references/agents/refactor-cleaner.md +75 -0
- package/references/agents/security-reviewer.md +542 -0
- package/rules/01-base.md +49 -0
- package/rules/02-code-size.md +13 -0
- package/rules/03-architecture.md +64 -0
- package/rules/04-error-handling.md +27 -0
- package/rules/05-git-workflow.md +56 -0
- package/rules/06-comments.md +44 -0
- package/rules/07-forbidden.md +43 -0
- package/rules/08-ecc-integration.md +46 -0
- package/rules/common/agent-orchestration.md +54 -0
- package/rules/common/context-hygiene.md +85 -0
- package/rules/common/harness-engineering.md +46 -0
- package/rules/common/hooks.md +87 -0
- package/rules/common/implementation.md +25 -0
- package/rules/common/performance.md +71 -0
- package/rules/common/pr-automation.md +73 -0
- package/rules/common/security.md +19 -0
- package/rules/common/skills-learning.md +39 -0
- package/rules/common/testing.md +68 -0
- package/scripts/install.ps1 +286 -0
- package/scripts/install.sh +214 -0
- package/scripts/learning/migrate-homunculus.js +93 -0
- package/scripts/learning/project-utils.js +214 -0
- package/scripts/learning/projects.js +60 -0
- package/scripts/learning/promote.js +98 -0
- package/scripts/learning/review-confidence.js +455 -0
- package/scripts/verify-harness.js +868 -0
- package/settings.json +77 -0
- package/skills/brainstorming/SKILL.md +185 -0
- package/skills/brainstorming/agents/openai.yaml +3 -0
- package/skills/brainstorming/scripts/frame-template.html +214 -0
- package/skills/brainstorming/scripts/helper.js +88 -0
- package/skills/brainstorming/scripts/server.cjs +354 -0
- package/skills/brainstorming/scripts/start-server.sh +148 -0
- package/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +287 -0
- package/skills/continuous-learning-v2/SKILL.md +74 -0
- package/skills/continuous-learning-v2/agents/observer.md +129 -0
- package/skills/continuous-learning-v2/agents/start-observer.sh +83 -0
- package/skills/continuous-learning-v2/config.json +58 -0
- package/skills/continuous-learning-v2/hooks/observe-v2.js +144 -0
- package/skills/documentation-lookup/SKILL.md +90 -0
- package/skills/e2e-testing/SKILL.md +326 -0
- package/skills/executing-plans/SKILL.md +66 -0
- package/skills/find-skills/SKILL.md +142 -0
- package/skills/skill-creator/LICENSE.txt +202 -0
- package/skills/skill-creator/SKILL.md +356 -0
- package/skills/skill-creator/references/output-patterns.md +82 -0
- package/skills/skill-creator/references/workflows.md +28 -0
- package/skills/skill-creator/scripts/init_skill.py +303 -0
- package/skills/skill-creator/scripts/package_skill.py +110 -0
- package/skills/skill-creator/scripts/quick_validate.py +95 -0
- package/skills/systematic-debugging/SKILL.md +59 -0
- package/skills/test-driven-development/SKILL.md +71 -0
- package/skills/using-git-worktrees/SKILL.md +64 -0
- package/skills/verification-before-completion/SKILL.md +77 -0
- package/skills/writing-plans/SKILL.md +183 -0
- package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Skill Initializer - Creates a new skill from template
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
init_skill.py <skill-name> --path <path>
|
|
7
|
+
|
|
8
|
+
Examples:
|
|
9
|
+
init_skill.py my-new-skill --path skills/public
|
|
10
|
+
init_skill.py my-api-helper --path skills/private
|
|
11
|
+
init_skill.py custom-skill --path /custom/location
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import sys
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
SKILL_TEMPLATE = """---
|
|
19
|
+
name: {skill_name}
|
|
20
|
+
description: [TODO: Complete and informative explanation of what the skill does and when to use it. Include WHEN to use this skill - specific scenarios, file types, or tasks that trigger it.]
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# {skill_title}
|
|
24
|
+
|
|
25
|
+
## Overview
|
|
26
|
+
|
|
27
|
+
[TODO: 1-2 sentences explaining what this skill enables]
|
|
28
|
+
|
|
29
|
+
## Structuring This Skill
|
|
30
|
+
|
|
31
|
+
[TODO: Choose the structure that best fits this skill's purpose. Common patterns:
|
|
32
|
+
|
|
33
|
+
**1. Workflow-Based** (best for sequential processes)
|
|
34
|
+
- Works well when there are clear step-by-step procedures
|
|
35
|
+
- Example: DOCX skill with "Workflow Decision Tree" → "Reading" → "Creating" → "Editing"
|
|
36
|
+
- Structure: ## Overview → ## Workflow Decision Tree → ## Step 1 → ## Step 2...
|
|
37
|
+
|
|
38
|
+
**2. Task-Based** (best for tool collections)
|
|
39
|
+
- Works well when the skill offers different operations/capabilities
|
|
40
|
+
- Example: PDF skill with "Quick Start" → "Merge PDFs" → "Split PDFs" → "Extract Text"
|
|
41
|
+
- Structure: ## Overview → ## Quick Start → ## Task Category 1 → ## Task Category 2...
|
|
42
|
+
|
|
43
|
+
**3. Reference/Guidelines** (best for standards or specifications)
|
|
44
|
+
- Works well for brand guidelines, coding standards, or requirements
|
|
45
|
+
- Example: Brand styling with "Brand Guidelines" → "Colors" → "Typography" → "Features"
|
|
46
|
+
- Structure: ## Overview → ## Guidelines → ## Specifications → ## Usage...
|
|
47
|
+
|
|
48
|
+
**4. Capabilities-Based** (best for integrated systems)
|
|
49
|
+
- Works well when the skill provides multiple interrelated features
|
|
50
|
+
- Example: Product Management with "Core Capabilities" → numbered capability list
|
|
51
|
+
- Structure: ## Overview → ## Core Capabilities → ### 1. Feature → ### 2. Feature...
|
|
52
|
+
|
|
53
|
+
Patterns can be mixed and matched as needed. Most skills combine patterns (e.g., start with task-based, add workflow for complex operations).
|
|
54
|
+
|
|
55
|
+
Delete this entire "Structuring This Skill" section when done - it's just guidance.]
|
|
56
|
+
|
|
57
|
+
## [TODO: Replace with the first main section based on chosen structure]
|
|
58
|
+
|
|
59
|
+
[TODO: Add content here. See examples in existing skills:
|
|
60
|
+
- Code samples for technical skills
|
|
61
|
+
- Decision trees for complex workflows
|
|
62
|
+
- Concrete examples with realistic user requests
|
|
63
|
+
- References to scripts/templates/references as needed]
|
|
64
|
+
|
|
65
|
+
## Resources
|
|
66
|
+
|
|
67
|
+
This skill includes example resource directories that demonstrate how to organize different types of bundled resources:
|
|
68
|
+
|
|
69
|
+
### scripts/
|
|
70
|
+
Executable code (Python/Bash/etc.) that can be run directly to perform specific operations.
|
|
71
|
+
|
|
72
|
+
**Examples from other skills:**
|
|
73
|
+
- PDF skill: `fill_fillable_fields.py`, `extract_form_field_info.py` - utilities for PDF manipulation
|
|
74
|
+
- DOCX skill: `document.py`, `utilities.py` - Python modules for document processing
|
|
75
|
+
|
|
76
|
+
**Appropriate for:** Python scripts, shell scripts, or any executable code that performs automation, data processing, or specific operations.
|
|
77
|
+
|
|
78
|
+
**Note:** Scripts may be executed without loading into context, but can still be read by Claude for patching or environment adjustments.
|
|
79
|
+
|
|
80
|
+
### references/
|
|
81
|
+
Documentation and reference material intended to be loaded into context to inform Claude's process and thinking.
|
|
82
|
+
|
|
83
|
+
**Examples from other skills:**
|
|
84
|
+
- Product management: `communication.md`, `context_building.md` - detailed workflow guides
|
|
85
|
+
- BigQuery: API reference documentation and query examples
|
|
86
|
+
- Finance: Schema documentation, company policies
|
|
87
|
+
|
|
88
|
+
**Appropriate for:** In-depth documentation, API references, database schemas, comprehensive guides, or any detailed information that Claude should reference while working.
|
|
89
|
+
|
|
90
|
+
### assets/
|
|
91
|
+
Files not intended to be loaded into context, but rather used within the output Claude produces.
|
|
92
|
+
|
|
93
|
+
**Examples from other skills:**
|
|
94
|
+
- Brand styling: PowerPoint template files (.pptx), logo files
|
|
95
|
+
- Frontend builder: HTML/React boilerplate project directories
|
|
96
|
+
- Typography: Font files (.ttf, .woff2)
|
|
97
|
+
|
|
98
|
+
**Appropriate for:** Templates, boilerplate code, document templates, images, icons, fonts, or any files meant to be copied or used in the final output.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
**Any unneeded directories can be deleted.** Not every skill requires all three types of resources.
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
EXAMPLE_SCRIPT = '''#!/usr/bin/env python3
|
|
106
|
+
"""
|
|
107
|
+
Example helper script for {skill_name}
|
|
108
|
+
|
|
109
|
+
This is a placeholder script that can be executed directly.
|
|
110
|
+
Replace with actual implementation or delete if not needed.
|
|
111
|
+
|
|
112
|
+
Example real scripts from other skills:
|
|
113
|
+
- pdf/scripts/fill_fillable_fields.py - Fills PDF form fields
|
|
114
|
+
- pdf/scripts/convert_pdf_to_images.py - Converts PDF pages to images
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
def main():
|
|
118
|
+
print("This is an example script for {skill_name}")
|
|
119
|
+
# TODO: Add actual script logic here
|
|
120
|
+
# This could be data processing, file conversion, API calls, etc.
|
|
121
|
+
|
|
122
|
+
if __name__ == "__main__":
|
|
123
|
+
main()
|
|
124
|
+
'''
|
|
125
|
+
|
|
126
|
+
EXAMPLE_REFERENCE = """# Reference Documentation for {skill_title}
|
|
127
|
+
|
|
128
|
+
This is a placeholder for detailed reference documentation.
|
|
129
|
+
Replace with actual reference content or delete if not needed.
|
|
130
|
+
|
|
131
|
+
Example real reference docs from other skills:
|
|
132
|
+
- product-management/references/communication.md - Comprehensive guide for status updates
|
|
133
|
+
- product-management/references/context_building.md - Deep-dive on gathering context
|
|
134
|
+
- bigquery/references/ - API references and query examples
|
|
135
|
+
|
|
136
|
+
## When Reference Docs Are Useful
|
|
137
|
+
|
|
138
|
+
Reference docs are ideal for:
|
|
139
|
+
- Comprehensive API documentation
|
|
140
|
+
- Detailed workflow guides
|
|
141
|
+
- Complex multi-step processes
|
|
142
|
+
- Information too lengthy for main SKILL.md
|
|
143
|
+
- Content that's only needed for specific use cases
|
|
144
|
+
|
|
145
|
+
## Structure Suggestions
|
|
146
|
+
|
|
147
|
+
### API Reference Example
|
|
148
|
+
- Overview
|
|
149
|
+
- Authentication
|
|
150
|
+
- Endpoints with examples
|
|
151
|
+
- Error codes
|
|
152
|
+
- Rate limits
|
|
153
|
+
|
|
154
|
+
### Workflow Guide Example
|
|
155
|
+
- Prerequisites
|
|
156
|
+
- Step-by-step instructions
|
|
157
|
+
- Common patterns
|
|
158
|
+
- Troubleshooting
|
|
159
|
+
- Best practices
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
EXAMPLE_ASSET = """# Example Asset File
|
|
163
|
+
|
|
164
|
+
This placeholder represents where asset files would be stored.
|
|
165
|
+
Replace with actual asset files (templates, images, fonts, etc.) or delete if not needed.
|
|
166
|
+
|
|
167
|
+
Asset files are NOT intended to be loaded into context, but rather used within
|
|
168
|
+
the output Claude produces.
|
|
169
|
+
|
|
170
|
+
Example asset files from other skills:
|
|
171
|
+
- Brand guidelines: logo.png, slides_template.pptx
|
|
172
|
+
- Frontend builder: hello-world/ directory with HTML/React boilerplate
|
|
173
|
+
- Typography: custom-font.ttf, font-family.woff2
|
|
174
|
+
- Data: sample_data.csv, test_dataset.json
|
|
175
|
+
|
|
176
|
+
## Common Asset Types
|
|
177
|
+
|
|
178
|
+
- Templates: .pptx, .docx, boilerplate directories
|
|
179
|
+
- Images: .png, .jpg, .svg, .gif
|
|
180
|
+
- Fonts: .ttf, .otf, .woff, .woff2
|
|
181
|
+
- Boilerplate code: Project directories, starter files
|
|
182
|
+
- Icons: .ico, .svg
|
|
183
|
+
- Data files: .csv, .json, .xml, .yaml
|
|
184
|
+
|
|
185
|
+
Note: This is a text placeholder. Actual assets can be any file type.
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def title_case_skill_name(skill_name):
|
|
190
|
+
"""Convert hyphenated skill name to Title Case for display."""
|
|
191
|
+
return ' '.join(word.capitalize() for word in skill_name.split('-'))
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def init_skill(skill_name, path):
|
|
195
|
+
"""
|
|
196
|
+
Initialize a new skill directory with template SKILL.md.
|
|
197
|
+
|
|
198
|
+
Args:
|
|
199
|
+
skill_name: Name of the skill
|
|
200
|
+
path: Path where the skill directory should be created
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
Path to created skill directory, or None if error
|
|
204
|
+
"""
|
|
205
|
+
# Determine skill directory path
|
|
206
|
+
skill_dir = Path(path).resolve() / skill_name
|
|
207
|
+
|
|
208
|
+
# Check if directory already exists
|
|
209
|
+
if skill_dir.exists():
|
|
210
|
+
print(f"❌ Error: Skill directory already exists: {skill_dir}")
|
|
211
|
+
return None
|
|
212
|
+
|
|
213
|
+
# Create skill directory
|
|
214
|
+
try:
|
|
215
|
+
skill_dir.mkdir(parents=True, exist_ok=False)
|
|
216
|
+
print(f"✅ Created skill directory: {skill_dir}")
|
|
217
|
+
except Exception as e:
|
|
218
|
+
print(f"❌ Error creating directory: {e}")
|
|
219
|
+
return None
|
|
220
|
+
|
|
221
|
+
# Create SKILL.md from template
|
|
222
|
+
skill_title = title_case_skill_name(skill_name)
|
|
223
|
+
skill_content = SKILL_TEMPLATE.format(
|
|
224
|
+
skill_name=skill_name,
|
|
225
|
+
skill_title=skill_title
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
skill_md_path = skill_dir / 'SKILL.md'
|
|
229
|
+
try:
|
|
230
|
+
skill_md_path.write_text(skill_content)
|
|
231
|
+
print("✅ Created SKILL.md")
|
|
232
|
+
except Exception as e:
|
|
233
|
+
print(f"❌ Error creating SKILL.md: {e}")
|
|
234
|
+
return None
|
|
235
|
+
|
|
236
|
+
# Create resource directories with example files
|
|
237
|
+
try:
|
|
238
|
+
# Create scripts/ directory with example script
|
|
239
|
+
scripts_dir = skill_dir / 'scripts'
|
|
240
|
+
scripts_dir.mkdir(exist_ok=True)
|
|
241
|
+
example_script = scripts_dir / 'example.py'
|
|
242
|
+
example_script.write_text(EXAMPLE_SCRIPT.format(skill_name=skill_name))
|
|
243
|
+
example_script.chmod(0o755)
|
|
244
|
+
print("✅ Created scripts/example.py")
|
|
245
|
+
|
|
246
|
+
# Create references/ directory with example reference doc
|
|
247
|
+
references_dir = skill_dir / 'references'
|
|
248
|
+
references_dir.mkdir(exist_ok=True)
|
|
249
|
+
example_reference = references_dir / 'api_reference.md'
|
|
250
|
+
example_reference.write_text(EXAMPLE_REFERENCE.format(skill_title=skill_title))
|
|
251
|
+
print("✅ Created references/api_reference.md")
|
|
252
|
+
|
|
253
|
+
# Create assets/ directory with example asset placeholder
|
|
254
|
+
assets_dir = skill_dir / 'assets'
|
|
255
|
+
assets_dir.mkdir(exist_ok=True)
|
|
256
|
+
example_asset = assets_dir / 'example_asset.txt'
|
|
257
|
+
example_asset.write_text(EXAMPLE_ASSET)
|
|
258
|
+
print("✅ Created assets/example_asset.txt")
|
|
259
|
+
except Exception as e:
|
|
260
|
+
print(f"❌ Error creating resource directories: {e}")
|
|
261
|
+
return None
|
|
262
|
+
|
|
263
|
+
# Print next steps
|
|
264
|
+
print(f"\n✅ Skill '{skill_name}' initialized successfully at {skill_dir}")
|
|
265
|
+
print("\nNext steps:")
|
|
266
|
+
print("1. Edit SKILL.md to complete the TODO items and update the description")
|
|
267
|
+
print("2. Customize or delete the example files in scripts/, references/, and assets/")
|
|
268
|
+
print("3. Run the validator when ready to check the skill structure")
|
|
269
|
+
|
|
270
|
+
return skill_dir
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def main():
|
|
274
|
+
if len(sys.argv) < 4 or sys.argv[2] != '--path':
|
|
275
|
+
print("Usage: init_skill.py <skill-name> --path <path>")
|
|
276
|
+
print("\nSkill name requirements:")
|
|
277
|
+
print(" - Hyphen-case identifier (e.g., 'data-analyzer')")
|
|
278
|
+
print(" - Lowercase letters, digits, and hyphens only")
|
|
279
|
+
print(" - Max 40 characters")
|
|
280
|
+
print(" - Must match directory name exactly")
|
|
281
|
+
print("\nExamples:")
|
|
282
|
+
print(" init_skill.py my-new-skill --path skills/public")
|
|
283
|
+
print(" init_skill.py my-api-helper --path skills/private")
|
|
284
|
+
print(" init_skill.py custom-skill --path /custom/location")
|
|
285
|
+
sys.exit(1)
|
|
286
|
+
|
|
287
|
+
skill_name = sys.argv[1]
|
|
288
|
+
path = sys.argv[3]
|
|
289
|
+
|
|
290
|
+
print(f"🚀 Initializing skill: {skill_name}")
|
|
291
|
+
print(f" Location: {path}")
|
|
292
|
+
print()
|
|
293
|
+
|
|
294
|
+
result = init_skill(skill_name, path)
|
|
295
|
+
|
|
296
|
+
if result:
|
|
297
|
+
sys.exit(0)
|
|
298
|
+
else:
|
|
299
|
+
sys.exit(1)
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
if __name__ == "__main__":
|
|
303
|
+
main()
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Skill Packager - Creates a distributable .skill file of a skill folder
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
python utils/package_skill.py <path/to/skill-folder> [output-directory]
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
python utils/package_skill.py skills/public/my-skill
|
|
10
|
+
python utils/package_skill.py skills/public/my-skill ./dist
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import sys
|
|
14
|
+
import zipfile
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from quick_validate import validate_skill
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def package_skill(skill_path, output_dir=None):
|
|
20
|
+
"""
|
|
21
|
+
Package a skill folder into a .skill file.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
skill_path: Path to the skill folder
|
|
25
|
+
output_dir: Optional output directory for the .skill file (defaults to current directory)
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
Path to the created .skill file, or None if error
|
|
29
|
+
"""
|
|
30
|
+
skill_path = Path(skill_path).resolve()
|
|
31
|
+
|
|
32
|
+
# Validate skill folder exists
|
|
33
|
+
if not skill_path.exists():
|
|
34
|
+
print(f"❌ Error: Skill folder not found: {skill_path}")
|
|
35
|
+
return None
|
|
36
|
+
|
|
37
|
+
if not skill_path.is_dir():
|
|
38
|
+
print(f"❌ Error: Path is not a directory: {skill_path}")
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
# Validate SKILL.md exists
|
|
42
|
+
skill_md = skill_path / "SKILL.md"
|
|
43
|
+
if not skill_md.exists():
|
|
44
|
+
print(f"❌ Error: SKILL.md not found in {skill_path}")
|
|
45
|
+
return None
|
|
46
|
+
|
|
47
|
+
# Run validation before packaging
|
|
48
|
+
print("🔍 Validating skill...")
|
|
49
|
+
valid, message = validate_skill(skill_path)
|
|
50
|
+
if not valid:
|
|
51
|
+
print(f"❌ Validation failed: {message}")
|
|
52
|
+
print(" Please fix the validation errors before packaging.")
|
|
53
|
+
return None
|
|
54
|
+
print(f"✅ {message}\n")
|
|
55
|
+
|
|
56
|
+
# Determine output location
|
|
57
|
+
skill_name = skill_path.name
|
|
58
|
+
if output_dir:
|
|
59
|
+
output_path = Path(output_dir).resolve()
|
|
60
|
+
output_path.mkdir(parents=True, exist_ok=True)
|
|
61
|
+
else:
|
|
62
|
+
output_path = Path.cwd()
|
|
63
|
+
|
|
64
|
+
skill_filename = output_path / f"{skill_name}.skill"
|
|
65
|
+
|
|
66
|
+
# Create the .skill file (zip format)
|
|
67
|
+
try:
|
|
68
|
+
with zipfile.ZipFile(skill_filename, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
|
69
|
+
# Walk through the skill directory
|
|
70
|
+
for file_path in skill_path.rglob('*'):
|
|
71
|
+
if file_path.is_file():
|
|
72
|
+
# Calculate the relative path within the zip
|
|
73
|
+
arcname = file_path.relative_to(skill_path.parent)
|
|
74
|
+
zipf.write(file_path, arcname)
|
|
75
|
+
print(f" Added: {arcname}")
|
|
76
|
+
|
|
77
|
+
print(f"\n✅ Successfully packaged skill to: {skill_filename}")
|
|
78
|
+
return skill_filename
|
|
79
|
+
|
|
80
|
+
except Exception as e:
|
|
81
|
+
print(f"❌ Error creating .skill file: {e}")
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def main():
|
|
86
|
+
if len(sys.argv) < 2:
|
|
87
|
+
print("Usage: python utils/package_skill.py <path/to/skill-folder> [output-directory]")
|
|
88
|
+
print("\nExample:")
|
|
89
|
+
print(" python utils/package_skill.py skills/public/my-skill")
|
|
90
|
+
print(" python utils/package_skill.py skills/public/my-skill ./dist")
|
|
91
|
+
sys.exit(1)
|
|
92
|
+
|
|
93
|
+
skill_path = sys.argv[1]
|
|
94
|
+
output_dir = sys.argv[2] if len(sys.argv) > 2 else None
|
|
95
|
+
|
|
96
|
+
print(f"📦 Packaging skill: {skill_path}")
|
|
97
|
+
if output_dir:
|
|
98
|
+
print(f" Output directory: {output_dir}")
|
|
99
|
+
print()
|
|
100
|
+
|
|
101
|
+
result = package_skill(skill_path, output_dir)
|
|
102
|
+
|
|
103
|
+
if result:
|
|
104
|
+
sys.exit(0)
|
|
105
|
+
else:
|
|
106
|
+
sys.exit(1)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
if __name__ == "__main__":
|
|
110
|
+
main()
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Quick validation script for skills - minimal version
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import sys
|
|
7
|
+
import os
|
|
8
|
+
import re
|
|
9
|
+
import yaml
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
def validate_skill(skill_path):
|
|
13
|
+
"""Basic validation of a skill"""
|
|
14
|
+
skill_path = Path(skill_path)
|
|
15
|
+
|
|
16
|
+
# Check SKILL.md exists
|
|
17
|
+
skill_md = skill_path / 'SKILL.md'
|
|
18
|
+
if not skill_md.exists():
|
|
19
|
+
return False, "SKILL.md not found"
|
|
20
|
+
|
|
21
|
+
# Read and validate frontmatter
|
|
22
|
+
content = skill_md.read_text()
|
|
23
|
+
if not content.startswith('---'):
|
|
24
|
+
return False, "No YAML frontmatter found"
|
|
25
|
+
|
|
26
|
+
# Extract frontmatter
|
|
27
|
+
match = re.match(r'^---\n(.*?)\n---', content, re.DOTALL)
|
|
28
|
+
if not match:
|
|
29
|
+
return False, "Invalid frontmatter format"
|
|
30
|
+
|
|
31
|
+
frontmatter_text = match.group(1)
|
|
32
|
+
|
|
33
|
+
# Parse YAML frontmatter
|
|
34
|
+
try:
|
|
35
|
+
frontmatter = yaml.safe_load(frontmatter_text)
|
|
36
|
+
if not isinstance(frontmatter, dict):
|
|
37
|
+
return False, "Frontmatter must be a YAML dictionary"
|
|
38
|
+
except yaml.YAMLError as e:
|
|
39
|
+
return False, f"Invalid YAML in frontmatter: {e}"
|
|
40
|
+
|
|
41
|
+
# Define allowed properties
|
|
42
|
+
ALLOWED_PROPERTIES = {'name', 'description', 'license', 'allowed-tools', 'metadata'}
|
|
43
|
+
|
|
44
|
+
# Check for unexpected properties (excluding nested keys under metadata)
|
|
45
|
+
unexpected_keys = set(frontmatter.keys()) - ALLOWED_PROPERTIES
|
|
46
|
+
if unexpected_keys:
|
|
47
|
+
return False, (
|
|
48
|
+
f"Unexpected key(s) in SKILL.md frontmatter: {', '.join(sorted(unexpected_keys))}. "
|
|
49
|
+
f"Allowed properties are: {', '.join(sorted(ALLOWED_PROPERTIES))}"
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Check required fields
|
|
53
|
+
if 'name' not in frontmatter:
|
|
54
|
+
return False, "Missing 'name' in frontmatter"
|
|
55
|
+
if 'description' not in frontmatter:
|
|
56
|
+
return False, "Missing 'description' in frontmatter"
|
|
57
|
+
|
|
58
|
+
# Extract name for validation
|
|
59
|
+
name = frontmatter.get('name', '')
|
|
60
|
+
if not isinstance(name, str):
|
|
61
|
+
return False, f"Name must be a string, got {type(name).__name__}"
|
|
62
|
+
name = name.strip()
|
|
63
|
+
if name:
|
|
64
|
+
# Check naming convention (hyphen-case: lowercase with hyphens)
|
|
65
|
+
if not re.match(r'^[a-z0-9-]+$', name):
|
|
66
|
+
return False, f"Name '{name}' should be hyphen-case (lowercase letters, digits, and hyphens only)"
|
|
67
|
+
if name.startswith('-') or name.endswith('-') or '--' in name:
|
|
68
|
+
return False, f"Name '{name}' cannot start/end with hyphen or contain consecutive hyphens"
|
|
69
|
+
# Check name length (max 64 characters per spec)
|
|
70
|
+
if len(name) > 64:
|
|
71
|
+
return False, f"Name is too long ({len(name)} characters). Maximum is 64 characters."
|
|
72
|
+
|
|
73
|
+
# Extract and validate description
|
|
74
|
+
description = frontmatter.get('description', '')
|
|
75
|
+
if not isinstance(description, str):
|
|
76
|
+
return False, f"Description must be a string, got {type(description).__name__}"
|
|
77
|
+
description = description.strip()
|
|
78
|
+
if description:
|
|
79
|
+
# Check for angle brackets
|
|
80
|
+
if '<' in description or '>' in description:
|
|
81
|
+
return False, "Description cannot contain angle brackets (< or >)"
|
|
82
|
+
# Check description length (max 1024 characters per spec)
|
|
83
|
+
if len(description) > 1024:
|
|
84
|
+
return False, f"Description is too long ({len(description)} characters). Maximum is 1024 characters."
|
|
85
|
+
|
|
86
|
+
return True, "Skill is valid!"
|
|
87
|
+
|
|
88
|
+
if __name__ == "__main__":
|
|
89
|
+
if len(sys.argv) != 2:
|
|
90
|
+
print("Usage: python quick_validate.py <skill_directory>")
|
|
91
|
+
sys.exit(1)
|
|
92
|
+
|
|
93
|
+
valid, message = validate_skill(sys.argv[1])
|
|
94
|
+
print(message)
|
|
95
|
+
sys.exit(0 if valid else 1)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: systematic-debugging
|
|
3
|
+
description: Use when encountering any bug, failing test, flaky behavior, or unexpected result before proposing fixes. Keeps debugging lightweight but root-cause driven.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Systematic Debugging
|
|
7
|
+
|
|
8
|
+
Use this skill when implementation or verification reveals a bug, failing test, flaky behavior, or unexpected result.
|
|
9
|
+
|
|
10
|
+
The goal is not to make debugging heavy. The goal is to stop guessing. Complete the four phases in order, then return to the active task or plan.
|
|
11
|
+
|
|
12
|
+
<HARD-GATE>
|
|
13
|
+
Do not propose or apply a fix until Phase 1 identifies a credible root cause and Phase 3 has tested the hypothesis with the smallest useful check.
|
|
14
|
+
</HARD-GATE>
|
|
15
|
+
|
|
16
|
+
## Phase 1: Root Cause Investigation
|
|
17
|
+
|
|
18
|
+
- Reproduce the failure with the smallest command or scenario.
|
|
19
|
+
- Capture the exact error, failing assertion, log line, or unexpected output.
|
|
20
|
+
- Trace backward from the symptom to the first incorrect state.
|
|
21
|
+
- Identify what changed recently and which boundary it crosses.
|
|
22
|
+
|
|
23
|
+
Output: one sentence naming the likely root cause and the evidence for it.
|
|
24
|
+
|
|
25
|
+
## Phase 2: Pattern Analysis
|
|
26
|
+
|
|
27
|
+
- Check whether the same pattern appears elsewhere in the codebase.
|
|
28
|
+
- Compare against nearby working implementations.
|
|
29
|
+
- Decide whether this is a local bug, contract mismatch, missing test, environment issue, or design gap.
|
|
30
|
+
|
|
31
|
+
Output: the smallest affected scope and any similar files that should or should not change.
|
|
32
|
+
|
|
33
|
+
## Phase 3: Hypothesis Test
|
|
34
|
+
|
|
35
|
+
- Form one falsifiable hypothesis.
|
|
36
|
+
- Run or add the smallest diagnostic check that can prove or disprove it.
|
|
37
|
+
- If the hypothesis fails, return to Phase 1 with the new evidence.
|
|
38
|
+
- After two failed fix hypotheses, stop and reassess the design before trying another fix.
|
|
39
|
+
|
|
40
|
+
Output: confirmed hypothesis or reason for returning to investigation.
|
|
41
|
+
|
|
42
|
+
## Phase 4: Fix And Verify
|
|
43
|
+
|
|
44
|
+
- Add or update the failing test first when the project has a suitable test path.
|
|
45
|
+
- Apply one focused fix at the source of the root cause.
|
|
46
|
+
- Run the failing test or reproduction command.
|
|
47
|
+
- Run the task's required verification from the plan.
|
|
48
|
+
- Remove diagnostic logging or temporary probes.
|
|
49
|
+
|
|
50
|
+
Output: root cause, fix summary, commands run, result, and remaining risk.
|
|
51
|
+
|
|
52
|
+
## Return To Plan
|
|
53
|
+
|
|
54
|
+
After the fix is verified, return to the original task:
|
|
55
|
+
|
|
56
|
+
- Re-run the task's normal test command.
|
|
57
|
+
- Re-run requirement/spec compliance review.
|
|
58
|
+
- Re-run code quality review.
|
|
59
|
+
- Only then mark the task complete.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-driven-development
|
|
3
|
+
description: 新功能、bug 修复、重构或行为变化需要测试先行时使用。强调先写失败测试、确认失败原因、最小实现和保持测试绿色。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test-Driven Development
|
|
7
|
+
|
|
8
|
+
参考来源: https://github.com/obra/superpowers/tree/main/skills/test-driven-development
|
|
9
|
+
|
|
10
|
+
本 skill 是本仓库的精简版本,只保留适合 agent 执行的 TDD 规则,不复制外部 skill 全文。
|
|
11
|
+
|
|
12
|
+
## 何时使用
|
|
13
|
+
|
|
14
|
+
- 新功能
|
|
15
|
+
- bug 修复
|
|
16
|
+
- 重构
|
|
17
|
+
- 行为变化
|
|
18
|
+
|
|
19
|
+
例外情况需要先和用户确认,例如一次性原型、生成代码、纯配置整理或没有可测试行为的文档修改。
|
|
20
|
+
|
|
21
|
+
## 核心规则
|
|
22
|
+
|
|
23
|
+
1. 先写一个最小失败测试。
|
|
24
|
+
2. 运行测试,确认它失败且失败原因正确。
|
|
25
|
+
3. 写最少生产代码让测试通过。
|
|
26
|
+
4. 再运行测试,确认相关测试全部通过。
|
|
27
|
+
5. 只有绿色后才重构。
|
|
28
|
+
6. 重构不能引入新行为;新行为需要新的失败测试。
|
|
29
|
+
7. 一次只推进一个垂直切片:一个可观察行为、一个失败测试、一个最小实现。
|
|
30
|
+
|
|
31
|
+
## Red Test Gate
|
|
32
|
+
|
|
33
|
+
新功能、bug 修复、重构引起行为变化、公共 API 变化和用户流程变化,必须先写失败测试并运行确认失败原因正确,才能写行为实现代码。
|
|
34
|
+
|
|
35
|
+
如果当前任务确实没有可测试行为,先记录原因,并给出替代验证方式,例如脚本 smoke test、文档 diff 检查、人工验收步骤或 harness 验证命令。
|
|
36
|
+
|
|
37
|
+
## 垂直切片纪律
|
|
38
|
+
|
|
39
|
+
- 从最小用户可观察行为开始,不先铺完整测试矩阵。
|
|
40
|
+
- 每轮 RED/GREEN/REFACTOR 都应能独立运行和回退。
|
|
41
|
+
- 新边界条件必须回到 RED,不能混在当前 GREEN 实现里顺手完成。
|
|
42
|
+
- 如果发现需要多个测试才能描述同一功能,先选择风险最高或最能定义接口的一个。
|
|
43
|
+
- 不为未来扩展预写测试;只有当前需求明确的行为才进入本轮。
|
|
44
|
+
|
|
45
|
+
## RED
|
|
46
|
+
|
|
47
|
+
- 测试名称描述真实行为。
|
|
48
|
+
- 每个测试只覆盖一个行为。
|
|
49
|
+
- 优先测试公开 API 和用户可观察结果。
|
|
50
|
+
- mock 只在不可避免时使用,避免测试 mock 本身。
|
|
51
|
+
|
|
52
|
+
## GREEN
|
|
53
|
+
|
|
54
|
+
- 只实现让当前测试通过所需的最小代码。
|
|
55
|
+
- 不顺手扩展未来需求。
|
|
56
|
+
- 不在同一步做无关重构。
|
|
57
|
+
|
|
58
|
+
## REFACTOR
|
|
59
|
+
|
|
60
|
+
- 去重复、改命名、提取 helper。
|
|
61
|
+
- 保持测试绿色。
|
|
62
|
+
- 如果发现新行为缺口,回到 RED。
|
|
63
|
+
|
|
64
|
+
## 完成检查
|
|
65
|
+
|
|
66
|
+
- 看见测试先失败。
|
|
67
|
+
- 失败原因符合预期。
|
|
68
|
+
- 最小实现后测试通过。
|
|
69
|
+
- 相关测试无错误、无警告。
|
|
70
|
+
- 边界条件和错误路径有覆盖。
|
|
71
|
+
- 每个新增行为都能追溯到对应失败测试。
|