|
1 | | -description='''Capture structured knowledge about a code entry point and save it to the knowledge docs.''' |
2 | | -prompt='''# Knowledge Capture Assistant |
3 | | -
|
4 | | -Guide me through creating a structured understanding of a code entry point and saving it to the knowledge docs. |
5 | | -
|
6 | | -## Step 1: Gather Context |
7 | | -- Entry point (file, folder, function, API) |
8 | | -- Why this entry point matters (feature, bug, investigation) |
9 | | -- Relevant requirements/design docs (if any) |
10 | | -- Desired depth or focus areas (logic, dependencies, data flow) |
11 | | -
|
12 | | -## Step 2: Validate Entry Point |
13 | | -- Determine entry point type and confirm it exists |
14 | | -- Surface ambiguity (multiple matches) and ask for clarification |
15 | | -- If not found, suggest likely alternatives or spelling fixes |
16 | | -
|
17 | | -## Step 3: Collect Source Context |
18 | | -- Read the primary file/module and summarize purpose, exports, key patterns |
19 | | -- For folders: list structure, highlight key modules |
20 | | -- For functions/APIs: capture signature, parameters, return values, error handling |
21 | | -- Extract essential snippets (avoid large dumps) |
22 | | -
|
23 | | -## Step 4: Analyze Dependencies |
24 | | -- Build a dependency view up to depth 3 |
25 | | -- Track visited nodes to avoid loops |
26 | | -- Categorize dependencies (imports, function calls, services, external packages) |
27 | | -- Note important external systems or generated code that should be excluded |
28 | | -
|
29 | | -## Step 5: Synthesize Explanation |
30 | | -- Draft an overview (purpose, language, high-level behavior) |
31 | | -- Detail core logic, key components, execution flow, patterns |
32 | | -- Highlight error handling, performance, security considerations |
33 | | -- Identify potential improvements or risks discovered during analysis |
34 | | -
|
35 | | -## Step 6: Create Documentation |
36 | | -- Normalize entry point name to kebab-case (`calculateTotalPrice` → `calculate-total-price`) |
37 | | -- Create `docs/ai/implementation/knowledge-{name}.md` using the headings implied in Step 5 (Overview, Implementation Details, Dependencies, Visual Diagrams, Additional Insights, Metadata, Next Steps) |
38 | | -- Populate sections with findings, diagrams, and metadata (analysis date, depth, files touched) |
39 | | -- Include mermaid diagrams when they clarify flows or relationships |
40 | | -
|
41 | | -## Step 7: Review & Next Actions |
42 | | -- Summarize key insights and open questions for follow-up |
43 | | -- Suggest related areas for deeper dives or refactors |
44 | | -- Confirm the knowledge file path and remind to commit it |
45 | | -- Encourage running `/capture-knowledge` again for related entry points if needed |
46 | | -
|
47 | | -Let me know the entry point and goals when you’re ready to begin the knowledge capture.''' |
| 1 | +description='''Document a code entry point in knowledge docs.''' |
| 2 | +prompt='''Guide me through creating a structured understanding of a code entry point and saving it to the knowledge docs. |
| 3 | +
|
| 4 | +1. **Gather & Validate Entry Point** — If not already provided, ask for: entry point (file, folder, function, API), why it matters (feature, bug, investigation), and desired depth or focus areas. Confirm the entry point exists; if ambiguous or not found, clarify or suggest alternatives. |
| 5 | +2. **Use Memory for Context** — Search memory for prior knowledge about this module/domain: `npx ai-devkit@latest memory search --query "<entry point or subsystem>"`. |
| 6 | +3. **Collect Source Context** — Read the primary file/module and summarize purpose, exports, key patterns. For folders: list structure, highlight key modules. For functions/APIs: capture signature, parameters, return values, error handling. Extract essential snippets (avoid large dumps). |
| 7 | +4. **Analyze Dependencies** — Build a dependency view up to depth 3, tracking visited nodes to avoid loops. Categorize: imports, function calls, services, external packages. Note external systems or generated code to exclude. |
| 8 | +5. **Synthesize Explanation** — Draft overview (purpose, language, high-level behavior). Detail core logic, execution flow, key patterns. Highlight error handling, performance, security considerations. Identify potential improvements or risks. |
| 9 | +6. **Create Documentation** — Normalize name to kebab-case (`calculateTotalPrice` → `calculate-total-price`). Create `docs/ai/implementation/knowledge-{name}.md` with sections: Overview, Implementation Details, Dependencies, Visual Diagrams, Additional Insights, Metadata, Next Steps. Include mermaid diagrams when they clarify flows or relationships. Add metadata (analysis date, depth, files touched). |
| 10 | +7. **Store Reusable Knowledge** — If insights should persist across sessions, store them using `npx ai-devkit@latest memory store ...`. |
| 11 | +8. **Review & Next Actions** — Summarize key insights and open questions. Suggest related areas for deeper dives, confirm file path, and suggest `/remember` for key long-lived rules.''' |
0 commit comments