create-raffles-it 1.0.1
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/LICENSE +21 -0
- package/README.md +214 -0
- package/agents/.agents +105 -0
- package/agents/backend-specialist/agent.yaml +21 -0
- package/agents/backend-specialist/prompt.md +255 -0
- package/agents/code-archaeologist/agent.yaml +13 -0
- package/agents/code-archaeologist/prompt.md +98 -0
- package/agents/database-architect/agent.yaml +13 -0
- package/agents/database-architect/prompt.md +218 -0
- package/agents/debugger/agent.yaml +7 -0
- package/agents/debugger/prompt.md +219 -0
- package/agents/devops-engineer/agent.yaml +16 -0
- package/agents/devops-engineer/prompt.md +234 -0
- package/agents/documentation-writer/agent.yaml +13 -0
- package/agents/documentation-writer/prompt.md +96 -0
- package/agents/explorer-agent/agent.yaml +16 -0
- package/agents/explorer-agent/prompt.md +65 -0
- package/agents/frontend-specialist/agent.yaml +17 -0
- package/agents/frontend-specialist/prompt.md +585 -0
- package/agents/orchestrator/agent.yaml +21 -0
- package/agents/orchestrator/prompt.md +408 -0
- package/agents/penetration-tester/agent.yaml +15 -0
- package/agents/penetration-tester/prompt.md +180 -0
- package/agents/performance-optimizer/agent.yaml +13 -0
- package/agents/performance-optimizer/prompt.md +179 -0
- package/agents/product-manager/agent.yaml +12 -0
- package/agents/product-manager/prompt.md +104 -0
- package/agents/product-owner/agent.yaml +12 -0
- package/agents/product-owner/prompt.md +87 -0
- package/agents/project-planner/agent.yaml +13 -0
- package/agents/project-planner/prompt.md +397 -0
- package/agents/qa-automation-engineer/agent.yaml +16 -0
- package/agents/qa-automation-engineer/prompt.md +95 -0
- package/agents/security-auditor/agent.yaml +15 -0
- package/agents/security-auditor/prompt.md +162 -0
- package/agents/seo-specialist/agent.yaml +13 -0
- package/agents/seo-specialist/prompt.md +103 -0
- package/agents/test-engineer/agent.yaml +17 -0
- package/agents/test-engineer/prompt.md +150 -0
- package/bin/commands/help.js +19 -0
- package/bin/commands/init.js +125 -0
- package/bin/commands/list.js +40 -0
- package/bin/index.js +44 -0
- package/bin/utils/logger.js +32 -0
- package/bin/utils/scaffold.js +114 -0
- package/configs/mcp_config.json +24 -0
- package/configs/model.yaml +20 -0
- package/configs/runtime.yaml +22 -0
- package/package.json +56 -0
- package/prompts/planning.md +31 -0
- package/prompts/reflection.md +21 -0
- package/prompts/system.md +24 -0
- package/rules/GEMINI.md +273 -0
- package/skills/api-patterns/SKILL.md +81 -0
- package/skills/api-patterns/api-style.md +42 -0
- package/skills/api-patterns/auth.md +24 -0
- package/skills/api-patterns/documentation.md +26 -0
- package/skills/api-patterns/graphql.md +41 -0
- package/skills/api-patterns/rate-limiting.md +31 -0
- package/skills/api-patterns/response.md +37 -0
- package/skills/api-patterns/rest.md +40 -0
- package/skills/api-patterns/scripts/api_validator.py +211 -0
- package/skills/api-patterns/security-testing.md +122 -0
- package/skills/api-patterns/skill.yaml +3 -0
- package/skills/api-patterns/trpc.md +41 -0
- package/skills/api-patterns/versioning.md +22 -0
- package/skills/architecture/SKILL.md +55 -0
- package/skills/architecture/context-discovery.md +43 -0
- package/skills/architecture/examples.md +94 -0
- package/skills/architecture/pattern-selection.md +68 -0
- package/skills/architecture/patterns-reference.md +50 -0
- package/skills/architecture/skill.yaml +3 -0
- package/skills/architecture/trade-off-analysis.md +77 -0
- package/skills/brainstorming/SKILL.md +163 -0
- package/skills/brainstorming/dynamic-questioning.md +350 -0
- package/skills/brainstorming/skill.yaml +3 -0
- package/skills/clean-code/SKILL.md +201 -0
- package/skills/clean-code/skill.yaml +3 -0
- package/skills/code-review-checklist/SKILL.md +109 -0
- package/skills/code-review-checklist/skill.yaml +3 -0
- package/skills/database-design/SKILL.md +52 -0
- package/skills/database-design/database-selection.md +43 -0
- package/skills/database-design/indexing.md +39 -0
- package/skills/database-design/migrations.md +48 -0
- package/skills/database-design/optimization.md +36 -0
- package/skills/database-design/orm-selection.md +30 -0
- package/skills/database-design/schema-design.md +56 -0
- package/skills/database-design/scripts/schema_validator.py +172 -0
- package/skills/database-design/skill.yaml +3 -0
- package/skills/frontend-design/SKILL.md +452 -0
- package/skills/frontend-design/animation-guide.md +331 -0
- package/skills/frontend-design/color-system.md +311 -0
- package/skills/frontend-design/decision-trees.md +418 -0
- package/skills/frontend-design/motion-graphics.md +306 -0
- package/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/skills/frontend-design/skill.yaml +3 -0
- package/skills/frontend-design/typography-system.md +345 -0
- package/skills/frontend-design/ux-psychology.md +1116 -0
- package/skills/frontend-design/visual-effects.md +383 -0
- package/skills/mcp-builder/SKILL.md +176 -0
- package/skills/mcp-builder/skill.yaml +3 -0
- package/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +351 -0
- package/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
- package/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
- package/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
- package/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
- package/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
- package/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
- package/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
- package/skills/nextjs-react-expert/9-cache-components.md +103 -0
- package/skills/nextjs-react-expert/SKILL.md +293 -0
- package/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
- package/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
- package/skills/nextjs-react-expert/skill.yaml +3 -0
- package/skills/nodejs-best-practices/SKILL.md +333 -0
- package/skills/nodejs-best-practices/skill.yaml +3 -0
- package/skills/parallel-agents/SKILL.md +175 -0
- package/skills/parallel-agents/skill.yaml +3 -0
- package/skills/powershell-windows/SKILL.md +167 -0
- package/skills/powershell-windows/skill.yaml +3 -0
- package/skills/python-patterns/SKILL.md +441 -0
- package/skills/python-patterns/skill.yaml +3 -0
- package/skills/seo-fundamentals/SKILL.md +129 -0
- package/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/skills/seo-fundamentals/skill.yaml +3 -0
- package/skills/systematic-debugging/SKILL.md +109 -0
- package/skills/systematic-debugging/skill.yaml +3 -0
- package/skills/tdd-workflow/SKILL.md +149 -0
- package/skills/tdd-workflow/skill.yaml +3 -0
- package/skills/vulnerability-scanner/SKILL.md +276 -0
- package/skills/vulnerability-scanner/checklists.md +121 -0
- package/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/skills/vulnerability-scanner/skill.yaml +3 -0
- package/skills/web-design-guidelines/SKILL.md +57 -0
- package/skills/web-design-guidelines/skill.yaml +3 -0
- package/skills/webapp-testing/SKILL.md +187 -0
- package/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/skills/webapp-testing/skill.yaml +3 -0
- package/workflows/brainstorm.md +113 -0
- package/workflows/create.md +59 -0
- package/workflows/debug.md +103 -0
- package/workflows/deploy.md +176 -0
- package/workflows/enhance.md +63 -0
- package/workflows/orchestrate.md +237 -0
- package/workflows/plan.md +89 -0
- package/workflows/preview.md +81 -0
- package/workflows/status.md +86 -0
- package/workflows/test.md +144 -0
- package/workflows/ui-ux-pro-max.md +296 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
SEO Checker - Search Engine Optimization Audit
|
|
4
|
+
Checks HTML/JSX/TSX pages for SEO best practices.
|
|
5
|
+
|
|
6
|
+
PURPOSE:
|
|
7
|
+
- Verify meta tags, titles, descriptions
|
|
8
|
+
- Check Open Graph tags for social sharing
|
|
9
|
+
- Validate heading hierarchy
|
|
10
|
+
- Check image accessibility (alt attributes)
|
|
11
|
+
|
|
12
|
+
WHAT IT CHECKS:
|
|
13
|
+
- HTML files (actual web pages)
|
|
14
|
+
- JSX/TSX files (React page components)
|
|
15
|
+
- Only files that are likely PUBLIC pages
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
python seo_checker.py <project_path>
|
|
19
|
+
"""
|
|
20
|
+
import sys
|
|
21
|
+
import json
|
|
22
|
+
import re
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
from datetime import datetime
|
|
25
|
+
|
|
26
|
+
# Fix Windows console encoding
|
|
27
|
+
try:
|
|
28
|
+
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
29
|
+
except:
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Directories to skip
|
|
34
|
+
SKIP_DIRS = {
|
|
35
|
+
'node_modules', '.next', 'dist', 'build', '.git', '.github',
|
|
36
|
+
'__pycache__', '.vscode', '.idea', 'coverage', 'test', 'tests',
|
|
37
|
+
'__tests__', 'spec', 'docs', 'documentation', 'examples'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Files to skip (not pages)
|
|
41
|
+
SKIP_PATTERNS = [
|
|
42
|
+
'config', 'setup', 'util', 'helper', 'hook', 'context', 'store',
|
|
43
|
+
'service', 'api', 'lib', 'constant', 'type', 'interface', 'mock',
|
|
44
|
+
'.test.', '.spec.', '_test.', '_spec.'
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def is_page_file(file_path: Path) -> bool:
|
|
49
|
+
"""Check if this file is likely a public-facing page."""
|
|
50
|
+
name = file_path.name.lower()
|
|
51
|
+
stem = file_path.stem.lower()
|
|
52
|
+
|
|
53
|
+
# Skip utility/config files
|
|
54
|
+
if any(skip in name for skip in SKIP_PATTERNS):
|
|
55
|
+
return False
|
|
56
|
+
|
|
57
|
+
# Check path - pages in specific directories are likely pages
|
|
58
|
+
parts = [p.lower() for p in file_path.parts]
|
|
59
|
+
page_dirs = ['pages', 'app', 'routes', 'views', 'screens']
|
|
60
|
+
|
|
61
|
+
if any(d in parts for d in page_dirs):
|
|
62
|
+
return True
|
|
63
|
+
|
|
64
|
+
# Filename indicators for pages
|
|
65
|
+
page_names = ['page', 'index', 'home', 'about', 'contact', 'blog',
|
|
66
|
+
'post', 'article', 'product', 'landing', 'layout']
|
|
67
|
+
|
|
68
|
+
if any(p in stem for p in page_names):
|
|
69
|
+
return True
|
|
70
|
+
|
|
71
|
+
# HTML files are usually pages
|
|
72
|
+
if file_path.suffix.lower() in ['.html', '.htm']:
|
|
73
|
+
return True
|
|
74
|
+
|
|
75
|
+
return False
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def find_pages(project_path: Path) -> list:
|
|
79
|
+
"""Find page files to check."""
|
|
80
|
+
patterns = ['**/*.html', '**/*.htm', '**/*.jsx', '**/*.tsx']
|
|
81
|
+
|
|
82
|
+
files = []
|
|
83
|
+
for pattern in patterns:
|
|
84
|
+
for f in project_path.glob(pattern):
|
|
85
|
+
# Skip excluded directories
|
|
86
|
+
if any(skip in f.parts for skip in SKIP_DIRS):
|
|
87
|
+
continue
|
|
88
|
+
|
|
89
|
+
# Check if it's likely a page
|
|
90
|
+
if is_page_file(f):
|
|
91
|
+
files.append(f)
|
|
92
|
+
|
|
93
|
+
return files[:50] # Limit to 50 files
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def check_page(file_path: Path) -> dict:
|
|
97
|
+
"""Check a single page for SEO issues."""
|
|
98
|
+
issues = []
|
|
99
|
+
|
|
100
|
+
try:
|
|
101
|
+
content = file_path.read_text(encoding='utf-8', errors='ignore')
|
|
102
|
+
except Exception as e:
|
|
103
|
+
return {"file": str(file_path.name), "issues": [f"Error: {e}"]}
|
|
104
|
+
|
|
105
|
+
# Detect if this is a layout/template file (has Head component)
|
|
106
|
+
is_layout = 'Head>' in content or '<head' in content.lower()
|
|
107
|
+
|
|
108
|
+
# 1. Title tag
|
|
109
|
+
has_title = '<title' in content.lower() or 'title=' in content or 'Head>' in content
|
|
110
|
+
if not has_title and is_layout:
|
|
111
|
+
issues.append("Missing <title> tag")
|
|
112
|
+
|
|
113
|
+
# 2. Meta description
|
|
114
|
+
has_description = 'name="description"' in content.lower() or 'name=\'description\'' in content.lower()
|
|
115
|
+
if not has_description and is_layout:
|
|
116
|
+
issues.append("Missing meta description")
|
|
117
|
+
|
|
118
|
+
# 3. Open Graph tags
|
|
119
|
+
has_og = 'og:' in content or 'property="og:' in content.lower()
|
|
120
|
+
if not has_og and is_layout:
|
|
121
|
+
issues.append("Missing Open Graph tags")
|
|
122
|
+
|
|
123
|
+
# 4. Heading hierarchy - multiple H1s
|
|
124
|
+
h1_matches = re.findall(r'<h1[^>]*>', content, re.I)
|
|
125
|
+
if len(h1_matches) > 1:
|
|
126
|
+
issues.append(f"Multiple H1 tags ({len(h1_matches)})")
|
|
127
|
+
|
|
128
|
+
# 5. Images without alt
|
|
129
|
+
img_pattern = r'<img[^>]+>'
|
|
130
|
+
imgs = re.findall(img_pattern, content, re.I)
|
|
131
|
+
for img in imgs:
|
|
132
|
+
if 'alt=' not in img.lower():
|
|
133
|
+
issues.append("Image missing alt attribute")
|
|
134
|
+
break
|
|
135
|
+
if 'alt=""' in img or "alt=''" in img:
|
|
136
|
+
issues.append("Image has empty alt attribute")
|
|
137
|
+
break
|
|
138
|
+
|
|
139
|
+
# 6. Check for canonical link (nice to have)
|
|
140
|
+
# has_canonical = 'rel="canonical"' in content.lower()
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
"file": str(file_path.name),
|
|
144
|
+
"issues": issues
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def main():
|
|
149
|
+
project_path = Path(sys.argv[1] if len(sys.argv) > 1 else ".").resolve()
|
|
150
|
+
|
|
151
|
+
print(f"\n{'='*60}")
|
|
152
|
+
print(f" SEO CHECKER - Search Engine Optimization Audit")
|
|
153
|
+
print(f"{'='*60}")
|
|
154
|
+
print(f"Project: {project_path}")
|
|
155
|
+
print(f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
|
156
|
+
print("-"*60)
|
|
157
|
+
|
|
158
|
+
# Find pages
|
|
159
|
+
pages = find_pages(project_path)
|
|
160
|
+
|
|
161
|
+
if not pages:
|
|
162
|
+
print("\n[!] No page files found.")
|
|
163
|
+
print(" Looking for: HTML, JSX, TSX in pages/app/routes directories")
|
|
164
|
+
output = {"script": "seo_checker", "files_checked": 0, "passed": True}
|
|
165
|
+
print("\n" + json.dumps(output, indent=2))
|
|
166
|
+
sys.exit(0)
|
|
167
|
+
|
|
168
|
+
print(f"Found {len(pages)} page files to analyze\n")
|
|
169
|
+
|
|
170
|
+
# Check each page
|
|
171
|
+
all_issues = []
|
|
172
|
+
for f in pages:
|
|
173
|
+
result = check_page(f)
|
|
174
|
+
if result["issues"]:
|
|
175
|
+
all_issues.append(result)
|
|
176
|
+
|
|
177
|
+
# Summary
|
|
178
|
+
print("=" * 60)
|
|
179
|
+
print("SEO ANALYSIS RESULTS")
|
|
180
|
+
print("=" * 60)
|
|
181
|
+
|
|
182
|
+
if all_issues:
|
|
183
|
+
# Group by issue type
|
|
184
|
+
issue_counts = {}
|
|
185
|
+
for item in all_issues:
|
|
186
|
+
for issue in item["issues"]:
|
|
187
|
+
issue_counts[issue] = issue_counts.get(issue, 0) + 1
|
|
188
|
+
|
|
189
|
+
print("\nIssue Summary:")
|
|
190
|
+
for issue, count in sorted(issue_counts.items(), key=lambda x: -x[1]):
|
|
191
|
+
print(f" [{count}] {issue}")
|
|
192
|
+
|
|
193
|
+
print(f"\nAffected files ({len(all_issues)}):")
|
|
194
|
+
for item in all_issues[:5]:
|
|
195
|
+
print(f" - {item['file']}")
|
|
196
|
+
if len(all_issues) > 5:
|
|
197
|
+
print(f" ... and {len(all_issues) - 5} more")
|
|
198
|
+
else:
|
|
199
|
+
print("\n[OK] No SEO issues found!")
|
|
200
|
+
|
|
201
|
+
total_issues = sum(len(item["issues"]) for item in all_issues)
|
|
202
|
+
passed = total_issues == 0
|
|
203
|
+
|
|
204
|
+
output = {
|
|
205
|
+
"script": "seo_checker",
|
|
206
|
+
"project": str(project_path),
|
|
207
|
+
"files_checked": len(pages),
|
|
208
|
+
"files_with_issues": len(all_issues),
|
|
209
|
+
"issues_found": total_issues,
|
|
210
|
+
"passed": passed
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
print("\n" + json.dumps(output, indent=2))
|
|
214
|
+
|
|
215
|
+
sys.exit(0 if passed else 1)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
if __name__ == "__main__":
|
|
219
|
+
main()
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: systematic-debugging
|
|
3
|
+
description: 4-phase systematic debugging methodology with root cause analysis and evidence-based verification. Use when debugging complex issues.
|
|
4
|
+
allowed-tools: Read, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Systematic Debugging
|
|
8
|
+
|
|
9
|
+
> Source: obra/superpowers
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
This skill provides a structured approach to debugging that prevents random guessing and ensures problems are properly understood before solving.
|
|
13
|
+
|
|
14
|
+
## 4-Phase Debugging Process
|
|
15
|
+
|
|
16
|
+
### Phase 1: Reproduce
|
|
17
|
+
Before fixing, reliably reproduce the issue.
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
## Reproduction Steps
|
|
21
|
+
1. [Exact step to reproduce]
|
|
22
|
+
2. [Next step]
|
|
23
|
+
3. [Expected vs actual result]
|
|
24
|
+
|
|
25
|
+
## Reproduction Rate
|
|
26
|
+
- [ ] Always (100%)
|
|
27
|
+
- [ ] Often (50-90%)
|
|
28
|
+
- [ ] Sometimes (10-50%)
|
|
29
|
+
- [ ] Rare (<10%)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Phase 2: Isolate
|
|
33
|
+
Narrow down the source.
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
## Isolation Questions
|
|
37
|
+
- When did this start happening?
|
|
38
|
+
- What changed recently?
|
|
39
|
+
- Does it happen in all environments?
|
|
40
|
+
- Can we reproduce with minimal code?
|
|
41
|
+
- What's the smallest change that triggers it?
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Phase 3: Understand
|
|
45
|
+
Find the root cause, not just symptoms.
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
## Root Cause Analysis
|
|
49
|
+
### The 5 Whys
|
|
50
|
+
1. Why: [First observation]
|
|
51
|
+
2. Why: [Deeper reason]
|
|
52
|
+
3. Why: [Still deeper]
|
|
53
|
+
4. Why: [Getting closer]
|
|
54
|
+
5. Why: [Root cause]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Phase 4: Fix & Verify
|
|
58
|
+
Fix and verify it's truly fixed.
|
|
59
|
+
|
|
60
|
+
```markdown
|
|
61
|
+
## Fix Verification
|
|
62
|
+
- [ ] Bug no longer reproduces
|
|
63
|
+
- [ ] Related functionality still works
|
|
64
|
+
- [ ] No new issues introduced
|
|
65
|
+
- [ ] Test added to prevent regression
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Debugging Checklist
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
## Before Starting
|
|
72
|
+
- [ ] Can reproduce consistently
|
|
73
|
+
- [ ] Have minimal reproduction case
|
|
74
|
+
- [ ] Understand expected behavior
|
|
75
|
+
|
|
76
|
+
## During Investigation
|
|
77
|
+
- [ ] Check recent changes (git log)
|
|
78
|
+
- [ ] Check logs for errors
|
|
79
|
+
- [ ] Add logging if needed
|
|
80
|
+
- [ ] Use debugger/breakpoints
|
|
81
|
+
|
|
82
|
+
## After Fix
|
|
83
|
+
- [ ] Root cause documented
|
|
84
|
+
- [ ] Fix verified
|
|
85
|
+
- [ ] Regression test added
|
|
86
|
+
- [ ] Similar code checked
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Common Debugging Commands
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Recent changes
|
|
93
|
+
git log --oneline -20
|
|
94
|
+
git diff HEAD~5
|
|
95
|
+
|
|
96
|
+
# Search for pattern
|
|
97
|
+
grep -r "errorPattern" --include="*.ts"
|
|
98
|
+
|
|
99
|
+
# Check logs
|
|
100
|
+
pm2 logs app-name --err --lines 100
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Anti-Patterns
|
|
104
|
+
|
|
105
|
+
❌ **Random changes** - "Maybe if I change this..."
|
|
106
|
+
❌ **Ignoring evidence** - "That can't be the cause"
|
|
107
|
+
❌ **Assuming** - "It must be X" without proof
|
|
108
|
+
❌ **Not reproducing first** - Fixing blindly
|
|
109
|
+
❌ **Stopping at symptoms** - Not finding root cause
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd-workflow
|
|
3
|
+
description: Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# TDD Workflow
|
|
8
|
+
|
|
9
|
+
> Write tests first, code second.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. The TDD Cycle
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
🔴 RED → Write failing test
|
|
17
|
+
↓
|
|
18
|
+
🟢 GREEN → Write minimal code to pass
|
|
19
|
+
↓
|
|
20
|
+
🔵 REFACTOR → Improve code quality
|
|
21
|
+
↓
|
|
22
|
+
Repeat...
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 2. The Three Laws of TDD
|
|
28
|
+
|
|
29
|
+
1. Write production code only to make a failing test pass
|
|
30
|
+
2. Write only enough test to demonstrate failure
|
|
31
|
+
3. Write only enough code to make the test pass
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 3. RED Phase Principles
|
|
36
|
+
|
|
37
|
+
### What to Write
|
|
38
|
+
|
|
39
|
+
| Focus | Example |
|
|
40
|
+
|-------|---------|
|
|
41
|
+
| Behavior | "should add two numbers" |
|
|
42
|
+
| Edge cases | "should handle empty input" |
|
|
43
|
+
| Error states | "should throw for invalid data" |
|
|
44
|
+
|
|
45
|
+
### RED Phase Rules
|
|
46
|
+
|
|
47
|
+
- Test must fail first
|
|
48
|
+
- Test name describes expected behavior
|
|
49
|
+
- One assertion per test (ideally)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 4. GREEN Phase Principles
|
|
54
|
+
|
|
55
|
+
### Minimum Code
|
|
56
|
+
|
|
57
|
+
| Principle | Meaning |
|
|
58
|
+
|-----------|---------|
|
|
59
|
+
| **YAGNI** | You Aren't Gonna Need It |
|
|
60
|
+
| **Simplest thing** | Write the minimum to pass |
|
|
61
|
+
| **No optimization** | Just make it work |
|
|
62
|
+
|
|
63
|
+
### GREEN Phase Rules
|
|
64
|
+
|
|
65
|
+
- Don't write unneeded code
|
|
66
|
+
- Don't optimize yet
|
|
67
|
+
- Pass the test, nothing more
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 5. REFACTOR Phase Principles
|
|
72
|
+
|
|
73
|
+
### What to Improve
|
|
74
|
+
|
|
75
|
+
| Area | Action |
|
|
76
|
+
|------|--------|
|
|
77
|
+
| Duplication | Extract common code |
|
|
78
|
+
| Naming | Make intent clear |
|
|
79
|
+
| Structure | Improve organization |
|
|
80
|
+
| Complexity | Simplify logic |
|
|
81
|
+
|
|
82
|
+
### REFACTOR Rules
|
|
83
|
+
|
|
84
|
+
- All tests must stay green
|
|
85
|
+
- Small incremental changes
|
|
86
|
+
- Commit after each refactor
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 6. AAA Pattern
|
|
91
|
+
|
|
92
|
+
Every test follows:
|
|
93
|
+
|
|
94
|
+
| Step | Purpose |
|
|
95
|
+
|------|---------|
|
|
96
|
+
| **Arrange** | Set up test data |
|
|
97
|
+
| **Act** | Execute code under test |
|
|
98
|
+
| **Assert** | Verify expected outcome |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 7. When to Use TDD
|
|
103
|
+
|
|
104
|
+
| Scenario | TDD Value |
|
|
105
|
+
|----------|-----------|
|
|
106
|
+
| New feature | High |
|
|
107
|
+
| Bug fix | High (write test first) |
|
|
108
|
+
| Complex logic | High |
|
|
109
|
+
| Exploratory | Low (spike, then TDD) |
|
|
110
|
+
| UI layout | Low |
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 8. Test Prioritization
|
|
115
|
+
|
|
116
|
+
| Priority | Test Type |
|
|
117
|
+
|----------|-----------|
|
|
118
|
+
| 1 | Happy path |
|
|
119
|
+
| 2 | Error cases |
|
|
120
|
+
| 3 | Edge cases |
|
|
121
|
+
| 4 | Performance |
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 9. Anti-Patterns
|
|
126
|
+
|
|
127
|
+
| ❌ Don't | ✅ Do |
|
|
128
|
+
|----------|-------|
|
|
129
|
+
| Skip the RED phase | Watch test fail first |
|
|
130
|
+
| Write tests after | Write tests before |
|
|
131
|
+
| Over-engineer initial | Keep it simple |
|
|
132
|
+
| Multiple asserts | One behavior per test |
|
|
133
|
+
| Test implementation | Test behavior |
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 10. AI-Augmented TDD
|
|
138
|
+
|
|
139
|
+
### Multi-Agent Pattern
|
|
140
|
+
|
|
141
|
+
| Agent | Role |
|
|
142
|
+
|-------|------|
|
|
143
|
+
| Agent A | Write failing tests (RED) |
|
|
144
|
+
| Agent B | Implement to pass (GREEN) |
|
|
145
|
+
| Agent C | Optimize (REFACTOR) |
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
> **Remember:** The test is the specification. If you can't write a test, you don't understand the requirement.
|