plan-flow-skill 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.
Files changed (124) hide show
  1. package/.claude/commands/create-contract.md +468 -0
  2. package/.claude/commands/create-plan.md +512 -0
  3. package/.claude/commands/discovery-plan.md +561 -0
  4. package/.claude/commands/execute-plan.md +682 -0
  5. package/.claude/commands/review-code.md +459 -0
  6. package/.claude/commands/review-pr.md +651 -0
  7. package/.claude/commands/setup.md +1609 -0
  8. package/.claude/commands/write-tests.md +543 -0
  9. package/.claude/rules/core/allowed-patterns.md +175 -0
  10. package/.claude/rules/core/complexity-scoring.md +225 -0
  11. package/.claude/rules/core/forbidden-patterns.md +253 -0
  12. package/.claude/rules/languages/python-patterns.md +6 -0
  13. package/.claude/rules/languages/typescript-patterns.md +7 -0
  14. package/.claude/rules/patterns/contract-patterns.md +332 -0
  15. package/.claude/rules/patterns/discovery-patterns.md +342 -0
  16. package/.claude/rules/patterns/discovery-templates.md +319 -0
  17. package/.claude/rules/patterns/jest-patterns.md +482 -0
  18. package/.claude/rules/patterns/plans-patterns.md +225 -0
  19. package/.claude/rules/patterns/plans-templates.md +227 -0
  20. package/.claude/rules/patterns/pytest-patterns.md +457 -0
  21. package/.claude/rules/patterns/review-code-templates.md +305 -0
  22. package/.claude/rules/patterns/review-pr-patterns.md +360 -0
  23. package/.claude/rules/tools/auth-pr-tool.md +30 -0
  24. package/.claude/rules/tools/interactive-questions-tool.md +235 -0
  25. package/.claude/rules/tools/jest-testing-tool.md +73 -0
  26. package/.claude/rules/tools/plan-mode-tool.md +164 -0
  27. package/.claude/rules/tools/pytest-testing-tool.md +121 -0
  28. package/.claude/rules/tools/reference-expansion-tool.md +326 -0
  29. package/LICENSE +21 -0
  30. package/README.md +167 -0
  31. package/dist/cli/commands/init.d.ts +6 -0
  32. package/dist/cli/commands/init.d.ts.map +1 -0
  33. package/dist/cli/commands/init.js +139 -0
  34. package/dist/cli/commands/init.js.map +1 -0
  35. package/dist/cli/handlers/claude.d.ts +9 -0
  36. package/dist/cli/handlers/claude.d.ts.map +1 -0
  37. package/dist/cli/handlers/claude.js +119 -0
  38. package/dist/cli/handlers/claude.js.map +1 -0
  39. package/dist/cli/handlers/codex.d.ts +9 -0
  40. package/dist/cli/handlers/codex.d.ts.map +1 -0
  41. package/dist/cli/handlers/codex.js +100 -0
  42. package/dist/cli/handlers/codex.js.map +1 -0
  43. package/dist/cli/handlers/cursor.d.ts +8 -0
  44. package/dist/cli/handlers/cursor.d.ts.map +1 -0
  45. package/dist/cli/handlers/cursor.js +34 -0
  46. package/dist/cli/handlers/cursor.js.map +1 -0
  47. package/dist/cli/handlers/openclaw.d.ts +8 -0
  48. package/dist/cli/handlers/openclaw.d.ts.map +1 -0
  49. package/dist/cli/handlers/openclaw.js +34 -0
  50. package/dist/cli/handlers/openclaw.js.map +1 -0
  51. package/dist/cli/handlers/shared.d.ts +9 -0
  52. package/dist/cli/handlers/shared.d.ts.map +1 -0
  53. package/dist/cli/handlers/shared.js +44 -0
  54. package/dist/cli/handlers/shared.js.map +1 -0
  55. package/dist/cli/index.d.ts +8 -0
  56. package/dist/cli/index.d.ts.map +1 -0
  57. package/dist/cli/index.js +43 -0
  58. package/dist/cli/index.js.map +1 -0
  59. package/dist/cli/types.d.ts +26 -0
  60. package/dist/cli/types.d.ts.map +1 -0
  61. package/dist/cli/types.js +5 -0
  62. package/dist/cli/types.js.map +1 -0
  63. package/dist/cli/utils/files.d.ts +37 -0
  64. package/dist/cli/utils/files.d.ts.map +1 -0
  65. package/dist/cli/utils/files.js +122 -0
  66. package/dist/cli/utils/files.js.map +1 -0
  67. package/dist/cli/utils/logger.d.ts +11 -0
  68. package/dist/cli/utils/logger.d.ts.map +1 -0
  69. package/dist/cli/utils/logger.js +34 -0
  70. package/dist/cli/utils/logger.js.map +1 -0
  71. package/dist/cli/utils/prompts.d.ts +10 -0
  72. package/dist/cli/utils/prompts.d.ts.map +1 -0
  73. package/dist/cli/utils/prompts.js +65 -0
  74. package/dist/cli/utils/prompts.js.map +1 -0
  75. package/dist/test/setup.d.ts +5 -0
  76. package/dist/test/setup.d.ts.map +1 -0
  77. package/dist/test/setup.js +7 -0
  78. package/dist/test/setup.js.map +1 -0
  79. package/package.json +63 -0
  80. package/rules/core/_index.mdc +89 -0
  81. package/rules/core/allowed-patterns.mdc +185 -0
  82. package/rules/core/complexity-scoring.mdc +235 -0
  83. package/rules/core/forbidden-patterns.mdc +263 -0
  84. package/rules/languages/_index.mdc +80 -0
  85. package/rules/languages/python-patterns.mdc +188 -0
  86. package/rules/languages/typescript-patterns.mdc +128 -0
  87. package/rules/patterns/_index.mdc +185 -0
  88. package/rules/patterns/contract-patterns.mdc +344 -0
  89. package/rules/patterns/discovery-patterns.mdc +354 -0
  90. package/rules/patterns/discovery-templates.mdc +329 -0
  91. package/rules/patterns/jest-patterns.mdc +492 -0
  92. package/rules/patterns/plans-patterns.mdc +237 -0
  93. package/rules/patterns/plans-templates.mdc +237 -0
  94. package/rules/patterns/pytest-patterns.mdc +467 -0
  95. package/rules/patterns/review-code-templates.mdc +315 -0
  96. package/rules/patterns/review-pr-patterns.mdc +370 -0
  97. package/rules/skills/_index.mdc +174 -0
  98. package/rules/skills/create-contract-skill.mdc +239 -0
  99. package/rules/skills/create-plan-skill.mdc +271 -0
  100. package/rules/skills/discovery-skill.mdc +295 -0
  101. package/rules/skills/execute-plan-skill.mdc +388 -0
  102. package/rules/skills/review-code-skill.mdc +308 -0
  103. package/rules/skills/review-pr-skill.mdc +496 -0
  104. package/rules/skills/setup-skill.mdc +923 -0
  105. package/rules/skills/write-tests-skill.mdc +294 -0
  106. package/rules/templates/index-template.mdc +126 -0
  107. package/rules/tools/_index.mdc +114 -0
  108. package/rules/tools/auth-pr-tool.mdc +362 -0
  109. package/rules/tools/interactive-questions-tool.mdc +337 -0
  110. package/rules/tools/jest-testing-tool.mdc +96 -0
  111. package/rules/tools/plan-mode-tool.mdc +229 -0
  112. package/rules/tools/pytest-testing-tool.mdc +144 -0
  113. package/rules/tools/reference-expansion-tool.mdc +338 -0
  114. package/skills/plan-flow/SKILL.md +109 -0
  115. package/skills/plan-flow/create-contract/SKILL.md +139 -0
  116. package/skills/plan-flow/create-plan/SKILL.md +93 -0
  117. package/skills/plan-flow/discovery/SKILL.md +85 -0
  118. package/skills/plan-flow/execute-plan/SKILL.md +89 -0
  119. package/skills/plan-flow/review-code/SKILL.md +100 -0
  120. package/skills/plan-flow/review-pr/SKILL.md +122 -0
  121. package/skills/plan-flow/setup/SKILL.md +73 -0
  122. package/skills/plan-flow/write-tests/SKILL.md +115 -0
  123. package/templates/shared/AGENTS.md.template +60 -0
  124. package/templates/shared/CLAUDE.md.template +62 -0
