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,468 @@
1
+ ---
2
+ description: This command creates an integration contract document by fetching information from a documentation U
3
+ ---
4
+
5
+ # Create Integration Contract
6
+
7
+ ## Command Description
8
+
9
+ This command creates an integration contract document by fetching information from a documentation URL or analyzing a project repository. The command validates inputs and orchestrates the contract creation process by invoking the `create-contract` skill.
10
+
11
+ **Output**: A markdown file at `flow/contracts/<service_name>_contract.md`
12
+
13
+ ---
14
+
15
+
16
+ ## Help
17
+
18
+ **If the user invokes this command with `-help`, display only this section and stop:**
19
+
20
+ ```
21
+ /create-contract - Create Integration Contract
22
+
23
+ DESCRIPTION:
24
+ Creates an integration contract document by fetching information from a
25
+ documentation URL or analyzing a project repository.
26
+
27
+ USAGE:
28
+ /create-contract <source_url> <description>
29
+ /create-contract -help
30
+
31
+ ARGUMENTS:
32
+ source_url Documentation URL (API docs, Swagger, OpenAPI) or repository URL
33
+ description What you want to integrate on the frontend
34
+
35
+ EXAMPLES:
36
+ /create-contract https://api.example.com/docs "User authentication endpoints"
37
+ /create-contract https://github.com/org/api-service "Payment processing integration"
38
+ /create-contract @https://swagger.io/spec.json "Order management API"
39
+
40
+ OUTPUT:
41
+ Creates: flow/contracts/<service_name>_contract.md
42
+
43
+ WORKFLOW:
44
+ 1. Fetches and analyzes the source URL
45
+ 2. Asks clarifying questions about scope, auth, error handling
46
+ 3. Generates contract document with endpoints, schemas, and integration notes
47
+
48
+ RECOMMENDED MODEL:
49
+ Claude Opus 4.5 or Sonnet 4.5 for best results
50
+
51
+ RELATED COMMANDS:
52
+ /discovery-plan Create discovery document from contract
53
+ /create-plan Create implementation plan from discovery
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Critical Rules
59
+
60
+ | Rule | Description |
61
+ | ------------------------ | -------------------------------------------------------- |
62
+ | **No Auto-Chaining** | NEVER auto-invoke /discovery-plan - user must invoke it |
63
+ | **Complete and Stop** | After presenting results, STOP and wait for user |
64
+
65
+ ---
66
+
67
+ ## Instructions
68
+
69
+ ### Step 1: Validate Inputs
70
+
71
+ | Input | Required | Description |
72
+ | ------------- | -------- | ---------------------------------------------------- |
73
+ | `source_url` | Yes | Documentation URL or repository URL |
74
+ | `description` | Yes | What the user wants to integrate on the frontend |
75
+
76
+ **Both inputs are required.** If either is missing, ask:
77
+
78
+ ```markdown
79
+ To create an integration contract, I need:
80
+
81
+ 1. **Source URL**: Where can I find the API documentation?
82
+ - API docs URL (e.g., https://api.example.com/docs)
83
+ - Swagger/OpenAPI spec URL
84
+ - Repository URL (GitHub, GitLab, etc.)
85
+
86
+ 2. **Description**: What do you want to integrate?
87
+ - Which specific endpoints/features are needed?
88
+ - What's the use case on the frontend?
89
+ ```
90
+
91
+ ---
92
+
93
+ ### Step 2: Detect Source Type
94
+
95
+ Analyze the URL to determine source type:
96
+
97
+ | Source Type | Detection |
98
+ | -------------- | ---------------------------------------- |
99
+ | Documentation | Contains `/docs`, `/api`, swagger |
100
+ | Repository | Contains github.com, gitlab.com |
101
+ | OpenAPI Spec | Ends with `.json`, `.yaml` |
102
+
103
+ ---
104
+
105
+ ### Step 3: Invoke Create Contract Skill
106
+
107
+ The skill will:
108
+
109
+ 1. Fetch information from the source URL
110
+ 2. Analyze API structure and schemas
111
+ 3. Ask clarifying questions via Interactive Questions Tool
112
+ 4. Generate contract document
113
+
114
+ See: `.claude/rules/skills/create-contract-skill.md`
115
+
116
+ ---
117
+
118
+ ### Step 4: Present Results
119
+
120
+ After the skill completes, confirm file creation:
121
+
122
+ ```markdown
123
+ Contract Created!
124
+
125
+ **Deliverable**: `flow/contracts/<service_name>_contract.md`
126
+
127
+ **Summary**:
128
+ - X endpoints documented
129
+ - Authentication: [method]
130
+ - Error handling documented
131
+
132
+ **Next Steps** (user must invoke manually):
133
+ 1. Review the contract above
134
+ 2. Request any refinements
135
+ 3. When ready, invoke `/discovery-plan @flow/contracts/<service_name>_contract.md`
136
+ ```
137
+
138
+ **CRITICAL**: This command is now complete. Do NOT auto-invoke `/discovery-plan`. Wait for the user to explicitly invoke it.
139
+
140
+ ---
141
+
142
+ ## Flow Diagram
143
+
144
+ ```
145
+ +------------------------------------------+
146
+ | /create-contract COMMAND |
147
+ +------------------------------------------+
148
+ |
149
+ v
150
+ +------------------------------------------+
151
+ | Step 1: Validate Inputs |
152
+ | - Check for source URL and description |
153
+ | - Ask for missing inputs if needed |
154
+ +------------------------------------------+
155
+ |
156
+ v
157
+ +------------------------------------------+
158
+ | Step 2: Detect Source Type |
159
+ | - Documentation, Repository, or OpenAPI |
160
+ +------------------------------------------+
161
+ |
162
+ v
163
+ +------------------------------------------+
164
+ | Step 3: Invoke Create Contract Skill |
165
+ | - Skill handles all contract logic |
166
+ | - See create-contract-skill.md |
167
+ +------------------------------------------+
168
+ |
169
+ v
170
+ +------------------------------------------+
171
+ | Step 4: Present Results |
172
+ | - Show summary |
173
+ | - Link to /discovery-plan command |
174
+ +------------------------------------------+
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Example Usage
180
+
181
+ **User**: `/create-contract https://api.example.com/docs "User authentication endpoints"`
182
+
183
+ **Execution**:
184
+
185
+ 1. Validate inputs: URL and description provided
186
+ 2. Detect source type: Documentation
187
+ 3. Invoke create-contract skill
188
+ 4. Present contract summary
189
+ 5. User reviews and proceeds to `/discovery-plan`
190
+
191
+ ---
192
+
193
+ ## Context Optimization
194
+
195
+ This command uses hierarchical context loading to reduce context consumption. Instead of loading full files, load indexes first and expand specific sections on-demand.
196
+
197
+ ### Recommended Loading Order
198
+
199
+ 1. **Always load first**: This command file (`commands/create-contract.md`)
200
+ 2. **Load indexes**: Load `_index.md` files for relevant folders
201
+ 3. **Expand on-demand**: Use reference codes to load specific sections when needed
202
+
203
+ ### Index Files for Contract Creation
204
+
205
+ | Index | When to Load |
206
+ |-------|--------------|
207
+ | `rules/patterns/_index.md` | To find contract patterns |
208
+ | `rules/skills/_index.md` | To understand skill workflow |
209
+ | `rules/tools/_index.md` | When using interactive questions |
210
+
211
+ ### Reference Codes for Contract Creation
212
+
213
+ | Code | Description | When to Expand |
214
+ |------|-------------|----------------|
215
+ | PTN-CON-1 | Contract document structure | Creating new contract |
216
+ | PTN-CON-2 | Endpoint documentation format | Documenting API endpoints |
217
+ | SKL-CON-1 | Contract skill workflow | Understanding full process |
218
+ | TLS-IQ-2 | How to switch to Plan mode | Before asking questions |
219
+ | TLS-IQ-3 | How to ask questions | When gathering scope info |
220
+
221
+ ### Expansion Instructions
222
+
223
+ When executing this command:
224
+
225
+ 1. **Start with indexes**: Read `rules/patterns/_index.md` and `rules/skills/_index.md`
226
+ 2. **Identify needed codes**: Based on current step, identify which codes are relevant
227
+ 3. **Expand as needed**: Use the Read tool with specific line ranges from the index
228
+ 4. **Don't expand everything**: Only load content required for the current step
229
+
230
+ ---
231
+
232
+ ## Related Resources
233
+
234
+ | Resource | Purpose |
235
+ | ------------------------------ | -------------------------------------- |
236
+ | `rules/skills/_index.md` | Index of skills with reference codes |
237
+ | `rules/patterns/_index.md` | Index of patterns with reference codes |
238
+ | `rules/tools/_index.md` | Index of tools with reference codes |
239
+ | `create-contract-skill.md` | Skill that creates the contract |
240
+ | `contract-patterns.md` | Rules and patterns for contracts |
241
+ | `interactive-questions-tool.md` | Interactive Questions UI workflow |
242
+ | `/discovery-plan` command | Create discovery from contract |
243
+ | `/create-plan` command | Create plan from discovery |
244
+
245
+ ---
246
+
247
+ # Implementation Details
248
+
249
+
250
+ ## Restrictions - CONTRACT CREATION ONLY
251
+
252
+ This skill is **strictly for creating contract documents**. The process:
253
+
254
+ 1. **Fetches** information from the source URL
255
+ 2. **Analyzes** the API structure and schemas
256
+ 3. **Asks** clarifying questions via Interactive Questions Tool
257
+ 4. **Generates** a contract markdown file
258
+
259
+ **No code, no implementation, no source file modifications.**
260
+
261
+ ### NEVER Do These Actions
262
+
263
+ | Forbidden Action | Reason |
264
+ | -------------------------------------- | ----------------------------------- |
265
+ | Create/edit source code files | Contract creation only |
266
+ | Write implementation code | Contracts describe, not implement |
267
+ | Modify configuration files | No codebase changes |
268
+ | Run build or test commands | No execution commands |
269
+ | Create files outside `flow/contracts/` | Only write contract documents |
270
+
271
+ ### Allowed Actions
272
+
273
+ | Allowed Action | Purpose |
274
+ | -------------------------------------- | ------------------------------------ |
275
+ | Use Web Search tool | Fetch documentation from URLs |
276
+ | Read repository files | Analyze API structure |
277
+ | Use Interactive Questions Tool | Gather requirements from user |
278
+ | Write to `flow/contracts/` | Save contract document |
279
+ | Read project rule files | Understand patterns to follow |
280
+
281
+ > **Important**: The ONLY writable location is `flow/contracts/`. No source code or other files should be modified.
282
+
283
+ ---
284
+
285
+ ## Inputs
286
+
287
+ | Input | Required | Description |
288
+ | ------------- | -------- | ---------------------------------------------------- |
289
+ | `source_url` | Yes | Documentation URL or repository URL |
290
+ | `description` | Yes | What the user wants to integrate on the frontend |
291
+
292
+ ---
293
+
294
+ ## Workflow
295
+
296
+ ### Step 1: Detect Source Type
297
+
298
+ Analyze the provided URL to determine the source type:
299
+
300
+ | Source Type | Detection |
301
+ | ---------------- | ---------------------------------------------- |
302
+ | Documentation | Contains `/docs`, `/api`, swagger, openapi |
303
+ | Repository | Contains github.com, gitlab.com, bitbucket.org |
304
+ | OpenAPI Spec | Ends with `.json`, `.yaml`, `/swagger` |
305
+
306
+ ---
307
+
308
+ ### Step 2A: Handle Documentation URL
309
+
310
+ If the source is a documentation URL:
311
+
312
+ 1. Use Web Search tool to fetch documentation content
313
+ 2. Extract key information:
314
+ - API endpoints
315
+ - Request/response schemas
316
+ - Authentication methods
317
+ - Error formats
318
+ - Rate limits
319
+
320
+ ---
321
+
322
+ ### Step 2B: Handle Repository URL
323
+
324
+ If the source is a repository URL:
325
+
326
+ 1. Analyze repository structure
327
+ 2. Identify relevant files:
328
+ - API route definitions
329
+ - Type definitions
330
+ - Schema files
331
+ - README/docs
332
+ 3. Read and extract key information
333
+
334
+ ---
335
+
336
+ ### Step 3: Ask Clarifying Questions
337
+
338
+ **Use Interactive Questions Tool** to gather requirements.
339
+
340
+ Follow `.claude/rules/tools/interactive-questions-tool.md`:
341
+
342
+ 1. Call `SwitchMode` tool to enter Plan mode
343
+ 2. Call `Ask the user directly in conversation` tool for each question about:
344
+ - **Scope**: Which specific endpoints/features are needed?
345
+ - **Authentication**: How will the FE authenticate?
346
+ - **Error Handling**: How should the FE handle errors?
347
+ - **Caching**: Any caching requirements?
348
+ 3. Wait for all responses
349
+ 4. Call `SwitchMode` tool to return to Agent mode
350
+ 5. Document answers for use in the contract document
351
+
352
+ ---
353
+
354
+ ### Step 4: Generate Contract Document
355
+
356
+ Create the contract with all gathered information:
357
+
358
+ **Location**: `flow/contracts/<service_name>_contract.md`
359
+
360
+ **Required Sections**:
361
+
362
+ 1. Overview
363
+ 2. Authentication
364
+ 3. Endpoints (with request/response schemas)
365
+ 4. Error Handling
366
+ 5. Integration Notes
367
+ 6. Usage Examples
368
+
369
+ ---
370
+
371
+ ## Output Format
372
+
373
+ ### Contract Template
374
+
375
+ ```markdown
376
+ # Integration Contract: [Service Name]
377
+
378
+ ## Overview
379
+
380
+ **Source**: [URL]
381
+ **Description**: [What this integration provides]
382
+ **Version**: [API version if applicable]
383
+
384
+ ## Authentication
385
+
386
+ **Method**: [Bearer token, API key, OAuth, etc.]
387
+ **Header**: [Authorization header format]
388
+ **Token Source**: [Where FE gets the token]
389
+
390
+ ## Endpoints
391
+
392
+ ### [Endpoint Name]
393
+
394
+ **Method**: [GET/POST/PUT/DELETE]
395
+ **URL**: [Endpoint URL]
396
+ **Description**: [What this endpoint does]
397
+
398
+ **Request**:
399
+ ```typescript
400
+ interface RequestBody {
401
+ // Request schema
402
+ }
403
+ ```
404
+
405
+ **Response**:
406
+ ```typescript
407
+ interface Response {
408
+ // Response schema
409
+ }
410
+ ```
411
+
412
+ **Example**:
413
+ ```bash
414
+ curl -X POST /api/endpoint \
415
+ -H "Authorization: Bearer token" \
416
+ -d '{"field": "value"}'
417
+ ```
418
+
419
+ ## Error Handling
420
+
421
+ | Status Code | Meaning | FE Action |
422
+ | ----------- | -------------------- | ------------------------- |
423
+ | 400 | Bad Request | Show validation error |
424
+ | 401 | Unauthorized | Redirect to login |
425
+ | 404 | Not Found | Show not found message |
426
+ | 500 | Server Error | Show generic error |
427
+
428
+ ## Integration Notes
429
+
430
+ ### Rate Limits
431
+ [Any rate limiting information]
432
+
433
+ ### Caching
434
+ [Caching recommendations]
435
+
436
+ ### Pagination
437
+ [Pagination format if applicable]
438
+
439
+ ## Usage Examples
440
+
441
+ ### [Use Case 1]
442
+ [Code example or description]
443
+ ```
444
+
445
+ ---
446
+
447
+ ## Validation Checklist
448
+
449
+ Before completing the contract, verify:
450
+
451
+ - [ ] Contract is saved in `flow/contracts/` folder
452
+ - [ ] File uses naming: `<service_name>_contract.md`
453
+ - [ ] All requested endpoints are documented
454
+ - [ ] Authentication method is clear
455
+ - [ ] Request/response schemas are defined
456
+ - [ ] Error handling is documented
457
+ - [ ] **NO implementation code is included**
458
+ - [ ] **NO source files were created or modified**
459
+
460
+ ---
461
+
462
+ ## Related Files
463
+
464
+ | File | Purpose |
465
+ | -------------------------------------------------- | --------------------------------- |
466
+ | `.claude/rules/patterns/contract-patterns.md` | Rules and patterns for contracts |
467
+ | `.claude/rules/tools/interactive-questions-tool.md` | Interactive Questions workflow |
468
+ | `flow/contracts/` | Output folder for contracts |