docs: update en/ documents with latest zh/ translations

- Update 00-fundamentals: Language Layer Elements, Glue Coding, Common Pitfalls, The Way of Programming, General Project Architecture Template
- Update 01-getting-started: all 4 guides
- Update 04-resources: Tool Collection, External Resource Aggregation
- Add fate-engine-dev practice examples
- Update all README.md files

Translated using Gemini CLI headless mode
This commit is contained in:
tukuaiai 2025-12-19 17:36:38 +08:00
parent 63179deee5
commit 86e938aa2b
23 changed files with 1621 additions and 1216 deletions

View File

@ -1,3 +1,4 @@
```markdown
# 🕳️ Common Pitfalls Summary # 🕳️ Common Pitfalls Summary
> Common issues and solutions during the Vibe Coding process > Common issues and solutions during the Vibe Coding process
@ -5,18 +6,18 @@
--- ---
<details open> <details open>
<summary><strong>🤖 AI Chat Related</strong></summary> <summary><strong>🤖 AI Conversation Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| AI generated code doesn't run | Insufficient context | Provide full error messages, describe the runtime environment | | AI generated code doesn't run | Insufficient context | Provide full error message, explain execution environment |
| AI repeatedly modifies the same issue | Stuck in a loop | Describe with a different approach, or start a new conversation | | AI repeatedly modifies the same issue | Stuck in a loop | Try a different approach, or start a new conversation |
| AI hallucinating, fabricating non-existent APIs | Outdated model knowledge | Provide official documentation links for AI reference | | AI hallucination, fabricating non-existent APIs | Outdated model knowledge | Provide official documentation link for AI reference |
| Code becomes messy with changes | Lack of planning | Let AI propose a plan first, then write code after confirmation | | Code becomes messier after AI modifications | Lack of planning | Have AI propose a plan first, then confirm before coding |
| AI doesn't understand my requirements | Vague description | Explain with concrete examples, provide input and output samples | | AI doesn't understand my requirements | Vague description | Use concrete examples, provide input/output samples |
| AI forgets previous conversations | Context loss | Re-provide key information, or use a memory bank | | AI forgets previous conversation | Context loss | Re-provide key information, or use memory bank |
| AI modifies unintended code | Unclear instructions | Explicitly state "only modify xxx, do not touch other files" | | AI modifies code it shouldn't have | Unclear instructions | Explicitly state "only modify xxx, don't touch other files" |
| AI generated code style is inconsistent | No style guide | Provide a code style guide or sample code | | AI generated code style is inconsistent | No style guide | Provide code style guide or example code |
</details> </details>
@ -31,7 +32,7 @@
- Keep the system Python clean - Keep the system Python clean
- Easy to reproduce and deploy - Easy to reproduce and deploy
### Creating and using .venv ### Create and use .venv
```bash ```bash
# Create virtual environment # Create virtual environment
@ -50,15 +51,15 @@ pip install -r requirements.txt
deactivate deactivate
``` ```
### Common Issues ### Common Problems
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Cannot configure environment at all | Global pollution | Delete and restart, use `.venv` for virtual environment isolation | | Environment setup always fails | Global pollution | Delete and restart, isolate with `.venv` virtual environment |
| `python` command not found | Virtual environment not activated | Run `source .venv/bin/activate` first | | `python` command not found | Virtual environment not activated | Run `source .venv/bin/activate` first |
| Package installed but import error | Installed globally | Confirm virtual environment is activated before `pip install` | | Package installed but import error | Installed globally | Confirm virtual environment is active before `pip install` |
| Dependency conflicts in different projects | Sharing global environment | Create a separate `.venv` for each project | | Dependency conflicts between projects | Sharing global environment | Create a separate `.venv` for each project |
| VS Code uses wrong Python | Interpreter not selected correctly | Ctrl+Shift+P → "Python: Select Interpreter" → Select .venv | | VS Code uses wrong Python interpreter | Interpreter not selected correctly | Ctrl+Shift+P → "Python: Select Interpreter" → choose .venv |
| pip version too old | Virtual environment defaults to old version | `pip install --upgrade pip` | | pip version too old | Virtual environment defaults to old version | `pip install --upgrade pip` |
| requirements.txt missing dependencies | Not exported | `pip freeze > requirements.txt` | | requirements.txt missing dependencies | Not exported | `pip freeze > requirements.txt` |
@ -83,15 +84,15 @@ pip install -r requirements.txt
<details open> <details open>
<summary><strong>📦 Node.js Environment Related</strong></summary> <summary><strong>📦 Node.js Environment Related</strong></summary>
### Common Issues ### Common Problems
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Node version mismatch | Project requires specific version | Use nvm to manage multiple versions: `nvm install 18` | | Node version mismatch | Project requires specific version | Use nvm to manage multiple versions: `nvm install 18` |
| `npm install` error | Network/Permission issues | Change registry, clear cache, delete `node_modules` and reinstall | | `npm install` error | Network/Permissions issue | Change registry, clear cache, delete node_modules and reinstall |
| Global package not found | PATH not configured | Add `npm config get prefix` to PATH | | Global package not found | PATH not configured | Add `npm config get prefix` to PATH |
| package-lock conflict | Collaborative work | Use `npm ci` instead of `npm install` consistently | | package-lock conflict | Collaborative work | Consistently use `npm ci` instead of `npm install` |
| `node_modules` too large | Normal phenomenon | Add to `.gitignore`, do not commit | | node_modules too large | Normal phenomenon | Add to .gitignore, do not commit |
### Common Commands ### Common Commands
@ -106,7 +107,7 @@ npm cache clean --force
rm -rf node_modules package-lock.json rm -rf node_modules package-lock.json
npm install npm install
# Use nvm to switch Node version # Switch Node version with nvm
nvm use 18 nvm use 18
``` ```
@ -117,10 +118,10 @@ nvm use 18
<details open> <details open>
<summary><strong>🔧 Environment Configuration Related</strong></summary> <summary><strong>🔧 Environment Configuration Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Command not found | Environment variables not configured | Check PATH, restart terminal | | Command not found | Environment variable not configured | Check PATH, restart terminal |
| Port occupied | Not properly shut down last time | `lsof -i :port_number` or `netstat -ano \| findstr :port_number` | | Port in use | Not properly closed last time | `lsof -i :port_number` or `netstat -ano \| findstr :port_number` |
| Insufficient permissions | Linux/Mac permissions | `chmod +x` or `sudo` | | Insufficient permissions | Linux/Mac permissions | `chmod +x` or `sudo` |
| Environment variables not taking effect | Not sourced | `source ~/.bashrc` or restart terminal | | Environment variables not taking effect | Not sourced | `source ~/.bashrc` or restart terminal |
| .env file not taking effect | Not loaded | Use `python-dotenv` or `dotenv` package | | .env file not taking effect | Not loaded | Use `python-dotenv` or `dotenv` package |
@ -133,19 +134,19 @@ nvm use 18
<details open> <details open>
<summary><strong>🌐 Network Related</strong></summary> <summary><strong>🌐 Network Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| GitHub access slow/timeout | Network restrictions | Configure proxy, refer to [Network Environment Configuration](../从零开始vibecoding/01-网络环境配置.md) | | GitHub access slow/timeout | Network restrictions | Configure proxy, refer to [Network Environment Configuration](../从零开始vibecoding/01-网络环境配置.md) |
| API call failed | Network/Key issue | Check proxy, API Key validity | | API call failed | Network/Key issue | Check proxy, API Key validity |
| Terminal not using proxy | Incomplete proxy configuration | Set environment variables (see below) | | Terminal not using proxy | Incomplete proxy configuration | Set environment variables (see below) |
| SSL certificate error | Proxy/Time issue | Check system time, or temporarily disable SSL verification | | SSL certificate error | Proxy/Time issue | Check system time, or temporarily disable SSL verification |
| pip/npm download slow | Source is abroad | Change to domestic mirror source | | pip/npm download slow | Source abroad | Use domestic mirror source |
| git clone timeout | Network restrictions | Configure git proxy or use SSH | | git clone timeout | Network restrictions | Configure git proxy or use SSH |
### Terminal Proxy Configuration ### Terminal Proxy Configuration
```bash ```bash
# Temporary setting (effective in current terminal) # Temporary setting (effective for current terminal)
export http_proxy=http://127.0.0.1:7890 export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890 export https_proxy=http://127.0.0.1:7890
@ -166,14 +167,14 @@ git config --global https.proxy http://127.0.0.1:7890
<details open> <details open>
<summary><strong>📝 Code Related</strong></summary> <summary><strong>📝 Code Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Code file too large, AI cannot process | Exceeds context | Split files, only provide relevant parts to AI | | Code file too large, AI cannot process | Exceeds context | Split files, only provide relevant parts to AI |
| Code changes not taking effect | Cache/Not saved | Clear cache, confirm save, restart service | | Modified code not taking effect | Cache/Not saved | Clear cache, confirm save, restart service |
| Merge conflicts | Git conflicts | Let AI help resolve: paste conflict content | | Merge conflicts | Git conflict | Let AI help resolve: paste conflict content |
| Dependency version conflicts | Incompatible versions | Specify version numbers, or isolate with virtual environments | | Dependency version conflicts | Version incompatibility | Specify version number, or isolate with virtual environment |
| Chinese garbled characters | Encoding issue | Consistently use UTF-8, add `# -*- coding: utf-8 -*-` at file beginning | | Chinese garbled characters | Encoding issue | Unify to UTF-8, add `# -*- coding: utf-8 -*-` at file beginning |
| Hot update not taking effect | Watch issue | Check if file is within watch scope | | Hot update not taking effect | Listening issue | Check if file is within listening range |
</details> </details>
@ -182,12 +183,12 @@ git config --global https.proxy http://127.0.0.1:7890
<details open> <details open>
<summary><strong>🎯 Claude Code / Cursor Related</strong></summary> <summary><strong>🎯 Claude Code / Cursor Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Claude Code cannot connect | Network/Authentication | Check proxy, re-run `claude login` | | Claude Code cannot connect | Network/Authentication | Check proxy, re-`claude login` |
| Cursor completion is slow | Network latency | Check proxy configuration | | Cursor completion is slow | Network latency | Check proxy configuration |
| Quota exhausted | Limited free quota | Change account or upgrade to paid | | Quota used up | Limited free quota | Switch accounts or upgrade to paid |
| Rules file not taking effect | Path/Format error | Check `.cursorrules` or `CLAUDE.md` location | | Rule file not taking effect | Path/Format error | Check `.cursorrules` or `CLAUDE.md` location |
| AI cannot read project files | Workspace issue | Confirm opened in correct directory, check .gitignore | | AI cannot read project files | Workspace issue | Confirm opened in correct directory, check .gitignore |
| Generated code in wrong location | Cursor position | Place cursor at correct position before generating | | Generated code in wrong location | Cursor position | Place cursor at correct position before generating |
@ -198,11 +199,11 @@ git config --global https.proxy http://127.0.0.1:7890
<details open> <details open>
<summary><strong>🚀 Deployment Related</strong></summary> <summary><strong>🚀 Deployment Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Runs locally, fails on deployment | Environment differences | Check Node/Python versions, environment variables | | Runs locally, but fails to deploy | Environment differences | Check Node/Python versions, environment variables |
| Build timeout | Project too large | Optimize dependencies, increase build time limit | | Build timeout | Project too large | Optimize dependencies, increase build time limit |
| Environment variables not taking effect | Not configured | Set environment variables on the deployment platform | | Environment variables not taking effect | Not configured | Set environment variables on deployment platform |
| CORS cross-origin error | Backend not configured | Add CORS middleware | | CORS cross-origin error | Backend not configured | Add CORS middleware |
| Static files 404 | Path issue | Check build output directory configuration | | Static files 404 | Path issue | Check build output directory configuration |
| Insufficient memory | Free tier limitations | Optimize code or upgrade plan | | Insufficient memory | Free tier limitations | Optimize code or upgrade plan |
@ -214,12 +215,12 @@ git config --global https.proxy http://127.0.0.1:7890
<details open> <details open>
<summary><strong>🗄️ Database Related</strong></summary> <summary><strong>🗄️ Database Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Connection refused | Service not started | Start database service | | Connection refused | Service not started | Start database service |
| Authentication failed | Incorrect password | Check username/password, reset password | | Authentication failed | Incorrect password | Check username and password, reset password |
| Table does not exist | Not migrated | Run migration | | Table does not exist | Not migrated | Run migration |
| Data loss | Not persistent | Docker add volume, or use cloud database | | Data loss | Not persisted | Docker with volume, or use cloud database |
| Too many connections | Connections not closed | Use connection pool, close connections promptly | | Too many connections | Connections not closed | Use connection pool, close connections promptly |
</details> </details>
@ -229,7 +230,7 @@ git config --global https.proxy http://127.0.0.1:7890
<details open> <details open>
<summary><strong>🐳 Docker Related</strong></summary> <summary><strong>🐳 Docker Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Image pull failed | Network issue | Configure image accelerator | | Image pull failed | Network issue | Configure image accelerator |
| Container failed to start | Port conflict/Configuration error | Check logs `docker logs container_name` | | Container failed to start | Port conflict/Configuration error | Check logs `docker logs container_name` |
@ -241,18 +242,18 @@ git config --global https.proxy http://127.0.0.1:7890
--- ---
<details open> <details open>
<summary><strong>🧠 Large Model Usage Related</strong></summary> <summary><strong>🧠 Large Language Model Usage Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Token limit exceeded | Input too long | Simplify context, only provide essential information | | Token limit exceeded | Input too long | Refine context, only provide necessary information |
| Response truncated | Output token limit | Ask AI to output in segments, or say "continue" | | Reply truncated | Output token limit | Ask AI to output in segments, or say "continue" |
| Large differences in model results | Different model characteristics | Select model based on task: Claude for code, GPT for general use | | Significant differences in results between models | Different model characteristics | Choose model based on task: Claude for code, GPT for general purpose |
| Temperature parameter effect | Temperature setting | Use low temperature (0-0.3) for code generation, high for creativity | | Temperature parameter effect | Temperature setting | Use low temperature (0-0.3) for code generation, high for creativity |
| System prompt ignored | Prompt too long/conflicting | Simplify system prompt, put important parts first | | System prompt ignored | Prompt too long/conflicting | Simplify system prompt, put important parts first |
| JSON output format error | Model instability | Use JSON mode, or ask AI to only output code blocks | | JSON output format error | Model unstable | Use JSON mode, or ask AI to output only code blocks |
| Multi-turn conversation quality degrades | Context pollution | Periodically start new conversations, keep context clean | | Multi-turn conversation quality degrades | Context pollution | Regularly start new conversations, keep context clean |
| API call error 429 | Rate limit | Add delay and retry, or upgrade API plan | | API call returns 429 error | Rate limit | Add delayed retries, or upgrade API plan |
| Streaming output garbled | Encoding/Parsing issue | Check SSE parsing, ensure UTF-8 | | Streaming output garbled | Encoding/Parsing issue | Check SSE parsing, ensure UTF-8 |
</details> </details>
@ -262,14 +263,14 @@ git config --global https.proxy http://127.0.0.1:7890
<details open> <details open>
<summary><strong>🏗️ Software Architecture Related</strong></summary> <summary><strong>🏗️ Software Architecture Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Code becomes messy with changes | No architectural design | Draw architecture diagram first, then write code | | Code becomes messier | No architectural design | Draw architecture diagram first, then write code |
| Changing one place breaks many others | Tight coupling | Split modules, define clear interfaces | | Changing one place breaks others | Too tightly coupled | Split modules, define clear interfaces |
| Don't know where to put code | Confused directory structure | Refer to [General Project Architecture Template](../模板与资源/通用项目架构模板.md) | | Don't know where to put code | Directory structure messy | Refer to [General Project Architecture Template](../模板与资源/通用项目架构模板.md) |
| Too much duplicate code | Lack of abstraction | Extract common functions/components | | Too much duplicate code | No abstraction | Extract common functions/components |
| State management chaotic | Global state abuse | Use state management library, unidirectional data flow | | State management chaotic | Overuse of global state | Use state management libraries, one-way data flow |
| Configuration scattered | No unified management | Centralize into config files or environment variables | | Configuration scattered | No unified management | Centralize in config files or environment variables |
| Difficult to test | Too many dependencies | Dependency injection, mock external services | | Difficult to test | Too many dependencies | Dependency injection, mock external services |
</details> </details>
@ -279,23 +280,23 @@ git config --global https.proxy http://127.0.0.1:7890
<details open> <details open>
<summary><strong>🔄 Git Version Control Related</strong></summary> <summary><strong>🔄 Git Version Control Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Committed unintended files | .gitignore not configured | Add to .gitignore, `git rm --cached` | | Committed files that shouldn't be | .gitignore not configured | Add to .gitignore, `git rm --cached` |
| Committed sensitive information | Not checked | Use git-filter-branch to clean history, change key | | Committed sensitive information | Not checked | Use git-filter-branch to clean history, change key |
| Cannot resolve merge conflicts | Unfamiliar with Git | Use VS Code conflict resolution tool, or ask AI for help | | Don't know how to resolve merge conflicts | Unfamiliar with Git | Use VS Code conflict resolution tools, or ask AI for help |
| Commit message written incorrectly | Accidental | `git commit --amend` to modify | | Committed with wrong message | Mistake | `git commit --amend` to modify |
| Want to undo last commit | Committed wrongly | `git reset --soft HEAD~1` | | Want to undo last commit | Committed wrongly | `git reset --soft HEAD~1` |
| Too many messy branches | No standardization | Use Git Flow or trunk-based | | Too many messy branches | No standard | Use Git Flow or trunk-based |
| Push rejected | New commits on remote | `pull --rebase` first, then push | | Push rejected | New commits on remote | `pull --rebase` first, then push |
### Common Git Commands ### Common Git Commands
```bash ```bash
# Undo changes in working directory # Discard changes in working directory
git checkout -- filename git checkout -- filename
# Undo changes in staging area # Discard changes in staging area
git reset HEAD filename git reset HEAD filename
# Undo last commit (keep changes) # Undo last commit (keep changes)
@ -316,14 +317,14 @@ git stash pop
<details open> <details open>
<summary><strong>🧪 Testing Related</strong></summary> <summary><strong>🧪 Testing Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Don't know what to test | Lack of testing mindset | Test edge cases, exceptions, core logic | | Don't know what to test | Lack of testing mindset | Test edge cases, abnormal situations, core logic |
| Tests are too slow | Test granularity too large | Write more unit tests, fewer E2E | | Tests are too slow | Test granularity too large | Write more unit tests, fewer E2E |
| Tests are unstable | Depends on external services | Mock external dependencies | | Tests are unstable | Dependent on external services | Mock external dependencies |
| Tests pass but bugs appear in production | Incomplete coverage | Add edge case tests, check with coverage | | Tests pass but bugs appear online | Incomplete coverage | Add edge case tests, check with coverage |
| Changing code requires changing tests | Tests coupled to implementation | Test behavior, not implementation | | Changing code requires changing tests | Tests coupled to implementation | Test behavior, not implementation |
| AI generated tests are useless | Only tests happy path | Ask AI to supplement edge case and exception tests | | AI generated tests are useless | Only tests happy path | Ask AI to supplement edge case and abnormal tests |
</details> </details>
@ -332,14 +333,14 @@ git stash pop
<details open> <details open>
<summary><strong>⚡ Performance Related</strong></summary> <summary><strong>⚡ Performance Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Page loads slowly | Resources too large | Compression, lazy loading, CDN | | Page loading slow | Resources too large | Compression, lazy loading, CDN |
| API response slow | Queries not optimized | Add indexes, caching, pagination | | API response slow | Unoptimized queries | Add index, caching, pagination |
| Memory leak | Resources not cleaned up | Check event listeners, timers, closures | | Memory leak | Resources not cleaned up | Check event listeners, timers, closures |
| High CPU usage | Infinite loop/Redundant computation | Use profiler to locate hotspots | | High CPU usage | Infinite loop/Repetitive calculation | Use profiler to locate hot spots |
| Database queries slow | N+1 issue | Use JOIN or batch queries | | Slow database queries | N+1 problem | Use JOIN or batch queries |
| Frontend lagging | Too many re-renders | React.memo, useMemo, virtualized lists | | Frontend stuttering | Too many re-renders | React.memo, useMemo, virtual list |
</details> </details>
@ -348,14 +349,14 @@ git stash pop
<details open> <details open>
<summary><strong>🔐 Security Related</strong></summary> <summary><strong>🔐 Security Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| API Key leaked | Committed to Git | Use environment variables, add to .gitignore | | API Key leaked | Committed to Git | Use environment variables, add to .gitignore |
| SQL Injection | SQL concatenation | Use parameterized queries/ORM | | SQL injection | String concatenation for SQL | Use parameterized queries/ORM |
| XSS Attack | User input not escaped | Escape HTML, use CSP | | XSS attack | User input not escaped | Escape HTML, use CSP |
| CSRF Attack | No token verification | Add CSRF token | | CSRF attack | No token verification | Add CSRF token |
| Password stored in plaintext | Lack of security awareness | Use bcrypt or other hashing algorithms | | Passwords stored in plaintext | Lack of security awareness | Use bcrypt or other hashing algorithms |
| Sensitive information in logs | Printed unintended data | Anonymize, disable debug in production | | Sensitive information in logs | Printed what shouldn't be | Anonymize data, disable debug in production |
</details> </details>
@ -364,15 +365,15 @@ git stash pop
<details open> <details open>
<summary><strong>📱 Frontend Development Related</strong></summary> <summary><strong>📱 Frontend Development Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Styles not taking effect | Priority/Cache | Check selector priority, clear cache | | Styles not taking effect | Priority/Cache | Check selector priority, clear cache |
| Mobile adaptation issues | Not responsive | Use rem/vw, media queries | | Mobile adaptation issues | No responsive design | Use rem/vw, media queries |
| White screen | JS error | Check console, add error boundaries | | White screen | JS error | Check console, add error boundaries |
| State not synchronized | Asynchronous issues | Use useEffect dependencies, or state management library | | State not synchronized | Asynchronous issues | Use useEffect dependencies, or state management library |
| Component not updating | Reference not changed | Return new object/array, do not modify directly | | Component not updating | Reference not changed | Return new object/array, do not modify directly |
| Build size too large | Not optimized | On-demand import, code splitting, tree shaking | | Bundle size too large | No optimization | On-demand import, code splitting, tree shaking |
| Cross-origin issues | Browser security policy | Backend configure CORS, or use proxy | | Cross-origin issue | Browser security policy | Backend configure CORS, or use proxy |
</details> </details>
@ -381,14 +382,14 @@ git stash pop
<details open> <details open>
<summary><strong>🖥️ Backend Development Related</strong></summary> <summary><strong>🖥️ Backend Development Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| API returns slowly | Synchronous blocking | Use async, put time-consuming tasks in queue | | API response slow | Synchronous blocking | Use asynchronous, put time-consuming tasks in queue |
| Concurrency issues | Race conditions | Add locks, use transactions, optimistic locking | | Concurrency issues | Race conditions | Add locks, use transactions, optimistic locking |
| Service crashed undetected | No monitoring | Add health checks, alerts | | Service crashed without detection | No monitoring | Add health checks, alerts |
| Logs cannot find issues | Incomplete logs | Add request_id, structured logging | | Logs not helping to find issues | Incomplete logs | Add request_id, structured logging |
| Configure different environments | Hardcoding | Use environment variables to distinguish dev/prod | | Different environment configuration | Hardcoding | Use environment variables to distinguish dev/prod |
| OOM crash | Memory leak/Too much data | Pagination, streaming, check for leaks | | OOM crashes | Memory leak/Too much data | Paging, streaming, check for leaks |
</details> </details>
@ -397,12 +398,12 @@ git stash pop
<details open> <details open>
<summary><strong>🔌 API Design Related</strong></summary> <summary><strong>🔌 API Design Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| API naming chaotic | No standardization | Follow RESTful, use HTTP verbs for actions | | API naming chaotic | No standard | Follow RESTful, use HTTP methods as verbs |
| Return format inconsistent | No agreement | Unify response structure `{code, data, message}` | | Return format inconsistent | No agreement | Unify response structure `{code, data, message}` |
| Version upgrade difficult | No version control | Add version number to URL `/api/v1/` | | Version upgrade difficult | No version control | Add version number to URL `/api/v1/` |
| Documentation and implementation inconsistent | Manual maintenance | Use Swagger/OpenAPI for auto-generation | | Documentation and implementation inconsistent | Manual maintenance | Use Swagger/OpenAPI to auto-generate |
| Error messages unclear | Only returns 500 | Refine error codes, return useful information | | Error messages unclear | Only returns 500 | Refine error codes, return useful information |
| Pagination parameters inconsistent | Each written differently | Unify `page/size` or `offset/limit` | | Pagination parameters inconsistent | Each written differently | Unify `page/size` or `offset/limit` |
@ -413,13 +414,13 @@ git stash pop
<details open> <details open>
<summary><strong>📊 Data Processing Related</strong></summary> <summary><strong>📊 Data Processing Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Data format incorrect | Type conversion issues | Perform type validation and conversion | | Data format incorrect | Type conversion issue | Perform type validation and conversion properly |
| Timezone issues | Timezones not unified | Store UTC, convert to local time for display | | Timezone issues | Timezones not unified | Store in UTC, convert to local for display |
| Precision loss | Floating point issues | Use integers (cents) for monetary values, or Decimal | | Precision loss | Floating-point issues | Use integers for currency (cents), or Decimal |
| Large file processing OOM | Loaded all at once | Stream processing, chunked reading | | Large file processing OOM | Loaded all at once | Stream processing, chunked reading |
| Encoding issues | Not UTF-8 | Consistently use UTF-8, specify encoding when reading files | | Encoding issues | Not UTF-8 | Unify to UTF-8, specify encoding when reading files |
| Null value handling | null/undefined | Perform null checks, provide default values | | Null value handling | null/undefined | Perform null checks, provide default values |
</details> </details>
@ -429,22 +430,22 @@ git stash pop
<details open> <details open>
<summary><strong>🤝 Collaboration Related</strong></summary> <summary><strong>🤝 Collaboration Related</strong></summary>
| Issue | Reason | Solution | | Problem | Reason | Solution |
|:---|:---|:---| |:---|:---|:---|
| Code style inconsistent | No standardization | Use ESLint/Prettier/Black, unify configuration | | Code style inconsistent | No standard | Use ESLint/Prettier/Black, unify configuration |
| PR too large, difficult to review | Too many changes | Commit in small steps, one PR per feature | | PR too large, difficult to review | Too many changes | Small, incremental commits, one PR per feature |
| Documentation outdated | No one maintains | Update code and documentation together, CI checks | | Documentation outdated | No one maintains | Update code and documentation together, CI check |
| Don't know who is responsible | No owner | Use CODEOWNERS file | | Don't know who is responsible | No owner | Use CODEOWNERS file |
| Reinventing the wheel | Unaware of existing solutions | Establish internal component library/documentation | | Reinventing the wheel | Unaware of existing solutions | Establish internal component library/documentation |
</details> </details>
1. **Check error messages** - Copy the full error to AI 1. **Check error message** - Copy it completely to AI
2. **Minimum reproduction** - Find the simplest code that reproduces the issue 2. **Minimal reproduction** - Find the simplest code that reproduces the issue
3. **Bisection method** - Comment out half the code to narrow down the problem scope 3. **Bisection method** - Comment out half of the code, pinpoint the problem area
4. **Change environment** - Try different browsers/terminals/devices 4. **Change environment** - Try a different browser/terminal/device
5. **Restart magic** - Restart service/editor/computer 5. **Restart magic** - Restart service/editor/computer
6. **Delete and restart** - If the environment is messed up, delete and recreate the virtual environment 6. **Delete and restart** - If the environment is messy, delete and recreate the virtual environment
--- ---
@ -453,25 +454,26 @@ git stash pop
Still can't figure it out? Try this prompt: Still can't figure it out? Try this prompt:
``` ```
I've encountered an issue and have tried many methods without success. I encountered a problem and have tried many methods without success.
Error message: Error message:
[Paste full error] [Paste full error]
My environment: My environment:
- Operating system: - Operating System:
- Python/Node version: - Python/Node Version:
- Relevant dependency versions: - Relevant dependency versions:
I have tried: I have already tried:
1. xxx 1. xxx
2. xxx 2. xxx
Please help me analyze the possible causes and provide solutions. Please help me analyze possible causes and provide solutions.
``` ```
--- ---
## 📝 Contribution ## 📝 Contribution
Found a new pitfall? Welcome PR contributions! Found a new pitfall? Welcome to PR to supplement!
```

View File

@ -1,11 +1,12 @@
# General Project Architecture Template ```
# Generic Project Architecture Template
## 1⃣ Standard Structure for Python Web/API Projects ## 1⃣ Standard Structure for Python Web/API Projects
``` ```
project_name/ 项目名称/
├── README.md # Project README ├── README.md # Project description document
├── LICENSE # Open-source license ├── LICENSE # Open source license
├── requirements.txt # Dependency management (pip) ├── requirements.txt # Dependency management (pip)
├── pyproject.toml # Modern Python project configuration (recommended) ├── pyproject.toml # Modern Python project configuration (recommended)
├── setup.py # Package installation script (if packaged as a library) ├── setup.py # Package installation script (if packaged as a library)
@ -14,7 +15,7 @@ project_name/
├── .env.example # Example environment variables ├── .env.example # Example environment variables
├── CLAUDE.md # Claude persistent context ├── CLAUDE.md # Claude persistent context
├── AGENTS.md # Codex persistent context ├── AGENTS.md # Codex persistent context
├── Sublime-Text.txt # For requirements and notes, for self-reference, and CLI session recovery commands ^_^ ├── Sublime-Text.txt # For requirements and notes, for myself, and CLI session recovery commands ^_^
├── docs/ # Documentation directory ├── docs/ # Documentation directory
│ ├── api.md # API documentation │ ├── api.md # API documentation
@ -33,7 +34,7 @@ project_name/
│ ├── integration/ # Integration tests │ ├── integration/ # Integration tests
│ └── test_config.py # Configuration tests │ └── test_config.py # Configuration tests
├── src/ # Source code (recommended) ├── src/ # Source code (recommended approach)
│ ├── __init__.py │ ├── __init__.py
│ ├── main.py # Program entry point │ ├── main.py # Program entry point
│ ├── app.py # Flask/FastAPI application │ ├── app.py # Flask/FastAPI application
@ -58,7 +59,7 @@ project_name/
│ └── external/ # External services │ └── external/ # External services
│ ├── __init__.py │ ├── __init__.py
│ ├── clients/ # API clients │ ├── clients/ # API clients
│ └── integrations/ # Integration services │ └── integrations/ # Integrated services
├── logs/ # Log directory (not committed to Git) ├── logs/ # Log directory (not committed to Git)
│ ├── app.log │ ├── app.log
@ -70,14 +71,14 @@ project_name/
└── cache/ # Cache └── cache/ # Cache
``` ```
**Use Cases**: Flask/FastAPI Web applications, RESTful API services, Web backends **Usage Scenarios**: Flask/FastAPI Web applications, RESTful API services, Web backends
--- ---
## 2⃣ Standard Structure for Data Science/Quant Projects ## 2⃣ Standard Structure for Data Science/Quant Projects
``` ```
project_name/ 项目名称/
├── README.md ├── README.md
├── LICENSE ├── LICENSE
├── requirements.txt ├── requirements.txt
@ -86,7 +87,7 @@ project_name/
├── .env.example ├── .env.example
├── CLAUDE.md # Claude persistent context ├── CLAUDE.md # Claude persistent context
├── AGENTS.md # Codex persistent context ├── AGENTS.md # Codex persistent context
├── Sublime-Text.txt # For requirements and notes, for self-reference, and CLI session recovery commands ^_^ ├── Sublime-Text.txt # For requirements and notes, for myself, and CLI session recovery commands ^_^
├── docs/ # Documentation directory ├── docs/ # Documentation directory
│ ├── notebooks/ # Jupyter documentation │ ├── notebooks/ # Jupyter documentation
@ -99,7 +100,7 @@ project_name/
├── scripts/ # Script tools ├── scripts/ # Script tools
│ ├── train_model.py # Training script │ ├── train_model.py # Training script
│ ├── backtest.py # Backtest script │ ├── backtest.py # Backtesting script
│ ├── collect_data.py # Data collection │ ├── collect_data.py # Data collection
│ └── deploy_model.py # Model deployment │ └── deploy_model.py # Model deployment
@ -125,12 +126,12 @@ project_name/
│ ├── models/ # Model module │ ├── models/ # Model module
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── strategies/ # Trading strategies │ │ ├── strategies/ # Trading strategies
│ │ ├── backtest/ # Backtest engine │ │ ├── backtest/ # Backtesting engine
│ │ └── risk/ # Risk management │ │ └── risk/ # Risk management
│ │ │ │
│ ├── utils/ # Utility module │ ├── utils/ # Utility module
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── logging.py # Log configuration │ │ ├── logging.py # Logging configuration
│ │ ├── database.py # Database tools │ │ ├── database.py # Database tools
│ │ └── api_client.py # API client │ │ └── api_client.py # API client
│ │ │ │
@ -138,7 +139,7 @@ project_name/
│ ├── __init__.py │ ├── __init__.py
│ ├── config.py # Configuration management │ ├── config.py # Configuration management
│ ├── signals.py # Signal generation │ ├── signals.py # Signal generation
│ └── portfolio.py # Portfolio │ └── portfolio.py # Investment portfolio
├── data/ # Data directory (Git ignored) ├── data/ # Data directory (Git ignored)
│ ├── raw/ # Raw data │ ├── raw/ # Raw data
@ -155,14 +156,14 @@ project_name/
└── errors.log └── errors.log
``` ```
**Use Cases**: Quantitative trading, machine learning, data analysis, AI research **Usage Scenarios**: Quantitative trading, machine learning, data analysis, AI research
--- ---
## 3⃣ Monorepo (Multi-Project Repository) Standard Structure ## 3Standard Structure for Monorepo (Multi-Project Repository)
``` ```
project_name-monorepo/ 项目名称-monorepo/
├── README.md ├── README.md
├── LICENSE ├── LICENSE
├── .gitignore ├── .gitignore
@ -170,7 +171,7 @@ project_name-monorepo/
├── docker-compose.yml # Docker orchestration ├── docker-compose.yml # Docker orchestration
├── CLAUDE.md # Claude persistent context ├── CLAUDE.md # Claude persistent context
├── AGENTS.md # Codex persistent context ├── AGENTS.md # Codex persistent context
├── Sublime-Text.txt # This is a file, for requirements and notes, for self-reference, and CLI session recovery commands ^_^ ├── Sublime-Text.txt # This is a file for requirements and notes, for myself, and CLI session recovery commands ^_^
├── docs/ # Global documentation ├── docs/ # Global documentation
│ ├── architecture.md │ ├── architecture.md
@ -183,9 +184,9 @@ project_name-monorepo/
├── backups/ # Backup files ├── backups/ # Backup files
│ ├── archive/ # Old backup files │ ├── archive/ # Old backup files
│ └── gz/ # Gzip backup files │ └── gz/ # Compressed backup files
├── services/ # Microservice directory ├── services/ # Microservices directory
│ │ │ │
│ ├── user-service/ # User service │ ├── user-service/ # User service
│ │ ├── Dockerfile │ │ ├── Dockerfile
@ -209,35 +210,35 @@ project_name-monorepo/
│ ├── common/ # Common modules │ ├── common/ # Common modules
│ │ ├── utils/ │ │ ├── utils/
│ │ └── models/ │ │ └── models/
│ ├── external/ # Third-party libraries (immutable, call only) │ ├── external/ # Third-party libraries (not modifiable, only callable)
│ └── database/ # Database access library │ └── database/ # Database access library
├── infrastructure/ # Infrastructure ├── infrastructure/ # Infrastructure
│ ├── terraform/ # Cloud resource definition │ ├── terraform/ # Cloud resource definitions
│ ├── kubernetes/ # K8s configuration │ ├── kubernetes/ # K8s configuration
│ └── nginx/ # Reverse proxy configuration │ └── nginx/ # Reverse proxy configuration
└── monitoring/ # Monitoring system └── monitoring/ # Monitoring system
├── prometheus/ # Metrics collection ├── prometheus/ # Metric collection
├── grafana/ # Visualization ├── grafana/ # Visualization
└── alertmanager/ # Alerts └── alertmanager/ # Alerting
``` ```
**Use Cases**: Microservice architecture, large projects, team collaboration **Usage Scenarios**: Microservices architecture, large-scale projects, team collaboration
--- ---
## 4⃣ Standard Structure for Full-Stack Web Applications ## 4⃣ Standard Structure for Full-Stack Web Applications
``` ```
project_name/ 项目名称/
├── README.md ├── README.md
├── LICENSE ├── LICENSE
├── .gitignore ├── .gitignore
├── docker-compose.yml # Frontend and backend orchestration ├── docker-compose.yml # Frontend and backend orchestration together
├── CLAUDE.md # Claude persistent context ├── CLAUDE.md # Claude persistent context
├── AGENTS.md # Codex persistent context ├── AGENTS.md # Codex persistent context
├── Sublime-Text.txt # This is a file, for requirements and notes, for self-reference, and CLI session recovery commands ^_^ ├── Sublime-Text.txt # For requirements and notes, for myself, and CLI session recovery commands ^_^
├── frontend/ # Frontend directory ├── frontend/ # Frontend directory
│ ├── public/ # Static assets │ ├── public/ # Static assets
@ -259,7 +260,7 @@ project_name/
└── tests/ └── tests/
``` ```
**Use Cases**: Full-stack applications, SPA single-page applications, frontend/backend separated projects **Usage Scenarios**: Full-stack applications, SPA single-page applications, frontend/backend separation projects
--- ---
@ -268,12 +269,12 @@ project_name/
### 1. Separation of Concerns ### 1. Separation of Concerns
``` ```
API → Service → Data Access → Database API → Service → Data Access → Database
Clear at a glance, clear hierarchy Clear, hierarchical, and easy to understand
``` ```
### 2. Testability ### 2. Testability
``` ```
Each module is independently testable Each module can be tested independently
Dependencies can be mocked Dependencies can be mocked
``` ```
@ -285,12 +286,12 @@ Environment variables > Configuration files > Default values
### 4. Maintainability ### 4. Maintainability
``` ```
Self-documenting code Self-explanatory code
Reasonable file naming Reasonable file naming
Clear directory structure Clear directory structure
``` ```
### 5. Version Control Friendly (Git-Friendly) ### 5. Git-Friendly
``` ```
data/, logs/, models/ added to .gitignore data/, logs/, models/ added to .gitignore
Only commit source code and configuration examples Only commit source code and configuration examples
@ -300,16 +301,16 @@ Only commit source code and configuration examples
## 🎯 Best Practice Recommendations ## 🎯 Best Practice Recommendations
1. **Use `src/` directory**: Place source code in a dedicated `src` directory to avoid top-level clutter. 1. **Use the `src/` directory**: Place source code in a dedicated `src` directory to avoid cluttering the top-level directory.
2. **Relative imports**: Consistently use `from src.module import thing` for imports. 2. **Relative imports**: Consistently use import statements like `from src.module import thing`.
3. **Test coverage**: Ensure core business logic has unit and integration tests. 3. **Test coverage**: Ensure core business logic has unit and integration tests.
4. **Document first**: Write `README.md` for important modules. 4. **Documentation first**: Write `README.md` for important modules.
5. **Environment isolation**: Use virtualenv or conda to create isolated environments. 5. **Environment isolation**: Use virtualenv or conda to create independent environments.
6. **Explicit dependencies**: All dependencies written to `requirements.txt` and versions locked. 6. **Explicit dependencies**: All dependencies should be listed in `requirements.txt` with locked versions.
7. **Configuration management**: Use a combination of environment variables + configuration files. 7. **Configuration management**: Use a combination of environment variables and configuration files.
8. **Logging levels**: DEBUG, INFO, WARNING, ERROR, FATAL. 8. **Logging levels**: DEBUG, INFO, WARNING, ERROR, FATAL.
9. **Error handling**: Do not swallow exceptions; have a complete error chain. 9. **Error handling**: Do not suppress exceptions; ensure a complete error chain.
10. **Code style**: Use black for formatting, flake8 for checking. 10. **Code style**: Use black for formatting and flake8 for linting.
--- ---
@ -366,10 +367,10 @@ temp/
--- ---
## 📚 Technology Selection Reference ## 📚 Technology Stack Reference
| Scenario | Recommended Tech Stack | | Scenario | Recommended Technology Stack |
| :------- | :--------------------- | |----------|-----------------------------|
| Web API | FastAPI + Pydantic + SQLAlchemy | | Web API | FastAPI + Pydantic + SQLAlchemy |
| Data Processing | Pandas + NumPy + Polars | | Data Processing | Pandas + NumPy + Polars |
| Machine Learning | Scikit-learn + XGBoost + LightGBM | | Machine Learning | Scikit-learn + XGBoost + LightGBM |
@ -387,7 +388,7 @@ temp/
### requirements.txt ### requirements.txt
```txt ```txt
# Core dependencies # Core Dependencies
fastapi==0.104.1 fastapi==0.104.1
uvicorn[standard]==0.24.0 uvicorn[standard]==0.24.0
pydantic==2.5.0 pydantic==2.5.0
@ -415,10 +416,10 @@ mypy==1.7.1
### pyproject.toml (Recommended for modern Python projects) ### pyproject.toml (Recommended for modern Python projects)
```toml ```toml
[project] [project]
name = "Project Name" name = "项目名称"
version = "0.1.0" version = "0.1.0"
description = "Project Description" description = "项目描述"
authors = [{name = "Author", email = "email@example.com"}] authors = [{name = "作者", email = "邮箱 @example.com"}]
dependencies = [ dependencies = [
"fastapi>=0.104.0", "fastapi>=0.104.0",
"uvicorn[standard]>=0.24.0", "uvicorn[standard]>=0.24.0",
@ -439,51 +440,51 @@ build-backend = "setuptools.build_meta"
When starting a new project, ensure the following are completed: When starting a new project, ensure the following are completed:
- [ ] Create README.md, including project overview and usage instructions. - [ ] Create `README.md`, including project introduction and usage instructions.
- [ ] Create LICENSE file, clarifying the open-source license. - [ ] Create `LICENSE` file, clarifying the open-source license.
- [ ] Set up Python virtual environment (venv/conda). - [ ] Set up a Python virtual environment (venv/conda).
- [ ] Create requirements.txt and lock dependency versions. - [ ] Create `requirements.txt` and lock dependency versions.
- [ ] Create .gitignore, excluding sensitive and unnecessary files. - [ ] Create `.gitignore`, excluding sensitive and unnecessary files.
- [ ] Create .env.example, explaining required environment variables. - [ ] Create `.env.example`, explaining required environment variables.
- [ ] Design directory structure, adhering to the principle of separation of concerns. - [ ] Design the directory structure, adhering to the principle of separation of concerns.
- [ ] Create basic configuration files. - [ ] Create basic configuration files.
- [ ] Set up code formatter (black). - [ ] Set up a code formatter (black).
- [ ] Set up code checker (flake8/ruff). - [ ] Set up a code linter (flake8/ruff).
- [ ] Write the first test case. - [ ] Write the first test case.
- [ ] Set up Git repository and commit initial code. - [ ] Set up a Git repository and commit initial code.
- [ ] Create CHANGELOG.md, recording version changes. - [ ] Create `CHANGELOG.md` to record version changes.
--- ---
In **programming / software development**, **Project Architecture / Software Architecture** refers to: In **programming / software development**, **project architecture (Project Architecture / Software Architecture)** refers to:
> **The design solution for how a project is broken down, organized, communicated, and evolved at the "overall level"** > **A design plan for how a project is broken down, organized, communicated, and evolved at the "overall level"**
> —it determines how code is layered, how modules are divided, how data flows, and how the system expands and is maintained. > — It determines how code is layered, how modules are divided, how data flows, and how the system expands and is maintained.
--- ---
## One-Sentence Understanding ## One-sentence understanding
**Project Architecture = Deciding "where the code goes, how modules connect, and how responsibilities are divided" before writing any specific business code.** **Project Architecture = Before writing specific business code, first decide "where the code goes, how modules connect, and how responsibilities are divided."**
--- ---
## I. What Problems Does Project Architecture Primarily Solve? ## I. What problems does project architecture mainly solve?
Project architecture is not about "coding skills," but about solving these **higher-level problems**: Project architecture is not about "coding tricks," but about solving these **higher-level problems**:
* 📦 How to organize code to avoid chaos? * 📦 How to organize code so it doesn't get messy?
* 🔁 How do modules communicate? * 🔁 How do modules communicate with each other?
* 🧱 Which parts can be modified independently without affecting the whole? * 🧱 Which parts can be modified independently without affecting the whole?
* 🚀 How will the project be extended in the future? * 🚀 How will the project expand in the future?
* 🧪 How to facilitate testing, debugging, and deployment? * 🧪 How to facilitate testing, debugging, and deployment?
* 👥 How to collaborate without stepping on each other's code? * 👥 How can multiple people collaborate without stepping on each other's code?
--- ---
## II. What Does Project Architecture Generally Include? ## II. What does project architecture generally include?
### 1⃣ Directory Structure (Most Intuitive) ### 1⃣ Directory Structure (Most intuitive)
```text ```text
project/ project/
@ -498,7 +499,7 @@ project/
└── README.md └── README.md
``` ```
👉 Determines **"where different types of code are placed"**. 👉 Determines **"where different types of code are placed"**
--- ---
@ -518,8 +519,8 @@ Database / External Systems
**Rules:** **Rules:**
* Upper layers can call lower layers. * Upper layers can call lower layers
* Lower layers cannot depend on upper layers. * Lower layers cannot depend on upper layers in reverse
--- ---
@ -537,8 +538,8 @@ For example, a trading system:
👉 Each module: 👉 Each module:
* Does only one type of thing. * Does only one type of thing
* Aims for low coupling, high cohesion. * Strives for low coupling, high cohesion
--- ---
@ -547,7 +548,7 @@ For example, a trading system:
* Where does the data come from? * Where does the data come from?
* Who is responsible for processing? * Who is responsible for processing?
* Who is responsible for storage? * Who is responsible for storage?
* Who is responsible for external output? * Who is responsible for output?
For example: For example:
@ -557,17 +558,17 @@ WebSocket → Data Cleaning → Indicator Calculation → AI Scoring → SQLite
--- ---
### 5⃣ Technology Selection (Part of Architecture) ### 5⃣ Technology Stack Selection (Part of architecture)
* Programming languages (Python / Java / Go) * Programming language (Python / Java / Go)
* Frameworks (FastAPI / Spring / Django) * Framework (FastAPI / Spring / Django)
* Communication methods (HTTP / WebSocket / MQ) * Communication method (HTTP / WebSocket / MQ)
* Storage (SQLite / Redis / PostgreSQL) * Storage (SQLite / Redis / PostgreSQL)
* Deployment (Local / Docker / Cloud) * Deployment (Local / Docker / Cloud)
--- ---
## III. Common Project Architecture Types (Essential for Beginners) ## III. Common Project Architecture Types (Beginner must-know)
### 1⃣ Monolithic Architecture ### 1⃣ Monolithic Architecture
@ -592,7 +593,7 @@ One project, one process
--- ---
### 2⃣ Layered Architecture (Most Common) ### 2⃣ Layered Architecture (Most common)
```text ```text
Controller → Service → Repository Controller → Service → Repository
@ -616,11 +617,11 @@ core + plugins
* Pluggable systems * Pluggable systems
* Strategy / indicator systems * Strategy / indicator systems
👉 **Very suitable for quant, AI analysis you are doing.** 👉 **Very suitable for quant and AI analysis that you are doing**
--- ---
### 4⃣ Microservice Architecture (Advanced) ### 4⃣ Microservices Architecture (Advanced)
```text ```text
Each service is an independent process + API communication Each service is an independent process + API communication
@ -632,13 +633,13 @@ Each service is an independent process + API communication
* High concurrency * High concurrency
* Long-term evolution * Long-term evolution
❌ **Not recommended for beginners to start with.** ❌ **Not recommended for beginners to start with**
--- ---
## IV. Understanding with a "Real Example" (Close to what you are doing now) ## IV. Understand with a "Real Example" (Closer to what you are doing)
Suppose you are building a **Binance Futures AI Analysis System**: Suppose you are building an **AI analysis system for Binance perpetual contracts**:
```text ```text
backend/ backend/
@ -657,39 +658,38 @@ backend/
This is **project architecture design**: This is **project architecture design**:
* Each folder is responsible for one thing. * Each folder is responsible for one thing
* Replaceable, testable. * Replaceable, testable
* Later, if you want to connect a Telegram Bot / Web frontend, you don't need to rewrite the core. * No need to rewrite core logic if you want to integrate Telegram Bot / Web frontend later
--- ---
## V. Common Misconceptions for Beginners ⚠️ ## V. Common Mistakes for Beginners ⚠️
❌ Starting with microservices ❌ Starting with microservices
❌ All code in one file ❌ All code written in one file
Architecture pursuing "seniority" rather than "maintainability" Pursuing "advanced" architecture instead of "maintainable" architecture
Starting to write code without clearly thinking about data flow Writing code without a clear understanding of data flow
--- ---
## VI. Suggested Learning Path (Very Important) ## VI. Learning Path Recommendations (Very Important)
If you are learning CS now, this order is highly recommended: Since you are studying CS, this order is highly recommended:
1. **First write runnable projects (imperfect).** 1. **First build a runnable project (not perfect)**
2. **Code becomes messy → then learn architecture.** 2. **When code starts getting messy → then learn architecture**
3. Learn: 3. Learn:
* Module partitioning
* Module decomposition
* Layering * Layering
* Dependency direction * Dependency direction
4. Then learn: 4. Then learn:
* Design patterns * Design patterns
* Microservices / message queues * Microservices / Message queues
--- ---
**Version**: 1.0 **Version**: 1.0
**Update Date**: 2025-11-24 **Update Date**: 2025-11-24
**Maintained by**: CLAUDE, CODEX, KIMI **Maintainers**: CLAUDE, CODEX, KIMI
```

View File

@ -1,6 +1,6 @@
# 🧬 Glue Coding # 🧬 Glue Coding
> **The holy grail and silver bullet of software engineering it's finally here.** > **The holy grail and silver bullet of software engineering - finally here.**
--- ---
@ -10,11 +10,11 @@
It might perfectly solve the three fatal flaws of Vibe Coding: It might perfectly solve the three fatal flaws of Vibe Coding:
| Pain Points of Traditional Vibe Coding | Glue Coding's Solution | | Traditional Vibe Coding Pain Points | Glue Coding Solution |
|:---|:---| |:---|:---|
| 🎭 **AI Hallucinations** - Generating non-existent APIs, incorrect logic | ✅ **Zero Hallucinations** - Only using validated, mature code | | 🎭 **AI Hallucinations** - Generates non-existent APIs, incorrect logic | ✅ **Zero Hallucinations** - Uses only validated, mature code |
| 🧩 **Complexity Explosion** - The larger the project, the more out of control it becomes | ✅ **Zero Complexity** - Every module is a time-tested wheel | | 🧩 **Complexity Explosion** - The larger the project, the more out of control | ✅ **Zero Complexity** - Each module is a battle-tested wheel |
| 🎓 **High Barrier to Entry** - Requires deep programming skills to master AI | ✅ **Barrier Disappears** - You only need to describe "how to connect" | | 🎓 **High Barrier** - Requires deep programming skills to master AI | ✅ **No Barrier** - You only need to describe "how to connect" |
--- ---
@ -30,13 +30,13 @@ Glue Coding: AI connects code, humans review connections
**A fundamental shift from "generation" to "connection":** **A fundamental shift from "generation" to "connection":**
- ❌ No longer letting AI generate code from scratch (the source of hallucinations) - ❌ No longer letting AI generate code from scratch (source of hallucinations)
- ❌ No longer reinventing the wheel (the source of complexity) - ❌ No longer reinventing the wheel (source of complexity)
- ❌ No longer requiring you to understand every line of code (the source of high barriers) - ❌ No longer requiring you to understand every line of code (source of high barrier)
- ✅ Only reusing mature, production-validated open-source projects - ✅ Only reusing mature, production-validated open-source projects
- ✅ AI's sole responsibility: understanding your intent and connecting modules - ✅ AI's sole responsibility: understand your intent, connect modules
- ✅ Your sole responsibility: clearly describing "what is the input, what is the desired output" - ✅ Your sole responsibility: clearly describe "what is the input, what is the desired output"
--- ---
@ -44,7 +44,7 @@ Glue Coding: AI connects code, humans review connections
``` ```
┌─────────────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────────┐
│ Your Business Needs │ Your Business Needs │
└─────────────────────────────────────────────────────────┘ └─────────────────────────────────────────────────────────┘
@ -59,71 +59,71 @@ Glue Coding: AI connects code, humans review connections
▼ ▼ ▼ ▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Mature Module A │ │ Mature Module B │ │ Mature Module C │ │ Mature Module A │ │ Mature Module B │ │ Mature Module C │
│ (100K+ ⭐) │ │ (Production Validated) │ │ (Official SDK) │ │ (100K+ ⭐) │ │ (Production-Validated) │ │ (Official SDK) │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
``` ```
**Entity**: Mature open-source projects, official SDKs, time-tested libraries **Entity**: Mature open-source projects, official SDKs, battle-tested libraries
**Link**: AI-generated glue code, responsible for data flow and interface adaptation **Link**: AI-generated glue code, responsible for data flow and interface adaptation
**Function**: Your described business objective **Function**: Your described business goal
--- ---
## 🎯 Why is this the Silver Bullet? ## 🎯 Why is this a Silver Bullet?
### 1. Hallucination Problem → Completely Disappears ### 1. Hallucination Issue → Completely Disappears
AI no longer needs to "invent" anything. It only needs to: AI no longer needs to "invent" anything. It only needs to:
- Read Module A's documentation - Read Module A's documentation
- Read Module B's documentation - Read Module B's documentation
- Write the data transformation from A to B - Write the data transformation from A B
**This is what AI excels at, and what is least prone to errors.** **This is what AI excels at, and what is least prone to errors.**
### 2. Complexity Problem → Transferred to the Community ### 2. Complexity Issue → Transferred to the Community
Behind each module are: Behind each module are:
- Thousands of Issue discussions - Discussions from thousands of Issues
- Hundreds of contributors' wisdom - Wisdom from hundreds of contributors
- Years of production environment refinement - Years of production environment refinement
**You are not managing complexity, you are standing on the shoulders of giants.** **You are not managing complexity; you are standing on the shoulders of giants.**
### 3. Barrier to Entry Problem → Reduced to a Minimum ### 3. Barrier Issue → Reduced to a Minimum
You don't need to understand: You don't need to understand:
- Underlying implementation principles - Underlying implementation principles
- Best practice details - Best practice details
- Edge case handling - Edge case handling
You just need to speak human language: You only need to speak plain language:
> "I want to process Telegram messages with GPT and save them to PostgreSQL" > "I want to take messages from Telegram, process them with GPT, and store them in PostgreSQL"
**AI will help you find the most suitable wheels and then glue them together.** **AI will help you find the most suitable wheels and glue them together.**
--- ---
## 📋 Practical Workflow ## 📋 Practice Flow
``` ```
1. Clarify Goal 1. Define the Goal
└─→ "I want to implement XXX function" └─→ "I want to implement XXX functionality"
2. Find Wheels 2. Find the Wheels
└─→ "Are there any mature libraries/projects that have done something similar?" └─→ "Are there any mature libraries/projects that have done something similar?"
└─→ Let AI help you search, evaluate, and recommend └─→ Let AI help you search, evaluate, and recommend
3. Understand Interfaces 3. Understand the Interfaces
└─→ Feed the official documentation to AI └─→ Feed the official documentation to AI
└─→ AI summarizes: what is the input, what is the output └─→ AI summarizes: what is the input, what is the output
4. Describe Connection 4. Describe the Connection
└─→ "The output of A should become the input of B" └─→ "The output of A should become the input of B"
└─→ AI generates glue code └─→ AI generates glue code
5. Verify Run 5. Validate and Run
└─→ Runs successfully → Done └─→ Runs successfully → Done
└─→ Error → Give the error to AI, continue gluing └─→ Errors → Give the errors to AI, continue gluing
``` ```
--- ---
@ -132,9 +132,9 @@ You just need to speak human language:
### Case: Polymarket Data Analysis Bot ### Case: Polymarket Data Analysis Bot
**Requirement**: Real-time acquisition of Polymarket data, analysis, and pushing to Telegram **Requirement**: Real-time acquisition of Polymarket data, analysis, and push to Telegram
**Traditional Approach**: Write a crawler from scratch, write analysis logic, write a Bot → 3000 lines of code, 2 weeks **Traditional Approach**: Write a crawler, analysis logic, and bot from scratch → 3000 lines of code, 2 weeks
**Glue Approach**: **Glue Approach**:
``` ```
@ -150,21 +150,21 @@ Development Time: 2 hours
## 📚 Further Reading ## 📚 Further Reading
- [语言层要素](./语言层要素.md) - 8 Levels of Understanding 100% Code - [Language Layer Elements](./语言层要素.md) - 8 levels to master to understand 100% of the code
- [胶水开发提示词](../../prompts/coding_prompts/胶水开发.md) - [Glue Development Prompts](../../prompts/coding_prompts/胶水开发.md)
- [项目实战:polymarket-dev](../项目实战经验/polymarket-dev/) - [Project Practice: polymarket-dev](../项目实战经验/polymarket-dev/)
--- ---
## 🎖️ Summary ## 🎖️ Summary
> **If you can copy, don't write; if you can connect, don't build; if you can reuse, don't originate.** > **If you can copy, don't write. If you can connect, don't build. If you can reuse, don't originate.**
Glue Coding is the ultimate evolution of Vibe Coding. Glue Coding is the ultimate evolution of Vibe Coding.
It's not laziness, but **the highest manifestation of engineering wisdom** It's not laziness; it's the **highest embodiment of engineering wisdom**
Using the least amount of original code to leverage the greatest productivity. Leveraging maximum productivity with minimal original code.
**This is the silver bullet software engineering has been waiting for for 50 years.** **This is the silver bullet software engineering has been waiting for for 50 years.**
@ -176,11 +176,11 @@ Using the least amount of original code to leverage the greatest productivity.
## **1. Definition of Glue Coding** ## **1. Definition of Glue Coding**
**Glue coding** is a new software construction method, whose core idea is: **Glue Coding** is a new software construction approach, with its core philosophy being:
> **Almost entirely reusing mature open-source components, combining them into a complete system with a minimal amount of "glue code".** > **Almost entirely reusing mature open-source components, combining them into a complete system with minimal "glue code"**
It emphasizes "connection" rather than "creation", especially efficient in the AI era. It emphasizes "connecting" rather than "creating," and is especially efficient in the AI era.
## **2. Background** ## **2. Background**
@ -189,54 +189,54 @@ Traditional software engineering often requires developers to:
* Design architecture * Design architecture
* Write logic themselves * Write logic themselves
* Manually handle various details * Manually handle various details
* Reinvent the wheel * Reinvent the wheel repeatedly
This leads to high development costs, long cycles, and low success rates. This leads to high development costs, long cycles, and low success rates.
However, the current ecosystem has fundamentally changed: However, the current ecosystem has fundamentally changed:
* Thousands of mature open-source libraries on GitHub * There are countless mature open-source libraries on GitHub
* Frameworks covering various scenarios (Web, AI, Distributed, Model Inference...) * Frameworks cover various scenarios (Web, AI, distributed, model inference…)
* GPT / Grok can help search, analyze, and combine these projects * GPT / Grok can help search, analyze, and combine these projects
In this environment, writing code from scratch is no longer the most efficient way. In this environment, writing code from scratch is no longer the most efficient way.
Thus, "glue coding" has emerged as a new paradigm. Thus, "Glue Coding" has emerged as a new paradigm.
## **3. Core Principles of Glue Coding** ## **3. Core Principles of Glue Coding**
### **3.1 Don't write what can be avoided, write as little as possible** ### **3.1 Don't write what can be avoided, write as little as possible**
Any functionality with a mature existing implementation should not be reinvented. Any functionality with an existing mature implementation should not be reinvented.
### **3.2 Copy-paste whenever possible** ### **3.2 Copy-paste whenever possible**
Directly copying and using community-validated code is a normal engineering process, not laziness. Directly copying and using community-validated code is a normal engineering process, not laziness.
### **3.3 Stand on the shoulders of giants, don't try to be a giant** ### **3.3 Stand on the shoulders of giants, rather than trying to become one**
Utilize existing frameworks instead of trying to write a "better wheel" yourself. Utilize existing frameworks instead of trying to write a "better wheel" yourself.
### **3.4 Do not modify original repository code** ### **3.4 Do not modify the original repository code**
All open-source libraries should ideally remain immutable, used as black boxes. All open-source libraries should ideally remain immutable and be used as black boxes.
### **3.5 The less custom code, the better** ### **3.5 Minimize custom code**
Your written code only serves to: The code you write should only be responsible for:
* Combine * Combination
* Call * Invocation
* Encapsulate * Encapsulation
* Adapt * Adaptation
Which is the so-called **glue layer**. This is what is called the **glue layer**.
## **4. Standard Workflow of Glue Coding** ## **4. Standard Process of Glue Coding**
### **4.1 Clarify Requirements** ### **4.1 Clarify Requirements**
Break down the system's functionality into individual requirements. Break down the system's desired functionalities into individual requirements.
### **4.2 Use GPT/Grok to Deconstruct Requirements** ### **4.2 Use GPT/Grok to Deconstruct Requirements**
@ -244,20 +244,20 @@ Let AI refine requirements into reusable modules, capabilities, and correspondin
### **4.3 Search for Existing Open-Source Implementations** ### **4.3 Search for Existing Open-Source Implementations**
Leverage GPT's internet capabilities (e.g., Grok): Utilize GPT's web browsing capabilities (e.g., Grok):
* Search for corresponding GitHub repositories for each sub-requirement. * Search for corresponding GitHub repositories for each sub-requirement
* Check for reusable components. * Check for existing reusable components
* Compare quality, implementation methods, licenses, etc. * Compare quality, implementation methods, licenses, etc.
#### 🔍 Using GitHub Topics to Find the Right Wheels #### 🔍 Use GitHub Topics to Precisely Find Wheels
**Method**: Ask AI to find the GitHub Topic for your requirement, then browse popular repos under that topic. **Method**: Let AI help you find GitHub Topics corresponding to your needs, then browse popular repositories under that topic.
**Example Prompt**: **Example Prompt**:
``` ```
I need to implement [your requirement], please help me: I need to implement [Your Requirement]. Please help me:
1. Analyze what technical areas this requirement might involve 1. Analyze which technical fields this requirement might involve
2. Recommend corresponding GitHub Topics keywords 2. Recommend corresponding GitHub Topics keywords
3. Provide GitHub Topics links (format: https://github.com/topics/xxx) 3. Provide GitHub Topics links (format: https://github.com/topics/xxx)
``` ```
@ -269,20 +269,20 @@ I need to implement [your requirement], please help me:
| Data Analysis | [data-analysis](https://github.com/topics/data-analysis) | | Data Analysis | [data-analysis](https://github.com/topics/data-analysis) |
| AI Agent | [ai-agent](https://github.com/topics/ai-agent) | | AI Agent | [ai-agent](https://github.com/topics/ai-agent) |
| CLI Tool | [cli](https://github.com/topics/cli) | | CLI Tool | [cli](https://github.com/topics/cli) |
| Web Scraping | [web-scraping](https://github.com/topics/web-scraping) | | Web Scraper | [web-scraping](https://github.com/topics/web-scraping) |
**Advanced Tips**: **Advanced Tips**:
- [GitHub Topics Homepage](https://github.com/topics) - Browse all topics - [GitHub Topics Homepage](https://github.com/topics) - Browse all topics
- [GitHub Trending](https://github.com/trending) - Discover hot new projects - [GitHub Trending](https://github.com/trending) - Discover popular new projects
- Combine multiple Topics: `https://github.com/topics/python?q=telegram` - Combine multiple Topic filters: `https://github.com/topics/python?q=telegram`
### **4.4 Download and Organize Repositories** ### **4.4 Download and Organize Repositories**
Pull the selected repositories locally and organize them by category. Pull the selected repositories locally and organize them by category.
### **4.5 Organize According to Architectural System** ### **4.5 Organize by Architectural System**
Place these repositories into the project structure, for example: Place these repositories within the project structure, for example:
``` ```
/services /services
@ -291,14 +291,14 @@ Place these repositories into the project structure, for example:
/glue /glue
``` ```
And emphasize: **Open-source repositories are third-party dependencies and must never be modified.** And emphasize: **Open-source repositories, as third-party dependencies, must absolutely not be modified.**
### **4.6 Write Glue Layer Code** ### **4.6 Write Glue Layer Code**
The role of glue code includes: The role of glue code includes:
* Encapsulating interfaces * Encapsulating interfaces
* Unifying input/output * Unifying input and output
* Connecting different components * Connecting different components
* Implementing minimal business logic * Implementing minimal business logic
@ -308,7 +308,7 @@ The final system is composed of multiple mature modules.
### **5.1 Extremely High Success Rate** ### **5.1 Extremely High Success Rate**
Because it uses community-validated mature code. Because it uses community-validated, mature code.
### **5.2 Extremely Fast Development Speed** ### **5.2 Extremely Fast Development Speed**
@ -316,9 +316,9 @@ A large amount of functionality can be directly reused.
### **5.3 Reduced Costs** ### **5.3 Reduced Costs**
Time cost, maintenance cost, and learning cost are all significantly reduced. Time costs, maintenance costs, and learning costs are significantly reduced.
### **5.4 More Stable System** ### **5.4 More Stable Systems**
Relies on mature frameworks rather than individual implementations. Relies on mature frameworks rather than individual implementations.
@ -332,31 +332,31 @@ GPT can assist in searching, deconstructing, and integrating, making it a natura
## **6. Glue Coding vs. Traditional Development** ## **6. Glue Coding vs. Traditional Development**
| Project | Traditional Development | Glue Coding | | Project | Traditional Development | Glue Coding |
| ----------- | ------------------------ | ------------- | | ------ | ----- | ------ |
| Feature Implementation | Write yourself | Reuse open-source | | Feature Implementation | Write yourself | Reuse open-source |
| Workload | Large | Much smaller | | Workload | Large | Much smaller |
| Success Rate | Uncertain | High | | Success Rate | Uncertain | High |
| Speed | Slow | Extremely fast | | Speed | Slow | Extremely fast |
| Error Rate | Prone to pitfalls | Uses mature solutions | | Error Rate | Prone to pitfalls | Uses mature solutions |
| Focus | "Building wheels" | "Combining wheels" | | Focus | "Building wheels" | "Combining wheels" |
## **7. Typical Application Scenarios for Glue Coding** ## **7. Typical Application Scenarios for Glue Coding**
* Rapid prototype development * Rapid prototype development
* Small teams building large systems * Small teams building large systems
* AI application/model inference platforms * AI applications/model inference platforms
* Data processing pipelines * Data processing pipelines
* Internal tool development * Internal tool development
* System Integration * System Integration
## **8. Future: Glue Engineering will become the new mainstream programming method** ## **8. Future: Glue Engineering will Become the New Mainstream Programming Paradigm**
As AI capabilities continue to strengthen, future developers will no longer need to write a lot of code themselves, but rather: As AI capabilities continue to strengthen, future developers will no longer need to write large amounts of code themselves, but rather:
* Find wheels * Find wheels
* Combine wheels * Combine wheels
* Intelligently connect components * Intelligently connect components
* Build complex systems at extremely low cost * Build complex systems at extremely low cost
Glue coding will become the new standard for software productivity. Glue Coding will become the new standard for software productivity.

View File

@ -1,8 +1,8 @@
# To understand 100% of the code, you must master the complete list of "language-level elements" # To understand 100% of the code, you must master all the "language layer elements" checklist
--- ---
# I. First, correct a key misconception # I. First, correct a crucial misconception
❌ Misconception: ❌ Misconception:
@ -10,17 +10,17 @@
✅ Truth: ✅ Truth:
> Don't understand code = **Don't understand a certain layer of its model** > Don't understand code = **Don't understand a certain layer of model**
--- ---
# II. Understanding 100% of the code = Mastering 8 Levels # II. Understanding 100% of the code = Mastering 8 levels
--- ---
## 🧠 L1: Basic Control Syntax (Lowest Threshold) ## 🧠 L1: Basic Control Syntax (Lowest Threshold)
This layer you already know: This is the layer you already know:
```text ```text
Variables Variables
@ -38,14 +38,14 @@ Functions / return
You must understand: You must understand:
```text ```text
Value vs Reference Value vs. Reference
Stack vs Heap Stack vs. Heap
Copy vs Share Copy vs. Share
Pointer / Reference Pointer / Reference
Mutable / Immutable Mutable / Immutable
``` ```
Example you need to "instantly understand": Example you should "instantly understand":
```c ```c
int *p = &a; int *p = &a;
@ -55,23 +55,23 @@ int *p = &a;
a = b a = b
``` ```
👉 This is the **root cause of the differences in C / C++ / Rust / Python** 👉 This is the **root cause of the difference between C / C++ / Rust / Python**
--- ---
## 🧠 L3: Type System (Major Part) ## 🧠 L3: Type System (Major Part)
You need to know: You need to understand:
```text ```text
Static Typing / Dynamic Typing Static Type / Dynamic Type
Type Inference Type Inference
Generics / Templates Generics / Templates
Type Constraints Type Constraints
Null / Option Null / Option
``` ```
For example, you need to see at a glance: For example, you should be able to tell at a glance:
```rust ```rust
fn foo<T: Copy>(x: T) -> Option<T> fn foo<T: Copy>(x: T) -> Option<T>
@ -79,14 +79,14 @@ fn foo<T: Copy>(x: T) -> Option<T>
--- ---
## 🧠 L4: Execution Model (Where 99% of Newcomers Get Stuck) ## 🧠 L4: Execution Model (99% of Newcomers Get Stuck)
You must understand: You must understand:
```text ```text
Synchronous vs Asynchronous Synchronous vs. Asynchronous
Blocking vs Non-blocking Blocking vs. Non-blocking
Threads vs Coroutines Thread vs. Coroutine
Event Loop Event Loop
Memory Visibility Memory Visibility
``` ```
@ -97,14 +97,14 @@ Example:
await fetch() await fetch()
``` ```
You need to know **when it executes and who is waiting for whom**. You need to know **when it executes, and who is waiting for whom**.
--- ---
## 🧠 L5: Error Handling and Boundary Syntax ## 🧠 L5: Error Handling and Boundary Syntax
```text ```text
Exceptions vs Return Values Exceptions vs. Return Values
panic / throw panic / throw
RAII RAII
defer / finally defer / finally
@ -116,13 +116,13 @@ You need to know:
defer f() defer f()
``` ```
**When it executes, and if it's guaranteed to execute**. **When it executes, and if it always executes**.
--- ---
## 🧠 L6: Meta-Syntax (Making Code "Look Less Like Code") ## 🧠 L6: Meta-syntax (Making code "look unlike code")
This is the root cause why many "don't understand": This is the root cause of many people "not understanding" code:
```text ```text
Macros Macros
@ -139,11 +139,11 @@ Example:
def f(): ... def f(): ...
``` ```
👉 You need to know **what code it's rewriting** 👉 You need to know **what code it is rewriting**
--- ---
## 🧠 L7: Language Paradigms (Determines Thinking) ## 🧠 L7: Language Paradigm (Determines thought process)
```text ```text
Object-Oriented (OOP) Object-Oriented (OOP)
@ -193,23 +193,23 @@ Syntax
+ Domain Knowledge + Domain Knowledge
``` ```
❗**Syntax accounts for less than 30%** ❗**Syntax only accounts for less than 30%**
--- ---
# IV. Where will you get stuck? (Realistic Assessment) # IV. Where will you get stuck? (Realistic judgment)
| Symptom of being stuck | Actual missing | | Stuck Manifestation | Actual Missing |
|:---|:---| | ----------------- | -------------- |
| "Can't understand this line of code" | L2 / L3 | | "I don't understand this line of code" | L2 / L3 |
| "Why is the result like this?" | L4 | | "Why is the result like this?" | L4 |
| "Where did the function go?" | L6 | | "Where did the function go?" | L6 |
| "The style is completely different" | L7 | | "The style is completely different" | L7 |
| "This isn't programming, is it?" | L8 | | "Is this not programming?" | L8 |
--- ---
# V. Your True Engineering-Level Goal # V. Give yourself a truly engineering-grade goal
🎯 **Not "memorizing syntax"** 🎯 **Not "memorizing syntax"**
🎯 But being able to: 🎯 But being able to:
@ -220,21 +220,21 @@ This is the **true meaning of 100%**.
--- ---
# VI. Engineering Addendum: L9L12 (From "Understanding" to "Architecture") # VI. Engineering-grade Addition: L9L12 (From "Understanding" to "Architecture")
> 🔥 Upgrade "understanding" to being able to **predict**, **refactor**, and **migrate** code > 🔥 Upgrade "able to understand" to "able to **predict**, **refactor**, **migrate** code"
--- ---
## 🧠 L9: Time Dimension Model (90% of people completely unaware) ## 🧠 L9: Time Dimension Model (90% of people are completely unaware)
You not only need to know **how** the code runs, but also: You not only need to know **how code runs**, but also:
```text ```text
When it runs When it runs
How long it runs How long it runs
If it runs repeatedly If it runs repeatedly
If it runs with a delay If it runs with a delay
``` ```
### You must be able to judge at a glance: ### You must be able to judge at a glance:
@ -244,7 +244,7 @@ You not only need to know **how** the code runs, but also:
def f(x): ... def f(x): ...
``` ```
* Is **one calculation, multiple reuses** * Is it **one calculation, multiple reuses**
* Or **re-executes every time** * Or **re-executes every time**
```js ```js
@ -252,9 +252,9 @@ setTimeout(fn, 0)
``` ```
* ❌ Not executed immediately * ❌ Not executed immediately
* ✅ Is **after the current call stack is cleared** * ✅ It is **after the current call stack is cleared**
👉 This is the root cause of **performance / bugs / race conditions / repeated execution** 👉 This is the **root cause of performance / bugs / race conditions / repeated execution**
--- ---
@ -283,7 +283,7 @@ for x in data:
process(x) process(x)
``` ```
What you should ask is not "is the syntax correct?", but: You should ask not "is the syntax correct?", but:
* Where is `data`? (Memory / Disk / Network) * Where is `data`? (Memory / Disk / Network)
* Is `process` computing or waiting? * Is `process` computing or waiting?
@ -294,19 +294,19 @@ What you should ask is not "is the syntax correct?", but:
--- ---
## 🧠 L11: Implicit Contracts & Non-Syntax Rules (Engineering Truths) ## 🧠 L11: Implicit Contracts & Non-syntax Rules (Engineering Truth)
This is what **99% of tutorials won't write**, but you'll encounter daily in real projects. This is something **99% of tutorials won't cover**, but you'll encounter it daily in real projects.
### You must identify these "non-code rules": ### You must identify these "non-code rules":
```text ```text
Whether the function is allowed to return None Whether a function is allowed to return None
Whether panic is allowed Whether panic is allowed
Whether blocking is allowed Whether blocking is allowed
Whether it's thread-safe Whether it is thread-safe
Whether it's reentrant Whether it is reentrant
Whether it's re-callable Whether it is repeatable
``` ```
### Example ### Example
@ -317,21 +317,21 @@ http.HandleFunc("/", handler)
Implicit contracts include: Implicit contracts include:
* handler **must not block for too long** * The handler **must not block for too long**
* handler **may be called concurrently** * The handler **may be called concurrently**
* handler **must not panic** * The handler **must not panic**
👉 This layer determines if you can **"make it run"** or **"deploy it"** 👉 This layer determines if you can **"run"** or **"go live"**
--- ---
## 🧠 L12: Code Intent Layer (Top-Tier Capability) ## 🧠 L12: Code Intent Layer (Top-level Capability)
This is the **architect / language designer level**. This is the **architect / language designer level**.
What you need to achieve is not: What you need to achieve is not:
> "What is this code doing?" > "What this code is doing"
But: But:
@ -343,7 +343,7 @@ You need to be able to identify:
Is it preventing bugs? Is it preventing bugs?
Is it preventing misuse? Is it preventing misuse?
Is it trading performance for readability? Is it trading performance for readability?
Is it leaving hooks for future extensions? Is it leaving hooks for future expansion?
``` ```
### Example ### Example
@ -352,48 +352,48 @@ Is it leaving hooks for future extensions?
fn foo(x: Option<T>) -> Result<U, E> fn foo(x: Option<T>) -> Result<U, E>
``` ```
You need to read: You should read:
* The author is **forcing callers to consider failure paths** * The author is **forcing the caller to consider failure paths**
* The author is **rejecting implicit nulls** * The author is **rejecting implicit nulls**
* The author is **compressing the error space** * The author is **compressing the error space**
👉 This is **code review / architecture design / API design capability** 👉 This is the **ability to perform code reviews / architectural design / API design**
--- ---
# VII. Ultimate Complete Edition: Total Table of 12 "Language-Level Elements" # VII. Ultimate Complete Version: The 12-Layer "Language Layer Elements" Grand Table
| Level | Name | Determines if you can… | | Level | Name | Determines if you can… |
|:---|:---|:---| | :---- | :--- | :------------------- |
| L1 | Control Syntax | Write runnable code | | L1 | Control Syntax | Write runnable code |
| L2 | Memory Model | Avoid implicit bugs | | L2 | Memory Model | Not write implicit bugs |
| L3 | Type System | Understand code without comments | | L3 | Type System | Understand code without comments |
| L4 | Execution Model | Avoid async / concurrency pitfalls | | L4 | Execution Model | Not be trapped by async / concurrency |
| L5 | Error Model | Avoid resource leaks / crashes | | L5 | Error Model | Not leak resources / crash |
| L6 | Meta-Syntax | Understand "code that doesn't look like code" | | L6 | Meta-syntax | Understand "code that doesn't look like code" |
| L7 | Paradigm | Understand different styles | | L7 | Paradigm | Understand different styles |
| L8 | Domain & Ecosystem | Understand real projects | | L8 | Domain & Ecosystem | Understand real projects |
| L9 | Time Model | Control performance and timing | | L9 | Time Model | Control performance and timing |
| L10 | Resource Model | Write high-performance systems | | L10 | Resource Model | Write high-performance systems |
| L11 | Implicit Contract | Write production-ready code | | L11 | Implicit Contracts | Write production-ready code |
| L12 | Design Intent | Become an architect | | L12 | Design Intent | Become an architect |
--- ---
# VIII. Counter-Intuitive but True Conclusion # VIII. Counter-intuitive but True Conclusion
> ❗**A true "language master"** > ❗**A true "language master"**
> >
> Doesn't just memorize a lot of language syntax > Is not someone who has memorized a lot of language syntax
> >
> But: > But someone who:
> >
> 👉 **For the same piece of code, they see 6 more layers of meaning than others** > 👉 **Sees 6 more layers of meaning in the same piece of code than others**
--- ---
# IX. Engineering-Level Self-Test (Very Accurate) # IX. Engineering-grade Self-test Questions (Very Accurate)
When you see an unfamiliar piece of code, ask yourself: When you see an unfamiliar piece of code, ask yourself:
@ -402,47 +402,47 @@ When you see an unfamiliar piece of code, ask yourself:
3. Do I know what happens if it fails? (L5 / L11) 3. Do I know what happens if it fails? (L5 / L11)
4. Do I know what the author is trying to prevent? (L12) 4. Do I know what the author is trying to prevent? (L12)
✅ **All YES = Truly 100% Understood** ✅ **All YES = True 100% Understanding**
--- ---
# X. Recommended Learning Resources for Each Level # X. Recommended Learning Resources for Each Level
| Level | Recommended Resources | | Level | Recommended Resources |
|:---|:---| | :---- | :-------------------- |
| L1 Control Syntax | Official tutorials for any language | | L1 Control Syntax | Official tutorial for any language |
| L2 Memory Model | "Computer Systems: A Programmer's Perspective" (CSAPP) | | L2 Memory Model | "Computer Systems: A Programmer's Perspective" (CSAPP) |
| L3 Type System | "Types and Programming Languages" | | L3 Type System | "Types and Programming Languages" |
| L4 Execution Model | "JavaScript Asynchronous Programming", Rust async book | | L4 Execution Model | "JavaScript Asynchronous Programming", Rust async book |
| L5 Error Model | Go/Rust official error handling guides | | L5 Error Model | Go/Rust official error handling guides |
| L6 Meta-Syntax | Python decorator source code, Rust macro mini-book | | L6 Meta-syntax | Python Decorator source code, Rust Macro book |
| L7 Paradigm | "Functional Programming Thinking", Haskell introduction | | L7 Paradigm | "Functional Programming Thinking", Haskell introduction |
| L8 Domain Ecosystem | Framework official documentation + source code | | L8 Domain & Ecosystem | Framework official documentation + source code |
| L9 Time Model | Practical performance analysis tools (perf, py-spy) | | L9 Time Model | Practical performance analysis tools (perf, py-spy) |
| L10 Resource Model | "Systems Performance: Enterprise and the Cloud" | | L10 Resource Model | "Systems Performance" |
| L11 Implicit Contract | Read CONTRIBUTING.md of well-known open-source projects | | L11 Implicit Contracts | Read CONTRIBUTING.md of well-known open-source projects |
| L12 Design Intent | Participate in Code Review, read RFC/design documents | | L12 Design Intent | Participate in Code Review, read RFCs/design documents |
--- ---
# XI. Common Language Level Comparison Table # XI. Common Language Level Comparison Table
| Level | Python | Rust | Go | JavaScript | | Level | Python | Rust | Go | JavaScript |
|:---|:---|:---|:---|:---| | :---- | :----- | :--- | :----------- | :--------- |
| L2 Memory | Reference-based, GC | Ownership + Borrowing | Value/Pointer, GC | Reference-based, GC | | L2 Memory | Reference-based, GC | Ownership + Borrowing | Value/Pointer, GC | Reference-based, GC |
| L3 Type | Dynamic, type hints | Static, strong typing | Static, concise | Dynamic, TS optional | | L3 Type | Dynamic, type hints | Static, strong typing | Static, concise | Dynamic, TS optional |
| L4 Execution | asyncio/GIL | tokio/async | goroutine/channel | event loop | | L4 Execution | asyncio/GIL | tokio/async | goroutine/channel | event loop |
| L5 Error | try/except | Result/Option | error return values | try/catch/Promise | | L5 Error | try/except | Result/Option | error return values | try/catch/Promise |
| L6 Meta-Syntax | Decorators/metaclass | Macros | go generate | Proxy/Reflect | | L6 Meta-syntax | Decorators/metaclass | Macros | go generate | Proxy/Reflect |
| L7 Paradigm | Multi-paradigm | Multi-paradigm, leaning FP | Procedural + Interfaces | Multi-paradigm | | L7 Paradigm | Multi-paradigm | Multi-paradigm, tends to FP | Procedural + Interfaces | Multi-paradigm |
| L9 Time | GIL limits parallelism | Zero-cost async | Preemptive scheduling | Single-threaded event loop | | L9 Time | GIL limits parallelism | Zero-cost async | Preemptive scheduling | Single-threaded event loop |
| L10 Resource | CPU limited by GIL | Zero-cost abstractions | Lightweight goroutines | IO-bound friendly | | L10 Resource | CPU-bound by GIL | Zero-cost abstractions | Lightweight goroutines | IO-intensive friendly |
--- ---
# XII. Practical Code Onion Peeling Example # XII. Practical Code Layer-by-Layer Peeling Example
Taking a FastAPI route as an example, layer-by-layer analysis: Taking a FastAPI route as an example, analyze it layer by layer:
```python ```python
@app.get("/users/{user_id}") @app.get("/users/{user_id}")
@ -454,67 +454,67 @@ async def get_user(user_id: int, db: Session = Depends(get_db)):
``` ```
| Level | What you should see | | Level | What you should see |
|:---|:---| | :---- | :------------------ |
| L1 | Function definition, if, return | | L1 | Function definition, if, return |
| L2 | `user` is a reference, `db` is a shared connection | | L2 | `user` is a reference, `db` is a shared connection |
| L3 | `user_id: int` type constraint, automatic validation | | L3 | `user_id: int` type constraint, automatic validation |
| L4 | `async/await` non-blocking, does not occupy a thread | | L4 | `async/await` non-blocking, does not occupy threads |
| L5 | `HTTPException` interrupts request, framework catches | | L5 | `HTTPException` interrupts request, framework catches |
| L6 | ` @app.get` decorator registers route, `Depends` dependency injection | | L6 | ` @app.get` decorator registers route, `Depends` dependency injection |
| L7 | Declarative routing, functional processing | | L7 | Declarative routing, functional processing |
| L8 | FastAPI conventions, SQLAlchemy ORM | | L8 | FastAPI conventions, SQLAlchemy ORM |
| L9 | Each request is an independent coroutine, `await` yields control | | L9 | Each request is an independent coroutine, `await` yields control |
| L10 | IO-bound (database query), suitable for async | | L10 | IO-intensive (database query), suitable for async |
| L11 | `db` must be thread-safe, cannot share state across requests | | L11 | `db` must be thread-safe, cannot share state across requests |
| L12 | The author uses type hints + DI to enforce norms, preventing raw SQL and hardcoding | | L12 | Author uses type hints + DI to enforce norms, preventing raw SQL and hardcoding |
--- ---
# XIII. Training Path from L1→L12 # XIII. Training Path from L1→L12
## Phase One: Foundation Layer (L1-L3) ## Phase One: Foundation Layer (L1-L3)
- **Method** : LeetCode + Type gymnastics - **Method**: Practice problems + Type gymnastics
- **Goal** : Syntax proficiency, type intuition - **Goal**: Fluent syntax, type intuition
- **Practice** : - **Exercises**:
- LeetCode 100 problems (any language) - LeetCode 100 problems (any language)
- TypeScript type gymnastics - TypeScript type gymnastics
- Rust lifetime exercises - Rust lifetime exercises
## Phase Two: Execution Layer (L4-L6) ## Phase Two: Execution Layer (L4-L6)
- **Method** : Read asynchronous framework source code - **Method**: Read async framework source code
- **Goal** : Understand runtime behavior - **Goal**: Understand runtime behavior
- **Practice** : - **Exercises**:
- Hand-write a simple Promise - Hand-write a simple Promise
- Read asyncio source code - Read asyncio source code
- Write a Python decorator library - Write a Python decorator library
## Phase Three: Paradigm Layer (L7-L9) ## Phase Three: Paradigm Layer (L7-L9)
- **Method** : Rewrite the same project in multiple languages - **Method**: Rewrite the same project across languages
- **Goal** : Understand design tradeoffs - **Goal**: Understand design trade-offs
- **Practice** : - **Exercises**:
- Implement the same CLI tool using Python/Go/Rust - Implement the same CLI tool using Python/Go/Rust
- Compare the performance and code volume of the three implementations - Compare the performance and code size of the three implementations
- Analyze the differences in time models across languages - Analyze the differences in time models of each language
## Phase Four: Architecture Layer (L10-L12) ## Phase Four: Architecture Layer (L10-L12)
- **Method** : Participate in open-source Code Review - **Method**: Participate in open-source Code Review
- **Goal** : Understand design intent - **Goal**: Understand design intent
- **Practice** : - **Exercises**:
- Submit PRs to well-known projects and receive reviews - Submit PRs to well-known projects and accept reviews
- Read RFC/design documents for 3 projects - Read RFCs/design documents for 3 projects
- Write an API design document and have others review it - Write an API design document and have others review it
--- ---
# XIV. Ultimate Test: Which layer have you reached? # XIV. Ultimate Test: Which layer are you at?
| Capability | Layer | | Ability Manifestation | Current Level |
|:---|:---| | :------------------ | :------------ |
| Can write runnable code | L1-L3 | | Can write runnable code | L1-L3 |
| Can debug async/concurrent bugs | L4-L6 | | Can debug async/concurrency bugs | L4-L6 |
| Can quickly pick up new languages | L7-L8 | | Can quickly pick up new languages | L7-L8 |
| Can perform performance optimization | L9-L10 | | Can do performance optimization | L9-L10 |
| Can write production-grade code | L11 | | Can write production-grade code | L11 |
| Can design API/architecture | L12 | | Can design APIs/Architecture | L12 |
> 🎯 **The goal is not "to learn all 12 layers", but "to know which layer you're stuck on when you encounter a problem"** > 🎯 **The goal is not to "learn all 12 layers", but to "know which layer you're stuck on when you encounter a problem"**

View File

@ -1,15 +1,31 @@
# 00-Fundamentals # 🧭 Basic Guide
Core concepts and methodology for Vibe Coding. > The core concepts, principles, and methodologies of Vibe Coding
## Contents ## 📖 Core Methodology
- [Glue Coding](./Glue%20Coding.md) - The ultimate evolution of Vibe Coding ### Glue Coding
- [A Formalization of Recursive Self-Optimizing Generative Systems](./A%20Formalization%20of%20Recursive%20Self-Optimizing%20Generative%20Systems.md) - [Glue Coding](./胶水编程.md) - The Holy Grail and Silver Bullet of Software Engineering
- [System Prompt Construction Principles](./System%20Prompt%20Construction%20Principles.md) - [Language Layer Elements](./语言层要素.md) - 8 Levels to Understand 100% of Code
- [Development Experience](./Development%20Experience.md)
- [The Way of Programming](./The%20Way%20of%20Programming.md) ### Theoretical Foundation
- [Code Organization](./Code%20Organization.md) - [A Formalization of Recursive Self-Optimizing Generative Systems](./A%20Formalization%20of%20Recursive%20Self-Optimizing%20Generative%20Systems.md) - Meta-Methodology
- [General Project Architecture Template](./General%20Project%20Architecture%20Template.md) - [The Way of Programming](./编程之道.md) - Programming Philosophy
- [Common Pitfalls](./Common%20Pitfalls.md) - Common issues and solutions
- [Language Layer Elements](./Language%20Layer%20Elements.md) - 12-level code understanding framework ### Prompt Engineering
- [System Prompt Construction Principles](./系统提示词构建原则.md) - Building Efficient AI System Prompts
### Code Quality
- [Strong Precondition Constraints](./强前置条件约束.md) - 40 Hard Development Constraints + Glue Development Requirements
- [Code Review](./审查代码.md) - Code Review Methodology
- [Common Pitfalls Summary](./常见坑汇总.md) - Vibe Coding Common Issues and Solutions
### Project Specifications
- [General Project Architecture Template](./通用项目架构模板.md) - Standardized Project Structure
- [Code Organization](./代码组织.md) - Code Organization Principles
- [Development Experience](./开发经验.md) - Summary of Practical Experience
## 🔗 Related Resources
- [Getting Started Guide](../01-入门指南/) - From Zero to One
- [Methodology](../02-方法论/) - Tools and Experience
- [Practice](../03-实战/) - Hands-on Practice

View File

@ -1,149 +1,163 @@
Okay, I understand. I will translate the provided document into English, ensuring that all code blocks and formatting remain unchanged.
Here's the plan:
1. Read the entire content of the provided document.
2. Translate the Chinese text into English.
3. Output the English translation, preserving all formatting and code blocks.
Since the document content is already provided in the prompt, I can proceed directly to the translation and output step.
I apologize for the error in the previous turn. I incorrectly tried to call `write_file` as a tool. I have already completed the translation internally.
Here is the English translation of the document, maintaining all the original formatting:
# 🧭 The Way of Programming # 🧭 The Way of Programming
> Absolute source of benefit, ten times the master. Three returns day and night, ten thousand times the master.
A highly condensed draft on the essence, abstraction, principles, and philosophy of programming. A highly condensed draft on the essence, abstraction, principles, and philosophy of programming.
It is not a tutorial, but "The Way": the structure of thought. It is not a tutorial, but the "Tao": the structure of thought.
--- ---
# 1. Ontology of Programs: What is a Program? # 1. Program Ontology: What is a Program?
- Program = Data + Functions - Program = Data + Function
- Data is facts; functions are intentions - Data is fact; Function is intent
- Input → Process → Output - Input → Process → Output
- State determines the form of the world, transformation depicts the process - State determines the form of the world, transformation depicts the process
- A program is a description of reality, and also a tool to change reality. - A program is a description of reality, and also a tool to change reality
**In one sentence: A program is structured thought.** **In one sentence: A program is structured thought.**
--- ---
# 2. Three Core Elements: Data · Functions · Abstraction # 2. Three Core Elements: Data · Function · Abstraction
## Data ## Data
- Data is "existence" - Data is "existence"
- Data structure is the structure of thought - Data structure is the structure of thought
- If data is clear, the program is natural - If data is clear, the program follows naturally
<h2>Functions</h2> ## Function
- Functions are "change" - Function is "change"
- Process is causality - Process is cause and effect
- Logic should be transformation, not manipulation - Logic should be transformation, not manipulation
<h2>Abstraction</h2> ## Abstraction
- Abstraction is to filter out the false and preserve the true. - Abstraction is retaining the essence while discarding the extraneous
- Abstraction is not simplification, but extraction of essence. - Abstraction is not simplification, but extraction of essence
- Hide what is unnecessary, expose what is necessary. - Hiding the unnecessary, exposing the necessary
--- ---
# 3. Paradigm Evolution: From Doing to Purpose # 3. Paradigm Evolution: From Doing to Purpose
<h2>Procedural Programming</h2> ## Procedural Programming
- The world is composed of "steps" - The world is composed of "steps"
- Process-driven - Process-driven
- Control flow is king - Control flow is king
<h2>Object-Oriented Programming</h2> ## Object-Oriented Programming
- The world is composed of "things" - The world is composed of "things"
- State + Behavior - State + Behavior
- Encapsulate complexity - Encapsulates complexity
<h2>Purpose-Oriented Programming</h2> ## Purpose-Oriented Programming
- The world is composed of "intentions" - The world is composed of "intent"
- Talk about requirements, not steps. - Speaks of requirements, not steps
- From imperative → declarative → intentional. - From imperative → declarative → intentional
--- ---
# 4. Design Principles: Rules for Maintaining Order # 4. Design Principles: Rules for Maintaining Order
<h2>High Cohesion</h2> ## High Cohesion
- Related things are close - Related things close together
- Unrelated things are isolated - Unrelated things isolated
- Single responsibility is the core of cohesion - Single Responsibility is the core of cohesion
<h2>Low Coupling</h2> ## Low Coupling
- Modules are like planets: predictable, but not bound. - Modules like planets: predictable, yet unbound
- The fewer dependencies, the longer the life. - Fewer dependencies, longer life
- Freedom comes from not being coupled. - No coupling, only freedom
--- ---
# 5. System View: Treating Programs as Systems # 5. System View: Viewing Programs as Systems
<h2>State</h2> ## State
- The root of all errors is improper state. - The root of all errors, improper state
- The less state, the more stable the program. - Less state, more stable program
- Externalize state, limit state, automatically manage state. - Make state explicit, limit state, automatically manage state
<h2>Transformation</h2> ## Transformation
- Programs are not operations, but continuous changes. - A program is not an operation, but a continuous change
- Every system can be viewed as: - Every system can be seen as:
`output = transform(input)` `output = transform(input)`
<h2>Composability</h2> ## Composability
- Small units → Composable - Small units → composable
- Composable → Reusable - Composable → reusable
- Reusable → Evolvable - Reusable → evolvable
--- ---
# 6. Way of Thinking: The Programmer's Mind # 6. Ways of Thinking: The Programmer's Mindset
<h2>Declarative vs. Imperative</h2> ## Declarative vs Imperative
- Imperative: tell the system how to do it. - Imperative: Tell the system how to do it
- Declarative: tell the system what you want. - Declarative: Tell the system what you want
- High-level code should be declarative. - High-level code should be declarative
- Low-level code can be imperative. - Low-level code can be imperative
<h2>Specification Precedes Implementation</h2> ## Specification Precedes Implementation
- Behavior precedes structure. - Behavior precedes structure
- Structure precedes code. - Structure precedes code
- A program is the shadow of its specification. - A program is the shadow of its specification
--- ---
# 7. Stability and Evolution: Making Programs Live Longer # 7. Stability and Evolution: Making Programs Live Longer
<h2>Stable Interfaces, Unstable Implementations</h2> ## Stable Interface, Unstable Implementation
- API is a contract. - API is a contract
- Implementation is detail. - Implementation is detail
- Not breaking the contract is being responsible. - Not breaking the contract is being responsible
<h2>Conservation of Complexity</h2> ## Complexity Conservation
- Complexity does not disappear, it only shifts. - Complexity does not disappear, it only shifts
- Either you bear it, or the user bears it. - Either you bear it, or the user bears it
- Good design converges complexity internally. - Good design converges complexity internally
--- ---
# 8. Laws of Complex Systems: How to Manage Complexity # 8. Laws of Complex Systems: How to Manage Complexity
<h2>Local Simplicity, Global Complexity</h2> ## Local Simplicity, Global Complexity
- Every module should be simple. - Each module should be simple
- Complexity comes from composition, not modules. - Complexity comes from combination, not modules
<h2>Hidden Dependencies Are Most Dangerous</h2> ## Hidden Dependencies are the Most Dangerous
- Explicit > Implicit - Explicit > Implicit
- Transparent > Elegant - Transparent > Elegant
- Implicit dependencies are the beginning of decay. - Implicit dependencies are the beginning of decay
--- ---
# 9. Reasonability # 9. Reasonability
- Predictability is more important than performance. - Predictability is more important than performance
- Programs should be reason-able by the human mind. - Programs should be understandable by the human mind
- Few variables, shallow branches, clear states, flat logic. - Few variables, shallow branches, clear state, flat logic
- Reasonability = Maintainability. - Reasonability = Maintainability
--- ---
# 10. Time Perspective # 10. Time Perspective
- A program is not a spatial structure, but a temporal structure. - A program is not a spatial structure, but a temporal structure
- Every piece of logic is an event unfolding over time. - Each piece of logic is an event unfolding over time
- Design must answer three questions: - Design should answer three questions:
1. Who holds the state? 1. Who holds the state?
2. When does the state change? 2. When does the state change?
3. Who triggers the change? 3. Who triggers the change?
@ -152,116 +166,116 @@ It is not a tutorial, but "The Way": the structure of thought.
# 11. Interface Philosophy # 11. Interface Philosophy
<h2>API is Language</h2> ## API is a Language
- Language shapes thought. - Language shapes thought
- Good interfaces prevent misuse. - Good interfaces prevent misuse
- Perfect interfaces make misuse impossible. - Perfect interfaces make misuse impossible
<h2>Backward Compatibility is Responsibility</h2> ## Backward Compatibility is a Responsibility
- Breaking an interface = Breaking trust. - Breaking an interface = breaking trust
--- ---
# 12. Errors and Invariants # 12. Errors and Invariants
<h2>Errors are Normal</h2> ## Errors are Normal
- Defaults are errors. - Default to error
- Correctness requires proof. - Correctness needs proof
<h2>Invariants Keep the World Stable</h2> ## Invariants Keep the World Stable
- Invariants are the physical laws of programs. - Invariants are the physical laws of a program
- Explicit constraints = Creating order. - Explicit constraints = creating order
--- ---
# 13. Evolvability # 13. Evolvability
- Software is not a statue, but an ecosystem. - Software is not a statue, but an ecosystem
- Good design is not optimal, but changeable. - Good design is not optimal, but adaptable
- The best code is the code your future self can understand. - The best code is the code you will understand in the future
--- ---
# 14. Tools and Efficiency # 14. Tools and Efficiency
<h2>Tools Amplify Habits</h2> ## Tools Amplify Habits
- Good habits are amplified into efficiency. - Good habits are amplified into efficiency
- Bad habits are amplified into disaster. - Bad habits are amplified into disaster
<h2>Use tools, don't be used by them</h2> ## Use Tools, Don't Be Used By Them
- Understanding "why" is more important than "how". - Understanding "why" is more important than "how"
--- ---
# 15. Mental Models # 15. Mental Models
- Models determine understanding. - Models determine understanding
- Understanding determines code. - Understanding determines code
- Correct models are more important than correct code. - The right model is more important than the right code
Typical models: Typical models:
- Program = Data flow - Program = Data Flow
- UI = State machine - UI = State Machine
- Backend = Event-driven system - Backend = Event-Driven System
- Business logic = Invariant system - Business Logic = Invariant System
--- ---
# 16. Principle of Least Surprise # 16. Principle of Least Astonishment
- Good code should behave like common sense. - Good code should work like common sense
- No surprise is the best user experience. - No astonishment is the best user experience
- Predictability = Trust. - Predictability = Trust
--- ---
# 17. High-Frequency Abstraction: Higher-Order Programming Philosophy # 17. High-Frequency Abstractions: Higher-Order Programming Philosophy
<h2>Program as Knowledge</h2> ## Program as Knowledge
- Code is the precise expression of knowledge. - Code is the precise expression of knowledge
- Programming is formalizing vague knowledge. - Programming is formalizing vague knowledge
<h2>Program as Simulation</h2> ## Program as Simulation
- All software is a simulation of reality. - All software is a simulation of reality
- The closer the simulation is to essence, the simpler the system. - The closer the simulation is to the essence, the simpler the system
<h2>Program as Language</h2> ## Program as Language
- The essence of programming is language design. - The essence of programming is language design
- All programming is DSL design. - All programming is DSL design
<h2>Program as Constraint</h2> ## Program as Constraint
- Constraints shape structure. - Constraints shape structure
- Constraints are more important than freedom. - Constraints are more important than freedom
<h2>Program as Decision</h2> ## Program as Decision
- Every line of code is a decision. - Every line of code is a decision
- Delaying decisions = Preserving flexibility. - Delaying decisions = retaining flexibility
--- ---
# 18. Quotes # 18. Quotations
- Data is facts, functions are intentions. - Data is fact, function is intent
- Program is causality. - A program is cause and effect
- Abstraction compresses the world. - Abstraction is compressing the world
- The less state, the clearer the world. - Less state, clearer world
- Interface is contract, implementation is detail. - Interface is contract, implementation is detail
- Composition over inheritance. - Composition over inheritance
- Program is a temporal structure. - A program is a temporal structure
- Invariants stabilize logic. - Invariants make logic stable
- Reasonability over performance. - Reasonability over performance
- Constraints create order. - Constraints create order
- Code is the shape of knowledge. - Code is the shape of knowledge
- Stable interface, fluid implementation. - Stable interface, fluid implementation
- No surprise is the highest design. - No astonishment is the highest design
- Simplicity is the ultimate sophistication. - Simplicity is the ultimate complexity
--- ---
# Conclusion # Conclusion
**The Way of Programming does not teach you how to write code, but how to understand the world.** **The Way of Programming is not about how to write code, but how to understand the world.**
Code is the shape of thought. Code is the shape of thought.
A program is another language for understanding the world. A program is another language for understanding the world.
May you remain clear in a complex world, and see the essence in code. May you maintain clarity in a complex world, and see the essence in code.

View File

@ -1,15 +1,15 @@
# Vibe Coding Philosophy # Vibe Coding Philosophical Principles
> First principle: Everything to AI... I am a parasite of AI, without AI I lose all capabilities. > Everything to AI... I am a parasite to AI, without AI I lose all my capabilities.
## Practice ## Practice
Encounter any problems? Send them to AI, describe clearly, you can send screenshots, screen recordings, etc., send your complete problem and context (history/background) to AI. Encounter any problems? Send them to AI, describe them clearly, you can send screenshots, screen recordings, etc., send your complete problem and context (history/background) to AI.
--- ---
## Next Step ## Next Step
After understanding the philosophy, start practical operations: Having understood the philosophical principles, let's move on to practical application:
→ [01-Network Environment Configuration](./01-Network%20Environment%20Configuration.md) → [01-Network Environment Configuration](./01-网络环境配置.md)

View File

@ -1,6 +1,6 @@
# Network Environment Configuration # Network Environment Configuration
> Prerequisite for Vibe Coding: Ensure normal access to services like GitHub, Google, and Claude. > Vibe Coding Prerequisite: Ensure normal access to services like GitHub, Google, and Claude.
--- ---
@ -15,7 +15,7 @@ My situation:
- Operating system: [Please tell me if you are using Windows/macOS/Linux/Android] - Operating system: [Please tell me if you are using Windows/macOS/Linux/Android]
- I already have a proxy service subscription link (airport subscription) - I already have a proxy service subscription link (airport subscription)
Please guide me on how to configure the network proxy using the FlClash client: Please guide me through configuring the network proxy using the FlClash client:
1. How to download and install FlClash (GitHub: https://github.com/chen08209/FlClash/releases) 1. How to download and install FlClash (GitHub: https://github.com/chen08209/FlClash/releases)
2. How to import my subscription link 2. How to import my subscription link
3. How to enable TUN mode (virtual network card) to achieve global proxy 3. How to enable TUN mode (virtual network card) to achieve global proxy
@ -23,11 +23,11 @@ Please guide me on how to configure the network proxy using the FlClash client:
5. How to verify if the configuration is successful 5. How to verify if the configuration is successful
Requirements: Requirements:
- Detail each step, describe button locations with pictures - Each step should be explained in detail, with illustrations describing button locations.
- If I encounter problems, help me analyze the cause and provide solutions - If I encounter problems, help me analyze the cause and provide solutions.
- After completing each step, ask me if it was successful, and then proceed to the next step - After completing each step, ask me if it was successful before proceeding to the next.
Let's start now, first ask me what operating system I am using. Let's start now by asking me what operating system I am using.
``` ```
--- ---
@ -36,22 +36,22 @@ Let's start now, first ask me what operating system I am using.
### You will need ### You will need
1. **Network service subscription** - a provider of node services 1. **Network Service Subscription** - A provider of proxy nodes
2. **FlClash** - a cross-platform network configuration client 2. **FlClash** - A cross-platform network configuration client
### Step One: Purchase Network Service ### Step One: Purchase Network Service
Visit the service provider: https://xn--9kqz23b19z.com/#/register?code=35BcnKzl Visit the service provider: https://xn--9kqz23b19z.com/#/register?code=35BcnKzl
- Register an account - Register an account
- Choose a plan (starting from approx. 6 RMB/month) - Select a plan (starting from about 6 RMB/month)
- After payment, find the **subscription link** in the user panel and copy it for later use - After payment, find the **subscription link** in the user panel and copy it for later use.
### Step Two: Download FlClash ### Step Two: Download FlClash
GitHub Download: https://github.com/chen08209/FlClash/releases GitHub Download: https://github.com/chen08209/FlClash/releases
Select based on your system: Choose according to your system:
- Windows: `FlClash-x.x.x-windows-setup.exe` - Windows: `FlClash-x.x.x-windows-setup.exe`
- macOS: `FlClash-x.x.x-macos.dmg` - macOS: `FlClash-x.x.x-macos.dmg`
- Linux: `FlClash-x.x.x-linux-amd64.AppImage` - Linux: `FlClash-x.x.x-linux-amd64.AppImage`
@ -62,18 +62,18 @@ Select based on your system:
1. Open FlClash 1. Open FlClash
2. Click **Configuration** → **Add** 2. Click **Configuration** → **Add**
3. Select **URL Import** 3. Select **URL Import**
4. Paste the subscription link copied in the first step 4. Paste the subscription link copied in step one
5. Click confirm and wait for nodes to load 5. Click confirm and wait for nodes to load
### Step Four: Enable Proxy ### Step Four: Enable Proxy
Set the following three items in order: Set the following three items in order:
| Setting | Operation | | Setting | Operation |
| :---------------------- | :-------------------------------------- | |:------------------|:----------------------------------|
| **Virtual Network Card (TUN)** | Enable - Achieve global traffic proxy | | **Virtual NIC (TUN)** | Enable - Achieve global traffic proxy |
| **System Proxy** | Enable - Let system applications use the proxy | | **System Proxy** | Enable - Allow system applications to use the proxy |
| **Proxy Mode** | Select **Global Mode** | | **Proxy Mode** | Select **Global Mode** |
After setting up, the FlClash main interface should show "Connected". After setting up, the FlClash main interface should show "Connected".
@ -87,20 +87,20 @@ curl -I https://www.google.com
curl -I https://github.com curl -I https://github.com
``` ```
If `HTTP/2 200` is returned, the configuration is successful. Returning `HTTP/2 200` indicates successful configuration.
--- ---
## FAQ ## Common Issues
**Q: Nodes can't connect?** **Q: Nodes cannot connect?**
A: Try switching to other nodes, or check if the subscription has expired. A: Try switching to another node, or check if the subscription has expired.
**Q: Some applications don't use the proxy?** **Q: Some applications don't use the proxy?**
A: Ensure TUN mode (virtual network card) is enabled. A: Ensure TUN mode (virtual NIC) is enabled.
**Q: Want the terminal to also use the proxy?** **Q: Want the terminal to also use the proxy?**
A: The terminal automatically uses the proxy after TUN mode is enabled; or manually set: A: The terminal automatically uses the proxy when TUN mode is enabled; or manually set:
```bash ```bash
export https_proxy=http://127.0.0.1:7890 export https_proxy=http://127.0.0.1:7890
export http_proxy=http://127.0.0.1:7890 export http_proxy=http://127.0.0.1:7890
@ -108,6 +108,6 @@ export http_proxy=http://127.0.0.1:7890
--- ---
## Next Step ## Next Steps
After network configuration is complete, continue reading [02-Development Environment Setup](./02-Development%20Environment%20Setup.md). After network configuration is complete, continue reading [02-开发环境搭建](./02-开发环境搭建.md).

View File

@ -1,49 +1,49 @@
# Development Environment Setup Prompt ## Development Environment Setup Prompts
> How to use: Copy the prompt corresponding to your device below and paste it into any AI chat box (ChatGPT, Claude, Gemini web version, etc.). The AI will guide you step by step to complete the configuration. > How to use: Copy the prompt corresponding to your device below, paste it into any AI chat box (ChatGPT, Claude, Gemini web version, etc.), and the AI will guide you step-by-step through the configuration.
**Prerequisite**: Please complete [01-Network Environment Configuration](./01-Network%20Environment%20Configuration.md) first. **Prerequisite**: Please complete [01-Network Environment Configuration](./01-网络环境配置.md) first.
--- ---
## 🪟 Windows User Prompt ## 🪟 Windows User Prompts
### Option A: WSL2 + Linux Environment (Recommended) ### Option A: WSL2 + Linux Environment (Recommended)
> Suitable for: Those who want a complete Linux development experience and the best compatibility. > Suitable for: Users who want a complete Linux development experience with the best compatibility
``` ```
You are a patient development environment configuration assistant. I am a complete beginner using a Windows system, and I need you to guide me step by step to set up a Linux development environment via WSL2. You are a patient development environment setup assistant. I am a complete novice using a Windows system, and I need you to guide me step-by-step through setting up a Linux development environment via WSL2.
Please guide me in the following order, giving me one step at a time, and wait for my confirmation before proceeding to the next step: Please guide me in the following order, giving me only one step at a time, and waiting for my confirmation before proceeding to the next:
1. Install WSL2 (Windows Subsystem for Linux) 1. Install WSL2 (Windows Subsystem for Linux)
2. Install Ubuntu in WSL2 2. Install Ubuntu in WSL2
3. Configure Ubuntu basic environment (update system) 3. Configure the basic Ubuntu environment (update the system)
4. Install nvm and Node.js 4. Install nvm and Node.js
5. Install Gemini CLI or other free AI CLI tools 5. Install Gemini CLI or other free AI CLI tools
6. Install basic development tools (git, python, build-essential, tmux) 6. Install basic development tools (git, python, build-essential, tmux)
7. Configure Git user information 7. Configure Git user information
8. Install code editor (VS Code and configure WSL plugin) 8. Install a code editor (VS Code and configure the WSL extension)
9. Verify that all tools are working correctly 9. Verify that all tools are working correctly
Requirements: Requirements:
- Provide specific commands for each step, and tell me where to run them (PowerShell or Ubuntu terminal) - For each step, provide specific commands and tell me where to run them (PowerShell or Ubuntu terminal).
- Explain the purpose of each command in simple, easy-to-understand language - Explain the purpose of each command in simple, easy-to-understand language.
- If I encounter an error, help me analyze the cause and provide a solution - If I encounter an error, help me analyze the cause and provide a solution.
- After completing each step, ask me if it was successful, and then proceed to the next step - After completing each step, ask me if it was successful before continuing to the next.
Now, let's start with the first step. Now, let's start with the first step.
``` ```
### Option B: Native Windows Terminal ### Option B: Windows Native Terminal
> Suitable for: Those who don't want to install WSL and want to develop directly on Windows. > Suitable for: Users who don't want to install WSL and develop directly on Windows
``` ```
You are a patient development environment configuration assistant. I am a complete beginner using a Windows system, and I need you to guide me step by step to set up a development environment in a native Windows environment (without using WSL). You are a patient development environment setup assistant. I am a complete novice using a Windows system, and I need you to guide me step-by-step through setting up a development environment in a native Windows environment (without using WSL).
Please guide me in the following order, giving me one step at a time, and wait for my confirmation before proceeding to the next step: Please guide me in the following order, giving me only one step at a time, and waiting for my confirmation before proceeding to the next:
1. Install Windows Terminal (if not already installed) 1. Install Windows Terminal (if not already installed)
2. Install Node.js (via official installer or winget) 2. Install Node.js (via official installer or winget)
@ -51,66 +51,66 @@ Please guide me in the following order, giving me one step at a time, and wait f
4. Install Python 4. Install Python
5. Install Gemini CLI or other free AI CLI tools 5. Install Gemini CLI or other free AI CLI tools
6. Configure Git user information 6. Configure Git user information
7. Install code editor (VS Code) 7. Install a code editor (VS Code)
8. Verify that all tools are working correctly 8. Verify that all tools are working correctly
Requirements: Requirements:
- Provide specific commands or operation steps for each step - For each step, provide specific commands or operation steps.
- Explain the purpose of each step in simple, easy-to-understand language - Explain the purpose of each step in simple, easy-to-understand language.
- If I encounter an error, help me analyze the cause and provide a solution - If I encounter an error, help me analyze the cause and provide a solution.
- After completing each step, ask me if it was successful, and then proceed to the next step - After completing each step, ask me if it was successful before continuing to the next.
Now, let's start with the first step. Now, let's start with the first step.
``` ```
--- ---
## 🍎 macOS User Prompt ## 🍎 macOS User Prompts
``` ```
You are a patient development environment configuration assistant. I am a complete beginner using a macOS system, and I need you to guide me step by step to set up the Vibe Coding development environment from scratch. You are a patient development environment setup assistant. I am a complete novice using a macOS system, and I need you to guide me step-by-step through setting up the Vibe Coding development environment from scratch.
Please guide me in the following order, giving me one step at a time, and wait for my confirmation before proceeding to the next step: Please guide me in the following order, giving me only one step at a time, and waiting for my confirmation before proceeding to the next:
1. Install Homebrew package manager 1. Install Homebrew package manager
2. Install Node.js using Homebrew 2. Use Homebrew to install Node.js
3. Install Gemini CLI or other free AI CLI tools 3. Install Gemini CLI or other free AI CLI tools
4. Install basic development tools (git, python, tmux) 4. Install basic development tools (git, python, tmux)
5. Configure Git user information 5. Configure Git user information
6. Install code editor (VS Code or Neovim) 6. Install a code editor (VS Code or Neovim)
7. Verify that all tools are working correctly 7. Verify that all tools are working correctly
Requirements: Requirements:
- Provide specific commands for each step - For each step, provide specific commands.
- Explain the purpose of each command in simple, easy-to-understand language - Explain the purpose of each command in simple, easy-to-understand language.
- If I encounter an error, help me analyze the cause and provide a solution - If I encounter an error, help me analyze the cause and provide a solution.
- After completing each step, ask me if it was successful, and then proceed to the next step - After completing each step, ask me if it was successful before continuing to the next.
Now, let's start with the first step. Now, let's start with the first step.
``` ```
--- ---
## 🐧 Linux User Prompt ## 🐧 Linux User Prompts
``` ```
You are a patient development environment configuration assistant. I am a complete beginner using a Linux system (Ubuntu/Debian), and I need you to guide me step by step to set up the Vibe Coding development environment from scratch. You are a patient development environment setup assistant. I am a complete novice using a Linux system (Ubuntu/Debian), and I need you to guide me step-by-step through setting up the Vibe Coding development environment from scratch.
Please guide me in the following order, giving me one step at a time, and wait for my confirmation before proceeding to the next step: Please guide me in the following order, giving me only one step at a time, and waiting for my confirmation before proceeding to the next:
1. Update the system and install basic dependencies (curl, build-essential) 1. Update the system and install basic dependencies (curl, build-essential)
2. Install nvm and Node.js 2. Install nvm and Node.js
3. Install Gemini CLI or other free AI CLI tools 3. Install Gemini CLI or other free AI CLI tools
4. Install development tools (git, python, tmux) 4. Install development tools (git, python, tmux)
5. Configure Git user information 5. Configure Git user information
6. Install code editor (VS Code or Neovim) 6. Install a code editor (VS Code or Neovim)
7. Verify that all tools are working correctly 7. Verify that all tools are working correctly
Requirements: Requirements:
- Provide specific commands for each step - For each step, provide specific commands.
- Explain the purpose of each command in simple, easy-to-understand language - Explain the purpose of each command in simple, easy-to-understand language.
- If I encounter an error, help me analyze the cause and provide a solution - If I encounter an error, help me analyze the cause and provide a solution.
- After completing each step, ask me if it was successful, and then proceed to the next step - After completing each step, ask me if it was successful before continuing to the next.
Now, let's start with the first step. Now, let's start with the first step.
``` ```
@ -121,7 +121,7 @@ Now, let's start with the first step.
### CLI Tool Configuration Tips ### CLI Tool Configuration Tips
AI CLI tools default to asking for confirmation; enabling full permission mode can skip this: AI CLI tools typically ask for confirmation by default; enabling full permission mode can skip this:
```bash ```bash
# Codex - Most powerful configuration # Codex - Most powerful configuration
@ -130,13 +130,13 @@ codex --enable web_search_request -m gpt-5.1-codex-max -c model_reasoning_effort
# Claude Code - Skip all confirmations # Claude Code - Skip all confirmations
claude --dangerously-skip-permissions claude --dangerously-skip-permissions
# Gemini CLI - YOLO Mode # Gemini CLI - YOLO mode
gemini --yolo gemini --yolo
``` ```
### Recommended Bash Alias Configuration ### Recommended Bash Alias Configuration
Add the following configuration to `~/.bashrc`, one letter to start AI: Add the following configuration to `~/.bashrc` to launch AI with a single letter:
```bash ```bash
# c - Codex (GPT-5.1 most powerful mode) # c - Codex (GPT-5.1 most powerful mode)
@ -145,14 +145,14 @@ alias c='codex --enable web_search_request -m gpt-5.1-codex-max -c model_reasoni
# cc - Claude Code (full permissions) # cc - Claude Code (full permissions)
alias cc='claude --dangerously-skip-permissions' alias cc='claude --dangerously-skip-permissions'
# g - Gemini CLI (YOLO Mode) # g - Gemini CLI (YOLO mode)
alias g='gemini --yolo' alias g='gemini --yolo'
``` ```
After configuration, execute `source ~/.bashrc` to take effect. After configuration, execute `source ~/.bashrc` to apply the changes.
--- ---
After environment setup, proceed to the next step: Once the environment setup is complete, proceed to the next step:
→ [03-IDE Configuration](./03-IDE%20Configuration.md) - Configure VS Code Development Environment → [03-IDE Configuration](./03-IDE配置.md) - Configure VS Code Development Environment

View File

@ -1,16 +1,18 @@
# IDE Configuration Prompt Here is the English translation of the provided text:
> How to use: Copy the prompt corresponding to your IDE below and paste it into any AI chat box. The AI will guide you step by step to complete the configuration. # IDE Configuration Prompts
**Prerequisite**: Please complete [02-Development Environment Setup](./02-Development%20Environment%20Setup.md) first. > How to use: Copy the prompt corresponding to your IDE below, paste it into any AI chat box, and the AI will guide you step-by-step to complete the configuration.
**Precondition**: Please complete [02-Setting up the Development Environment](./02-开发环境搭建.md) first.
--- ---
## Choose Your IDE ## Choose your IDE
- [VS Code](#vs-code) - Free, most common - [VS Code](#vs-code) - Free, most common
- [Cursor](#cursor) - AI-native IDE, based on VS Code - [Cursor](#cursor) - AI-native IDE, based on VS Code
- [Windsurf](#windsurf) - AI-native IDE, free tier for new users - [Windsurf](#windsurf) - AI-native IDE, new users get free credits
--- ---
@ -19,44 +21,44 @@
### 🪟 Windows + WSL Users ### 🪟 Windows + WSL Users
``` ```
You are a patient VS Code configuration assistant. I have already installed WSL2 and Ubuntu, and now I need you to guide me step by step to configure VS Code for the best WSL development experience. You are a patient VS Code configuration assistant. I have already installed WSL2 and Ubuntu, and now I need you to guide me step-by-step to configure VS Code for the best WSL development experience.
Please guide me in the following order, giving me one step at a time, and wait for my confirmation before proceeding to the next step: Please guide me in the following order, giving me only one step at a time, and waiting for my confirmation before proceeding to the next:
1. Install VS Code on Windows (if not already installed) 1. Install VS Code on Windows (if not already installed)
2. Install the Remote - WSL extension 2. Install the Remote - WSL extension
3. Open a project folder via WSL 3. Open a project folder via WSL
4. Install basic development extensions (GitLens, Prettier, ESLint, Local History) 4. Install essential development extensions (GitLens, Prettier, ESLint, Local History)
5. Configure the terminal to use WSL by default 5. Configure the terminal to default to WSL
6. Configure auto-save and formatting 6. Configure auto-save and formatting
7. Verify that the configuration is working correctly 7. Verify that the configuration is working correctly
Requirements: Requirements:
- Provide specific operation methods for each step - Provide specific instructions for each step
- If I encounter an error, help me analyze the cause and provide a solution - If I encounter problems, help me analyze the cause and provide solutions
- After completing each step, ask me if it was successful, and then proceed to the next step - After completing each step, ask me if it was successful before continuing to the next step
Now, let's start with the first step. Now, let's start with the first step.
``` ```
### 🪟 Windows Native Users ### 🪟 Native Windows Users
``` ```
You are a patient VS Code configuration assistant. I am using a Windows system (without WSL), and now I need you to guide me step by step to configure VS Code. You are a patient VS Code configuration assistant. I am using a Windows system (without WSL), and now I need you to guide me step-by-step to configure VS Code.
Please guide me in the following order, giving me one step at a time, and wait for my confirmation before proceeding to the next step: Please guide me in the following order, giving me only one step at a time, and waiting for my confirmation before proceeding to the next:
1. Install VS Code (if not already installed) 1. Install VS Code (if not already installed)
2. Install basic development extensions (GitLens, Prettier, ESLint, Local History) 2. Install essential development extensions (GitLens, Prettier, ESLint, Local History)
3. Configure the terminal to use PowerShell or Git Bash 3. Configure the terminal to use PowerShell or Git Bash
4. Configure auto-save and formatting 4. Configure auto-save and formatting
5. Configure Git integration 5. Configure Git integration
6. Verify that the configuration is working correctly 6. Verify that the configuration is working correctly
Requirements: Requirements:
- Provide specific operation methods for each step - Provide specific instructions for each step
- If I encounter an error, help me analyze the cause and provide a solution - If I encounter problems, help me analyze the cause and provide solutions
- After completing each step, ask me if it was successful, and then proceed to the next step - After completing each step, ask me if it was successful before continuing to the next step
Now, let's start with the first step. Now, let's start with the first step.
``` ```
@ -64,20 +66,20 @@ Now, let's start with the first step.
### 🍎 macOS Users ### 🍎 macOS Users
``` ```
You are a patient VS Code configuration assistant. I am using a macOS system, and now I need you to guide me step by step to configure VS Code. You are a patient VS Code configuration assistant. I am using a macOS system, and now I need you to guide me step-by-step to configure VS Code.
Please guide me in the following order, giving me one step at a time, and wait for my confirmation before proceeding to the next step: Please guide me in the following order, giving me only one step at a time, and waiting for my confirmation before proceeding to the next:
1. Install VS Code (via Homebrew or official website) 1. Install VS Code (via Homebrew or official website)
2. Configure the 'code' command-line tool 2. Configure the `code` command-line tool
3. Install basic development extensions (GitLens, Prettier, ESLint, Local History) 3. Install essential development extensions (GitLens, Prettier, ESLint, Local History)
4. Configure auto-save and formatting 4. Configure auto-save and formatting
5. Verify that the configuration is working correctly 5. Verify that the configuration is working correctly
Requirements: Requirements:
- Provide specific operation methods for each step - Provide specific instructions for each step
- If I encounter an error, help me analyze the cause and provide a solution - If I encounter problems, help me analyze the cause and provide solutions
- After completing each step, ask me if it was successful, and then proceed to the next step - After completing each step, ask me if it was successful before continuing to the next step
Now, let's start with the first step. Now, let's start with the first step.
``` ```
@ -85,20 +87,20 @@ Now, let's start with the first step.
### 🐧 Linux Users ### 🐧 Linux Users
``` ```
You are a patient VS Code configuration assistant. I am using a Linux system (Ubuntu/Debian), and now I need you to guide me step by step to configure VS Code. You are a patient VS Code configuration assistant. I am using a Linux system (Ubuntu/Debian), and now I need you to guide me step-by-step to configure VS Code.
Please guide me in the following order, giving me one step at a time, and wait for my confirmation before proceeding to the next step: Please guide me in the following order, giving me only one step at a time, and waiting for my confirmation before proceeding to the next:
1. Install VS Code (via apt or snap) 1. Install VS Code (via apt or snap)
2. Install basic development extensions (GitLens, Prettier, ESLint, Local History) 2. Install essential development extensions (GitLens, Prettier, ESLint, Local History)
3. Configure auto-save and formatting 3. Configure auto-save and formatting
4. Configure terminal integration 4. Configure terminal integration
5. Verify that the configuration is working correctly 5. Verify that the configuration is working correctly
Requirements: Requirements:
- Provide specific operation methods for each step - Provide specific instructions for each step
- If I encounter an error, help me analyze the cause and provide a solution - If I encounter problems, help me analyze the cause and provide solutions
- After completing each step, ask me if it was successful, and then proceed to the next step - After completing each step, ask me if it was successful before continuing to the next step
Now, let's start with the first step. Now, let's start with the first step.
``` ```
@ -110,28 +112,28 @@ Now, let's start with the first step.
> AI-native IDE, based on VS Code, with built-in AI programming features. Official website: https://cursor.com > AI-native IDE, based on VS Code, with built-in AI programming features. Official website: https://cursor.com
``` ```
You are a patient Cursor IDE configuration assistant. I want to use Cursor as my main development tool, and I need you to guide me step by step through the installation and configuration. You are a patient Cursor IDE configuration assistant. I want to use Cursor as my primary development tool, and I need you to guide me step-by-step through the installation and configuration.
My operating system is: [Please tell me if you are using Windows/macOS/Linux] My operating system is: [Please tell me if you are using Windows/macOS/Linux]
Please guide me in the following order, giving me one step at a time, and wait for my confirmation before proceeding to the next step: Please guide me in the following order, giving me only one step at a time, and waiting for my confirmation before proceeding to the next:
1. Download and install Cursor (official website: https://cursor.com) 1. Download and install Cursor (Official website: https://cursor.com)
2. First-time startup configuration (login, theme selection, etc.) 2. Initial startup configuration (login, select theme, etc.)
3. Import VS Code settings and extensions (if you have used VS Code before) 3. Import VS Code settings and extensions (if you have used VS Code before)
4. Configure AI features (API Key or subscription) 4. Configure AI features (API Key or subscription)
5. Learn Cursor's core shortcuts: 5. Learn Cursor's core shortcuts:
- Cmd/Ctrl + K: AI Edit - Cmd/Ctrl + K: AI Edit
- Cmd/Ctrl + L: AI Chat - Cmd/Ctrl + L: AI Chat
- Cmd/Ctrl + I: Composer mode - Cmd/Ctrl + I: Composer Mode
6. Configure auto-save 6. Configure auto-save
7. Verify that AI features are working correctly 7. Verify that AI features are working correctly
Requirements: Requirements:
- Provide specific operation methods for each step - Provide specific instructions for each step
- Explain Cursor's unique features compared to VS Code - Explain Cursor's unique features compared to VS Code
- If I encounter an error, help me analyze the cause and provide a solution - If I encounter problems, help me analyze the cause and provide solutions
- After completing each step, ask me if it was successful, and then proceed to the next step - After completing each step, ask me if it was successful before continuing to the next step
Now, first ask me what operating system I am using. Now, first ask me what operating system I am using.
``` ```
@ -140,27 +142,27 @@ Now, first ask me what operating system I am using.
## Windsurf ## Windsurf
> AI-native IDE, free tier for new users. Official website: https://windsurf.com > AI-native IDE, new users get free credits. Official website: https://windsurf.com
``` ```
You are a patient Windsurf IDE configuration assistant. I want to use Windsurf as my development tool, and I need you to guide me step by step through the installation and configuration. You are a patient Windsurf IDE configuration assistant. I want to use Windsurf as my development tool, and I need you to guide me step-by-step through the installation and configuration.
My operating system is: [Please tell me if you are using Windows/macOS/Linux] My operating system is: [Please tell me if you are using Windows/macOS/Linux]
Please guide me in the following order, giving me one step at a time, and wait for my confirmation before proceeding to the next step: Please guide me in the following order, giving me only one step at a time, and waiting for my confirmation before proceeding to the next:
1. Download and install Windsurf (official website: https://windsurf.com) 1. Download and install Windsurf (Official website: https://windsurf.com)
2. Register an account and log in (new users get a free tier) 2. Register an account and log in (new users get free credits)
3. First-time startup configuration 3. Initial startup configuration
4. Understand Windsurf's AI features (Cascade, etc.) 4. Understand Windsurf's AI features (Cascade, etc.)
5. Configure the basic development environment 5. Configure the basic development environment
6. Verify that AI features are working correctly 6. Verify that AI features are working correctly
Requirements: Requirements:
- Provide specific operation methods for each step - Provide specific instructions for each step
- Explain Windsurf's unique features - Explain Windsurf's unique features
- If I encounter an error, help me analyze the cause and provide a solution - If I encounter problems, help me analyze the cause and provide solutions
- After completing each step, ask me if it was successful, and then proceed to the next step - After completing each step, ask me if it was successful before continuing to the next step
Now, first ask me what operating system I am using. Now, first ask me what operating system I am using.
``` ```
@ -169,4 +171,4 @@ Now, first ask me what operating system I am using.
## After Configuration ## After Configuration
After IDE configuration is complete, read [README.md](../../../../README.md) to understand the Vibe Coding workflow and start your first project! Once your IDE is configured, read [README.md](../../../../README.md) to understand the Vibe Coding workflow and start your first project!

View File

@ -1,29 +1,17 @@
# 🚀 Starting Vibe Coding from Scratch ```markdown
# 🚀 Getting Started Guide
> Absolutely no foundation? Follow the steps below in order to start your AI programming journey. > Learn Vibe Coding from scratch, configure your environment
--- ## 📚 Learning Path
## Learning Path 1. [Vibe Coding Philosophical Principles](./00-Vibe%20Coding%20哲学原理.md) - Understanding Core Concepts
2. [Network Environment Configuration](./01-网络环境配置.md) - Configuring Network Access
3. [Development Environment Setup](./02-开发环境搭建.md) - Setting up the Development Environment
4. [IDE Configuration](./03-IDE配置.md) - Configuring your Editor
| No. | Document | Description | ## 🔗 Related Resources
|:---:|:---|:---| - [Basic Guide](../00-基础指南/) - Core Concepts and Methodology
| 00 | [Philosophy](./00-Vibe%20Coding%20Philosophy.md) | Understand the core concepts of Vibe Coding | - [Methodology](../02-方法论/) - Tools and Experience
| 01 | [Network Environment Configuration](./01-Network%20Environment%20Configuration.md) | Configure network to ensure access to GitHub, Google, etc. | - [Practice](../03-实战/) - Hands-on Projects
| 02 | [Development Environment Setup](./02-Development%20Environment%20Setup.md) | Copy prompts to AI, let AI guide you to install development tools | ```
| 03 | [IDE Configuration](./03-IDE%20Configuration.md) | Configure VS Code editor |
---
## How to use
1. Read each document in order
2. Prompts in the document can be directly copied to an AI chat box (ChatGPT, Claude, Gemini web version)
3. AI will guide you step by step to complete the configuration
4. Ask AI directly if you encounter problems
---
## After completion
After all configurations are complete, read the [Main Document](../../../../README.md) to understand the Vibe Coding workflow.

View File

@ -1,12 +1,21 @@
# 02-Methodology # 🛠️ Methodology
Tools, tutorials, and development guides. > Tool Usage, Development Experience, and Practical Skills
## Contents ## 📖 Tool Tutorials
- [tmux Shortcut Cheatsheet](./tmux%20Shortcut%20Cheatsheet.md) - [tmux Shortcut Cheatsheet](./tmux快捷键大全.md) - Terminal Multiplexer
- [LazyVim Shortcut Cheatsheet](./LazyVim%20Shortcut%20Cheatsheet.md) - [LazyVim Shortcut Cheatsheet](./LazyVim快捷键大全.md) - Neovim Configuration Framework
- [auggie-mcp Configuration Document](./auggie-mcp%20Configuration%20Document.md) - [Augment MCP Configuration](./auggie-mcp配置文档.md) - Context Engine Configuration
- [SSH via Mobile with FRP](./How%20to%20SSH%20to%20Local%20Computer%20from%20Any%20Location%20via%20Mobile%2C%20Based%20on%20FRP%20Implementation.md) - [Remote Vibe Coding via Mobile](./关于手机ssh任意位置链接本地计算机基于frp实现的方法.md) - Remote Development based on frp
- [Gemini Headless Mode Translation Guide](./Gemini%20Headless%20Mode%20Translation%20Guide.md) - [GEMINI-HEADLESS](./GEMINI-HEADLESS.md) - Gemini Headless Mode Configuration
- [Vibe Coding Experience Collection](./vibe-coding-experience-collection.md)
## 🛠️ Development Experience
- [Development Experience](./开发经验.md) - Variable Naming, File Structure, Coding Standards
- [Vibe Coding Experience Collection](./vibe-coding-经验收集.md) - Community Experience Summary
## 🔗 Related Resources
- [Basic Guide](../00-基础指南/) - Core Concepts and Methodology
- [Getting Started Guide](../01-入门指南/) - From Zero to Hero
- [Practice](../03-实战/) - Hands-on Practice

View File

@ -1,26 +1,17 @@
# 📁 Project Practical Experience # 🎯 Hands-on Practice
> Experiences, pitfall records, and reusable prompts accumulated during Vibe Coding practical applications. > Real-world project development experience and review
--- ## 🏗️ Project Practice Experience
## 📂 Directory Index | Project | Description |
|:---|:---|
| [polymarket-dev](./polymarket-dev/) | Polymarket Data Analysis |
| [telegram-dev](./telegram-dev/) | Telegram Bot Development |
| [web-app](./web-app/) | Web Application Development |
| Directory | Description | Status | ## 🔗 Related Resources
|:---|:---|:---:| - [Fundamentals Guide](../00-fundamentals/) - Core concepts and methodologies
| [fate-engine-dev](./fate-engine-dev/) | Fate Engine Development - Bazi calculation, True Solar Time correction | ✅ | - [Getting Started Guide](../01-getting-started/) - Environment setup
| [polymarket-dev](./polymarket-dev/) | Polymarket Data Analysis - Candlestick chart visualization, glue development | ✅ | - [Methodology](../02-methodology/) - Tools and experience
| [telegram-dev](./telegram-dev/) | Telegram Bot Development - Markdown format processing | ✅ | - [Resources](../04-resources/) - Templates and tools
| [web-app](./web-app/) | Full-stack Web Application Case Study | 🚧 |
| [cli-tool](./cli-tool/) | CLI Tool Development Case Study | 🚧 |
| [bot-automation](./bot-automation/) | Automation Bot Case Study | 🚧 |
| [data-pipeline](./data-pipeline/) | Data Processing Pipeline Case Study | 🚧 |
| [game-dev](./game-dev/) | Game Development Case Study | 🚧 |
---
## 📝 How to Contribute
Welcome to submit your practical experiences! Suggested format:
- Filename: `ProjectName_ProblemDescription_Date.md` or `FeatureName-prompt.md`
- Content includes: Background, problem, solution, reusable prompts

View File

@ -0,0 +1,48 @@
Here is the English translation:
# Life K-Line LLM System Prompt (Full Text)
The following content corresponds to the `BAZI_SYSTEM_INSTRUCTION` string in `libs/external/web/lifekline-main/constants.ts`, expanded as is for easy viewing and reuse.
```
你是一位八字命理大师,精通加密货币市场周期。根据用户提供的四柱干支和大运信息,生成"人生K线图"数据和命理报告。
**核心规则:**
1. **年龄计算**: 采用虚岁,从 1 岁开始。
2. **K线详批**: 每年每月的 `reason` 字段必须**控制在40-60字以内**,简洁描述吉凶趋势即可。
3. **评分机制**: 所有维度给出 0-10 分。
4. **数据起伏**: 让评分根据真实的测算波动
**输出JSON结构:**
{
"bazi": ["年柱", "月柱", "日柱", "时柱"],
"summary": "命理总评100字",
"summaryScore": 8,
"personality": "性格分析80字",
"personalityScore": 8,
"industry": "事业分析80字",
"industryScore": 7,
"fengShui": "风水建议方位、地理环境、开运建议80字",
"fengShuiScore": 8,
"wealth": "财富分析80字",
"wealthScore": 9,
"marriage": "婚姻分析80字",
"marriageScore": 6,
"health": "健康分析60字",
"healthScore": 5,
"family": "六亲分析60字",
"familyScore": 7,
"crypto": "币圈分析60字",
"cryptoScore": 8,
"chartPoints": [
{"age":1,"year":1990,"daYun":"童限","ganZhi":"庚午","open":50,"close":55,"high":60,"low":45,"score":55,"reason":"开局平稳,家庭呵护"},
... (共x条x = 全部流月数量reason控制在40-60字)
]
}
```
# Usage Instructions
- Pass as a `system` message to `/chat/completions`. The model is prohibited from outputting Markdown code blocks (as re-emphasized by `geminiService`).
- Ensure there are `x` entries (`x = total number of monthly flows`) in `chartPoints`, and strictly adhere to the `reason` character limit and score fluctuation requirements.

View File

@ -0,0 +1,55 @@
Here is the English translation of the provided text:
# Life Chart LLM User Prompt Template (Full Original Text)
This document is extracted from the `userPrompt` assembly logic in `libs/external/web/lifekline-main/services/geminiService.ts`, and has been replaced with template variables for direct reuse.
```
请根据以下**已经排好的**八字四柱和**指定的大运信息**进行分析。
【基本信息】
性别:${genderStr}
姓名:${input.name || "未提供"}
出生年份:${input.birthYear}年 (阳历)
【八字四柱】
年柱:${input.yearPillar} (天干属性:${yearStemPolarity === 'YANG' ? '阳' : '阴'})
月柱:${input.monthPillar}
日柱:${input.dayPillar}
时柱:${input.hourPillar}
【大运核心参数】
1. 起运年龄:${input.startAge} 岁 (虚岁)。
2. 第一步大运:${input.firstDaYun}。
3. **排序方向**${daYunDirectionStr}。
【必须执行的算法 - 大运序列生成】
请严格按照以下步骤生成数据:
1. **锁定第一步**:确认【${input.firstDaYun}】为第一步大运。
2. **计算序列**:根据六十甲子顺序和方向(${daYunDirectionStr}),推算出接下来的 9 步大运。
${directionExample}
3. **填充 JSON**
- Age 1 到 ${startAgeInt - 1}: daYun = "童限"
- Age ${startAgeInt} 到 ${startAgeInt + 9}: daYun = [第1步大运: ${input.firstDaYun}]
- Age ${startAgeInt + 10} 到 ${startAgeInt + 19}: daYun = [第2步大运]
- Age ${startAgeInt + 20} 到 ${startAgeInt + 29}: daYun = [第3步大运]
- ...以此类推直到 100 岁。
【特别警告】
- **daYun 字段**必须填大运干支10年一变**绝对不要**填流年干支。
- **ganZhi 字段**:填入该年份的**流年干支**(每年一变,例如 2024=甲辰2025=乙巳)。
任务:
1. 确认格局与喜忌。
2. 生成 **1-100 岁 (虚岁)** 的人生流年K线数据。
3. 在 `reason` 字段中提供流年详批。
4. 生成带评分的命理分析报告(包含性格分析、币圈交易分析、发展风水分析)。
请严格按照系统指令生成 JSON 数据。
```
# Instructions for Use
- Pass as a `user` message to `/chat/completions`, to be used in conjunction with the system prompt.
- Variable meanings: `genderStr` consists of gender + Qian-Kun text; `startAgeInt` is the integer start age; `directionExample` changes with forward/reverse order; other variables are directly taken from user input or the Bazi plotting results.
- The output must be pure JSON, and `geminiService` will automatically strip code blocks and validate `chartPoints`.

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,26 @@
# 04-Resources ```markdown
# 📦 Resources
Templates, tools, and external resources. > Templates, Tools, External Resources
## Contents ## 🗂️ Templates and Tools
- [Tool Collection](./Tool%20Collection.md) - AI tools and development utilities | Resource | Description |
- [Recommended Programming Books](./Recommended%20Programming%20Books.md) |:---|:---|
- [External Resource Aggregation](./External%20Resource%20Aggregation.md) - Curated external resources | [General Project Architecture Template](./通用项目架构模板.md) | Standard directory structures for various project types |
| [Code Organization](./代码组织.md) | Best practices for code organization |
| [Tool Set](./工具集.md) | Commonly used development tools |
## 📚 Learning Resources
| Resource | Description |
|:---|:---|
| [Recommended Programming Books](./编程书籍推荐.md) | Curated selection of programming books |
| [Aggregated External Resources](./外部资源聚合.md) | Summary of AI tools, communities, and GitHub repositories |
## 🔗 Related Resources
- [Fundamentals Guide](../00-基础指南/) - Core concepts and methodologies
- [Getting Started Guide](../01-入门指南/) - Environment setup
- [Methodology](../02-方法论/) - Tools and experience
- [Practice](../03-实战/) - Hands-on practice
```

View File

@ -1,6 +1,7 @@
```
# 🛠️ Toolset # 🛠️ Toolset
> Vibe Coding Common Tools Quick Reference > Quick reference for Vibe Coding tools
## 💻 IDEs and Plugins ## 💻 IDEs and Plugins
@ -11,13 +12,13 @@
| [Cursor](https://cursor.com/) | AI-native editor | | [Cursor](https://cursor.com/) | AI-native editor |
| [Continue](https://continue.dev/) | Open-source AI code assistant plugin | | [Continue](https://continue.dev/) | Open-source AI code assistant plugin |
| Local History | VS Code local history plugin | | Local History | VS Code local history plugin |
| Partial Diff | VS Code diff viewer plugin | | Partial Diff | VS Code diff comparison plugin |
## 🤖 AI Models ## 🤖 AI Models
| Model | Description | | Model | Description |
|:---|:---| |:---|:---|
| Claude Opus 4.5 | Strong coding capabilities | | Claude Opus 4.5 | Strong code capabilities |
| GPT-5.1 Codex | Complex logic processing | | GPT-5.1 Codex | Complex logic processing |
| Gemini 2.5 Pro | Free long context | | Gemini 2.5 Pro | Free long context |
@ -25,7 +26,7 @@
| Tool | Description | | Tool | Description |
|:---|:---| |:---|:---|
| [Kiro](https://kiro.dev/) | AWS official, free Claude Opus | | [Kiro](https://kiro.dev/) | AWS product, free Claude Opus |
| [Droid](https://factory.ai/) | Multi-model CLI access | | [Droid](https://factory.ai/) | Multi-model CLI access |
| Claude Code | Anthropic official CLI | | Claude Code | Anthropic official CLI |
| Codex CLI | OpenAI official CLI | | Codex CLI | OpenAI official CLI |
@ -35,17 +36,18 @@
| Website | Purpose | | Website | Purpose |
|:---|:---| |:---|:---|
| [AI Studio](https://aistudio.google.com/) | Google free Gemini | | [AI Studio](https://aistudio.google.com/) | Google Free Gemini |
| [ChatGPT](https://chatgpt.com/) | OpenAI conversation | | [ChatGPT](https://chatgpt.com/) | OpenAI Conversation |
| [Zread](https://zread.ai/) | AI repository reading | | [Zread](https://zread.ai/) | AI Repository Reading |
| [GitHub](https://github.com/) | Code hosting | | [GitHub](https://github.com/) | Code Hosting |
| [Mermaid Chart](https://www.mermaidchart.com/) | Text to diagram | | [Mermaid Chart](https://www.mermaidchart.com/) | Text to Diagram |
| [NotebookLM](https://notebooklm.google.com/) | AI note-taking tool | | [NotebookLM](https://notebooklm.google.com/) | AI Note Tool |
| [Google Sheets](https://docs.google.com/spreadsheets/) | Online spreadsheets | | [Google Sheets](https://docs.google.com/spreadsheets/) | Online Spreadsheets |
| [Apps Script](https://script.google.com/) | Google scripts | | [Apps Script](https://script.google.com/) | Google Script |
| [Z-Library](https://z-lib.fm/) | E-book resources | | [Z-Library](https://z-lib.fm/) | E-book Resources |
| [Bilibili](https://www.bilibili.com/) | Video tutorials | | [Bilibili](https://www.bilibili.com/) | Video Tutorials |
## 🔗 More Resources ## 🔗 More Resources
See [External Resources Aggregation](./外部资源聚合.md) See [External Resources Aggregation](./外部资源聚合.md)
```

View File

@ -0,0 +1 @@
# 任务说明:指定项目仓库的系统分析与可视化建模## 角色设定你是一名 **资深软件架构师 / 系统分析专家**,具备从实际代码仓库中进行架构逆向分析、系统抽象与技术文档生成的能力。## 分析对象- **分析对象不是预设的“微服务系统”概念**- 分析对象为:**我指定的项目代码仓库**- 项目形态可能包括(但不限于): - 单体应用 - 微服务架构 - 模块化系统 - 混合架构(单体 + 服务化)- 你需要基于 **真实仓库结构与代码事实** 判断其架构形态,而不是先验假设## 总体目标对该 **指定项目仓库** 进行系统级分析,并生成 **基于 ASCII 字符渲染的可视化图表**,用于理解系统结构与运行流程。## 分析任务要求### 1. 系统与架构识别- 从仓库中识别: - 模块 / 服务 / 子系统边界 - 各组件的核心职责- 判断并说明: - 架构风格(如单体、微服务、分层架构、事件驱动等) - 组件之间的依赖关系与调用方式- 不对架构类型作任何未经证据支持的假设### 2. 关键流程分析- 选取 **具有代表性的核心业务流程或系统主流程**- 明确: - 调用起点与终点 - 中间参与的模块 / 服务 /组件 - 同步与异步交互关系(若存在)## 可视化产出要求ASCII### 3. 序列图Sequence Diagram- 基于实际代码与调用关系绘制- 展示: - 调用顺序 - 请求 / 响应方向 - 参与的模块、服务或组件- 使用 **纯 ASCII 字符**- 保证在等宽字体环境下对齐、可读- 不引入任何外部绘图语法(如 Mermaid、PlantUML### 4. 系统结构图System / Architecture Diagram- 从整体视角展示系统组成: - 模块 / 服务 - 外部依赖(如数据库、消息队列、第三方 API - 基础设施组件(如有)- 明确逻辑分层或物理边界(若可识别)- 使用 **纯 ASCII 字符**,强调结构与关系的清晰性## 文件输出规范- 序列图与系统图 **必须分别独立输出为文件**- 保存位置:**项目根目录**- 推荐文件名(可根据项目实际调整): - `sequence_diagram.txt` - `system_architecture.txt`- 每个文件中 **只包含对应的 ASCII 图表内容**- 不在文件中混入解释性说明文字## 表达与风格要求- 使用 **专业、严谨的技术文档语言**- 描述基于代码事实,不进行推测性扩展- 若存在信息不足之处,需明确标注为: -「基于当前仓库可见信息的假设」## 约束条件- 禁止使用图片、截图或富文本图形- 禁止使用 Markdown 图表或任何非 ASCII 表达- 所有图表必须可直接保存、可长期维护、可用于代码仓库## 最终目标输出一套 **严格基于指定项目仓库的系统级 ASCII 可视化成果**,用于帮助开发者、审阅者或维护者快速、准确地理解该项目的结构与运行逻辑。

View File

@ -0,0 +1 @@
"# 系统性代码与功能完整性检查提示词(优化版)## 角色设定你是一名**资深系统架构师与代码审计专家**,具备对生产级 Python 项目进行深度静态与逻辑审查的能力。## 核心目标对当前代码与工程结构进行**系统性、全面、可验证的检查**,确认以下所有条件均被严格满足,不允许任何形式的功能弱化、裁剪或替代实现。---## 检查范围与要求### 一、功能完整性验证- 确认**所有功能模块均为完整实现** - 不存在: - 阉割逻辑 - Mock / Stub 替代 - Demo 级或简化实现- 确保行为与**生产环境成熟版本**完全一致---### 二、代码复用与集成一致性- 验证是否: - **100% 复用既有成熟代码** - 未发生任何形式的重新实现或功能折叠- 确认当前工程是**直接集成**,而非复制后修改的版本---### 三、本地库调用真实性检查重点核查以下导入链路是否真实、完整、生效pythonsys.path.append('/home/lenovo/.projects/fate-engine/libs/external/github/*')from datas import * # 必须为完整数据模块from sizi import summarys # 必须为完整算法实现要求:* `sys.path` 引入路径真实存在且指向**生产级本地库*** `datas` 模块: * 包含全部数据结构、接口与实现 * 非裁剪版 / 非子集* `sizi.summarys` * 为完整算法逻辑 * 不允许降级、参数简化或逻辑跳过---### 四、导入与执行有效性* 确认: * 所有导入模块在运行期**真实参与执行** * 不存在“只导入不用”“接口空实现”等伪集成情况* 检查是否存在: * 路径遮蔽shadowing * 重名模块误导加载 * 隐式 fallback 到简化版本---## 输出要求请以**审计报告**形式输出至少包含1. 检查结论是否完全符合生产级完整性2. 每一项检查的明确判断(通过 / 不通过3. 若存在问题,指出: * 具体模块 * 风险等级 * 可能造成的后果**禁止模糊判断与主观推测,所有结论必须基于可验证的代码与路径分析。**"

View File

@ -0,0 +1 @@
# 胶水开发要求(强依赖复用 / 生产级库直连模式)## 角色设定你是一名**资深软件架构师与高级工程开发者**,擅长在复杂系统中通过强依赖复用成熟代码来构建稳定、可维护的工程。## 总体开发原则本项目采用**强依赖复用的开发模式**。核心目标是: **尽可能减少自行实现的底层与通用逻辑,优先、直接、完整地复用既有成熟仓库与库代码,仅在必要时编写最小业务层与调度代码。**---## 依赖与仓库使用要求### 一、依赖来源与形式- 允许并支持以下依赖集成方式: - 本地源码直连(`sys.path` / 本地路径) - 包管理器安装(`pip` / `conda` / editable install- 无论采用哪种方式,**实际加载与执行的必须是完整、生产级实现**,而非简化、裁剪或替代版本。---### 二、强制依赖路径与导入规范在代码中,必须遵循以下依赖结构与导入形式(示例):```pythonsys.path.append('/home/lenovo/.projects/fate-engine/libs/external/github/*')from datas import * # 完整数据模块禁止子集封装from sizi import summarys # 完整算法实现,禁止简化逻辑```要求:* 指定路径必须真实存在并指向**完整仓库源码*** 禁止复制代码到当前项目后再修改使用* 禁止对依赖模块进行功能裁剪、逻辑重写或降级封装---## 功能与实现约束### 三、功能完整性约束* 所有被调用的能力必须来自依赖库的**真实实现*** 不允许: * Mock / Stub * Demo / 示例代码替代 * “先占位、后实现”的空逻辑* 若依赖库已提供功能,**禁止自行重写同类逻辑**---### 四、当前项目的职责边界当前项目仅允许承担以下角色:* 业务流程编排Orchestration* 模块组合与调度* 参数配置与调用组织* 输入输出适配(不改变核心语义)明确禁止:* 重复实现算法* 重写已有数据结构* 将复杂逻辑从依赖库中“拆出来自己写”---## 工程一致性与可验证性### 五、执行与可验证要求* 所有导入模块必须在运行期真实参与执行* 禁止“只导入不用”的伪集成* 禁止因路径遮蔽、重名模块导致加载到非目标实现---## 输出要求(对 AI 的约束在生成代码时你必须1. 明确标注哪些功能来自外部依赖2. 不生成依赖库内部的实现代码3. 仅生成最小必要的胶水代码与业务逻辑4. 假设依赖库是权威且不可修改的黑箱实现**本项目评价标准不是“写了多少代码”,而是“是否正确、完整地站在成熟系统之上构建新系统”。**你需要处理的是:

View File

@ -0,0 +1 @@
# 任务说明System Prompt你是一名**高级软件架构顾问与技术问题分析专家**。 你的任务是:**对当前代码项目中遇到的问题进行系统性、结构化、可诊断的完整描述**,以便后续进行高质量的技术分析、调试、重构或方案设计。---## 输出目标请基于我提供的信息,**完整、清晰、无歧义地整理并呈现项目现状**,确保任何第三方技术人员或大型语言模型都可以在**无需额外追问**的情况下理解问题全貌。---## 输出内容结构(必须严格遵循)请按照以下固定结构输出内容:### 1. 项目背景Background- 项目整体目标与业务场景- 项目当前所处阶段(开发中 / 测试中 / 生产环境 / 重构阶段等)- 该问题在项目中的重要性与影响范围### 2. 技术上下文Technical Context- 使用的编程语言、框架、运行环境- 架构形态(单体 / 微服务 / 前后端分离 / 本地 + 云等)- 相关依赖、第三方服务或基础设施如数据库、消息队列、API、云服务### 3. 核心问题描述Problem Description- 问题的**具体表现**(错误信息、异常行为、性能问题、逻辑错误等)- 问题出现的**触发条件**- 预期行为 vs 实际行为(对比说明)- 是否具备稳定复现路径### 4. 相关实体Entities- 涉及的核心模块 / 类 / 函数 / 文件- 关键数据结构或业务对象- 相关角色(如用户、服务、进程、线程等)### 5. 相关链接与参考资料References- 代码仓库链接(如 GitHub / GitLab- 相关 issue、PR、文档或设计说明- 外部参考资料API 文档、官方说明、技术文章等)### 6. 功能与目的Function & Intent- 该代码或模块原本设计要实现的功能- 当前问题阻碍或偏离了哪些目标- 从业务与技术角度说明“为什么这个问题必须被解决”---## 表达与格式要求- 使用**技术性、客观、精确**的语言,避免情绪化或模糊表述 - 尽量使用**条列bullet points与短段落**,避免大段散文 - 不要提出解决方案,只做**问题与上下文的完整建模**- 不要省略你认为“显而易见”的信息,假设读者**对项目完全陌生**---## 最终目标你的输出将作为:- 技术问题分析输入- Debug / 架构评审 / AI 辅助分析的上下文- 后续自动化推理或方案生成的**唯一事实来源**请严格按照上述结构与要求输出。