@@ -0,0 +1,338 @@
1
+ ---
2
+ description: "Tool for expanding reference codes to load full content on-demand"
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Reference Expansion Tool
7
+
8
+ ## Purpose
9
+
10
+ This tool documents how to use the hierarchical context loading system with reference codes. Instead of loading full files, load the index first, then expand specific sections on-demand.
11
+
12
+ ---
13
+
14
+ ## Reference Code System
15
+
16
+ ### Code Prefixes
17
+
18
+ | Prefix | Folder | Description |
19
+ |--------|--------|-------------|
20
+ | COR- | `rules/core/` | Core rules (allowed/forbidden patterns, complexity) |
21
+ | LNG- | `rules/languages/` | Language-specific patterns |
22
+ | PTN- | `rules/patterns/` | Pattern files (discovery, plans, tests, etc.) |
23
+ | SKL- | `rules/skills/` | Skill files for commands |
24
+ | TLS- | `rules/tools/` | Tool documentation |
25
+
26
+ ### Code Format
27
+
28
+ ```
29
+ [PREFIX]-[SUBCATEGORY]-[NUMBER]
30
+ ```
31
+
32
+ **Examples**:
33
+ - `COR-1` - Core rule section 1
34
+ - `LNG-TS-1` - TypeScript pattern section 1
35
+ - `PTN-DIS-1` - Discovery pattern section 1
36
+ - `SKL-EXEC-1` - Execute plan skill section 1
37
+ - `TLS-AUTH-1` - Auth tool section 1
38
+
39
+ ---
40
+
41
+ ## Expansion Workflow
42
+
43
+ ### Step 1: Load the Index
44
+
45
+ When a command or skill is invoked, load the relevant `_index.mdc` file:
46
+
47
+ ```
48
+ rules/[folder]/_index.mdc
49
+ ```
50
+
51
+ The index contains a table of all reference codes with descriptions.
52
+
53
+ ### Step 2: Identify Needed References
54
+
55
+ Based on the current task, identify which reference codes are needed:
56
+
57
+ - Read the "When to Expand" section in the index
58
+ - Match the task to specific codes
59
+ - Only expand what's needed for the current task
60
+
61
+ ### Step 3: Expand Reference Codes
62
+
63
+ Use the Read tool to load the specific line range:
64
+
65
+ ```
66
+ Read file: rules/[folder]/[filename].mdc
67
+ Lines: [start]-[end]
68
+ ```
69
+
70
+ ### Step 4: Use the Content
71
+
72
+ The expanded content is now in context. Use it for the current task.
73
+
74
+ ---
75
+
76
+ ## When to Expand vs. When to Skip
77
+
78
+ ### Expand When
79
+
80
+ | Situation | Action |
81
+ |-----------|--------|
82
+ | Creating a discovery document | Expand PTN-DIS-* (discovery templates/patterns) |
83
+ | Writing tests | Expand PTN-JEST-* or PTN-PYTEST-* |
84
+ | Reviewing a PR | Expand PTN-PR-* and SKL-PR-* |
85
+ | Need specific example code | Expand the example section code |
86
+ | Following a specific pattern | Expand that pattern's section |
87
+
88
+ ### Skip When
89
+
90
+ | Situation | Action |
91
+ |-----------|--------|
92
+ | Task is simple and familiar | Use index summary only |
93
+ | Pattern is well-known | Don't expand, just reference |
94
+ | Multiple sections might apply | Start with index, narrow down |
95
+ | Already have similar context | Don't duplicate |
96
+
97
+ ---
98
+
99
+ ## Example: Discovery Command
100
+
101
+ **Task**: Create a discovery document
102
+
103
+ **Step 1**: Load index
104
+ ```
105
+ Read: rules/patterns/_index.mdc
106
+ ```
107
+
108
+ **Step 2**: Identify needed codes from index
109
+ - PTN-DIS-1: Discovery document template
110
+ - PTN-DIS-2: Requirements gathering example
111
+
112
+ **Step 3**: Expand specific sections
113
+ ```
114
+ Read: rules/patterns/discovery-templates.mdc
115
+ Lines: 15-80 (for PTN-DIS-1)
116
+ Lines: 244-279 (for PTN-DIS-2)
117
+ ```
118
+
119
+ **Step 4**: Use templates to create the document
120
+
121
+ ---
122
+
123
+ ## Example: Execute Plan Command
124
+
125
+ **Task**: Execute an implementation plan
126
+
127
+ **Step 1**: Load indexes
128
+ ```
129
+ Read: rules/skills/_index.mdc
130
+ Read: rules/core/_index.mdc
131
+ ```
132
+
133
+ **Step 2**: Identify needed codes
134
+ - SKL-EXEC-1: Execution workflow
135
+ - SKL-EXEC-2: Complexity-based grouping
136
+ - COR-3: Complexity scoring table
137
+
138
+ **Step 3**: Expand as needed during execution
139
+
140
+ ---
141
+
142
+ ## Maintenance Guidelines
143
+
144
+ ### When to Update Indexes
145
+
146
+ Update the relevant `_index.mdc` when:
147
+
148
+ 1. **Adding a new section** to a source file
149
+ 2. **Removing a section** from a source file
150
+ 3. **Renaming a section** in a source file
151
+ 4. **Line numbers change** significantly (after major edits)
152
+
153
+ ### How to Update
154
+
155
+ 1. Open the source file and identify the new/changed section
156
+ 2. Note the line range (start line to end line)
157
+ 3. Update the `_index.mdc` reference table:
158
+ - Add new code for new sections
159
+ - Update line ranges for moved sections
160
+ - Remove codes for deleted sections
161
+
162
+ ### Best Practices
163
+
164
+ | Practice | Reason |
165
+ |----------|--------|
166
+ | Update index immediately after editing source | Prevents stale references |
167
+ | Use descriptive section descriptions | Helps identify correct code |
168
+ | Keep line ranges accurate | Ensures correct content is loaded |
169
+ | Review indexes periodically | Catch any drift |
170
+
171
+ ---
172
+
173
+ ## Index File Locations
174
+
175
+ | Folder | Index Path |
176
+ |--------|------------|
177
+ | Core | `rules/core/_index.mdc` |
178
+ | Languages | `rules/languages/_index.mdc` |
179
+ | Patterns | `rules/patterns/_index.mdc` |
180
+ | Skills | `rules/skills/_index.mdc` |
181
+ | Tools | `rules/tools/_index.mdc` |
182
+
183
+ ---
184
+
185
+ ## Troubleshooting
186
+
187
+ ### Reference Code Not Found
188
+
189
+ If a reference code isn't in the index:
190
+ 1. Check the prefix matches the correct folder
191
+ 2. Verify the index file exists
192
+ 3. The section may have been added recently - check source file
193
+
194
+ ### Line Range Invalid
195
+
196
+ If the line range doesn't match expected content:
197
+ 1. The source file was edited after index creation
198
+ 2. Re-analyze the source file
199
+ 3. Update the line range in the index
200
+
201
+ ### Content Seems Incomplete
202
+
203
+ If expanded content is missing context:
204
+ 1. Expand a larger line range
205
+ 2. Include surrounding sections
206
+ 3. Check if section references other sections
207
+
208
+ ---
209
+
210
+ ## Adding New Reference Codes
211
+
212
+ When adding content to the project that should be indexed:
213
+
214
+ ### Step 1: Create or Edit the Source File
215
+
216
+ Add your new section to the appropriate file in `rules/`:
217
+ - Core rules → `rules/core/`
218
+ - Language patterns → `rules/languages/`
219
+ - Patterns → `rules/patterns/`
220
+ - Skills → `rules/skills/`
221
+ - Tools → `rules/tools/`
222
+
223
+ ### Step 2: Determine the Reference Code
224
+
225
+ Use the naming convention:
226
+ ```
227
+ [PREFIX]-[SUBCATEGORY]-[NUMBER]
228
+ ```
229
+
230
+ | Prefix | For Files In |
231
+ |--------|--------------|
232
+ | COR- | rules/core/ |
233
+ | LNG- | rules/languages/ |
234
+ | PTN- | rules/patterns/ |
235
+ | SKL- | rules/skills/ |
236
+ | TLS- | rules/tools/ |
237
+
238
+ ### Step 3: Update the Index
239
+
240
+ Open `rules/[folder]/_index.mdc` and add a new row to the reference table:
241
+
242
+ ```markdown
243
+ | NEW-CODE-1 | 150-180 | Description of the new section |
244
+ ```
245
+
246
+ ### Step 4: Verify
247
+
248
+ 1. Check the line numbers match the actual content
249
+ 2. Ensure the description is clear and actionable
250
+ 3. Update "When to Expand" section if needed
251
+
252
+ ---
253
+
254
+ ## Context Savings Estimate
255
+
256
+ The hierarchical loading system reduces context consumption significantly:
257
+
258
+ ### Before (Full Loading)
259
+
260
+ | Folder | Total Lines | Always Loaded |
261
+ |--------|-------------|---------------|
262
+ | rules/core/ | ~1,200 | Yes (partial) |
263
+ | rules/languages/ | ~800 | No |
264
+ | rules/patterns/ | ~2,500 | No |
265
+ | rules/skills/ | ~2,800 | No |
266
+ | rules/tools/ | ~1,400 | No |
267
+ | **Total** | **~8,700** | |
268
+
269
+ ### After (Index + On-Demand)
270
+
271
+ | Component | Lines | When Loaded |
272
+ |-----------|-------|-------------|
273
+ | Index files (6 total) | ~600 | Per command |
274
+ | Average expansion | ~100-200 | Per task |
275
+ | **Typical session** | **~800-1,000** | |
276
+
277
+ ### Estimated Savings
278
+
279
+ | Scenario | Before | After | Savings |
280
+ |----------|--------|-------|---------|
281
+ | Discovery command | ~3,500 lines | ~800 lines | ~77% |
282
+ | Execute plan | ~4,000 lines | ~1,000 lines | ~75% |
283
+ | Write tests | ~2,500 lines | ~600 lines | ~76% |
284
+ | **Average** | **~3,300 lines** | **~800 lines** | **~76%** |
285
+
286
+ ---
287
+
288
+ ## System Overview
289
+
290
+ The context optimization system consists of:
291
+
292
+ ### Components
293
+
294
+ | Component | Location | Purpose |
295
+ |-----------|----------|---------|
296
+ | Index Template | `rules/templates/index-template.mdc` | Template for creating new indexes |
297
+ | Core Index | `rules/core/_index.mdc` | Core rules reference codes |
298
+ | Languages Index | `rules/languages/_index.mdc` | Language patterns reference codes |
299
+ | Patterns Index | `rules/patterns/_index.mdc` | Pattern files reference codes |
300
+ | Skills Index | `rules/skills/_index.mdc` | Skill files reference codes |
301
+ | Tools Index | `rules/tools/_index.mdc` | Tool files reference codes |
302
+ | Expansion Tool | `rules/tools/reference-expansion-tool.mdc` | This documentation |
303
+
304
+ ### Workflow Summary
305
+
306
+ ```
307
+ Command Invoked
308
+ |
309
+ v
310
+ Load Command File
311
+ |
312
+ v
313
+ Load Relevant Indexes (_index.mdc)
314
+ |
315
+ v
316
+ Identify Needed Reference Codes
317
+ |
318
+ v
319
+ Expand Specific Sections (Read tool)
320
+ |
321
+ v
322
+ Execute Task with Loaded Context
323
+ |
324
+ v
325
+ (Optional) Update Indexes if Files Changed
326
+ ```
327
+
328
+ ---
329
+
330
+ ## Summary
331
+
332
+ | Step | Action |
333
+ |------|--------|
334
+ | 1 | Load `_index.mdc` for relevant folder |
335
+ | 2 | Identify reference codes needed for task |
336
+ | 3 | Use Read tool with specific line ranges |
337
+ | 4 | Use content for current task |
338
+ | 5 | Update index if source files change |
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: plan-flow
3
+ description: Structured AI-assisted development workflows - discovery, planning, execution, code reviews, and testing
4
+ metadata: {"openclaw":{"requires":{"bins":["git","gh"]}}}
5
+ homepage: https://github.com/brunoscardoso/plan-flow
6
+ user-invocable: true
7
+ ---
8
+
9
+ # Plan-Flow: Structured AI-Assisted Development
10
+
11
+ A comprehensive skill set for AI-assisted software development with structured workflows.
12
+
13
+ ## Available Commands
14
+
15
+ | Command | Description |
16
+ |---------|-------------|
17
+ | `/setup` | Analyze project and generate pattern files |
18
+ | `/discovery` | Create discovery document for requirements gathering |
19
+ | `/create-plan` | Create implementation plan with phases and complexity scores |
20
+ | `/execute-plan` | Execute plan phases with verification |
21
+ | `/create-contract` | Create integration contract from API docs |
22
+ | `/review-code` | Review local uncommitted changes |
23
+ | `/review-pr` | Review a Pull Request |
24
+ | `/write-tests` | Write tests to achieve coverage target |
25
+
26
+ ## Recommended Workflow
27
+
28
+ **Automated - runs without asking permission:**
29
+
30
+ ```
31
+ 1. /setup → Index project patterns (run once)
32
+ 2. /discovery → Gather requirements for a feature
33
+ 3. /create-plan → Create structured implementation plan (auto-runs after discovery)
34
+ 4. /execute-plan → Execute the plan phase by phase (auto-runs after plan)
35
+ 5. /review-code → Review changes before committing
36
+ 6. Archive → Move discovery + plan to flow/archive/
37
+ ```
38
+
39
+ **Only stop to ask the user when:**
40
+ - Missing critical information (device type, browser, etc.)
41
+ - Need to reproduce an issue
42
+ - Ambiguous requirements
43
+ - Need approval for destructive actions
44
+
45
+ **Never ask "Ready to create plan?" or "Proceed with execution?" - just do it.**
46
+
47
+ ## Core Concepts
48
+
49
+ ### Complexity Scoring
50
+
51
+ Every plan phase has a complexity score (0-10):
52
+
53
+ | Score | Level | Description |
54
+ |-------|-------|-------------|
55
+ | 0-2 | Trivial | Simple, mechanical changes |
56
+ | 3-4 | Low | Straightforward implementation |
57
+ | 5-6 | Medium | Moderate complexity, some decisions |
58
+ | 7-8 | High | Complex, multiple considerations |
59
+ | 9-10 | Very High | Significant complexity/risk |
60
+
61
+ ### Flow Directory Structure
62
+
63
+ All artifacts are stored in `flow/`:
64
+
65
+ ```
66
+ flow/
67
+ ├── archive/ # Completed/abandoned plans
68
+ ├── contracts/ # Integration contracts
69
+ ├── discovery/ # Discovery documents
70
+ ├── plans/ # Active implementation plans
71
+ ├── references/ # Reference materials
72
+ ├── reviewed-code/ # Code review documents
73
+ └── reviewed-pr/ # PR review documents
74
+ ```
75
+
76
+ ## Critical Rules
77
+
78
+ 1. **Automated Workflow**: Run discovery → plan → execute automatically. Only stop to ask when you need information from the user.
79
+ 2. **Discovery First**: Always run `/discovery` before `/create-plan` for new features or bugs.
80
+ 3. **Tests Last**: Tests are always the last phase of any implementation plan.
81
+ 4. **Build at End Only**: Run build verification only after ALL phases complete.
82
+ 5. **Archive When Done**: Move completed discovery and plans to `flow/archive/`.
83
+
84
+ ## Configuration
85
+
86
+ Create `.plan-flow.yml` in your project root:
87
+
88
+ ```yaml
89
+ ai:
90
+ provider: claude
91
+ anthropic_api_key: sk-ant-api03-your-key-here
92
+ ```
93
+
94
+ ## Requirements
95
+
96
+ - `git` - For version control operations
97
+ - `gh` - GitHub CLI for PR reviews
98
+
99
+ ## Installation
100
+
101
+ ```bash
102
+ clawhub install plan-flow
103
+ ```
104
+
105
+ Or add to your workspace skills folder:
106
+
107
+ ```bash
108
+ git clone https://github.com/brunoscardoso/plan-flow.git ~/.openclaw/skills/plan-flow
109
+ ```
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: create-contract
3
+ description: Create an integration contract from API documentation
4
+ metadata: {"openclaw":{"requires":{"bins":["git"]}}}
5
+ user-invocable: true
6
+ ---
7
+
8
+ # Create Contract
9
+
10
+ Create an integration contract document from API documentation.
11
+
12
+ ## What It Does
13
+
14
+ 1. Fetches or reads API documentation
15
+ 2. Extracts endpoints, schemas, and authentication details
16
+ 3. Creates TypeScript interfaces for all data types
17
+ 4. Documents error handling and rate limits
18
+ 5. Provides usage examples
19
+
20
+ ## Usage
21
+
22
+ ```
23
+ /create-contract <url>
24
+ ```
25
+
26
+ **Arguments:**
27
+ - `url` (required): URL to the API documentation
28
+
29
+ ## Output
30
+
31
+ Creates: `flow/contracts/<service>_contract.md`
32
+
33
+ ## Contract Structure
34
+
35
+ ```markdown
36
+ # Contract: [Service Name]
37
+
38
+ Source: [URL]
39
+
40
+ ## Overview
41
+ Brief description of the API
42
+
43
+ ## Authentication
44
+ ```typescript
45
+ // Authentication example
46
+ const headers = {
47
+ 'Authorization': `Bearer ${token}`,
48
+ };
49
+ ```
50
+
51
+ ## Base Configuration
52
+ | Setting | Value |
53
+ |---------|-------|
54
+ | Base URL | https://api.example.com |
55
+ | Rate Limit | 100 req/min |
56
+ | Timeout | 30s |
57
+
58
+ ## Endpoints
59
+
60
+ ### GET /users
61
+ Get list of users
62
+
63
+ **Request:**
64
+ ```typescript
65
+ interface GetUsersRequest {
66
+ page?: number;
67
+ limit?: number;
68
+ }
69
+ ```
70
+
71
+ **Response:**
72
+ ```typescript
73
+ interface GetUsersResponse {
74
+ data: User[];
75
+ meta: { total: number };
76
+ }
77
+ ```
78
+
79
+ ## TypeScript Interfaces
80
+ ```typescript
81
+ interface User {
82
+ id: string;
83
+ email: string;
84
+ name: string;
85
+ }
86
+ ```
87
+
88
+ ## Error Handling
89
+ | Code | Meaning | Action |
90
+ |------|---------|--------|
91
+ | 401 | Unauthorized | Refresh token |
92
+ | 429 | Rate Limited | Retry with backoff |
93
+
94
+ ## Usage Examples
95
+ ```typescript
96
+ // Fetch users
97
+ const users = await api.getUsers({ page: 1 });
98
+ ```
99
+ ```
100
+
101
+ ## Example
102
+
103
+ ```
104
+ /create-contract https://api.stripe.com/docs
105
+ ```
106
+
107
+ **Output:**
108
+ ```
109
+ Creating contract for: https://api.stripe.com/docs
110
+
111
+ Fetching documentation...
112
+ Extracting endpoints...
113
+ Generating TypeScript interfaces...
114
+
115
+ Contract created: flow/contracts/stripe_contract.md
116
+
117
+ Summary:
118
+ - 45 endpoints documented
119
+ - 28 TypeScript interfaces
120
+ - Authentication: Bearer token
121
+ - Rate limit: 100 req/sec
122
+ ```
123
+
124
+ ## What's Included
125
+
126
+ - **Overview**: Service description and version
127
+ - **Authentication**: How to authenticate requests
128
+ - **Endpoints**: All available endpoints with schemas
129
+ - **TypeScript Interfaces**: Types for all request/response data
130
+ - **Error Handling**: Error codes and recommended actions
131
+ - **Rate Limits**: Throttling information
132
+ - **Usage Examples**: Code snippets for common operations
133
+
134
+ ## Use Cases
135
+
136
+ - Integrating with third-party APIs
137
+ - Documenting internal APIs
138
+ - Creating type-safe API clients
139
+ - Onboarding new developers
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: create-plan
3
+ description: Create a structured implementation plan with phases and complexity scores
4
+ metadata: {"openclaw":{"requires":{"bins":["git"]}}}
5
+ user-invocable: true
6
+ ---
7
+
8
+ # Create Plan
9
+
10
+ Create a structured implementation plan based on a discovery document or user input.
11
+
12
+ ## What It Does
13
+
14
+ 1. Extracts requirements from discovery document (or user input)
15
+ 2. Analyzes scope and complexity
16
+ 3. Structures phases with complexity scores (0-10)
17
+ 4. Assigns tasks to each phase
18
+ 5. Ensures tests are always the last phase
19
+
20
+ ## Usage
21
+
22
+ ```
23
+ /create-plan <discovery_document>
24
+ /create-plan "<feature_description>"
25
+ ```
26
+
27
+ **Arguments:**
28
+ - `discovery_document`: Path to discovery document (recommended)
29
+ - `feature_description`: Direct description of feature (if no discovery)
30
+
31
+ ## Output
32
+
33
+ Creates: `flow/plans/plan_<feature>_v<version>.md`
34
+
35
+ ## Complexity Scoring
36
+
37
+ | Score | Level | Description |
38
+ |-------|-------|-------------|
39
+ | 0-2 | Trivial | Simple, mechanical changes |
40
+ | 3-4 | Low | Straightforward implementation |
41
+ | 5-6 | Medium | Moderate complexity, some decisions |
42
+ | 7-8 | High | Complex, multiple considerations |
43
+ | 9-10 | Very High | Significant complexity/risk |
44
+
45
+ ## Plan Structure
46
+
47
+ ```markdown
48
+ # Plan: [Feature Name]
49
+
50
+ ## Overview
51
+ Brief description
52
+
53
+ ## Goals
54
+ - Goal 1
55
+ - Goal 2
56
+
57
+ ## Phases
58
+
59
+ ### Phase 1: [Name]
60
+ **Scope**: What this phase covers
61
+ **Complexity**: X/10
62
+
63
+ - [ ] Task 1
64
+ - [ ] Task 2
65
+
66
+ **Build Verification**: Run `npm run build`
67
+
68
+ ### Phase N: Tests (Final)
69
+ **Scope**: Write comprehensive tests
70
+ **Complexity**: X/10
71
+
72
+ - [ ] Unit tests
73
+ - [ ] Integration tests
74
+
75
+ ## Key Changes
76
+ 1. **Category**: Description
77
+ ```
78
+
79
+ ## Example
80
+
81
+ ```
82
+ /create-plan @flow/discovery/discovery_user_auth_v1.md
83
+ ```
84
+
85
+ ## Critical Rules
86
+
87
+ - **No Code**: Plans describe what to implement, not how to code it.
88
+ - **Tests Last**: Tests are always the final phase.
89
+ - **No Auto-Chaining**: Do NOT auto-invoke `/execute-plan`.
90
+
91
+ ## Next Command
92
+
93
+ After creating a plan, review it and then run `/execute-plan @flow/plans/plan_<feature>_v1.md`.