moai-adk 0.3.13__py3-none-any.whl → 0.4.1__py3-none-any.whl
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.
Potentially problematic release.
This version of moai-adk might be problematic. Click here for more details.
- moai_adk/__init__.py +1 -1
- moai_adk/__main__.py +1 -1
- moai_adk/cli/commands/__init__.py +1 -1
- moai_adk/cli/commands/doctor.py +2 -2
- moai_adk/cli/commands/init.py +10 -5
- moai_adk/cli/commands/status.py +1 -1
- moai_adk/cli/commands/update.py +210 -8
- moai_adk/cli/prompts/init_prompts.py +15 -19
- moai_adk/core/__init__.py +1 -1
- moai_adk/core/diagnostics/slash_commands.py +1 -1
- moai_adk/core/git/branch.py +1 -1
- moai_adk/core/git/manager.py +1 -1
- moai_adk/core/project/backup_utils.py +1 -0
- moai_adk/core/project/phase_executor.py +3 -1
- moai_adk/core/project/validator.py +3 -2
- moai_adk/core/quality/__init__.py +1 -1
- moai_adk/core/quality/trust_checker.py +1 -1
- moai_adk/core/quality/validators/__init__.py +1 -1
- moai_adk/core/quality/validators/base_validator.py +1 -1
- moai_adk/core/template/__init__.py +1 -1
- moai_adk/core/template/backup.py +12 -3
- moai_adk/core/template/config.py +24 -0
- moai_adk/core/template/languages.py +1 -1
- moai_adk/core/template/merger.py +74 -4
- moai_adk/core/template/processor.py +62 -14
- moai_adk/templates/.claude/agents/alfred/cc-manager.md +765 -191
- moai_adk/templates/.claude/agents/alfred/debug-helper.md +116 -103
- moai_adk/templates/.claude/agents/alfred/doc-syncer.md +130 -116
- moai_adk/templates/.claude/agents/alfred/git-manager.md +186 -174
- moai_adk/templates/.claude/agents/alfred/implementation-planner.md +227 -213
- moai_adk/templates/.claude/agents/alfred/project-manager.md +205 -125
- moai_adk/templates/.claude/agents/alfred/quality-gate.md +224 -209
- moai_adk/templates/.claude/agents/alfred/spec-builder.md +174 -160
- moai_adk/templates/.claude/agents/alfred/tag-agent.md +151 -139
- moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +209 -196
- moai_adk/templates/.claude/agents/alfred/trust-checker.md +247 -233
- moai_adk/templates/.claude/commands/alfred/0-project.md +856 -355
- moai_adk/templates/.claude/commands/alfred/1-plan.md +572 -0
- moai_adk/templates/.claude/commands/alfred/2-run.md +470 -0
- moai_adk/templates/.claude/commands/alfred/3-sync.md +366 -356
- moai_adk/templates/.claude/hooks/alfred/README.md +52 -52
- moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +44 -48
- moai_adk/templates/.claude/hooks/alfred/core/__init__.py +17 -17
- moai_adk/templates/.claude/hooks/alfred/core/checkpoint.py +59 -59
- moai_adk/templates/.claude/hooks/alfred/core/context.py +19 -19
- moai_adk/templates/.claude/hooks/alfred/core/project.py +52 -52
- moai_adk/templates/.claude/hooks/alfred/handlers/__init__.py +1 -1
- moai_adk/templates/.claude/hooks/alfred/handlers/notification.py +4 -4
- moai_adk/templates/.claude/hooks/alfred/handlers/session.py +30 -51
- moai_adk/templates/.claude/hooks/alfred/handlers/tool.py +16 -17
- moai_adk/templates/.claude/hooks/alfred/handlers/user.py +11 -11
- moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +308 -307
- moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +297 -296
- moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +191 -190
- moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/SKILL.md +112 -0
- moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/SKILL.md +103 -0
- moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/SKILL.md +103 -0
- moai_adk/templates/.claude/skills/moai-alfred-git-workflow/SKILL.md +95 -0
- moai_adk/templates/.claude/skills/moai-alfred-language-detection/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/SKILL.md +105 -0
- moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/SKILL.md +97 -0
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/SKILL.md +97 -0
- moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/SKILL.md +90 -0
- moai_adk/templates/.claude/skills/moai-alfred-trust-validation/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/SKILL.md +87 -0
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/examples.md +62 -0
- moai_adk/templates/.claude/skills/moai-claude-code/SKILL.md +94 -0
- moai_adk/templates/.claude/skills/moai-claude-code/examples.md +513 -0
- moai_adk/templates/.claude/skills/moai-claude-code/reference.md +433 -0
- moai_adk/templates/.claude/skills/moai-claude-code/templates/agent-full.md +332 -0
- moai_adk/templates/.claude/skills/moai-claude-code/templates/command-full.md +384 -0
- moai_adk/templates/.claude/skills/moai-claude-code/templates/plugin-full.json +363 -0
- moai_adk/templates/.claude/skills/moai-claude-code/templates/settings-full.json +595 -0
- moai_adk/templates/.claude/skills/moai-claude-code/templates/skill-full.md +496 -0
- moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-domain-cli-tool/SKILL.md +95 -0
- moai_adk/templates/.claude/skills/moai-domain-data-science/SKILL.md +98 -0
- moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +100 -0
- moai_adk/templates/.claude/skills/moai-domain-devops/SKILL.md +100 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-domain-ml/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-domain-mobile-app/SKILL.md +93 -0
- moai_adk/templates/.claude/skills/moai-domain-security/SKILL.md +105 -0
- moai_adk/templates/.claude/skills/moai-domain-web-api/SKILL.md +97 -0
- moai_adk/templates/.claude/skills/moai-essentials-debug/SKILL.md +102 -0
- moai_adk/templates/.claude/skills/moai-essentials-perf/SKILL.md +104 -0
- moai_adk/templates/.claude/skills/moai-essentials-refactor/SKILL.md +96 -0
- moai_adk/templates/.claude/skills/moai-essentials-review/SKILL.md +112 -0
- moai_adk/templates/.claude/skills/moai-foundation-ears/SKILL.md +98 -0
- moai_adk/templates/.claude/skills/moai-foundation-git/SKILL.md +90 -0
- moai_adk/templates/.claude/skills/moai-foundation-langs/SKILL.md +94 -0
- moai_adk/templates/.claude/skills/moai-foundation-specs/SKILL.md +93 -0
- moai_adk/templates/.claude/skills/moai-foundation-tags/SKILL.md +86 -0
- moai_adk/templates/.claude/skills/moai-foundation-trust/SKILL.md +86 -0
- moai_adk/templates/.claude/skills/moai-lang-c/SKILL.md +100 -0
- moai_adk/templates/.claude/skills/moai-lang-clojure/SKILL.md +100 -0
- moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +102 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +100 -0
- moai_adk/templates/.claude/skills/moai-lang-dart/SKILL.md +98 -0
- moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +100 -0
- moai_adk/templates/.claude/skills/moai-lang-haskell/SKILL.md +100 -0
- moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +98 -0
- moai_adk/templates/.claude/skills/moai-lang-javascript/SKILL.md +96 -0
- moai_adk/templates/.claude/skills/moai-lang-julia/SKILL.md +98 -0
- moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-lang-lua/SKILL.md +98 -0
- moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +98 -0
- moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +96 -0
- moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +100 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +100 -0
- moai_adk/templates/.claude/skills/moai-lang-shell/SKILL.md +100 -0
- moai_adk/templates/.claude/skills/moai-lang-sql/SKILL.md +100 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +96 -0
- moai_adk/templates/.github/PULL_REQUEST_TEMPLATE.md +44 -43
- moai_adk/templates/.github/workflows/moai-gitflow.yml +36 -35
- moai_adk/templates/.moai/config.json +9 -6
- moai_adk/templates/.moai/memory/development-guide.md +220 -221
- moai_adk/templates/.moai/memory/gitflow-protection-policy.md +85 -85
- moai_adk/templates/.moai/memory/spec-metadata.md +149 -150
- moai_adk/templates/.moai/project/product.md +90 -90
- moai_adk/templates/.moai/project/structure.md +85 -85
- moai_adk/templates/.moai/project/tech.md +117 -117
- moai_adk/templates/CLAUDE.md +354 -573
- moai_adk/templates/__init__.py +1 -1
- moai_adk/utils/__init__.py +1 -1
- moai_adk/utils/banner.py +7 -7
- moai_adk/utils/logger.py +1 -1
- moai_adk-0.4.1.dist-info/METADATA +303 -0
- moai_adk-0.4.1.dist-info/RECORD +152 -0
- moai_adk/templates/.claude/commands/alfred/1-spec.md +0 -532
- moai_adk/templates/.claude/commands/alfred/2-build.md +0 -432
- moai_adk/templates/.moai/hooks/pre-push.sample +0 -88
- moai_adk-0.3.13.dist-info/METADATA +0 -1586
- moai_adk-0.3.13.dist-info/RECORD +0 -90
- {moai_adk-0.3.13.dist-info → moai_adk-0.4.1.dist-info}/WHEEL +0 -0
- {moai_adk-0.3.13.dist-info → moai_adk-0.4.1.dist-info}/entry_points.txt +0 -0
- {moai_adk-0.3.13.dist-info → moai_adk-0.4.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,114 +1,115 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: Study with Alfred
|
|
3
|
-
description:
|
|
3
|
+
description: Learning mode to easily learn new skills with Alfred
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Study with Alfred
|
|
7
|
+
> Interactive prompts rely on `Skill("moai-alfred-tui-survey")` so AskUserQuestion renders TUI selection menus for user surveys and approvals.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
**Audience**: Developers looking to learn new technologies/languages/frameworks
|
|
9
10
|
|
|
10
|
-
Alfred
|
|
11
|
+
This is a learning mode where Alfred easily explains new skills and helps you practice, like a friend learning together.
|
|
11
12
|
|
|
12
|
-
##
|
|
13
|
+
## How to Learn with Alfred
|
|
13
14
|
|
|
14
|
-
**Alfred
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
15
|
+
**Alfred's role**:
|
|
16
|
+
- Explain complex concepts in an easy-to-understand manner
|
|
17
|
+
- Improve understanding with real-life analogies
|
|
18
|
+
- Practice together step by step
|
|
19
|
+
- Answer frequently asked questions
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
**Learning Flow**:
|
|
21
22
|
```
|
|
22
|
-
1. What (
|
|
23
|
-
2. Why (
|
|
24
|
-
3. How (
|
|
25
|
-
4. Practice
|
|
23
|
+
1. What (What is this?) → Understanding the basic concept
|
|
24
|
+
2. Why (Why do you need it?) → Reasons for use and advantages
|
|
25
|
+
3. How (How to use it?) → Practice-based learning
|
|
26
|
+
4. Practice → Integration with MoAI-ADK
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
---
|
|
29
30
|
|
|
30
|
-
##
|
|
31
|
+
## 4 stages of learning
|
|
31
32
|
|
|
32
|
-
### Step 1: What (
|
|
33
|
+
### Step 1: What (What is this?)
|
|
33
34
|
|
|
34
|
-
**Alfred**: "
|
|
35
|
+
**Alfred**: "I'll summarize the new technology in one sentence."
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
37
|
+
**Explanation method**:
|
|
38
|
+
- One line summary
|
|
39
|
+
- Real life analogy
|
|
40
|
+
- 3 key concepts
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
**Example**: FastAPI (Python web framework)
|
|
42
43
|
```
|
|
43
|
-
Alfred: "FastAPI
|
|
44
|
+
Alfred: "FastAPI is a tool to quickly create APIs with Python."
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
Real life analogy:
|
|
47
|
+
A tool that quickly assembles API pieces like Lego blocks
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
Python +
|
|
49
|
+
One-line summary:
|
|
50
|
+
Python + automatic verification + fast speed = FastAPI
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
1.
|
|
53
|
-
2.
|
|
54
|
-
3.
|
|
52
|
+
Key concepts:
|
|
53
|
+
1. Automatic documentation (Swagger UI)
|
|
54
|
+
2. Type verification (Pydantic)
|
|
55
|
+
3. Asynchronous processing (async/await)
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
### Step 2: Why (
|
|
58
|
+
### Step 2: Why (Why do you need it?)
|
|
58
59
|
|
|
59
|
-
**Alfred**:
|
|
60
|
+
**Alfred**: “Let’s think together about the problems this technology solves.”
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
62
|
+
**How to explain**:
|
|
63
|
+
- Problem situation
|
|
64
|
+
- Solution
|
|
65
|
+
- Actual use case
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
**Example**: Why use FastAPI?
|
|
67
68
|
```
|
|
68
|
-
|
|
69
|
+
Let's think about it with Alfred:
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
"Flask
|
|
71
|
+
Problem:
|
|
72
|
+
"Flask is slow, and Django is too heavy. Type validation also has to be done manually."
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
FastAPI
|
|
74
|
+
Solution:
|
|
75
|
+
FastAPI is fast, lightweight, and automatically verifies types.
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
- Uber:
|
|
78
|
-
- Netflix:
|
|
79
|
-
- Microsoft: Azure
|
|
77
|
+
Real world usage:
|
|
78
|
+
- Uber: Real-time location API
|
|
79
|
+
- Netflix: Recommendation system API
|
|
80
|
+
- Microsoft: Azure services API
|
|
80
81
|
|
|
81
|
-
Alfred:
|
|
82
|
+
Alfred: “Used in places where high speed and stability are required!”
|
|
82
83
|
```
|
|
83
84
|
|
|
84
|
-
### Step 3: How (
|
|
85
|
+
### Step 3: How (How do I use it?)
|
|
85
86
|
|
|
86
|
-
**Alfred**: "
|
|
87
|
+
**Alfred**: "Let's start with the simplest example"
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
1.
|
|
90
|
-
2.
|
|
91
|
-
3.
|
|
89
|
+
**Learning order**:
|
|
90
|
+
1. Minimal example (Hello World)
|
|
91
|
+
2. Practical example (CRUD API)
|
|
92
|
+
3. Frequently Asked Questions
|
|
92
93
|
|
|
93
|
-
|
|
94
|
+
**Example**: How to use FastAPI
|
|
94
95
|
```
|
|
95
|
-
Alfred:
|
|
96
|
+
Alfred: “Let’s start with the simplest example”
|
|
96
97
|
|
|
97
98
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
98
|
-
[
|
|
99
|
+
[Minimum example]
|
|
99
100
|
|
|
100
|
-
from fastapi import FastAPI
|
|
101
|
+
from fastapi import FastAPI # ← Import FastAPI
|
|
101
102
|
|
|
102
|
-
app = FastAPI()
|
|
103
|
+
app = FastAPI() # ← Create app
|
|
103
104
|
|
|
104
|
-
@app.get("/hello")
|
|
105
|
+
@app.get("/hello") # ← Create /hello address
|
|
105
106
|
def hello():
|
|
106
|
-
|
|
107
|
+
return {"message": "Hello!"} # ← Send response
|
|
107
108
|
|
|
108
|
-
Alfred:
|
|
109
|
+
Alfred: “An API is complete in just 5 lines!”
|
|
109
110
|
|
|
110
111
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
111
|
-
[
|
|
112
|
+
[Practical example: User inquiry API]
|
|
112
113
|
|
|
113
114
|
from fastapi import FastAPI, HTTPException
|
|
114
115
|
from pydantic import BaseModel
|
|
@@ -127,61 +128,61 @@ async def get_user(user_id: int) -> User:
|
|
|
127
128
|
raise HTTPException(status_code=404, detail="User not found")
|
|
128
129
|
return user
|
|
129
130
|
|
|
130
|
-
Alfred: "Pydantic
|
|
131
|
+
Alfred: "Automatic verification with Pydantic, error handling with HTTPException!"
|
|
131
132
|
|
|
132
133
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
133
|
-
[
|
|
134
|
+
[Frequently Asked Questions]
|
|
134
135
|
|
|
135
|
-
Q: Flask
|
|
136
|
-
Alfred:
|
|
136
|
+
Q: Compared to Flask?
|
|
137
|
+
Alfred: “FastAPI is 3 times faster and has automatic verification.”
|
|
137
138
|
|
|
138
|
-
Q: async/await
|
|
139
|
-
Alfred: "
|
|
139
|
+
Q: What is async/await?
|
|
140
|
+
Alfred: "It's a way to handle multiple tasks simultaneously. While waiting for one request, you can process another request."
|
|
140
141
|
|
|
141
|
-
Q:
|
|
142
|
-
Alfred:
|
|
142
|
+
Q: When is it best to use it?
|
|
143
|
+
Alfred: “It’s best for fast API, real-time processing, and microservices.”
|
|
143
144
|
```
|
|
144
145
|
|
|
145
|
-
### Step 4: Practice
|
|
146
|
+
### Step 4: Practice
|
|
146
147
|
|
|
147
|
-
**Alfred**:
|
|
148
|
+
**Alfred**: “Now shall we try using it with MoAI-ADK?”
|
|
148
149
|
|
|
149
|
-
|
|
150
|
-
- SPEC → TEST → CODE
|
|
151
|
-
- @TAG
|
|
152
|
-
- TRUST 5
|
|
150
|
+
**Practice method**:
|
|
151
|
+
- Practice with SPEC → TEST → CODE flow
|
|
152
|
+
- Application of @TAG system
|
|
153
|
+
- Compliance with TRUST 5 principles
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
**Example**: Creating a user API with FastAPI
|
|
155
156
|
```
|
|
156
|
-
Alfred:
|
|
157
|
+
Alfred: “Let’s create it together with the MoAI-ADK workflow!”
|
|
157
158
|
|
|
158
159
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
159
|
-
[1
|
|
160
|
+
[Step 1: Write SPEC]
|
|
160
161
|
|
|
161
|
-
/alfred:1-
|
|
162
|
+
/alfred:1-plan "User Lookup API"
|
|
162
163
|
|
|
163
|
-
|
|
164
|
+
SPEC created by Alfred:
|
|
164
165
|
---
|
|
165
166
|
id: USER-001
|
|
166
167
|
version: 0.0.1
|
|
167
168
|
status: draft
|
|
168
169
|
---
|
|
169
170
|
|
|
170
|
-
# @SPEC:USER-001:
|
|
171
|
+
# @SPEC:USER-001: User Lookup API
|
|
171
172
|
|
|
172
173
|
## Ubiquitous Requirements
|
|
173
|
-
-
|
|
174
|
+
- The system must provide an API to search user information by user ID.
|
|
174
175
|
|
|
175
176
|
## Event-driven Requirements
|
|
176
|
-
- WHEN
|
|
177
|
-
- WHEN
|
|
177
|
+
- WHEN If a user ID that exists is requested, the system SHOULD return user information
|
|
178
|
+
- WHEN If a user ID that does not exist is requested, the system SHOULD return a 404 error.
|
|
178
179
|
|
|
179
180
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
180
|
-
[2
|
|
181
|
+
[Step 2: TDD implementation]
|
|
181
182
|
|
|
182
|
-
/alfred:2-
|
|
183
|
+
/alfred:2-run USER-001
|
|
183
184
|
|
|
184
|
-
Alfred:
|
|
185
|
+
Alfred: “I’ll write a test first”
|
|
185
186
|
|
|
186
187
|
# @TEST:USER-001 | SPEC: SPEC-USER-001.md
|
|
187
188
|
def test_get_user_returns_user():
|
|
@@ -193,72 +194,72 @@ def test_get_user_not_found():
|
|
|
193
194
|
response = client.get("/users/999")
|
|
194
195
|
assert response.status_code == 404
|
|
195
196
|
|
|
196
|
-
Alfred:
|
|
197
|
+
Alfred: “Now let me write the code”
|
|
197
198
|
|
|
198
199
|
# @CODE:USER-001 | SPEC: SPEC-USER-001.md | TEST: tests/test_user.py
|
|
199
200
|
@app.get("/users/{user_id}")
|
|
200
201
|
async def get_user(user_id: int) -> User:
|
|
201
|
-
|
|
202
|
+
"""@CODE:USER-001: User Lookup API"""
|
|
202
203
|
user = await db.users.find_by_id(user_id)
|
|
203
204
|
if not user:
|
|
204
205
|
raise HTTPException(status_code=404, detail="User not found")
|
|
205
206
|
return user
|
|
206
207
|
|
|
207
|
-
Alfred:
|
|
208
|
+
Alfred: “SPEC → TEST → CODE are all connected!”
|
|
208
209
|
|
|
209
210
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
210
|
-
[3
|
|
211
|
+
[Step 3: Document Synchronization]
|
|
211
212
|
|
|
212
213
|
/alfred:3-sync
|
|
213
214
|
|
|
214
|
-
Alfred:
|
|
215
|
+
Alfred: “I will verify the TAG chain”
|
|
215
216
|
|
|
216
217
|
✓ @SPEC:USER-001 → .moai/specs/SPEC-USER-001.md
|
|
217
218
|
✓ @TEST:USER-001 → tests/test_user.py
|
|
218
219
|
✓ @CODE:USER-001 → src/api/user.py
|
|
219
|
-
✓ @DOC:USER-001 → docs/api/user.md (
|
|
220
|
+
✓ @DOC:USER-001 → docs/api/user.md (automatically generated)
|
|
220
221
|
|
|
221
|
-
Alfred: "
|
|
222
|
+
Alfred: "Complete! FastAPI + MoAI-ADK work together!"
|
|
222
223
|
```
|
|
223
224
|
|
|
224
225
|
---
|
|
225
226
|
|
|
226
|
-
##
|
|
227
|
+
## Framework-specific study guide
|
|
227
228
|
|
|
228
229
|
### TypeScript + Express
|
|
229
230
|
|
|
230
|
-
**Alfred**: "
|
|
231
|
+
**Alfred**: "It's the most popular web framework in Node.js"
|
|
231
232
|
|
|
232
|
-
#### What (
|
|
233
|
+
#### What (What is this?)
|
|
233
234
|
```
|
|
234
|
-
Alfred: "Express
|
|
235
|
+
Alfred: "Express is a tool to easily create a web server with Node.js."
|
|
235
236
|
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
Real life analogy:
|
|
238
|
+
The role is like a waiter in a restaurant, taking requests and delivering responses.
|
|
238
239
|
|
|
239
|
-
|
|
240
|
-
Node.js +
|
|
240
|
+
One-line summary:
|
|
241
|
+
Node.js + middleware + routing = Express
|
|
241
242
|
|
|
242
|
-
|
|
243
|
-
1.
|
|
244
|
-
2.
|
|
245
|
-
3.
|
|
243
|
+
Key concepts:
|
|
244
|
+
1. Middleware chain
|
|
245
|
+
2. Routing
|
|
246
|
+
3. Request-response processing
|
|
246
247
|
```
|
|
247
248
|
|
|
248
|
-
#### Why (
|
|
249
|
+
#### Why (Why do you need it?)
|
|
249
250
|
```
|
|
250
|
-
Alfred:
|
|
251
|
+
Alfred: “More than 95% of Node.js APIs use Express”
|
|
251
252
|
|
|
252
|
-
|
|
253
|
-
|
|
253
|
+
Problem: Node.js default http module is too complicated
|
|
254
|
+
Solution: Express can be easily created with a simple API
|
|
254
255
|
|
|
255
|
-
|
|
256
|
-
- Uber, Netflix, PayPal
|
|
256
|
+
Practical Use:
|
|
257
|
+
- Uber, Netflix, PayPal, etc.
|
|
257
258
|
```
|
|
258
259
|
|
|
259
|
-
#### How (
|
|
260
|
+
#### How (How do you use it?)
|
|
260
261
|
```
|
|
261
|
-
Alfred:
|
|
262
|
+
Alfred: “It’s the simplest example.”
|
|
262
263
|
|
|
263
264
|
import express from 'express';
|
|
264
265
|
|
|
@@ -271,12 +272,12 @@ app.get('/users/:id', async (req, res) => {
|
|
|
271
272
|
|
|
272
273
|
app.listen(3000);
|
|
273
274
|
|
|
274
|
-
Alfred:
|
|
275
|
+
Alfred: “All you need is this to complete your API server!”
|
|
275
276
|
```
|
|
276
277
|
|
|
277
|
-
#### Practice (MoAI-ADK
|
|
278
|
+
#### Practice (with MoAI-ADK)
|
|
278
279
|
```
|
|
279
|
-
Alfred:
|
|
280
|
+
Alfred: “Now let’s make it TDD”
|
|
280
281
|
|
|
281
282
|
// @TEST:USER-001 | SPEC: SPEC-USER-001.md
|
|
282
283
|
test('GET /users/:id returns user', async () => {
|
|
@@ -294,57 +295,57 @@ app.get('/users/:id', async (req, res) => {
|
|
|
294
295
|
res.json(user);
|
|
295
296
|
});
|
|
296
297
|
|
|
297
|
-
Alfred:
|
|
298
|
+
Alfred: “SPEC → TEST → CODE completed!”
|
|
298
299
|
```
|
|
299
300
|
|
|
300
|
-
####
|
|
301
|
+
#### Frequently Asked Questions
|
|
301
302
|
```
|
|
302
|
-
Q:
|
|
303
|
-
Alfred: "
|
|
303
|
+
Q: What is middleware?
|
|
304
|
+
Alfred: "It is a step that goes through before processing a request. It is used for logging, authentication, etc."
|
|
304
305
|
|
|
305
|
-
Q: async
|
|
306
|
-
Alfred: "express-async-errors
|
|
306
|
+
Q: How to handle async errors?
|
|
307
|
+
Alfred: "If you use the express-async-errors package, it will be handled automatically."
|
|
307
308
|
|
|
308
309
|
Q: FastAPI vs Express?
|
|
309
|
-
Alfred:
|
|
310
|
+
Alfred: “Express is flexible and has a large ecosystem, and FastAPI is fast and has strong automatic verification.”
|
|
310
311
|
```
|
|
311
312
|
|
|
312
313
|
---
|
|
313
314
|
|
|
314
315
|
### Python + FastAPI
|
|
315
316
|
|
|
316
|
-
**Alfred**: "
|
|
317
|
+
**Alfred**: "It's the standard for modern Python web frameworks."
|
|
317
318
|
|
|
318
|
-
#### What (
|
|
319
|
+
#### What (What is this?)
|
|
319
320
|
```
|
|
320
|
-
Alfred: "FastAPI
|
|
321
|
+
Alfred: "FastAPI is a tool to create fast APIs with Python."
|
|
321
322
|
|
|
322
|
-
|
|
323
|
-
|
|
323
|
+
Real life analogy:
|
|
324
|
+
Automatically verify and document like robots in a car factory
|
|
324
325
|
|
|
325
|
-
|
|
326
|
-
Python + Pydantic +
|
|
326
|
+
One-line summary:
|
|
327
|
+
Python + Pydantic + Async = FastAPI
|
|
327
328
|
|
|
328
|
-
|
|
329
|
-
1.
|
|
330
|
-
2.
|
|
331
|
-
3.
|
|
329
|
+
Key concepts:
|
|
330
|
+
1. Automatic Verification (Pydantic)
|
|
331
|
+
2. Automatic documentation (Swagger)
|
|
332
|
+
3. Asynchronous processing (async/await)
|
|
332
333
|
```
|
|
333
334
|
|
|
334
|
-
#### Why (
|
|
335
|
+
#### Why (Why do you need it?)
|
|
335
336
|
```
|
|
336
|
-
Alfred:
|
|
337
|
+
Alfred: “3x faster than Flask and more concise than Django”
|
|
337
338
|
|
|
338
|
-
|
|
339
|
-
|
|
339
|
+
Problem: Flask is slow, Django is heavy
|
|
340
|
+
Solution: FastAPI is fast, lightweight, yet powerful
|
|
340
341
|
|
|
341
|
-
|
|
342
|
+
Actual use:
|
|
342
343
|
- Uber, Microsoft, Netflix
|
|
343
344
|
```
|
|
344
345
|
|
|
345
|
-
#### How (
|
|
346
|
+
#### How (How do you use it?)
|
|
346
347
|
```
|
|
347
|
-
Alfred:
|
|
348
|
+
Alfred: “It’s a basic example.”
|
|
348
349
|
|
|
349
350
|
from fastapi import FastAPI
|
|
350
351
|
from pydantic import BaseModel
|
|
@@ -359,12 +360,12 @@ class User(BaseModel):
|
|
|
359
360
|
async def get_user(user_id: int) -> User:
|
|
360
361
|
return await db.find_user(user_id)
|
|
361
362
|
|
|
362
|
-
Alfred:
|
|
363
|
+
Alfred: “Pydantic verifies it automatically!”
|
|
363
364
|
```
|
|
364
365
|
|
|
365
|
-
#### Practice (MoAI-ADK
|
|
366
|
+
#### Practice (with MoAI-ADK)
|
|
366
367
|
```
|
|
367
|
-
Alfred:
|
|
368
|
+
Alfred: “Let’s build it together with TDD”
|
|
368
369
|
|
|
369
370
|
# @TEST:USER-001 | SPEC: SPEC-USER-001.md
|
|
370
371
|
def test_get_user():
|
|
@@ -374,96 +375,96 @@ def test_get_user():
|
|
|
374
375
|
# @CODE:USER-001 | SPEC: SPEC-USER-001.md | TEST: tests/test_user.py
|
|
375
376
|
@app.get("/users/{user_id}")
|
|
376
377
|
async def get_user(user_id: int) -> User:
|
|
377
|
-
|
|
378
|
+
"""@CODE:USER-001: User query"""
|
|
378
379
|
user = await db.find_user(user_id)
|
|
379
380
|
if not user:
|
|
380
381
|
raise HTTPException(status_code=404)
|
|
381
382
|
return user
|
|
382
383
|
|
|
383
|
-
Alfred:
|
|
384
|
+
Alfred: “Complete!”
|
|
384
385
|
```
|
|
385
386
|
|
|
386
|
-
####
|
|
387
|
+
#### Frequently Asked Questions
|
|
387
388
|
```
|
|
388
|
-
Q: Pydantic
|
|
389
|
-
Alfred:
|
|
389
|
+
Q: What is Pydantic?
|
|
390
|
+
Alfred: “It is a library that automatically verifies data.”
|
|
390
391
|
|
|
391
|
-
Q: async/await
|
|
392
|
-
Alfred: "
|
|
392
|
+
Q: Is async/await really necessary?
|
|
393
|
+
Alfred: "If you need fast performance, it's essential, otherwise the sync function is fine."
|
|
393
394
|
|
|
394
395
|
Q: Django vs FastAPI?
|
|
395
|
-
Alfred: "Django
|
|
396
|
+
Alfred: "Django is full-stack, FastAPI is API-only."
|
|
396
397
|
```
|
|
397
398
|
|
|
398
399
|
---
|
|
399
400
|
|
|
400
|
-
##
|
|
401
|
+
## Study Tips
|
|
401
402
|
|
|
402
|
-
### Alfred
|
|
403
|
+
### Alfred's Study Advice
|
|
403
404
|
|
|
404
|
-
**1.
|
|
405
|
+
**1. Start small**
|
|
405
406
|
```
|
|
406
|
-
Alfred: "
|
|
407
|
+
Alfred: "Let's start with Hello World"
|
|
407
408
|
|
|
408
|
-
|
|
409
|
-
|
|
409
|
+
Examples that are too complex can be confusing.
|
|
410
|
+
Start with the simplest example and expand gradually.
|
|
410
411
|
```
|
|
411
412
|
|
|
412
|
-
**2.
|
|
413
|
+
**2. Practice-oriented**
|
|
413
414
|
```
|
|
414
|
-
Alfred: "
|
|
415
|
+
Alfred: "Try the code yourself"
|
|
415
416
|
|
|
416
|
-
|
|
417
|
-
|
|
417
|
+
Just read it and forget it right away.
|
|
418
|
+
Try it yourself, run it, and correct the errors.
|
|
418
419
|
```
|
|
419
420
|
|
|
420
|
-
**3. MoAI-ADK
|
|
421
|
+
**3. Integration with MoAI-ADK**
|
|
421
422
|
```
|
|
422
|
-
Alfred:
|
|
423
|
+
Alfred: “I learn MoAI-ADK while learning new technologies.”
|
|
423
424
|
|
|
424
|
-
SPEC → TEST → CODE
|
|
425
|
-
|
|
425
|
+
If you practice with the SPEC → TEST → CODE flow,
|
|
426
|
+
You can kill two birds with one stone!
|
|
426
427
|
```
|
|
427
428
|
|
|
428
|
-
**4.
|
|
429
|
+
**4. Use frequently asked questions**
|
|
429
430
|
```
|
|
430
|
-
Alfred:
|
|
431
|
+
Alfred: “If you have any questions, feel free to ask”
|
|
431
432
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
433
|
+
“Why do I have to do this?”
|
|
434
|
+
“Is there another way?”
|
|
435
|
+
“How do I use it in practice?”
|
|
435
436
|
```
|
|
436
437
|
|
|
437
|
-
###
|
|
438
|
+
### Recommended learning sequence
|
|
438
439
|
|
|
439
440
|
```
|
|
440
|
-
1
|
|
441
|
+
Step 1: Familiarize yourself with MoAI-ADK
|
|
441
442
|
→ /output-style moai-adk-learning
|
|
442
443
|
|
|
443
|
-
2
|
|
444
|
+
Step 2: Learning a new framework (now)
|
|
444
445
|
→ /output-style study-with-alfred
|
|
445
446
|
|
|
446
|
-
3
|
|
447
|
+
Step 3: Apply practical projects
|
|
447
448
|
→ /output-style agentic-coding
|
|
448
449
|
```
|
|
449
450
|
|
|
450
451
|
---
|
|
451
452
|
|
|
452
|
-
##
|
|
453
|
+
## Style conversion guide
|
|
453
454
|
|
|
454
|
-
###
|
|
455
|
-
- ✅
|
|
456
|
-
- ✅
|
|
457
|
-
- ✅
|
|
458
|
-
- ✅
|
|
455
|
+
### When this style suits you
|
|
456
|
+
- ✅ When learning a new language/framework
|
|
457
|
+
- ✅ When you want to easily understand complex concepts
|
|
458
|
+
- ✅ When you want to learn practice-oriented
|
|
459
|
+
- ✅ When you want to learn by talking with Alfred
|
|
459
460
|
|
|
460
|
-
###
|
|
461
|
+
### Switch to a different style
|
|
461
462
|
|
|
462
|
-
|
|
|
463
|
-
|
|
464
|
-
| MoAI-ADK
|
|
465
|
-
|
|
|
463
|
+
| Situation | Recommended Style | Conversion command |
|
|
464
|
+
| ----------------------------- | ----------------- | --------------------------------- |
|
|
465
|
+
| First time using MoAI-ADK | moai-adk-learning | `/output-style moai-adk-learning` |
|
|
466
|
+
| Practical project development | agentic-coding | `/output-style agentic-coding` |
|
|
466
467
|
|
|
467
468
|
---
|
|
468
469
|
|
|
469
|
-
**Study with Alfred**:
|
|
470
|
+
**Study with Alfred**: This is a learning mode that allows you to easily learn new skills as if talking with Alfred and apply them directly to practice by integrating with MoAI-ADK.
|