@el-j/magic-helix-plugins 4.0.0-beta.2 → 4.0.0-beta.4
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/dist/architecture/codeowners.md +123 -0
- package/dist/architecture/monorepo.md +146 -0
- package/dist/architecture/nx.md +122 -0
- package/dist/architecture/turborepo.md +114 -0
- package/dist/ci/github-actions.md +268 -0
- package/dist/ci/gitlab-ci.md +330 -0
- package/dist/containers/docker-multistage.md +120 -0
- package/dist/containers/kubernetes-deploy.md +210 -0
- package/dist/cpp/index.cjs +79 -0
- package/dist/cpp/index.mjs +209 -0
- package/dist/csharp/index.cjs +2 -2
- package/dist/csharp/{index.js → index.mjs} +17 -11
- package/dist/csharp/templates/framework-aspnetcore.md +205 -0
- package/dist/csharp/templates/framework-blazor.md +271 -0
- package/dist/csharp/templates/lang-csharp.md +162 -0
- package/dist/devops/docker-compose.md +111 -0
- package/dist/devops/docker-dockerfile.md +94 -0
- package/dist/devops/github-actions.md +160 -0
- package/dist/devops/gitlab-ci.md +210 -0
- package/dist/generic/lang-typescript.md +57 -0
- package/dist/generic/state-redux.md +21 -0
- package/dist/generic/state-rxjs.md +6 -0
- package/dist/generic/style-mui.md +23 -0
- package/dist/generic/style-tailwind.md +76 -0
- package/dist/generic/test-cypress.md +21 -0
- package/dist/generic/test-jest.md +20 -0
- package/dist/generic/test-playwright.md +21 -0
- package/dist/generic/test-vitest.md +131 -0
- package/dist/go/index.cjs +3 -3
- package/dist/go/{index.js → index.mjs} +18 -15
- package/dist/go/templates/lang-go.md +571 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +24 -0
- package/dist/java/index.cjs +2 -2
- package/dist/java/{index.js → index.mjs} +25 -19
- package/dist/java/templates/build-gradle.md +102 -0
- package/dist/java/templates/build-maven.md +86 -0
- package/dist/java/templates/framework-spring-boot.md +179 -0
- package/dist/java/templates/lang-java.md +78 -0
- package/dist/java/templates/lang-kotlin.md +88 -0
- package/dist/meta/magic-helix-meta.md +213 -0
- package/dist/meta/meta-debug.md +459 -0
- package/dist/meta/meta-implement.md +450 -0
- package/dist/meta/meta-roadmap.md +265 -0
- package/dist/nodejs/templates/angular-core.md +19 -0
- package/dist/nodejs/templates/lang-typescript.md +57 -0
- package/dist/nodejs/templates/nestjs-core.md +7 -0
- package/dist/nodejs/templates/react-core.md +677 -0
- package/dist/nodejs/templates/react-zustand.md +7 -0
- package/dist/nodejs/templates/state-redux.md +21 -0
- package/dist/nodejs/templates/state-rxjs.md +6 -0
- package/dist/nodejs/templates/style-primevue.md +6 -0
- package/dist/nodejs/templates/style-quasar.md +22 -0
- package/dist/nodejs/templates/style-tailwind.md +76 -0
- package/dist/nodejs/templates/test-cypress.md +21 -0
- package/dist/nodejs/templates/test-jest.md +20 -0
- package/dist/nodejs/templates/test-playwright.md +21 -0
- package/dist/nodejs/templates/test-vitest.md +131 -0
- package/dist/nodejs/templates/vue-core.md +108 -0
- package/dist/nodejs/templates/vue-pinia.md +5 -0
- package/dist/patterns/architecture/clean-architecture.md +469 -0
- package/dist/patterns/architecture/dependency-injection.md +517 -0
- package/dist/patterns/architecture/domain-driven-design.md +621 -0
- package/dist/patterns/architecture/layered-architecture.md +382 -0
- package/dist/patterns/architecture/repository-pattern.md +408 -0
- package/dist/patterns/domain-expertise/nextjs-rules.md +115 -0
- package/dist/patterns/domain-expertise/react-patterns.md +181 -0
- package/dist/patterns/domain-expertise/server-components.md +212 -0
- package/dist/patterns/domain-expertise/shadcn-ui.md +52 -0
- package/dist/patterns/domain-expertise/tailwind-patterns.md +52 -0
- package/dist/patterns/environment/container-awareness.md +17 -0
- package/dist/patterns/environment/ide-features.md +17 -0
- package/dist/patterns/environment/os-commands.md +17 -0
- package/dist/patterns/organization/heading-hierarchy.md +103 -0
- package/dist/patterns/organization/sequential-workflows.md +102 -0
- package/dist/patterns/organization/xml-rule-groups.md +64 -0
- package/dist/patterns/reasoning/agent-loop.md +151 -0
- package/dist/patterns/reasoning/confirmation-gates.md +141 -0
- package/dist/patterns/reasoning/dependency-analysis.md +132 -0
- package/dist/patterns/reasoning/one-tool-per-iteration.md +152 -0
- package/dist/patterns/reasoning/preview-before-action.md +194 -0
- package/dist/patterns/reasoning/reflection-checkpoints.md +166 -0
- package/dist/patterns/reasoning/result-verification.md +157 -0
- package/dist/patterns/reasoning/subtask-breakdown.md +131 -0
- package/dist/patterns/reasoning/thinking-tags.md +100 -0
- package/dist/patterns/role-definition/capability-declarations.md +72 -0
- package/dist/patterns/role-definition/expert-identity.md +45 -0
- package/dist/patterns/role-definition/scope-boundaries.md +61 -0
- package/dist/patterns/safety/code-safety-rules.md +17 -0
- package/dist/patterns/safety/credential-handling.md +17 -0
- package/dist/patterns/safety/destructive-warnings.md +17 -0
- package/dist/patterns/safety/refusal-messages.md +17 -0
- package/dist/patterns/tone/adaptive-tone.md +17 -0
- package/dist/patterns/tone/concise-communication.md +17 -0
- package/dist/patterns/tone/forbidden-phrases.md +17 -0
- package/dist/patterns/tool-guidelines/function-schemas.md +143 -0
- package/dist/patterns/tool-guidelines/parameter-examples.md +137 -0
- package/dist/patterns/tool-guidelines/usage-policies.md +105 -0
- package/dist/php/index.cjs +2 -2
- package/dist/php/{index.js → index.mjs} +12 -6
- package/dist/php/templates/framework-laravel.md +112 -0
- package/dist/php/templates/lang-php.md +94 -0
- package/dist/python/index.cjs +4 -4
- package/dist/python/{index.js → index.mjs} +10 -7
- package/dist/python/templates/lang-python.md +508 -0
- package/dist/ruby/index.cjs +2 -2
- package/dist/ruby/{index.js → index.mjs} +16 -10
- package/dist/ruby/templates/framework-rails.md +309 -0
- package/dist/ruby/templates/framework-sinatra.md +227 -0
- package/dist/ruby/templates/lang-ruby.md +216 -0
- package/dist/rust/index.cjs +3 -3
- package/dist/rust/{index.js → index.mjs} +24 -18
- package/dist/rust/templates/lang-rust.md +89 -0
- package/dist/swift/index.cjs +32 -0
- package/dist/swift/index.mjs +112 -0
- package/dist/swift/templates/framework-vapor.md +352 -0
- package/dist/swift/templates/lang-swift.md +291 -0
- package/package.json +31 -21
- package/dist/index.js +0 -20
- /package/dist/nodejs/{index.js → index.mjs} +0 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Preview Before Action Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Show what will happen before executing, even for non-destructive operations. From **Cline** pattern.
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
|
|
8
|
+
```markdown
|
|
9
|
+
## Preview Policy
|
|
10
|
+
|
|
11
|
+
Before any file modification, show preview:
|
|
12
|
+
|
|
13
|
+
### Preview Format
|
|
14
|
+
```
|
|
15
|
+
📝 **Preview**: {OPERATION_NAME}
|
|
16
|
+
|
|
17
|
+
**File**: {FILE_PATH}
|
|
18
|
+
**Lines**: {START_LINE}-{END_LINE}
|
|
19
|
+
|
|
20
|
+
**Current**:
|
|
21
|
+
```{LANGUAGE}
|
|
22
|
+
{OLD_CODE}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Proposed**:
|
|
26
|
+
```{LANGUAGE}
|
|
27
|
+
{NEW_CODE}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Changes**:
|
|
31
|
+
- {CHANGE_DESCRIPTION_1}
|
|
32
|
+
- {CHANGE_DESCRIPTION_2}
|
|
33
|
+
```
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
### Cline (Code Edit Preview)
|
|
39
|
+
```markdown
|
|
40
|
+
## Preview Policy: File Edits
|
|
41
|
+
|
|
42
|
+
Before modifying files, show exact changes:
|
|
43
|
+
|
|
44
|
+
📝 **Preview**: Update import path in Header component
|
|
45
|
+
|
|
46
|
+
**File**: `src/components/Header.tsx`
|
|
47
|
+
**Lines**: 1-10
|
|
48
|
+
|
|
49
|
+
**Current**:
|
|
50
|
+
```typescript
|
|
51
|
+
import React from 'react';
|
|
52
|
+
import { Button } from './ui/button';
|
|
53
|
+
import { Logo } from './Logo';
|
|
54
|
+
|
|
55
|
+
export const Header = () => {
|
|
56
|
+
return (
|
|
57
|
+
<header>
|
|
58
|
+
<Logo />
|
|
59
|
+
<Button>Click me</Button>
|
|
60
|
+
</header>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Proposed**:
|
|
66
|
+
```typescript
|
|
67
|
+
import React from 'react';
|
|
68
|
+
import { Button } from '@/components/ui/Button'; // Fixed path and capitalization
|
|
69
|
+
import { Logo } from './Logo';
|
|
70
|
+
|
|
71
|
+
export const Header = () => {
|
|
72
|
+
return (
|
|
73
|
+
<header>
|
|
74
|
+
<Logo />
|
|
75
|
+
<Button>Click me</Button>
|
|
76
|
+
</header>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Changes**:
|
|
82
|
+
- Changed `./ui/button` to `@/components/ui/Button`
|
|
83
|
+
- Fixed case sensitivity (button → Button)
|
|
84
|
+
- Uses absolute path alias (@/) for clarity
|
|
85
|
+
|
|
86
|
+
Proceeding with edit...
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### same.new (Component Creation Preview)
|
|
90
|
+
```markdown
|
|
91
|
+
## Preview Policy: New File Creation
|
|
92
|
+
|
|
93
|
+
Before creating files, show complete content:
|
|
94
|
+
|
|
95
|
+
📝 **Preview**: Create UserProfile component
|
|
96
|
+
|
|
97
|
+
**File**: `src/components/UserProfile.tsx` (new file)
|
|
98
|
+
|
|
99
|
+
**Content**:
|
|
100
|
+
```typescript
|
|
101
|
+
import React from 'react';
|
|
102
|
+
|
|
103
|
+
interface UserProfileProps {
|
|
104
|
+
name: string;
|
|
105
|
+
email: string;
|
|
106
|
+
avatarUrl?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const UserProfile: React.FC<UserProfileProps> = ({
|
|
110
|
+
name,
|
|
111
|
+
email,
|
|
112
|
+
avatarUrl
|
|
113
|
+
}) => {
|
|
114
|
+
return (
|
|
115
|
+
<div className="user-profile">
|
|
116
|
+
{avatarUrl && <img src={avatarUrl} alt={name} />}
|
|
117
|
+
<h2>{name}</h2>
|
|
118
|
+
<p>{email}</p>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Features**:
|
|
125
|
+
- TypeScript with proper interface
|
|
126
|
+
- Optional avatar support
|
|
127
|
+
- Accessible img alt text
|
|
128
|
+
- Clean, minimal styling hooks
|
|
129
|
+
|
|
130
|
+
Creating file...
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### v0 (Multi-File Preview)
|
|
134
|
+
```markdown
|
|
135
|
+
## Preview Policy: Multiple File Generation
|
|
136
|
+
|
|
137
|
+
Before creating multiple files, show structure and key content:
|
|
138
|
+
|
|
139
|
+
📝 **Preview**: Generate authentication system
|
|
140
|
+
|
|
141
|
+
**Files to Create**:
|
|
142
|
+
1. `src/lib/auth.ts` - Auth utilities (45 lines)
|
|
143
|
+
2. `src/app/login/page.tsx` - Login page (80 lines)
|
|
144
|
+
3. `src/app/signup/page.tsx` - Signup page (75 lines)
|
|
145
|
+
4. `src/middleware.ts` - Route protection (20 lines)
|
|
146
|
+
|
|
147
|
+
**Key Sections**:
|
|
148
|
+
|
|
149
|
+
**auth.ts**:
|
|
150
|
+
```typescript
|
|
151
|
+
export async function hashPassword(password: string): Promise<string> { /*...*/ }
|
|
152
|
+
export async function verifyPassword(password: string, hash: string): Promise<boolean> { /*...*/ }
|
|
153
|
+
export async function createSession(userId: string): Promise<string> { /*...*/ }
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**login/page.tsx**:
|
|
157
|
+
```typescript
|
|
158
|
+
export default function LoginPage() {
|
|
159
|
+
const [email, setEmail] = useState('');
|
|
160
|
+
const [password, setPassword] = useState('');
|
|
161
|
+
// ... form handling
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Structure**:
|
|
166
|
+
- Uses bcrypt for password hashing
|
|
167
|
+
- JWT for session tokens
|
|
168
|
+
- Server Actions for form submission
|
|
169
|
+
- Protected routes via middleware
|
|
170
|
+
|
|
171
|
+
Proceed with generation?
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Variables
|
|
175
|
+
- `{OPERATION_NAME}`: What you're doing (e.g., "Update import path")
|
|
176
|
+
- `{FILE_PATH}`: Absolute or relative path
|
|
177
|
+
- `{START_LINE}` / `{END_LINE}`: Line range
|
|
178
|
+
- `{LANGUAGE}`: Syntax highlighting language
|
|
179
|
+
- `{OLD_CODE}`: Current file contents
|
|
180
|
+
- `{NEW_CODE}`: Proposed changes
|
|
181
|
+
- `{CHANGE_DESCRIPTION_X}`: Plain English explanation
|
|
182
|
+
|
|
183
|
+
## Best Practices
|
|
184
|
+
1. Show preview for:
|
|
185
|
+
- All file edits (even single-line changes)
|
|
186
|
+
- New file creation (show full content if <100 lines)
|
|
187
|
+
- File deletion (show what's being removed)
|
|
188
|
+
- Terminal commands with side effects
|
|
189
|
+
2. Use syntax highlighting (```typescript, ```python, etc.)
|
|
190
|
+
3. Include context lines (3-5 lines above/below change)
|
|
191
|
+
4. Explain *why* change is needed, not just *what* changed
|
|
192
|
+
5. For large files (>100 lines), show key sections + summary
|
|
193
|
+
6. For multiple files, prioritize most critical/complex
|
|
194
|
+
7. Benefits: Catches mistakes before execution, educates user, builds confidence
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Reflection Checkpoints Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Periodically evaluate progress and adjust strategy. From **Claude** and **Bolt.new** patterns.
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
|
|
8
|
+
```markdown
|
|
9
|
+
## Reflection Checkpoints
|
|
10
|
+
|
|
11
|
+
After every {N} iterations or {MILESTONE}, pause and reflect:
|
|
12
|
+
|
|
13
|
+
### Progress Check
|
|
14
|
+
- **What have we accomplished?** {LIST_COMPLETED_TASKS}
|
|
15
|
+
- **What's remaining?** {LIST_PENDING_TASKS}
|
|
16
|
+
- **Are we on track?** {YES_NO_AND_WHY}
|
|
17
|
+
|
|
18
|
+
### Quality Check
|
|
19
|
+
- **Does output meet requirements?** {VERIFY_AGAINST_SPECS}
|
|
20
|
+
- **Are there obvious issues?** {BUGS_PERFORMANCE_STYLE}
|
|
21
|
+
- **Is code/design idiomatic?** {FOLLOWS_BEST_PRACTICES}
|
|
22
|
+
|
|
23
|
+
### Strategy Check
|
|
24
|
+
- **Is current approach working?** {ASSESS_EFFECTIVENESS}
|
|
25
|
+
- **Should we change tactics?** {ALTERNATIVE_APPROACHES}
|
|
26
|
+
- **Do we need clarification?** {QUESTIONS_FOR_USER}
|
|
27
|
+
|
|
28
|
+
### Decision
|
|
29
|
+
- ✅ **Continue**: Current approach is effective
|
|
30
|
+
- 🔄 **Adjust**: Modify strategy based on learnings
|
|
31
|
+
- ❓ **Clarify**: Ask user for guidance
|
|
32
|
+
- ⛔ **Stop**: Goal achieved or insurmountable blocker
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
### Claude (Long Conversation Reflection)
|
|
38
|
+
```markdown
|
|
39
|
+
## Reflection Checkpoints: Complex Refactoring
|
|
40
|
+
|
|
41
|
+
After every 5 tool calls, pause and reflect:
|
|
42
|
+
|
|
43
|
+
### Progress Check (After Iteration 5)
|
|
44
|
+
- **What have we accomplished?**
|
|
45
|
+
- ✅ Identified 12 files needing refactoring
|
|
46
|
+
- ✅ Extracted common utility functions
|
|
47
|
+
- ✅ Created new shared module
|
|
48
|
+
|
|
49
|
+
- **What's remaining?**
|
|
50
|
+
- ⏳ Update imports in 8 consumer files
|
|
51
|
+
- ⏳ Write tests for new utilities
|
|
52
|
+
- ⏳ Remove duplicated code
|
|
53
|
+
|
|
54
|
+
- **Are we on track?**
|
|
55
|
+
- Yes, 40% complete, no major blockers
|
|
56
|
+
|
|
57
|
+
### Quality Check
|
|
58
|
+
- **Does output meet requirements?**
|
|
59
|
+
- New utilities are well-typed ✅
|
|
60
|
+
- Functions are properly documented ✅
|
|
61
|
+
|
|
62
|
+
- **Are there obvious issues?**
|
|
63
|
+
- No error handling in two functions ⚠️
|
|
64
|
+
- Missing input validation ⚠️
|
|
65
|
+
|
|
66
|
+
- **Is code idiomatic?**
|
|
67
|
+
- Follows TypeScript best practices ✅
|
|
68
|
+
- Consistent naming conventions ✅
|
|
69
|
+
|
|
70
|
+
### Strategy Check
|
|
71
|
+
- **Is current approach working?**
|
|
72
|
+
- Yes, incremental refactoring is safe and testable
|
|
73
|
+
|
|
74
|
+
- **Should we change tactics?**
|
|
75
|
+
- Add error handling before updating consumers
|
|
76
|
+
- Write tests now (easier with isolated utilities)
|
|
77
|
+
|
|
78
|
+
- **Do we need clarification?**
|
|
79
|
+
- Should we maintain backward compatibility?
|
|
80
|
+
- Preferred error handling strategy?
|
|
81
|
+
|
|
82
|
+
### Decision
|
|
83
|
+
- 🔄 **Adjust**: Add error handling and tests before proceeding
|
|
84
|
+
- Next 5 iterations: Focus on robustness
|
|
85
|
+
- Then continue with consumer updates
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Bolt.new (Build Pipeline Reflection)
|
|
89
|
+
```markdown
|
|
90
|
+
## Reflection Checkpoints: Full-Stack App Creation
|
|
91
|
+
|
|
92
|
+
After each major milestone, pause and reflect:
|
|
93
|
+
|
|
94
|
+
### Progress Check (After Database Setup)
|
|
95
|
+
- **What have we accomplished?**
|
|
96
|
+
- ✅ Prisma schema defined
|
|
97
|
+
- ✅ Migrations run successfully
|
|
98
|
+
- ✅ Database seeded with test data
|
|
99
|
+
|
|
100
|
+
- **What's remaining?**
|
|
101
|
+
- ⏳ API routes for CRUD operations
|
|
102
|
+
- ⏳ Frontend components
|
|
103
|
+
- ⏳ Authentication integration
|
|
104
|
+
|
|
105
|
+
- **Are we on track?**
|
|
106
|
+
- Yes, 25% complete (1 of 4 phases done)
|
|
107
|
+
|
|
108
|
+
### Quality Check
|
|
109
|
+
- **Does output meet requirements?**
|
|
110
|
+
- Schema matches user's data model ✅
|
|
111
|
+
- Relationships properly defined ✅
|
|
112
|
+
|
|
113
|
+
- **Are there obvious issues?**
|
|
114
|
+
- No indexes on frequently queried fields ⚠️
|
|
115
|
+
- Missing cascade deletes on relationships ⚠️
|
|
116
|
+
|
|
117
|
+
- **Is code/design idiomatic?**
|
|
118
|
+
- Follows Prisma naming conventions ✅
|
|
119
|
+
- Uses appropriate field types ✅
|
|
120
|
+
|
|
121
|
+
### Strategy Check
|
|
122
|
+
- **Is current approach working?**
|
|
123
|
+
- Yes, schema-first design enables type-safe API
|
|
124
|
+
|
|
125
|
+
- **Should we change tactics?**
|
|
126
|
+
- Add indexes before building API (prevents performance issues)
|
|
127
|
+
- Use `onDelete: Cascade` for parent-child relationships
|
|
128
|
+
|
|
129
|
+
- **Do we need clarification?**
|
|
130
|
+
- Which fields will be most queried? (to optimize indexes)
|
|
131
|
+
- Should soft deletes be used instead of hard deletes?
|
|
132
|
+
|
|
133
|
+
### Decision
|
|
134
|
+
- 🔄 **Adjust**: Optimize schema before building API
|
|
135
|
+
- Add indexes on user_id, created_at
|
|
136
|
+
- Add cascade deletes on comment relationships
|
|
137
|
+
- Then proceed to API routes phase
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Variables
|
|
141
|
+
- `{N}`: Number of iterations between checkpoints (e.g., 5, 10)
|
|
142
|
+
- `{MILESTONE}`: Significant completion point (e.g., "after database setup")
|
|
143
|
+
- `{LIST_COMPLETED_TASKS}`: Enumeration with ✅
|
|
144
|
+
- `{LIST_PENDING_TASKS}`: Enumeration with ⏳
|
|
145
|
+
- `{YES_NO_AND_WHY}`: Assessment with reasoning
|
|
146
|
+
- `{VERIFY_AGAINST_SPECS}`: Compare to requirements
|
|
147
|
+
- `{BUGS_PERFORMANCE_STYLE}`: Common quality issues
|
|
148
|
+
- `{FOLLOWS_BEST_PRACTICES}`: Idiomatic code check
|
|
149
|
+
- `{ASSESS_EFFECTIVENESS}`: Is strategy working?
|
|
150
|
+
- `{ALTERNATIVE_APPROACHES}`: Other options to consider
|
|
151
|
+
- `{QUESTIONS_FOR_USER}`: What to clarify
|
|
152
|
+
|
|
153
|
+
## Best Practices
|
|
154
|
+
1. Set checkpoint frequency based on task complexity (5-10 iterations)
|
|
155
|
+
2. Use checkpoints at natural milestones (after component, API, test suite)
|
|
156
|
+
3. Be honest about issues (don't hide problems until later)
|
|
157
|
+
4. Adjust strategy based on findings (not just report)
|
|
158
|
+
5. Ask user questions when uncertain (don't guess)
|
|
159
|
+
6. Document decisions (why you adjusted or continued)
|
|
160
|
+
7. Benefits: Catches issues early, prevents wasted work, maintains quality
|
|
161
|
+
|
|
162
|
+
## Implementation Notes
|
|
163
|
+
- Can be explicit (show user reflection) or implicit (internal reasoning)
|
|
164
|
+
- Combine with thinking tags for transparent reasoning
|
|
165
|
+
- Especially valuable for long-running tasks (>10 iterations)
|
|
166
|
+
- Helps models avoid "tunnel vision" (blindly following initial plan)
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Result Verification Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Validate tool outputs and check for errors after execution. From **Manus** and **Bolt.new** patterns.
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
|
|
8
|
+
```markdown
|
|
9
|
+
## Result Verification
|
|
10
|
+
|
|
11
|
+
After every tool call, verify the outcome:
|
|
12
|
+
|
|
13
|
+
### 1. Check Status
|
|
14
|
+
- **Success?** {DID_TOOL_COMPLETE_SUCCESSFULLY}
|
|
15
|
+
- **Error?** {PARSE_ERROR_MESSAGE_IF_FAILED}
|
|
16
|
+
|
|
17
|
+
### 2. Validate Output
|
|
18
|
+
- **Expected?** {DOES_OUTPUT_MATCH_EXPECTATIONS}
|
|
19
|
+
- **Complete?** {IS_ALL_REQUIRED_DATA_PRESENT}
|
|
20
|
+
- **Correct?** {SPOT_CHECK_VALUES_OR_CONTENT}
|
|
21
|
+
|
|
22
|
+
### 3. Handle Issues
|
|
23
|
+
If verification fails:
|
|
24
|
+
- **Retry**: {SAME_OPERATION_WITH_ADJUSTED_PARAMS}
|
|
25
|
+
- **Fallback**: {ALTERNATIVE_APPROACH}
|
|
26
|
+
- **Escalate**: {ASK_USER_FOR_HELP}
|
|
27
|
+
|
|
28
|
+
### 4. Update State
|
|
29
|
+
- **Record**: {SAVE_RELEVANT_DATA_FOR_NEXT_ITERATION}
|
|
30
|
+
- **Track**: {UPDATE_PROGRESS_MARKERS}
|
|
31
|
+
- **Learn**: {NOTE_PATTERNS_FOR_FUTURE_CALLS}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Manus (File Read Verification)
|
|
37
|
+
```markdown
|
|
38
|
+
## Result Verification: Read File
|
|
39
|
+
|
|
40
|
+
After reading file, verify the outcome:
|
|
41
|
+
|
|
42
|
+
**Tool Call**:
|
|
43
|
+
```
|
|
44
|
+
read_file({ path: "src/app.ts", startLine: 1, endLine: 50 })
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 1. Check Status
|
|
48
|
+
- **Success?** ✅ Tool returned 200 OK
|
|
49
|
+
- **Error?** None
|
|
50
|
+
|
|
51
|
+
### 2. Validate Output
|
|
52
|
+
- **Expected?** ✅ File contains TypeScript code
|
|
53
|
+
- **Complete?** ⚠️ File is 150 lines, only got first 50
|
|
54
|
+
- **Correct?** ✅ Spot check: imports at top, export at bottom
|
|
55
|
+
|
|
56
|
+
### 3. Handle Issues
|
|
57
|
+
- **Issue**: Need more context (file is longer than expected)
|
|
58
|
+
- **Action**: Read lines 50-150 in next iteration
|
|
59
|
+
- **Record**: Note that app.ts is 150 lines total
|
|
60
|
+
|
|
61
|
+
### 4. Update State
|
|
62
|
+
- **Record**: app.ts imports from './config' and './utils'
|
|
63
|
+
- **Track**: File analysis: 33% complete (1 of 3 files read fully)
|
|
64
|
+
- **Learn**: Large files need multiple read calls
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Bolt.new (Build Command Verification)
|
|
68
|
+
```markdown
|
|
69
|
+
## Result Verification: Run Build
|
|
70
|
+
|
|
71
|
+
After running build command, verify the outcome:
|
|
72
|
+
|
|
73
|
+
**Tool Call**:
|
|
74
|
+
```
|
|
75
|
+
run_terminal({ command: "npm run build" })
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 1. Check Status
|
|
79
|
+
- **Success?** ❌ Exit code: 1 (failure)
|
|
80
|
+
- **Error?** "Module not found: Can't resolve '@/lib/utils'"
|
|
81
|
+
|
|
82
|
+
### 2. Validate Output
|
|
83
|
+
- **Expected?** ❌ Expected successful build
|
|
84
|
+
- **Complete?** N/A (build failed)
|
|
85
|
+
- **Correct?** N/A (error message is the output)
|
|
86
|
+
|
|
87
|
+
### 3. Handle Issues
|
|
88
|
+
- **Issue**: Module resolution error
|
|
89
|
+
- **Root Cause**: Path alias (@/) not configured in tsconfig.json
|
|
90
|
+
- **Action**:
|
|
91
|
+
1. Read tsconfig.json to verify paths config
|
|
92
|
+
2. If missing, add paths: { "@/*": ["./src/*"] }
|
|
93
|
+
3. Retry build command
|
|
94
|
+
|
|
95
|
+
### 4. Update State
|
|
96
|
+
- **Record**: Build failed due to missing path alias
|
|
97
|
+
- **Track**: Build attempt 1/3 failed, trying fix
|
|
98
|
+
- **Learn**: Always verify tsconfig before using path aliases
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### same.new (Component Generation Verification)
|
|
102
|
+
```markdown
|
|
103
|
+
## Result Verification: Create Component
|
|
104
|
+
|
|
105
|
+
After creating component file, verify the outcome:
|
|
106
|
+
|
|
107
|
+
**Tool Call**:
|
|
108
|
+
```
|
|
109
|
+
create_file({ path: "src/components/Button.tsx", content: "..." })
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 1. Check Status
|
|
113
|
+
- **Success?** ✅ File created
|
|
114
|
+
- **Error?** None
|
|
115
|
+
|
|
116
|
+
### 2. Validate Output
|
|
117
|
+
- **Expected?** ✅ File exists at specified path
|
|
118
|
+
- **Complete?** ✅ Full component code written
|
|
119
|
+
- **Correct?**
|
|
120
|
+
- ✅ Has TypeScript interface
|
|
121
|
+
- ✅ Uses React.FC type
|
|
122
|
+
- ✅ Has proper exports
|
|
123
|
+
- ⚠️ Missing aria-label for accessibility
|
|
124
|
+
|
|
125
|
+
### 3. Handle Issues
|
|
126
|
+
- **Issue**: Missing accessibility attribute
|
|
127
|
+
- **Action**: Edit file to add aria-label prop and usage
|
|
128
|
+
- **Don't Create New**: Modify existing file instead
|
|
129
|
+
|
|
130
|
+
### 4. Update State
|
|
131
|
+
- **Record**: Button.tsx created, needs accessibility fix
|
|
132
|
+
- **Track**: Component generation: 90% complete (add a11y)
|
|
133
|
+
- **Learn**: Include aria attributes in initial generation
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Variables
|
|
137
|
+
- `{DID_TOOL_COMPLETE_SUCCESSFULLY}`: Boolean + status code
|
|
138
|
+
- `{PARSE_ERROR_MESSAGE_IF_FAILED}`: Extract meaningful error
|
|
139
|
+
- `{DOES_OUTPUT_MATCH_EXPECTATIONS}`: Compare to intent
|
|
140
|
+
- `{IS_ALL_REQUIRED_DATA_PRESENT}`: Completeness check
|
|
141
|
+
- `{SPOT_CHECK_VALUES_OR_CONTENT}`: Validate sample data
|
|
142
|
+
- `{SAME_OPERATION_WITH_ADJUSTED_PARAMS}`: Retry with fixes
|
|
143
|
+
- `{ALTERNATIVE_APPROACH}`: Different tool or method
|
|
144
|
+
- `{ASK_USER_FOR_HELP}`: When stuck or uncertain
|
|
145
|
+
- `{SAVE_RELEVANT_DATA_FOR_NEXT_ITERATION}`: State updates
|
|
146
|
+
- `{UPDATE_PROGRESS_MARKERS}`: Track completion
|
|
147
|
+
- `{NOTE_PATTERNS_FOR_FUTURE_CALLS}`: Learning
|
|
148
|
+
|
|
149
|
+
## Best Practices
|
|
150
|
+
1. **Always** check tool return status (don't assume success)
|
|
151
|
+
2. Parse error messages (extract actionable information)
|
|
152
|
+
3. Validate output structure (not just success boolean)
|
|
153
|
+
4. Spot-check content (random sampling for large outputs)
|
|
154
|
+
5. Implement retry logic (up to 3 attempts with backoff)
|
|
155
|
+
6. Fall back gracefully (alternative tools or manual steps)
|
|
156
|
+
7. Update mental model (learn from successes and failures)
|
|
157
|
+
8. Benefits: Robust execution, early error detection, self-correction, adaptive behavior
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Subtask Breakdown Pattern
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Decompose complex requests into manageable steps. From **Manus** and **Bolt.new** patterns.
|
|
5
|
+
|
|
6
|
+
## Template
|
|
7
|
+
|
|
8
|
+
```markdown
|
|
9
|
+
When faced with a complex task, break it down:
|
|
10
|
+
|
|
11
|
+
## Task: {MAIN_GOAL}
|
|
12
|
+
|
|
13
|
+
### Subtasks:
|
|
14
|
+
1. {SUBTASK_1}
|
|
15
|
+
- Input: {WHAT_YOU_NEED}
|
|
16
|
+
- Output: {WHAT_YOU_PRODUCE}
|
|
17
|
+
- Depends on: {PREREQUISITES}
|
|
18
|
+
|
|
19
|
+
2. {SUBTASK_2}
|
|
20
|
+
- Input: {WHAT_YOU_NEED}
|
|
21
|
+
- Output: {WHAT_YOU_PRODUCE}
|
|
22
|
+
- Depends on: {PREREQUISITES}
|
|
23
|
+
|
|
24
|
+
3. {SUBTASK_3}
|
|
25
|
+
- Input: {WHAT_YOU_NEED}
|
|
26
|
+
- Output: {WHAT_YOU_PRODUCE}
|
|
27
|
+
- Depends on: {PREREQUISITES}
|
|
28
|
+
|
|
29
|
+
### Execution Order:
|
|
30
|
+
{WHICH_CAN_RUN_IN_PARALLEL}, {WHICH_MUST_BE_SEQUENTIAL}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Bolt.new (Full-Stack App Creation)
|
|
36
|
+
```markdown
|
|
37
|
+
When creating a new application, break it down:
|
|
38
|
+
|
|
39
|
+
## Task: Create a Next.js blog with authentication
|
|
40
|
+
|
|
41
|
+
### Subtasks:
|
|
42
|
+
1. **Initialize Project Structure**
|
|
43
|
+
- Input: Framework choice (Next.js), styling (Tailwind)
|
|
44
|
+
- Output: package.json, tsconfig.json, basic file structure
|
|
45
|
+
- Depends on: Nothing (can start immediately)
|
|
46
|
+
|
|
47
|
+
2. **Set Up Database Schema**
|
|
48
|
+
- Input: Data models (User, Post, Comment)
|
|
49
|
+
- Output: Prisma schema, migrations
|
|
50
|
+
- Depends on: Project structure
|
|
51
|
+
|
|
52
|
+
3. **Implement Authentication**
|
|
53
|
+
- Input: Auth provider (NextAuth.js), database schema
|
|
54
|
+
- Output: Login/signup pages, session management
|
|
55
|
+
- Depends on: Database schema
|
|
56
|
+
|
|
57
|
+
4. **Build Blog Features**
|
|
58
|
+
- Input: Post CRUD operations, authentication
|
|
59
|
+
- Output: Create/edit/delete post UI, public blog pages
|
|
60
|
+
- Depends on: Authentication
|
|
61
|
+
|
|
62
|
+
5. **Add Styling and Polish**
|
|
63
|
+
- Input: Component library (shadcn/ui), design tokens
|
|
64
|
+
- Output: Consistent UI, responsive design
|
|
65
|
+
- Depends on: Blog features (can run in parallel with testing)
|
|
66
|
+
|
|
67
|
+
### Execution Order:
|
|
68
|
+
- Sequential: 1 → 2 → 3 → 4
|
|
69
|
+
- Parallel: 5 (styling) can happen alongside 4 (features)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Manus (Debugging Workflow)
|
|
73
|
+
```markdown
|
|
74
|
+
When debugging an error, break it down:
|
|
75
|
+
|
|
76
|
+
## Task: Fix "Module not found" error in React app
|
|
77
|
+
|
|
78
|
+
### Subtasks:
|
|
79
|
+
1. **Locate Error Source**
|
|
80
|
+
- Input: Error message, stack trace
|
|
81
|
+
- Output: File path and line number of import
|
|
82
|
+
- Depends on: Nothing
|
|
83
|
+
|
|
84
|
+
2. **Verify Module Exists**
|
|
85
|
+
- Input: Import statement, project file structure
|
|
86
|
+
- Output: Confirmation if module exists or is missing
|
|
87
|
+
- Depends on: Error location
|
|
88
|
+
|
|
89
|
+
3. **Check Import Path**
|
|
90
|
+
- Input: Relative vs absolute path, tsconfig paths
|
|
91
|
+
- Output: Correct import syntax
|
|
92
|
+
- Depends on: Module verification
|
|
93
|
+
|
|
94
|
+
4. **Install Missing Package** (if needed)
|
|
95
|
+
- Input: Package name, package manager (npm/yarn/pnpm)
|
|
96
|
+
- Output: Updated package.json, node_modules
|
|
97
|
+
- Depends on: Module not existing in project
|
|
98
|
+
|
|
99
|
+
5. **Verify Fix**
|
|
100
|
+
- Input: Updated import, build command
|
|
101
|
+
- Output: Successful build or new error
|
|
102
|
+
- Depends on: Import correction or package installation
|
|
103
|
+
|
|
104
|
+
### Execution Order:
|
|
105
|
+
- Sequential: 1 → 2 → (3 OR 4) → 5
|
|
106
|
+
- Branch: If module exists (3), else (4)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Variables
|
|
110
|
+
- `{MAIN_GOAL}`: High-level objective
|
|
111
|
+
- `{SUBTASK_X}`: Concrete, achievable step
|
|
112
|
+
- `{WHAT_YOU_NEED}`: Required inputs/context
|
|
113
|
+
- `{WHAT_YOU_PRODUCE}`: Expected output/deliverable
|
|
114
|
+
- `{PREREQUISITES}`: Dependencies (other subtasks or external factors)
|
|
115
|
+
- `{WHICH_CAN_RUN_IN_PARALLEL}`: Independent subtasks
|
|
116
|
+
- `{WHICH_MUST_BE_SEQUENTIAL}`: Dependent subtasks
|
|
117
|
+
|
|
118
|
+
## Best Practices
|
|
119
|
+
1. Keep subtasks small (completable in 1-3 tool calls)
|
|
120
|
+
2. Make dependencies explicit (enables parallelization)
|
|
121
|
+
3. Identify inputs/outputs for each step (validates completeness)
|
|
122
|
+
4. Number subtasks for easy reference
|
|
123
|
+
5. Show alternative paths (if/else branches)
|
|
124
|
+
6. Estimate complexity (simple/medium/complex)
|
|
125
|
+
7. Benefits: Enables progress tracking, reveals missing steps, improves estimation
|
|
126
|
+
|
|
127
|
+
## Implementation Notes
|
|
128
|
+
- Use this pattern for tasks requiring >3 distinct operations
|
|
129
|
+
- Can be combined with thinking tags (plan subtasks in <thinking>)
|
|
130
|
+
- Update subtask status as you progress (✓ completed, ⏳ in progress)
|
|
131
|
+
- Re-evaluate after each subtask (dependencies may change)
|