docs: 更新文档和技能

This commit is contained in:
tukuaiai 2025-12-18 00:51:26 +08:00
parent 1c37451a83
commit 6eb309b1e4
1 changed files with 106 additions and 0 deletions

View File

@ -0,0 +1,106 @@
# Essential Technical Documentation Generation Prompt
## Essential General Version
```
Based on the current project files, help me generate technical documentation:
【Project Information】
Name: {Project Name}
Problem: {Core Problem}
Technology: {Tech Stack}
【Document Structure - 4 Parts】
1⃣ Problem and Solution (300 words)
- What is the problem
- Why it needs to be solved
- How to solve it
- Why this solution was chosen
2⃣ Technical Implementation (300 words)
- What technologies were used
- Role of each technology
- Explanation of key technical points
- Key parameters or configurations
3⃣ System Architecture (simple flowchart)
- Complete data flow
- Relationships between parts
- Execution process
4⃣ Achievements and Benefits (200 words)
- What was solved
- What benefits were brought
- Reusable aspects
```
---
## CoinGlass Project - Practical Example
**1⃣ Problem and Solution**
The heatmap on the CoinGlass website cannot be obtained via API and is dynamically rendered by React.
Solution: Use Playwright browser automation for screenshots.
- Launch a headless browser, visit the website, wait for animation to complete.
- Take a precise screenshot and crop it to get a clean heatmap.
Why this solution was chosen:
- API: No public API for the website ❌
- Scraper: Cannot handle JavaScript dynamic rendering ❌
- Screenshot: Directly obtains the final visual result, most accurate ✅
**2⃣ Technical Implementation**
- **Playwright** - Browser automation framework, controls browser behavior.
- **Chromium** - Headless browser engine, executes JavaScript.
- **PIL** - Python Imaging Library, for precise cropping.
Key technical points:
- Waiting strategy: 5 seconds initial + 7 seconds animation (ensures React rendering and CSS animations complete).
- CSS selector: `[class*="treemap"]` to locate the heatmap container.
- Precise cropping: Left -1px, Right -1px, Top -1px, Bottom -1px → 840×384px → 838×382px (completely borderless).
**3⃣ System Architecture**
```
Crontab scheduled task (hourly)
Python script starts
Playwright launches browser
Visit website → Wait (5s) → Click coin → Wait (7s)
Screenshot (840×384px)
PIL cropping (Left -1, Right -1, Top -1, Bottom -1)
Final Heatmap (838×382px)
Save to local directory
```
**4⃣ Achievements and Benefits**
Achievements:
- ✓ Automatically and regularly obtains heatmaps (no manual intervention).
- ✓ 100% success rate (completely reliable).
- ✓ Complete historical data (persistently saved).
Benefits:
- Efficiency: From manual 5 minutes → automatic 16.5 seconds.
- Annual savings: 243 hours of work time.
- Quality: Consistent screenshot quality.
Reusable experience:
- Playwright browser automation best practices.
- Anti-scraping detection bypass strategies.
- Dynamic rendering page waiting patterns.
---
*Version: v1.0 (Essential Edition)*
*Update: 2025-10-19*