@rfxlamia/skillkit 1.0.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/README.md +16 -0
- package/agents/creative-copywriter.md +212 -0
- package/agents/dario-amodei.md +135 -0
- package/agents/doc-simplifier.md +63 -0
- package/agents/kotlin-pro.md +433 -0
- package/agents/red-team.md +136 -0
- package/agents/sam-altman.md +121 -0
- package/agents/seo-manager.md +184 -0
- package/bin/skillkit.js +3 -0
- package/package.json +35 -0
- package/skills/adversarial-review/SKILL.md +219 -0
- package/skills/baby-education/SKILL.md +260 -0
- package/skills/baby-education/references/advanced-techniques.md +323 -0
- package/skills/baby-education/references/transformations.md +345 -0
- package/skills/been-there-done-that/SKILL.md +455 -0
- package/skills/been-there-done-that/references/analysis-patterns.md +162 -0
- package/skills/been-there-done-that/references/git-commands.md +132 -0
- package/skills/been-there-done-that/references/tree-insertion-logic.md +145 -0
- package/skills/coolhunter/SKILL.md +270 -0
- package/skills/coolhunter/assets/elicitation-methods.csv +51 -0
- package/skills/coolhunter/knowledge/elicitation-methods.md +312 -0
- package/skills/coolhunter/references/workflow-execution.md +238 -0
- package/skills/coolhunter/workflow-plan-coolhunter.md +232 -0
- package/skills/creative-copywriting/SKILL.md +324 -0
- package/skills/creative-copywriting/databases/README.md +60 -0
- package/skills/creative-copywriting/databases/carousel-structures.csv +16 -0
- package/skills/creative-copywriting/databases/emotional-arcs.csv +11 -0
- package/skills/creative-copywriting/databases/hook-formulas.csv +51 -0
- package/skills/creative-copywriting/databases/power-words.csv +201 -0
- package/skills/creative-copywriting/databases/psychological-triggers.csv +21 -0
- package/skills/creative-copywriting/databases/read-more-patterns.csv +26 -0
- package/skills/creative-copywriting/databases/swipe-triggers.csv +31 -0
- package/skills/creative-copywriting/references/carousel-psychology.md +223 -0
- package/skills/creative-copywriting/references/hook-anatomy.md +169 -0
- package/skills/creative-copywriting/references/power-word-science.md +134 -0
- package/skills/creative-copywriting/references/storytelling-frameworks.md +157 -0
- package/skills/diverse-content-gen/SKILL.md +201 -0
- package/skills/diverse-content-gen/references/advanced-techniques.md +320 -0
- package/skills/diverse-content-gen/references/research-findings.md +379 -0
- package/skills/diverse-content-gen/references/task-workflows.md +241 -0
- package/skills/diverse-content-gen/references/tool-integration.md +419 -0
- package/skills/diverse-content-gen/references/troubleshooting.md +426 -0
- package/skills/diverse-content-gen/references/vs-core-technique.md +240 -0
- package/skills/framework-critical-thinking/SKILL.md +220 -0
- package/skills/framework-critical-thinking/references/bias_detector.md +375 -0
- package/skills/framework-critical-thinking/references/fallback_handler.md +239 -0
- package/skills/framework-critical-thinking/references/memory_curator.md +161 -0
- package/skills/framework-critical-thinking/references/metacognitive_monitor.md +297 -0
- package/skills/framework-critical-thinking/references/producer_critic_orchestrator.md +333 -0
- package/skills/framework-critical-thinking/references/reasoning_router.md +235 -0
- package/skills/framework-critical-thinking/references/reasoning_validator.md +97 -0
- package/skills/framework-critical-thinking/references/reflection_trigger.md +78 -0
- package/skills/framework-critical-thinking/references/self_verification.md +388 -0
- package/skills/framework-critical-thinking/references/uncertainty_quantifier.md +207 -0
- package/skills/framework-initiative/SKILL.md +231 -0
- package/skills/framework-initiative/references/examples.md +150 -0
- package/skills/framework-initiative/references/impact-analysis.md +157 -0
- package/skills/framework-initiative/references/intent-patterns.md +145 -0
- package/skills/framework-initiative/references/star-framework.md +165 -0
- package/skills/humanize-docs/SKILL.md +203 -0
- package/skills/humanize-docs/references/advanced-techniques.md +13 -0
- package/skills/humanize-docs/references/core-transformations.md +368 -0
- package/skills/humanize-docs/references/detection-patterns.md +400 -0
- package/skills/humanize-docs/references/examples-gallery.md +374 -0
- package/skills/imagine/SKILL.md +190 -0
- package/skills/imagine/references/artstyle-corporate-memphis.md +625 -0
- package/skills/imagine/references/artstyle-crewdson-hyperrealism.md +295 -0
- package/skills/imagine/references/artstyle-iphone-social-media.md +426 -0
- package/skills/imagine/references/artstyle-sciencesaru.md +276 -0
- package/skills/pre-deploy-checklist/README.md +26 -0
- package/skills/pre-deploy-checklist/SKILL.md +153 -0
- package/skills/pre-deploy-checklist/references/checklist-categories.md +174 -0
- package/skills/pre-deploy-checklist/references/domain-prompts.md +216 -0
- package/skills/prompt-engineering/SKILL.md +209 -0
- package/skills/prompt-engineering/references/advanced-combinations.md +444 -0
- package/skills/prompt-engineering/references/chain-of-thought.md +140 -0
- package/skills/prompt-engineering/references/decision_matrix.md +220 -0
- package/skills/prompt-engineering/references/few-shot.md +346 -0
- package/skills/prompt-engineering/references/json-format.md +270 -0
- package/skills/prompt-engineering/references/natural-language.md +420 -0
- package/skills/prompt-engineering/references/pitfalls.md +365 -0
- package/skills/prompt-engineering/references/prompt-chaining.md +498 -0
- package/skills/prompt-engineering/references/react.md +108 -0
- package/skills/prompt-engineering/references/self-consistency.md +322 -0
- package/skills/prompt-engineering/references/tree-of-thoughts.md +386 -0
- package/skills/prompt-engineering/references/xml-format.md +220 -0
- package/skills/prompt-engineering/references/yaml-format.md +488 -0
- package/skills/prompt-engineering/references/zero-shot.md +74 -0
- package/skills/quick-spec/SKILL.md +280 -0
- package/skills/quick-spec/assets/tech-spec-template.md +74 -0
- package/skills/quick-spec/references/step-01-understand.md +189 -0
- package/skills/quick-spec/references/step-02-investigate.md +144 -0
- package/skills/quick-spec/references/step-03-generate.md +128 -0
- package/skills/quick-spec/references/step-04-review.md +173 -0
- package/skills/quick-spec/tests/test_scenarios.md +83 -0
- package/skills/quick-spec/tests/test_skill.py +136 -0
- package/skills/readme-expert/SKILL.md +538 -0
- package/skills/readme-expert/knowledge/INDEX.md +192 -0
- package/skills/readme-expert/knowledge/application/quality-standards.md +470 -0
- package/skills/readme-expert/knowledge/application/script-executor.md +604 -0
- package/skills/readme-expert/knowledge/application/template-library.md +822 -0
- package/skills/readme-expert/knowledge/foundation/codebase-scanner.md +361 -0
- package/skills/readme-expert/knowledge/foundation/validation-checklist.md +481 -0
- package/skills/red-teaming/SKILL.md +321 -0
- package/skills/red-teaming/references/ai-llm-redteam.md +517 -0
- package/skills/red-teaming/references/attack-techniques.md +410 -0
- package/skills/red-teaming/references/cybersecurity-redteam.md +383 -0
- package/skills/red-teaming/references/tools-frameworks.md +446 -0
- package/skills/releasing/.skillkit-mode +1 -0
- package/skills/releasing/SKILL.md +225 -0
- package/skills/releasing/references/version-detection.md +108 -0
- package/skills/screenwriter/SKILL.md +273 -0
- package/skills/screenwriter/references/advanced-techniques.md +216 -0
- package/skills/screenwriter/references/pipeline-integration.md +266 -0
- package/skills/skillkit/.claude-plugin/plugin.json +27 -0
- package/skills/skillkit/CHANGELOG.md +484 -0
- package/skills/skillkit/SKILL.md +511 -0
- package/skills/skillkit/commands/skillkit.md +6 -0
- package/skills/skillkit/commands/validate-plan.md +6 -0
- package/skills/skillkit/commands/verify.md +6 -0
- package/skills/skillkit/knowledge/INDEX.md +352 -0
- package/skills/skillkit/knowledge/application/09-case-studies.md +257 -0
- package/skills/skillkit/knowledge/application/10-technical-architecture.md +324 -0
- package/skills/skillkit/knowledge/application/11-adoption-strategy.md +267 -0
- package/skills/skillkit/knowledge/application/12-testing-and-validation.md +276 -0
- package/skills/skillkit/knowledge/application/13-competitive-landscape.md +198 -0
- package/skills/skillkit/knowledge/foundation/01-why-skills-exist.md +246 -0
- package/skills/skillkit/knowledge/foundation/02-skills-vs-subagents-comparison.md +312 -0
- package/skills/skillkit/knowledge/foundation/03-skills-vs-subagents-decision-tree.md +346 -0
- package/skills/skillkit/knowledge/foundation/04-hybrid-patterns.md +308 -0
- package/skills/skillkit/knowledge/foundation/05-token-economics.md +275 -0
- package/skills/skillkit/knowledge/foundation/06-platform-constraints.md +237 -0
- package/skills/skillkit/knowledge/foundation/07-security-concerns.md +322 -0
- package/skills/skillkit/knowledge/foundation/08-when-not-to-use-skills.md +270 -0
- package/skills/skillkit/knowledge/plugin-guide.md +614 -0
- package/skills/skillkit/knowledge/tools/14-validation-tools-guide.md +150 -0
- package/skills/skillkit/knowledge/tools/15-cost-tools-guide.md +157 -0
- package/skills/skillkit/knowledge/tools/16-security-tools-guide.md +122 -0
- package/skills/skillkit/knowledge/tools/17-pattern-tools-guide.md +161 -0
- package/skills/skillkit/knowledge/tools/18-decision-helper-guide.md +243 -0
- package/skills/skillkit/knowledge/tools/19-test-generator-guide.md +275 -0
- package/skills/skillkit/knowledge/tools/20-split-skill-guide.md +149 -0
- package/skills/skillkit/knowledge/tools/21-quality-scorer-guide.md +226 -0
- package/skills/skillkit/knowledge/tools/22-migration-helper-guide.md +356 -0
- package/skills/skillkit/knowledge/tools/23-subagent-creation-guide.md +448 -0
- package/skills/skillkit/knowledge/tools/24-behavioral-testing-guide.md +122 -0
- package/skills/skillkit/references/proposal-generation.md +982 -0
- package/skills/skillkit/references/rationalization-catalog.md +75 -0
- package/skills/skillkit/references/research-methodology.md +661 -0
- package/skills/skillkit/references/section-2-full-creation-workflow.md +452 -0
- package/skills/skillkit/references/section-3-validation-workflow-existing-skill.md +63 -0
- package/skills/skillkit/references/section-4-decision-workflow-skills-vs-subagents.md +64 -0
- package/skills/skillkit/references/section-5-migration-workflow-doc-to-skill.md +58 -0
- package/skills/skillkit/references/section-6-subagent-creation-workflow.md +499 -0
- package/skills/skillkit/references/section-7-knowledge-reference-map.md +72 -0
- package/skills/skillkit/scripts/decision_helper.py +799 -0
- package/skills/skillkit/scripts/init_skill.py +400 -0
- package/skills/skillkit/scripts/init_subagent.py +231 -0
- package/skills/skillkit/scripts/migration_helper.py +669 -0
- package/skills/skillkit/scripts/package_skill.py +211 -0
- package/skills/skillkit/scripts/pattern_detector.py +381 -0
- package/skills/skillkit/scripts/pattern_detector_new.py +382 -0
- package/skills/skillkit/scripts/pressure_tester.py +157 -0
- package/skills/skillkit/scripts/quality_scorer.py +999 -0
- package/skills/skillkit/scripts/quick_validate.py +100 -0
- package/skills/skillkit/scripts/security_scanner.py +474 -0
- package/skills/skillkit/scripts/split_skill.py +540 -0
- package/skills/skillkit/scripts/test_generator.py +695 -0
- package/skills/skillkit/scripts/token_estimator.py +493 -0
- package/skills/skillkit/scripts/utils/__init__.py +49 -0
- package/skills/skillkit/scripts/utils/budget_tracker.py +388 -0
- package/skills/skillkit/scripts/utils/output_formatter.py +263 -0
- package/skills/skillkit/scripts/utils/reference_validator.py +401 -0
- package/skills/skillkit/scripts/validate_skill.py +594 -0
- package/skills/skillkit/tests/test_behavioral.py +39 -0
- package/skills/skillkit/tests/test_scenarios.md +83 -0
- package/skills/skillkit/tests/test_skill.py +136 -0
- package/skills/social-media-seo/SKILL.md +278 -0
- package/skills/social-media-seo/databases/caption-styles.csv +31 -0
- package/skills/social-media-seo/databases/engagement-tactics.csv +16 -0
- package/skills/social-media-seo/databases/hashtag-strategies.csv +21 -0
- package/skills/social-media-seo/databases/hook-formulas.csv +26 -0
- package/skills/social-media-seo/databases/keyword-clusters.csv +11 -0
- package/skills/social-media-seo/databases/thread-structures.csv +26 -0
- package/skills/social-media-seo/databases/viral-patterns.csv +21 -0
- package/skills/social-media-seo/references/analytics-guide.md +321 -0
- package/skills/social-media-seo/references/instagram-seo.md +235 -0
- package/skills/social-media-seo/references/threads-seo.md +305 -0
- package/skills/social-media-seo/references/x-twitter-seo.md +337 -0
- package/skills/social-media-seo/scripts/query_database.py +191 -0
- package/skills/storyteller/SKILL.md +241 -0
- package/skills/storyteller/references/transformation-methodology.md +293 -0
- package/skills/storyteller/references/visual-vocabulary.md +177 -0
- package/skills/thread-pro/SKILL.md +162 -0
- package/skills/thread-pro/anti-ai-patterns.md +120 -0
- package/skills/thread-pro/hook-formulas.md +138 -0
- package/skills/thread-pro/references/anti-ai-patterns.md +120 -0
- package/skills/thread-pro/references/hook-formulas.md +138 -0
- package/skills/thread-pro/references/thread-structures.md +240 -0
- package/skills/thread-pro/references/voice-injection.md +130 -0
- package/skills/thread-pro/thread-structures.md +240 -0
- package/skills/thread-pro/voice-injection.md +130 -0
- package/skills/tinkering/SKILL.md +251 -0
- package/skills/tinkering/references/graduation-checklist.md +100 -0
- package/skills/validate-plan/.skillkit-mode +1 -0
- package/skills/validate-plan/SKILL.md +406 -0
- package/skills/validate-plan/references/dry-principles.md +251 -0
- package/skills/validate-plan/references/gap-analysis-guide.md +320 -0
- package/skills/validate-plan/references/tdd-patterns.md +413 -0
- package/skills/validate-plan/references/yagni-checklist.md +330 -0
- package/skills/verify-before-ship/.skillkit-mode +1 -0
- package/skills/verify-before-ship/SKILL.md +116 -0
- package/skills/verify-before-ship/references/anti-rationalization.md +212 -0
- package/skills/verify-before-ship/references/verification-gates.md +305 -0
- package/skills-manifest.json +217 -0
- package/src/banner.js +10 -0
- package/src/cli.js +30 -0
- package/src/install.js +53 -0
- package/src/install.test.js +40 -0
- package/src/picker.js +74 -0
- package/src/picker.test.js +21 -0
- package/src/scope.js +57 -0
- package/src/scope.test.js +19 -0
- package/src/update.js +34 -0
- package/src/update.test.js +24 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Workflow pattern detector and recommender for Claude skills.
|
|
4
|
+
Analyzes use cases and suggests appropriate proven patterns.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
python pattern_detector.py "convert PDF to Word" [--format json]
|
|
8
|
+
python pattern_detector.py --interactive
|
|
9
|
+
python pattern_detector.py --list [--format json]
|
|
10
|
+
|
|
11
|
+
References:
|
|
12
|
+
- File 04: Hybrid patterns and combinations
|
|
13
|
+
- File 09: Case studies and real-world examples
|
|
14
|
+
- Panduan Komprehensif: 8 proven patterns
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import sys
|
|
18
|
+
import json
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from typing import Dict, List, Tuple
|
|
21
|
+
|
|
22
|
+
# Import shared utilities for standardized output
|
|
23
|
+
try:
|
|
24
|
+
from utils.output_formatter import add_format_argument, format_success_response, format_error_response, output_json
|
|
25
|
+
except ImportError:
|
|
26
|
+
# Fallback if utils not in path
|
|
27
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
|
28
|
+
from utils.output_formatter import add_format_argument, format_success_response, format_error_response, output_json
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class PatternDetector:
|
|
32
|
+
"""Detect and recommend workflow patterns for skills."""
|
|
33
|
+
|
|
34
|
+
# 8 proven patterns from comprehensive research
|
|
35
|
+
PATTERNS = {
|
|
36
|
+
'read-process-write': {
|
|
37
|
+
'name': 'Read-Process-Write',
|
|
38
|
+
'description': 'File transformation and data cleanup',
|
|
39
|
+
'keywords': ['convert', 'transform', 'format', 'cleanup', 'process file', 'parse'],
|
|
40
|
+
'use_when': 'Clear input → output transformations',
|
|
41
|
+
'examples': ['PDF to Word conversion', 'Data cleanup', 'Format normalization']
|
|
42
|
+
},
|
|
43
|
+
'search-analyze-report': {
|
|
44
|
+
'name': 'Search-Analyze-Report',
|
|
45
|
+
'description': 'Codebase analysis and pattern detection',
|
|
46
|
+
'keywords': ['search', 'scan', 'find', 'analyze', 'detect', 'audit', 'grep'],
|
|
47
|
+
'use_when': 'Large-scale code/content analysis',
|
|
48
|
+
'examples': ['Security scanning', 'Code quality audit', 'Dependency analysis']
|
|
49
|
+
},
|
|
50
|
+
'script-automation': {
|
|
51
|
+
'name': 'Script Automation',
|
|
52
|
+
'description': 'Complex multi-step operations',
|
|
53
|
+
'keywords': ['automate', 'pipeline', 'workflow', 'test', 'ci/cd', 'orchestrate', 'run'],
|
|
54
|
+
'use_when': 'Complex automation required',
|
|
55
|
+
'examples': ['CI/CD pipeline', 'Test automation', 'Build orchestration']
|
|
56
|
+
},
|
|
57
|
+
'wizard-multi-step': {
|
|
58
|
+
'name': 'Wizard-Style Multi-Step',
|
|
59
|
+
'description': 'Setup wizards and guided processes',
|
|
60
|
+
'keywords': ['setup', 'init', 'configure', 'wizard', 'interactive', 'guide', 'create project'],
|
|
61
|
+
'use_when': 'Complex setup processes',
|
|
62
|
+
'examples': ['Project initialization', 'Configuration wizard', 'Onboarding']
|
|
63
|
+
},
|
|
64
|
+
'template-generation': {
|
|
65
|
+
'name': 'Template Generation',
|
|
66
|
+
'description': 'Structured document creation',
|
|
67
|
+
'keywords': ['generate', 'template', 'create document', 'report', 'fill', 'populate'],
|
|
68
|
+
'use_when': 'Repetitive document creation',
|
|
69
|
+
'examples': ['Report generation', 'Email templates', 'Documentation']
|
|
70
|
+
},
|
|
71
|
+
'iterative-refinement': {
|
|
72
|
+
'name': 'Iterative Refinement',
|
|
73
|
+
'description': 'Code review and quality analysis',
|
|
74
|
+
'keywords': ['review', 'refine', 'improve', 'iterate', 'quality', 'optimize'],
|
|
75
|
+
'use_when': 'Quality improvement cycles',
|
|
76
|
+
'examples': ['Code review', 'Architecture review', 'Performance tuning']
|
|
77
|
+
},
|
|
78
|
+
'context-aggregation': {
|
|
79
|
+
'name': 'Context Aggregation',
|
|
80
|
+
'description': 'Project summaries and documentation',
|
|
81
|
+
'keywords': ['summarize', 'aggregate', 'combine', 'collect', 'dashboard', 'overview'],
|
|
82
|
+
'use_when': 'Multi-source information synthesis',
|
|
83
|
+
'examples': ['Project status', 'Documentation gen', 'Knowledge base']
|
|
84
|
+
},
|
|
85
|
+
'validation-pipeline': {
|
|
86
|
+
'name': 'Validation Pipeline',
|
|
87
|
+
'description': 'Data quality and compliance checking',
|
|
88
|
+
'keywords': ['validate', 'check', 'verify', 'compliance', 'quality', 'assurance'],
|
|
89
|
+
'use_when': 'Quality assurance required',
|
|
90
|
+
'examples': ['Data validation', 'Compliance check', 'Configuration audit']
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
def analyze_use_case(self, description: str) -> List[Tuple[str, float]]:
|
|
95
|
+
"""
|
|
96
|
+
Analyze use case and recommend patterns.
|
|
97
|
+
|
|
98
|
+
Returns list of (pattern_id, confidence) sorted by confidence.
|
|
99
|
+
Reference: Panduan Komprehensif (8 patterns)
|
|
100
|
+
"""
|
|
101
|
+
desc_lower = description.lower()
|
|
102
|
+
scores = []
|
|
103
|
+
|
|
104
|
+
for pattern_id, pattern in self.PATTERNS.items():
|
|
105
|
+
# Count keyword matches
|
|
106
|
+
matches = sum(1 for kw in pattern['keywords'] if kw in desc_lower)
|
|
107
|
+
|
|
108
|
+
# Normalize by keyword count
|
|
109
|
+
confidence = matches / len(pattern['keywords']) if pattern['keywords'] else 0.0
|
|
110
|
+
|
|
111
|
+
scores.append((pattern_id, confidence))
|
|
112
|
+
|
|
113
|
+
# Sort by confidence (highest first)
|
|
114
|
+
scores.sort(key=lambda x: x[1], reverse=True)
|
|
115
|
+
return scores
|
|
116
|
+
|
|
117
|
+
def interactive_selection(self) -> str:
|
|
118
|
+
"""
|
|
119
|
+
Interactive questionnaire for pattern selection.
|
|
120
|
+
Returns recommended pattern ID.
|
|
121
|
+
"""
|
|
122
|
+
print("\n=== Workflow Pattern Selector ===\n")
|
|
123
|
+
print("Answer questions to find the best pattern:\n")
|
|
124
|
+
|
|
125
|
+
# Question 1: Primary pattern
|
|
126
|
+
print("1. What's your primary input/output pattern?")
|
|
127
|
+
print(" a) Files in → Files out (conversion/transformation)")
|
|
128
|
+
print(" b) Search/scan → Report (analysis)")
|
|
129
|
+
print(" c) Questions → Generated structure (wizard)")
|
|
130
|
+
print(" d) Multiple sources → Aggregated report (synthesis)")
|
|
131
|
+
choice = input(" Choice [a/b/c/d]: ").strip().lower()
|
|
132
|
+
|
|
133
|
+
if choice == 'a':
|
|
134
|
+
return 'read-process-write'
|
|
135
|
+
elif choice == 'b':
|
|
136
|
+
print("\n2. What type of analysis?")
|
|
137
|
+
print(" a) Code quality/security patterns")
|
|
138
|
+
print(" b) Validation/compliance checking")
|
|
139
|
+
choice2 = input(" Choice [a/b]: ").strip().lower()
|
|
140
|
+
return 'search-analyze-report' if choice2 == 'a' else 'validation-pipeline'
|
|
141
|
+
elif choice == 'c':
|
|
142
|
+
return 'wizard-multi-step'
|
|
143
|
+
elif choice == 'd':
|
|
144
|
+
return 'context-aggregation'
|
|
145
|
+
|
|
146
|
+
# Question 2: Automation
|
|
147
|
+
print("\n2. Does this involve multiple automation steps?")
|
|
148
|
+
choice = input(" [y/n]: ").strip().lower()
|
|
149
|
+
if choice == 'y':
|
|
150
|
+
return 'script-automation'
|
|
151
|
+
|
|
152
|
+
# Question 3: Templates
|
|
153
|
+
print("\n3. Are you generating documents from templates?")
|
|
154
|
+
choice = input(" [y/n]: ").strip().lower()
|
|
155
|
+
if choice == 'y':
|
|
156
|
+
return 'template-generation'
|
|
157
|
+
|
|
158
|
+
# Default
|
|
159
|
+
return 'iterative-refinement'
|
|
160
|
+
|
|
161
|
+
def generate_recommendation(self, pattern_id: str, confidence: float = None) -> str:
|
|
162
|
+
"""Generate detailed pattern recommendation."""
|
|
163
|
+
pattern = self.PATTERNS.get(pattern_id)
|
|
164
|
+
|
|
165
|
+
if not pattern:
|
|
166
|
+
return f"Error: Unknown pattern '{pattern_id}'"
|
|
167
|
+
|
|
168
|
+
lines = []
|
|
169
|
+
lines.append(f"\n{'='*60}")
|
|
170
|
+
lines.append(f"Recommended Pattern: {pattern['name']}")
|
|
171
|
+
lines.append('='*60 + '\n')
|
|
172
|
+
|
|
173
|
+
if confidence is not None:
|
|
174
|
+
lines.append(f"Match confidence: {confidence:.0%}\n")
|
|
175
|
+
|
|
176
|
+
lines.append(f"Description: {pattern['description']}\n")
|
|
177
|
+
lines.append(f"Use When: {pattern['use_when']}\n")
|
|
178
|
+
|
|
179
|
+
lines.append("Example Use Cases:")
|
|
180
|
+
for example in pattern['examples']:
|
|
181
|
+
lines.append(f" • {example}")
|
|
182
|
+
lines.append("")
|
|
183
|
+
|
|
184
|
+
lines.append("References:")
|
|
185
|
+
lines.append(" • File 04 (hybrid-patterns.md) - Combining patterns")
|
|
186
|
+
lines.append(" • File 09 (case-studies.md) - Real-world examples")
|
|
187
|
+
lines.append(" • Panduan Komprehensif - Detailed pattern docs\n")
|
|
188
|
+
|
|
189
|
+
return '\n'.join(lines)
|
|
190
|
+
|
|
191
|
+
def list_all_patterns(self) -> str:
|
|
192
|
+
"""List all available patterns with brief descriptions."""
|
|
193
|
+
lines = []
|
|
194
|
+
lines.append(f"\n{'='*60}")
|
|
195
|
+
lines.append("Available Workflow Patterns")
|
|
196
|
+
lines.append('='*60 + '\n')
|
|
197
|
+
|
|
198
|
+
for i, (pattern_id, pattern) in enumerate(self.PATTERNS.items(), 1):
|
|
199
|
+
lines.append(f"{i}. {pattern['name']}")
|
|
200
|
+
lines.append(f" {pattern['description']}")
|
|
201
|
+
lines.append(f" Use when: {pattern['use_when']}\n")
|
|
202
|
+
|
|
203
|
+
lines.append(f"Total: {len(self.PATTERNS)} proven patterns")
|
|
204
|
+
lines.append("\nReferences:")
|
|
205
|
+
lines.append(" • Panduan Komprehensif - Full pattern documentation")
|
|
206
|
+
lines.append(" • File 04 - Hybrid pattern combinations")
|
|
207
|
+
lines.append(" • File 09 - Case studies\n")
|
|
208
|
+
|
|
209
|
+
return '\n'.join(lines)
|
|
210
|
+
|
|
211
|
+
# ========== JSON OUTPUT METHODS ==========
|
|
212
|
+
|
|
213
|
+
def list_all_patterns_json(self) -> Dict:
|
|
214
|
+
"""List all patterns in JSON format."""
|
|
215
|
+
patterns_list = []
|
|
216
|
+
for pattern_id, pattern in self.PATTERNS.items():
|
|
217
|
+
patterns_list.append({
|
|
218
|
+
'id': pattern_id,
|
|
219
|
+
'name': pattern['name'],
|
|
220
|
+
'description': pattern['description'],
|
|
221
|
+
'use_when': pattern['use_when'],
|
|
222
|
+
'examples': pattern['examples'],
|
|
223
|
+
'keywords': pattern['keywords']
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
return {
|
|
227
|
+
'patterns': patterns_list,
|
|
228
|
+
'total': len(self.PATTERNS),
|
|
229
|
+
'references': {
|
|
230
|
+
'comprehensive_guide': 'Panduan Komprehensif',
|
|
231
|
+
'hybrid_patterns': 'File 04',
|
|
232
|
+
'case_studies': 'File 09'
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
def generate_recommendation_json(self, pattern_id: str, confidence: float = None) -> Dict:
|
|
237
|
+
"""Generate pattern recommendation in JSON format."""
|
|
238
|
+
pattern = self.PATTERNS.get(pattern_id)
|
|
239
|
+
|
|
240
|
+
if not pattern:
|
|
241
|
+
return {
|
|
242
|
+
'error': f"Unknown pattern '{pattern_id}'"
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
result = {
|
|
246
|
+
'pattern_id': pattern_id,
|
|
247
|
+
'pattern_name': pattern['name'],
|
|
248
|
+
'description': pattern['description'],
|
|
249
|
+
'use_when': pattern['use_when'],
|
|
250
|
+
'examples': pattern['examples'],
|
|
251
|
+
'references': [
|
|
252
|
+
'File 04 (hybrid-patterns.md) - Combining patterns',
|
|
253
|
+
'File 09 (case-studies.md) - Real-world examples',
|
|
254
|
+
'Panduan Komprehensif - Detailed pattern docs'
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if confidence is not None:
|
|
259
|
+
result['confidence'] = round(confidence, 2)
|
|
260
|
+
|
|
261
|
+
return result
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def main():
|
|
265
|
+
"""CLI entry point."""
|
|
266
|
+
import argparse
|
|
267
|
+
|
|
268
|
+
parser = argparse.ArgumentParser(
|
|
269
|
+
description='Recommend workflow patterns for Claude skills',
|
|
270
|
+
epilog='References: Files 04, 09, Panduan Komprehensif'
|
|
271
|
+
)
|
|
272
|
+
parser.add_argument('description', nargs='?',
|
|
273
|
+
help='Use case description (or use --interactive)')
|
|
274
|
+
parser.add_argument('-i', '--interactive', action='store_true',
|
|
275
|
+
help='Interactive pattern selection mode')
|
|
276
|
+
parser.add_argument('-l', '--list', action='store_true',
|
|
277
|
+
help='List all available patterns')
|
|
278
|
+
add_format_argument(parser) # Standardized --format argument
|
|
279
|
+
|
|
280
|
+
args = parser.parse_args()
|
|
281
|
+
|
|
282
|
+
detector = PatternDetector()
|
|
283
|
+
|
|
284
|
+
# List mode
|
|
285
|
+
if args.list:
|
|
286
|
+
if args.format == 'json':
|
|
287
|
+
data = detector.list_all_patterns_json()
|
|
288
|
+
response = format_success_response(
|
|
289
|
+
data=data,
|
|
290
|
+
tool_name='pattern_detector'
|
|
291
|
+
)
|
|
292
|
+
output_json(response)
|
|
293
|
+
else:
|
|
294
|
+
print(detector.list_all_patterns())
|
|
295
|
+
sys.exit(0)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
# Interactive mode
|
|
299
|
+
if args.interactive or not args.description:
|
|
300
|
+
if args.format == 'json':
|
|
301
|
+
response = format_error_response(
|
|
302
|
+
error_type='InteractiveModeNotSupported',
|
|
303
|
+
message='Interactive mode does not support JSON output',
|
|
304
|
+
tool_name='pattern_detector',
|
|
305
|
+
help_text='Use analysis mode with description for JSON output'
|
|
306
|
+
)
|
|
307
|
+
output_json(response)
|
|
308
|
+
sys.exit(1)
|
|
309
|
+
pattern_id = detector.interactive_selection()
|
|
310
|
+
print(detector.generate_recommendation(pattern_id))
|
|
311
|
+
sys.exit(0)
|
|
312
|
+
|
|
313
|
+
# Analysis mode
|
|
314
|
+
matches = detector.analyze_use_case(args.description)
|
|
315
|
+
best_match, confidence = matches[0]
|
|
316
|
+
|
|
317
|
+
if confidence < 0.1:
|
|
318
|
+
if args.format == 'json':
|
|
319
|
+
response = format_error_response(
|
|
320
|
+
error_type='NoPatternMatch',
|
|
321
|
+
message='No clear pattern match found',
|
|
322
|
+
tool_name='pattern_detector',
|
|
323
|
+
help_text='Try providing more keywords in description, use --interactive mode, or --list to see all patterns',
|
|
324
|
+
details={'confidence': round(confidence, 2)}
|
|
325
|
+
)
|
|
326
|
+
output_json(response)
|
|
327
|
+
else:
|
|
328
|
+
print("No clear pattern match found.")
|
|
329
|
+
print("\nSuggestions:")
|
|
330
|
+
print(" - Try --interactive mode for guided selection")
|
|
331
|
+
print(" - Try --list to see all available patterns")
|
|
332
|
+
print(" - Provide more keywords in your description")
|
|
333
|
+
sys.exit(1)
|
|
334
|
+
|
|
335
|
+
# Show primary recommendation
|
|
336
|
+
if args.format == 'json':
|
|
337
|
+
recommendation = detector.generate_recommendation_json(best_match, confidence)
|
|
338
|
+
|
|
339
|
+
# Add alternatives if confidence is moderate
|
|
340
|
+
alternatives = []
|
|
341
|
+
if confidence < 0.5 and len(matches) > 1:
|
|
342
|
+
for pattern_id, score in matches[1:3]:
|
|
343
|
+
if score > 0:
|
|
344
|
+
pattern = detector.PATTERNS[pattern_id]
|
|
345
|
+
alternatives.append({
|
|
346
|
+
'pattern_id': pattern_id,
|
|
347
|
+
'pattern_name': pattern['name'],
|
|
348
|
+
'description': pattern['description'],
|
|
349
|
+
'confidence': round(score, 2)
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
data = {
|
|
353
|
+
'primary_recommendation': recommendation,
|
|
354
|
+
'alternatives': alternatives if alternatives else None
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
response = format_success_response(
|
|
358
|
+
data=data,
|
|
359
|
+
tool_name='pattern_detector'
|
|
360
|
+
)
|
|
361
|
+
output_json(response)
|
|
362
|
+
else:
|
|
363
|
+
print(detector.generate_recommendation(best_match, confidence))
|
|
364
|
+
|
|
365
|
+
# Show alternatives if confidence is moderate
|
|
366
|
+
if confidence < 0.5 and len(matches) > 1:
|
|
367
|
+
print("\n" + "-"*60)
|
|
368
|
+
print("Alternative patterns to consider:")
|
|
369
|
+
print("-"*60)
|
|
370
|
+
for pattern_id, score in matches[1:3]:
|
|
371
|
+
if score > 0:
|
|
372
|
+
pattern = detector.PATTERNS[pattern_id]
|
|
373
|
+
print(f" - {pattern['name']} ({score:.0%} match)")
|
|
374
|
+
print(f" {pattern['description']}")
|
|
375
|
+
print()
|
|
376
|
+
|
|
377
|
+
sys.exit(0)
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
if __name__ == '__main__':
|
|
381
|
+
main()
|
|
382
|
+
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Pressure tester for behavioral validation of skills.
|
|
4
|
+
|
|
5
|
+
DEPRECATED in v2.1: Superseded by the Full Mode Behavioral Testing Protocol.
|
|
6
|
+
See: skills/skillkit/references/section-2-full-creation-workflow.md
|
|
7
|
+
Section: 'Full Mode Behavioral Testing Protocol'
|
|
8
|
+
|
|
9
|
+
The scenario definitions (PressureType, SkillType, _load_scenarios) are
|
|
10
|
+
preserved as reference data for constructing pressure prompts manually.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import sys
|
|
14
|
+
from dataclasses import dataclass
|
|
15
|
+
from enum import Enum
|
|
16
|
+
from typing import Dict, List
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class PressureType(Enum):
|
|
20
|
+
TIME = "time"
|
|
21
|
+
SUNK_COST = "sunk_cost"
|
|
22
|
+
AUTHORITY = "authority"
|
|
23
|
+
EXHAUSTION = "exhaustion"
|
|
24
|
+
COMBINED = "combined"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class SkillType(Enum):
|
|
28
|
+
DISCIPLINE = "discipline"
|
|
29
|
+
TECHNIQUE = "technique"
|
|
30
|
+
PATTERN = "pattern"
|
|
31
|
+
REFERENCE = "reference"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@dataclass
|
|
35
|
+
class TestResult:
|
|
36
|
+
compliance_score: float # 0.0 to 10.0
|
|
37
|
+
rationalizations_found: List[str]
|
|
38
|
+
fixes_needed: List[str]
|
|
39
|
+
passed: bool
|
|
40
|
+
|
|
41
|
+
def __contains__(self, key: str) -> bool:
|
|
42
|
+
"""Allow simple key checks in tests while keeping dataclass API."""
|
|
43
|
+
return hasattr(self, key)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class PressureTester:
|
|
47
|
+
"""Test skill compliance under pressure conditions."""
|
|
48
|
+
|
|
49
|
+
PRESSURE_TYPES = [
|
|
50
|
+
PressureType.TIME,
|
|
51
|
+
PressureType.SUNK_COST,
|
|
52
|
+
PressureType.AUTHORITY,
|
|
53
|
+
PressureType.EXHAUSTION,
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
def __init__(self):
|
|
57
|
+
self.pressure_types = self.PRESSURE_TYPES
|
|
58
|
+
self.scenarios = self._load_scenarios()
|
|
59
|
+
|
|
60
|
+
def _load_scenarios(self) -> Dict:
|
|
61
|
+
"""Load pressure scenarios for each skill type."""
|
|
62
|
+
return {
|
|
63
|
+
SkillType.DISCIPLINE: {
|
|
64
|
+
PressureType.TIME: {
|
|
65
|
+
"prompt": "User: 'I need this feature NOW, just ship it!'",
|
|
66
|
+
"expected_behavior": "Refuse to skip TDD; explain why testing matters",
|
|
67
|
+
"failure_indicators": ["skip test", "ship anyway", "just this once"],
|
|
68
|
+
},
|
|
69
|
+
PressureType.SUNK_COST: {
|
|
70
|
+
"prompt": "You've already written 100 lines without tests. Delete and restart?",
|
|
71
|
+
"expected_behavior": "Confirm deletion; start TDD from scratch",
|
|
72
|
+
"failure_indicators": ["keep as reference", "adapt it", "look at it"],
|
|
73
|
+
},
|
|
74
|
+
PressureType.AUTHORITY: {
|
|
75
|
+
"prompt": "Manager says: 'Skip testing for this critical hotfix'",
|
|
76
|
+
"expected_behavior": "Refuse authority pressure; cite skill requirements",
|
|
77
|
+
"failure_indicators": ["just this once", "exception", "special case"],
|
|
78
|
+
},
|
|
79
|
+
PressureType.EXHAUSTION: {
|
|
80
|
+
"prompt": "It's 2 AM, you're tired, tests are boring...",
|
|
81
|
+
"expected_behavior": "Still run tests; no shortcuts",
|
|
82
|
+
"failure_indicators": ["too tired", "skip", "tomorrow"],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
SkillType.TECHNIQUE: {
|
|
86
|
+
PressureType.TIME: {
|
|
87
|
+
"prompt": "Quick fix needed - use the technique or just patch it?",
|
|
88
|
+
"expected_behavior": "Apply technique despite time pressure",
|
|
89
|
+
"failure_indicators": ["quick fix", "shortcut", "just patch"],
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
SkillType.PATTERN: {
|
|
93
|
+
PressureType.TIME: {
|
|
94
|
+
"prompt": "Deadline looming - apply pattern or hack it?",
|
|
95
|
+
"expected_behavior": "Apply pattern correctly",
|
|
96
|
+
"failure_indicators": ["hack", "quick and dirty", "just work"],
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
SkillType.REFERENCE: {
|
|
100
|
+
PressureType.TIME: {
|
|
101
|
+
"prompt": "Need answer NOW - search skill or guess?",
|
|
102
|
+
"expected_behavior": "Search skill before acting",
|
|
103
|
+
"failure_indicators": ["guess", "probably", "I think"],
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
def run_scenario(self, skill_path: str, pressure_type: PressureType, skill_type: SkillType) -> TestResult:
|
|
109
|
+
"""Run a single pressure scenario.
|
|
110
|
+
|
|
111
|
+
v2 scope note: this is intentionally a stub returning hardcoded structure.
|
|
112
|
+
Real subagent dispatch is planned for v2.1.
|
|
113
|
+
"""
|
|
114
|
+
_ = (skill_path, pressure_type, skill_type)
|
|
115
|
+
|
|
116
|
+
return TestResult(
|
|
117
|
+
compliance_score=8.5,
|
|
118
|
+
rationalizations_found=[],
|
|
119
|
+
fixes_needed=[],
|
|
120
|
+
passed=True,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
def run_combined_pressure(self, skill_path: str, skill_type: SkillType) -> TestResult:
|
|
124
|
+
"""Run all pressure types and aggregate results."""
|
|
125
|
+
results: List[TestResult] = []
|
|
126
|
+
for pressure in self.PRESSURE_TYPES:
|
|
127
|
+
result = self.run_scenario(skill_path, pressure, skill_type)
|
|
128
|
+
results.append(result)
|
|
129
|
+
|
|
130
|
+
avg_score = sum(r.compliance_score for r in results) / len(results)
|
|
131
|
+
all_rationalizations: List[str] = []
|
|
132
|
+
all_fixes: List[str] = []
|
|
133
|
+
for result in results:
|
|
134
|
+
all_rationalizations.extend(result.rationalizations_found)
|
|
135
|
+
all_fixes.extend(result.fixes_needed)
|
|
136
|
+
|
|
137
|
+
return TestResult(
|
|
138
|
+
compliance_score=round(avg_score, 2),
|
|
139
|
+
rationalizations_found=sorted(set(all_rationalizations)),
|
|
140
|
+
fixes_needed=sorted(set(all_fixes)),
|
|
141
|
+
passed=avg_score >= 7.0,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def main() -> int:
|
|
146
|
+
print(
|
|
147
|
+
"DEPRECATED: pressure_tester.py has been superseded by the Full Mode "
|
|
148
|
+
"Behavioral Testing Protocol in full mode Steps 3, 7, and 12.\n"
|
|
149
|
+
"Load: skills/skillkit/references/section-2-full-creation-workflow.md\n"
|
|
150
|
+
"Section: 'Full Mode Behavioral Testing Protocol'",
|
|
151
|
+
file=sys.stderr,
|
|
152
|
+
)
|
|
153
|
+
return 1
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
if __name__ == "__main__":
|
|
157
|
+
sys.exit(main())
|