docs: 更新文档和技能
This commit is contained in:
parent
fb74acbd9b
commit
4f5bc01e3d
332
AGENTS.md
332
AGENTS.md
|
|
@ -1,195 +1,149 @@
|
||||||
# Repository Guidelines
|
# Repository Guidelines
|
||||||
|
|
||||||
## Project Structure & Module Organization
|
## Project Structure & Module Organization
|
||||||
- 根目录:`README.md` 给出全貌,`Makefile` 封装日常命令,`CONTRIBUTING.md` 说明贡献流程,`LICENSE` 载明协议。保持根目录扁平,避免巨石文件。
|
- 根目录:`README.md` 给出全貌,`Makefile` 封装日常命令,`CONTRIBUTING.md` 说明贡献流程,`LICENSE` 载明协议。保持根目录扁平,避免巨石文件。
|
||||||
- 多语言 i18n:`i18n/<lang>/` 统一三层结构(documents / prompts / skills)。现有语言:中文 `zh`、英文 `en`、希伯来语 `he`,以及高频/常用的 `es`、`hi`、`ar`、`pt`、`ru`、`fr`、`de`、`ja`、`ko`、`it`、`tr`、`nl`、`pl`、`id`、`vi`、`th`、`fa`、`uk`、`bn`、`ta`、`ur`、`ms`、`sw`、`ha`;新增语言遵循同样层级。
|
- 多语言 i18n:`i18n/<lang>/` 统一三层结构(documents / prompts / skills)。现有语言:中文 `zh`、英文 `en`、希伯来语 `he`,以及 `es`、`hi`、`ar`、`pt`、`ru`、`fr`、`de`、`ja`、`ko`、`it`、`tr`、`nl`、`pl`、`id`、`vi`、`th`、`fa`、`uk`、`bn`、`ta`、`ur`、`ms`、`sw`、`ha`;新增语言遵循同样层级。
|
||||||
- 文档库:`i18n/zh/documents/` 仍是默认中文方法论入口(如 `i18n/zh/documents/模板与资源/代码组织.md` 等),新增语言文档按需在对应 `documents/` 下创建并保持同步。
|
- 文档库:`i18n/zh/documents/` 是默认中文方法论入口,含子目录:`方法论与原则/`、`模板与资源/`、`教程与指南/`、`外部资源聚合/`、`胶水编程/`、`从零开始vibecoding/` 等。
|
||||||
- 提示词资产:`i18n/zh/prompts/` 按角色拆分(system / assistant / coding / user),`libs/external/prompts-library/` 提供 Excel ↔ Markdown 互转工具与脚本目录,便于批量维护提示词,适合作为“单一真实来源”。
|
- 提示词资产:`i18n/zh/prompts/` 按角色拆分(`system_prompts/`、`assistant_prompts/`、`coding_prompts/`、`user_prompts/`、`meta_prompts/`),`libs/external/prompts-library/` 提供 Excel ↔ Markdown 互转工具。
|
||||||
- 代码与集成:`libs/` 预留核心实现骨架,`common/`、`database/`、`external/` 分别对应通用模型、存储适配与外部依赖登记;新增模块需保持分层边界与单一职责,避免跨层调用。
|
- 技能库:`i18n/zh/skills/` 包含模块化技能集,如 `ccxt/`、`postgresql/`、`telegram-dev/`、`claude-code-guide/`、`claude-skills/` 等 16+ 个技能目录。
|
||||||
- 备份:`backups/` 内含 `一键备份.sh` 与 `快速备份.py`,用于本地快照或同步,请先在隔离目录试跑,确认输出路径与权限。
|
- 代码与集成:`libs/` 预留核心实现骨架,`common/`(含 `models/`、`utils/`)、`database/`、`external/` 分别对应通用模型、存储适配与外部依赖。
|
||||||
|
- 外部工具:`libs/external/` 含 `prompts-library/`、`l10n-tool/`、`my-nvim/`、`MCPlayerTransfer/`、`XHS-image-to-PDF-conversion/` 等。
|
||||||
## Build, Test, and Development Commands
|
- 备份:`backups/` 内含 `一键备份.sh`、`快速备份.py` 和 `gz/` 存档目录。
|
||||||
- `make help`:列出所有 Make 目标,是新人快速上手的入口。
|
- 脚本:`scripts/` 目录预留项目脚本。
|
||||||
- `make lint`:使用 `markdownlint-cli` 校验全仓库 Markdown,一旦新增文档请先跑通(需本地 Node/npm 环境,可用 `npm install -g markdownlint-cli` 安装)。
|
- GitHub 配置:`.github/` 含 `ISSUE_TEMPLATE/`、`PULL_REQUEST_TEMPLATE.md`、`SECURITY.md`、`FUNDING.yml`。
|
||||||
- `make build` / `make test` / `make clean`:目前为占位,落地具体实现后务必更新脚本和说明;建议在 `Makefile` 旁补充注释并保持幂等,避免修改全局状态。
|
|
||||||
- 提示词转换:进入 `libs/external/prompts-library/` 后执行 `python main.py` 按交互提示进行转换,运行前请确认虚拟环境、依赖与输出目录,并在完成后检查生成 Markdown 是否符合 lint 规则。
|
## Build, Test, and Development Commands
|
||||||
|
- `make help`:列出所有 Make 目标。
|
||||||
## Coding Style & Naming Conventions
|
- `make lint`:使用 `markdownlint-cli` 校验全仓库 Markdown。
|
||||||
- 文字层:文档、注释、日志使用中文;代码符号(函数 / 变量 / 模块)统一英文且语义直白,避免晦涩缩写。
|
- `make build` / `make test` / `make clean`:目前为占位。
|
||||||
- 缩进与排版:全仓保持空格缩进(2 或 4 空格任选其一但不得混用);Markdown 列表、代码块与表格对齐清晰,行宽控制在 120 列内。Git diff 可读性优先。
|
- 提示词转换:`cd libs/external/prompts-library && python main.py`。
|
||||||
- 设计品味:优先消除分支与重复;函数力求单一职责且短小;命名遵循小写加中划线或下划线,不使用空格与特殊字符;跨模块接口保持稳定签名。
|
- 备份:`bash backups/一键备份.sh` 或 `python backups/快速备份.py`。
|
||||||
- 依赖管理:新增工具或库时记录安装方式、最小版本与来源,必要时在 `i18n/zh/documents/模板与资源/工具集.md` 或 README 中补充,并说明为何需要它(性能、兼容、功能)。
|
|
||||||
|
## Coding Style & Naming Conventions
|
||||||
## Testing Guidelines
|
- 文字层:文档、注释、日志使用中文;代码符号统一英文且语义直白。
|
||||||
- 当前无实测用例;引入代码时请至少提供最小可复现测试。推荐 Python 使用 `pytest`,文件命名 `test_*.py`,夹具精简可读,遵循 red-green-refactor 循环。
|
- 缩进与排版:全仓保持空格缩进(2 或 4 空格不混用);行宽控制在 120 列内。
|
||||||
- 文档与提示词改动:提交前运行 `make lint`;如转换脚本涉及数据,附带示例输入 / 输出说明或最小数据样例,确保可重复。
|
- 设计品味:优先消除分支与重复;函数单一职责且短小;命名小写加中划线或下划线。
|
||||||
- 覆盖率基线由模块维护者设定;若暂无标准,确保主流程和边界条件均可被测试验证,必要时在 PR 描述中写明未覆盖的风险,并建议后续补测计划。
|
- 依赖管理:新增工具或库时记录安装方式、最小版本与来源。
|
||||||
|
|
||||||
## Commit & Pull Request Guidelines
|
## Testing Guidelines
|
||||||
- Commit 建议遵循简化 Conventional Commits:`feat|fix|docs|chore|refactor|test: scope – summary`,一句话说明行为与范围;避免笼统的 “update”。
|
- 当前无实测用例;引入代码时请至少提供最小可复现测试。
|
||||||
- PR 必填:变更摘要、动机或关联 Issue、测试与验证步骤(列出运行的命令与结果概览);涉及文档 / UI 的修改应附对比截图或链接,方便 reviewer 快速复核。
|
- 文档与提示词改动:提交前运行 `make lint`。
|
||||||
- 提交前清单:跑通 `make lint`;若新增脚本 / 依赖,更新对应文档与 `Makefile` 目标;确认不携带临时文件或机密数据,并在描述中注明潜在风险或需要 reviewer 特别关注的点。
|
- 覆盖率基线由模块维护者设定。
|
||||||
|
|
||||||
## Security & Configuration Tips
|
## Commit & Pull Request Guidelines
|
||||||
- 运行备份或转换脚本前,确认输出目录不会覆盖私有数据;建议先在临时目录试跑并检查生成文件,必要时使用只读副本。
|
- Commit 遵循简化 Conventional Commits:`feat|fix|docs|chore|refactor|test: scope – summary`。
|
||||||
- 外部依赖来源记录在 `libs/external/` 目录下,增减依赖时同步维护,保持可追溯;引入第三方脚本需标明许可证与来源。
|
- PR 必填:变更摘要、动机或关联 Issue、测试与验证步骤。
|
||||||
|
- 提交前清单:跑通 `make lint`;更新对应文档与 `Makefile` 目标;确认不携带临时文件或机密数据。
|
||||||
## Architecture Overview & Workflow
|
|
||||||
- 工作流倡导「规划 → 上下文固定 → 分步实现 → 自测 → 复盘」,对应资产分别存放在 `i18n/zh/documents/`、`i18n/zh/prompts/`、`libs/` 与备份脚本中。保持单向数据流和清晰责任边界可以避免后期维护成本激增。
|
## Security & Configuration Tips
|
||||||
- 设计决策与目录结构更新后,请同步修订本文件与相关文档,确保团队共享同一真相源,减少口头约定与隐式规则。
|
- 运行备份或转换脚本前,确认输出目录不会覆盖私有数据。
|
||||||
|
- 外部依赖来源记录在 `libs/external/` 目录下,引入第三方脚本需标明许可证与来源。
|
||||||
---
|
|
||||||
|
## Architecture Overview & Workflow
|
||||||
# CLAUDE.md
|
- 工作流倡导「规划 → 上下文固定 → 分步实现 → 自测 → 复盘」。
|
||||||
|
- 设计决策与目录结构更新后,请同步修订本文件与相关文档。
|
||||||
This file provides guidance to Claude series models when working with code in this repository.
|
|
||||||
|
---
|
||||||
## Repository Overview
|
|
||||||
|
# CLAUDE.md
|
||||||
This is the **Vibe Coding CN** repository, a workflow, toolset, and knowledge base for advanced AI-assisted programming. The project's core assets are its extensive `prompts` and `skills` libraries.
|
|
||||||
|
This file provides guidance to Claude series models when working with code in this repository.
|
||||||
## Key Commands
|
|
||||||
|
## Repository Overview
|
||||||
### Prompt Library Management
|
|
||||||
```bash
|
This is the **Vibe Coding CN** repository, a workflow, toolset, and knowledge base for advanced AI-assisted programming. The project's core assets are its extensive `prompts` and `skills` libraries.
|
||||||
# Enter the library directory
|
|
||||||
cd libs/external/prompts-library
|
## Key Commands
|
||||||
|
|
||||||
# Run the interactive conversion tool
|
```bash
|
||||||
python3 main.py
|
# Prompt library conversion
|
||||||
```
|
cd libs/external/prompts-library && python3 main.py
|
||||||
|
|
||||||
### Development & Maintenance
|
# Lint all markdown files
|
||||||
```bash
|
make lint
|
||||||
# Lint all markdown files in the repository
|
|
||||||
make lint
|
# Create a full project backup
|
||||||
|
bash backups/一键备份.sh
|
||||||
# Create a full project backup (respects .gitignore)
|
```
|
||||||
bash backups/一键备份.sh
|
|
||||||
```
|
## Architecture & Structure
|
||||||
|
|
||||||
## Architecture & Structure
|
### Core Directories
|
||||||
|
- **`i18n/zh/prompts/`**: Core prompt library (`coding_prompts/`, `system_prompts/`, `user_prompts/`, `assistant_prompts/`, `meta_prompts/`)
|
||||||
### Core Directories
|
- **`i18n/zh/skills/`**: Modular skills library (16+ skills including `ccxt`, `postgresql`, `telegram-dev`, `claude-skills`)
|
||||||
- **`i18n/zh/prompts/`**: The core asset. A massive, well-organized library of prompts.
|
- **`i18n/zh/documents/`**: Knowledge base (`方法论与原则/`, `模板与资源/`, `教程与指南/`, `胶水编程/`, `从零开始vibecoding/`)
|
||||||
- `coding_prompts/`, `system_prompts/`, `user_prompts/`, `meta_prompts/`
|
- **`libs/external/prompts-library/`**: Excel ↔ Markdown conversion tool
|
||||||
- **`i18n/zh/skills/`**: A modular library of skills for the AI, providing domain-specific knowledge for various tools like `ccxt`, `postgresql`, `telegram-dev`,
|
- **`libs/external/`**: External tools (`l10n-tool/`, `my-nvim/`, `MCPlayerTransfer/`)
|
||||||
etc.
|
- **`backups/`**: Backup scripts and archives
|
||||||
- **`i18n/zh/documents/`**: The project's knowledge base, containing methodology, principles, and guides.
|
- **`scripts/`**: Project scripts placeholder
|
||||||
- **`libs/external/prompts-library/`**: A Python-based tool for converting prompts between Excel and Markdown formats.
|
|
||||||
- **`backups/`**: Scripts for project backups.
|
### Key Technical Details
|
||||||
- **`libs/`**: Skeleton for shared Python library code.
|
1. **Prompt Organization**: Prompts use `(row,col)_` prefix for categorization.
|
||||||
|
2. **Conversion Tool**: Uses Python with `pandas` and `openpyxl`.
|
||||||
### Key Technical Details
|
3. **Documentation Standard**: User-facing docs in Chinese; code/filenames in English.
|
||||||
1. **Prompt Organization**: Prompts use a `(row,col)_` prefix for categorization.
|
4. **Skills**: Each skill has its own `SKILL.md`.
|
||||||
2. **Conversion Tool**: The `prompts-library` uses Python with `pandas` and `openpyxl`.
|
|
||||||
3. **Documentation Standard**: User-facing documentation is in Chinese. Code, file names, and structure are in English.
|
## Development Workflow
|
||||||
4. **Skills**: The `skills` directory provides context and knowledge for specific tools and domains, each with its own `SKILL.md`.
|
|
||||||
|
1. Follow existing prompt and skill categorization systems.
|
||||||
## Development Workflow
|
2. Use `prompts-library` tool for prompt updates.
|
||||||
|
3. Run `make lint` after Markdown changes.
|
||||||
When modifying this repository:
|
4. Run backup before major refactoring.
|
||||||
1. Follow the existing prompt and skill categorization systems.
|
|
||||||
2. Use the `prompts-library` tool to maintain consistency when updating prompts.
|
---
|
||||||
3. Run `make lint` after changing any Markdown files.
|
|
||||||
4. Run a backup with `bash backups/一键备份.sh` before any major refactoring.
|
# GEMINI.md - 项目上下文文档
|
||||||
|
|
||||||
---
|
## 项目概述
|
||||||
|
|
||||||
# GEMINI.md - 项目上下文文档 (Project Context Document)
|
`vibe-coding-cn` 是一个通过与 AI 结对编程实现"将想法变为现实"的终极工作流程。强调"规划驱动"和"模块化"核心理念。
|
||||||
|
|
||||||
## 项目概述 (Project Overview)
|
## 技术栈
|
||||||
|
|
||||||
`vibe-coding-cn` 项目旨在提供一个通过与 AI 结对编程实现“将想法变为现实”的终极工作流程。它强调“规划驱动”和“模块化”的核心理念,旨在避免 AI 失控导致的项目混乱。该项目不仅仅是一个代码库,更是一个全面的 AI 结对编程指南、庞大的提示词库和模块化的技能工具集,涵盖了从项目构思、技术选型、实施规划到具体开发、调试和扩展的全过程。
|
- **核心语言:** Python
|
||||||
|
- **CLI 交互:** `rich`, `InquirerPy`
|
||||||
**核心理念:** 规划是核心,通过结构化、模块化的方式引导 AI,确保项目可控、可维护。
|
- **数据处理:** `pandas`, `openpyxl`
|
||||||
|
- **配置管理:** `PyYAML`
|
||||||
## 技术栈 (Technology Stack)
|
- **文档规范:** `markdownlint-cli`
|
||||||
|
- **版本控制:** Git
|
||||||
本项目主要的技术栈和相关工具包括:
|
- **自动化:** Makefile
|
||||||
|
|
||||||
* **核心语言:** Python (用于 `prompts-library` 工具和备份脚本)
|
## 文件结构
|
||||||
* **CLI 交互:** `rich`, `InquirerPy` (用于 `prompts-library` 提供友好的命令行界面)
|
|
||||||
* **数据处理:** `pandas`, `openpyxl` (用于 `prompts-library` 处理 Excel 文件)
|
|
||||||
* **配置管理:** `PyYAML` (用于 `prompts-library` 的配置)
|
|
||||||
* **文档规范:** `markdownlint-cli` (用于 `Makefile` 中的 `lint` 任务)
|
|
||||||
* **版本控制:** Git
|
|
||||||
* **自动化:** Makefile
|
|
||||||
* **操作系统:** 兼容 Linux
|
|
||||||
|
|
||||||
## 主要功能与工作流程 (Key Features & Workflow)
|
|
||||||
|
|
||||||
1. **AI 提示词库 (`i18n/zh/prompts/`):**
|
|
||||||
* 一个极其庞大和精细分类的提示词集合,是项目的核心资产。
|
|
||||||
* `coding_prompts/`: 专注于编程和代码生成的提示词。
|
|
||||||
* `system_prompts/`: 用于设定 AI 行为和思维框架的系统级提示词。
|
|
||||||
* `user_prompts/`: 用户自定义或常用的提示词。
|
|
||||||
* `meta_prompts/`: 元提示词与提示工程辅助。
|
|
||||||
|
|
||||||
2. **提示词库管理工具 (`libs/external/prompts-library/`):**
|
|
||||||
* 提供 Python 工具 (`main.py`),用于在 Excel 工作簿 (`prompt_excel/`) 和 Markdown 文档 (`prompt_docs/`) 之间进行提示词的相互转换。
|
|
||||||
* 支持交互式和非交互式操作。
|
|
||||||
|
|
||||||
3. **技能库 (`i18n/zh/skills/`):**
|
|
||||||
* 一个模块化的技能集合,为 AI 提供了特定工具和领域的知识。
|
|
||||||
* 每个技能(如 `ccxt`, `postgresql`, `telegram-dev`)都包含独立的 `SKILL.md` 描述, 参考资料和脚本。
|
|
||||||
|
|
||||||
4. **项目备份工具 (`backups/`):**
|
|
||||||
* `快速备份.py` 脚本能根据 `.gitignore` 规则智能地打包项目文件为 `.tar.gz` 格式。
|
|
||||||
|
|
||||||
5. **知识库与文档 (`i18n/zh/documents/`):**
|
|
||||||
* 包含代码组织、开发经验、系统提示词构建原则、项目架构模板等各类文档。
|
|
||||||
|
|
||||||
6. **外部工具与个人配置 (`libs/external/`):**
|
|
||||||
* 存放非核心项目代码但有用的外部工具、个人配置或实验性代码。例如:`my-nvim/` (nvim 配置), `XHS-image-to-PDF-conversion/` (图片转PDF工具)。
|
|
||||||
|
|
||||||
## 文件结构 (File Structure)
|
|
||||||
|
|
||||||
```
|
```
|
||||||
.
|
.
|
||||||
├── .gitignore # Git 版本控制忽略文件配置
|
├── .github/ # GitHub 配置 (Issue/PR 模板, SECURITY, FUNDING)
|
||||||
├── AGENTS.md # 面向 AI Agent 的贡献与行为准则。
|
├── AGENTS.md # AI Agent 行为准则
|
||||||
├── CLAUDE.md # 面向 Claude 模型的上下文与指令。
|
├── CLAUDE.md # Claude 模型上下文
|
||||||
├── CODE_OF_CONDUCT.md # 项目行为准则。
|
├── GEMINI.md # Gemini 模型上下文
|
||||||
├── CONTRIBUTING.md # 贡献指南。
|
├── CODE_OF_CONDUCT.md # 行为准则
|
||||||
├── GEMINI.md # 面向 Gemini 模型的上下文与指令 (本文档)。
|
├── CONTRIBUTING.md # 贡献指南
|
||||||
├── LICENSE # 项目许可证。
|
├── LICENSE # MIT 许可证
|
||||||
├── Makefile # 项目自动化脚本 (lint, backup 等)。
|
├── Makefile # 自动化脚本
|
||||||
├── README.md # 项目主文档,包含项目概览、使用指南等。
|
├── README.md # 项目主文档
|
||||||
│
|
|
||||||
├── i18n/
|
|
||||||
│ ├── zh/{documents,prompts,skills} # 中文主语料与方法论。
|
|
||||||
│ ├── en/{documents,prompts,skills} # 英文版本资产。
|
|
||||||
│ ├── he/{documents,prompts,skills} # 希伯来语(以色列)。
|
|
||||||
│ ├── es|hi|ar|pt|ru|fr|de|ja|ko|it|tr|nl|pl|id|vi|th|fa|uk|bn|ta|ur|ms|sw|ha/{documents,prompts,skills} # 其他常用语言骨架。
|
|
||||||
│
|
│
|
||||||
├── libs/ # 核心库代码。
|
├── i18n/ # 多语言资产 (29 种语言)
|
||||||
│ ├── common/ # 通用功能和工具库。
|
│ ├── zh/ # 中文主语料
|
||||||
│ │ ├── __init__.py # Python 包初始化文件。
|
│ │ ├── documents/ # 文档库 (方法论/模板/教程/胶水编程等)
|
||||||
│ │ ├── models/ # 数据模型定义。
|
│ │ ├── prompts/ # 提示词库 (system/coding/user/assistant/meta)
|
||||||
│ │ └── utils/ # 实用工具函数。
|
│ │ └── skills/ # 技能库 (16+ 技能)
|
||||||
│ ├── database/ # 数据库相关代码。
|
│ ├── en/ # 英文版本
|
||||||
│ └── external/ # 外部工具、个人配置或实验性代码。
|
│ └── ... # 其他语言骨架
|
||||||
│ ├── prompts-library/ # 提示词库管理工具 (Excel-Markdown 互转)。
|
│
|
||||||
│ │ ├── main.py # 提示词库管理工具主程序。
|
├── libs/ # 核心库代码
|
||||||
│ │ ├── requirements.txt # 工具依赖。
|
│ ├── common/ # 通用模块 (models/, utils/)
|
||||||
│ │ ├── prompt_excel/ # Excel 格式提示词。
|
│ ├── database/ # 数据库模块
|
||||||
│ │ ├── prompt_docs/ # Markdown 格式提示词文档。
|
│ └── external/ # 外部工具
|
||||||
│ │ └── ... (其他 prompts-library 内部文件)
|
│ ├── prompts-library/ # Excel-Markdown 互转工具
|
||||||
│ ├── l10n-tool/ # 多语言批量翻译脚本,保护代码块,先机翻后润色。
|
│ ├── l10n-tool/ # 多语言翻译脚本
|
||||||
│ ├── my-nvim/ # 个人 Neovim 配置。
|
│ ├── my-nvim/ # Neovim 配置
|
||||||
│ └── XHS-image-to-PDF-conversion/ # 小红书图片转 PDF 工具。
|
│ ├── MCPlayerTransfer/ # MC 玩家迁移工具
|
||||||
│
|
│ └── XHS-image-to-PDF-conversion/
|
||||||
├── i18n/zh/prompts/ # 核心资产:AI 提示词库。
|
│
|
||||||
│ ├── coding_prompts/ # 编程与代码生成相关提示词。
|
├── backups/ # 备份脚本与存档
|
||||||
│ ├── system_prompts/ # AI 系统级提示词(含 CLAUDE 版本目录)。
|
│ ├── 一键备份.sh
|
||||||
│ ├── user_prompts/ # 用户自定义提示词。
|
│ ├── 快速备份.py
|
||||||
│ └── meta_prompts/ # 元提示词与提示工程辅助。
|
│ └── gz/ # 压缩存档
|
||||||
│
|
│
|
||||||
└── i18n/zh/skills/ # 模块化技能库。
|
└── scripts/ # 项目脚本
|
||||||
├── ccxt/ # CCXT 加密货币交易库技能。
|
|
||||||
├── claude-code-guide/ # Claude Code 使用指南技能。
|
|
||||||
├── postgresql/ # PostgreSQL 数据库技能。
|
|
||||||
├── telegram-dev/ # Telegram Bot 开发技能。
|
|
||||||
└── ... (其他 10+ 个技能)
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,242 +1,241 @@
|
||||||
TRANSLATED CONTENT:
|
# 🎯 AI Skills Library
|
||||||
# 🎯 AI Skills 技能库
|
|
||||||
|
|
||||||
`i18n/zh/skills/` 目录存放 AI 技能(Skills),这些是比提示词更高级的能力封装,可以让 AI 在特定领域表现出专家级水平。当前包含 **14 个**专业技能。
|
The `i18n/zh/skills/` directory stores AI Skills. These are advanced capability encapsulations, more sophisticated than simple prompts, that enable AI to perform at an expert level in specific domains. Currently includes **14** professional skills.
|
||||||
|
|
||||||
## 目录结构
|
## Directory Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
i18n/zh/skills/
|
i18n/zh/skills/
|
||||||
├── README.md # 本文件
|
├── README.md # This file
|
||||||
│
|
│
|
||||||
├── # === 元技能(核心) ===
|
├── # === Meta Skills (Core) ===
|
||||||
├── claude-skills/ # ⭐ 元技能:生成 Skills 的 Skills(11KB)
|
├── claude-skills/ # ⭐ Meta Skill: Skills for Generating Skills (11KB)
|
||||||
│
|
│
|
||||||
├── # === Claude 工具 ===
|
├── # === Claude Tools ===
|
||||||
├── claude-code-guide/ # Claude Code 使用指南(9KB)
|
├── claude-code-guide/ # Guide for using Claude Code (9KB)
|
||||||
├── claude-cookbooks/ # Claude API 最佳实践(9KB)
|
├── claude-cookbooks/ # Best practices for Claude API (9KB)
|
||||||
│
|
│
|
||||||
├── # === 数据库 ===
|
├── # === Databases ===
|
||||||
├── postgresql/ # ⭐ PostgreSQL 专家技能(76KB,最详细)
|
├── postgresql/ # ⭐ PostgreSQL Expert Skill (76KB, most detailed)
|
||||||
├── timescaledb/ # 时序数据库扩展(3KB)
|
├── timescaledb/ # Time-series Database Extension (3KB)
|
||||||
│
|
│
|
||||||
├── # === 加密货币/量化 ===
|
├── # === Cryptocurrency / Quant ===
|
||||||
├── ccxt/ # 加密货币交易所统一 API(18KB)
|
├── ccxt/ # Unified Cryptocurrency Exchange API (18KB)
|
||||||
├── coingecko/ # CoinGecko 行情 API(3KB)
|
├── coingecko/ # CoinGecko Market Data API (3KB)
|
||||||
├── cryptofeed/ # 加密货币实时数据流(6KB)
|
├── cryptofeed/ # Cryptocurrency Real-time Data Stream (6KB)
|
||||||
├── hummingbot/ # 量化交易机器人框架(4KB)
|
├── hummingbot/ # Quant Trading Bot Framework (4KB)
|
||||||
├── polymarket/ # 预测市场 API(6KB)
|
├── polymarket/ # Prediction Market API (6KB)
|
||||||
│
|
│
|
||||||
├── # === 开发工具 ===
|
├── # === Development Tools ===
|
||||||
├── telegram-dev/ # Telegram Bot 开发(18KB)
|
├── telegram-dev/ # Telegram Bot Development (18KB)
|
||||||
├── twscrape/ # Twitter/X 数据抓取(11KB)
|
├── twscrape/ # Twitter/X Data Scraping (11KB)
|
||||||
├── snapdom/ # DOM 快照工具(8KB)
|
├── snapdom/ # DOM Snapshot Tool (8KB)
|
||||||
└── proxychains/ # 代理链配置(6KB)
|
└── proxychains/ # Proxy Chains Configuration (6KB)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Skills 一览表
|
## Skills Overview Table
|
||||||
|
|
||||||
### 按文件大小排序(详细程度)
|
### Sorted by File Size (Detail Level)
|
||||||
|
|
||||||
| 技能 | 大小 | 领域 | 说明 |
|
| Skill | Size | Domain | Description |
|
||||||
|------|------|------|------|
|
|---|---|---|---|
|
||||||
| **postgresql** | 76KB | 数据库 | ⭐ 最详细,PostgreSQL 完整专家技能 |
|
| **postgresql** | 76KB | Database | ⭐ Most detailed, complete PostgreSQL expert skill |
|
||||||
| **telegram-dev** | 18KB | Bot 开发 | Telegram Bot 开发完整指南 |
|
| **telegram-dev** | 18KB | Bot Development | Complete guide for Telegram Bot development |
|
||||||
| **ccxt** | 18KB | 交易 | 加密货币交易所统一 API |
|
| **ccxt** | 18KB | Trading | Unified API for cryptocurrency exchanges |
|
||||||
| **twscrape** | 11KB | 数据采集 | Twitter/X 数据抓取 |
|
| **twscrape** | 11KB | Data Collection | Twitter/X data scraping |
|
||||||
| **claude-skills** | 11KB | 元技能 | ⭐ 生成 Skills 的 Skills |
|
| **claude-skills** | 11KB | Meta Skill | ⭐ Skills for Generating Skills |
|
||||||
| **claude-code-guide** | 9KB | 工具 | Claude Code 使用最佳实践 |
|
| **claude-code-guide** | 9KB | Tools | Best practices for Claude Code usage |
|
||||||
| **claude-cookbooks** | 9KB | 工具 | Claude API 使用示例 |
|
| **claude-cookbooks** | 9KB | Tools | Claude API usage examples |
|
||||||
| **snapdom** | 8KB | 前端 | DOM 快照与测试 |
|
| **snapdom** | 8KB | Frontend | DOM snapshots and testing |
|
||||||
| **cryptofeed** | 6KB | 数据流 | 加密货币实时数据流 |
|
| **cryptofeed** | 6KB | Data Stream | Cryptocurrency real-time data stream |
|
||||||
| **polymarket** | 6KB | 预测市场 | Polymarket API 集成 |
|
| **polymarket** | 6KB | Prediction Market | Polymarket API integration |
|
||||||
| **proxychains** | 6KB | 网络 | 代理链配置与使用 |
|
| **proxychains** | 6KB | Network | Proxy chains configuration and usage |
|
||||||
| **hummingbot** | 4KB | 量化 | 量化交易机器人框架 |
|
| **hummingbot** | 4KB | Quant | Quant trading bot framework |
|
||||||
| **timescaledb** | 3KB | 数据库 | PostgreSQL 时序扩展 |
|
| **timescaledb** | 3KB | Database | PostgreSQL time-series extension |
|
||||||
| **coingecko** | 3KB | 行情 | CoinGecko 行情 API |
|
| **coingecko** | 3KB | Market Data | CoinGecko Market Data API |
|
||||||
|
|
||||||
### 按领域分类
|
### Categorized by Domain
|
||||||
|
|
||||||
#### 🔧 元技能与工具
|
#### 🔧 Meta Skills & Tools
|
||||||
|
|
||||||
| 技能 | 说明 | 推荐场景 |
|
| Skill | Description | Recommended Scenarios |
|
||||||
|------|------|----------|
|
|---|---|---|
|
||||||
| `claude-skills` | 生成 Skills 的 Skills | 创建新技能时必用 |
|
| `claude-skills` | Skills for Generating Skills | Essential for creating new skills |
|
||||||
| `claude-code-guide` | Claude Code CLI 使用指南 | 日常开发 |
|
| `claude-code-guide` | Claude Code CLI Usage Guide | Daily development |
|
||||||
| `claude-cookbooks` | Claude API 最佳实践 | API 集成 |
|
| `claude-cookbooks` | Claude API Best Practices | API integration |
|
||||||
|
|
||||||
#### 🗄️ 数据库
|
#### 🗄️ Databases
|
||||||
|
|
||||||
| 技能 | 说明 | 推荐场景 |
|
| Skill | Description | Recommended Scenarios |
|
||||||
|------|------|----------|
|
|---|---|---|
|
||||||
| `postgresql` | PostgreSQL 完整指南(76KB) | 关系型数据库开发 |
|
| `postgresql` | Complete PostgreSQL Guide (76KB) | Relational database development |
|
||||||
| `timescaledb` | 时序数据库扩展 | 时间序列数据 |
|
| `timescaledb` | Time-series Database Extension | Time-series data |
|
||||||
|
|
||||||
#### 💰 加密货币/量化
|
#### 💰 Cryptocurrency / Quant
|
||||||
|
|
||||||
| 技能 | 说明 | 推荐场景 |
|
| Skill | Description | Recommended Scenarios |
|
||||||
|------|------|----------|
|
|---|---|---|
|
||||||
| `ccxt` | 交易所统一 API | 多交易所对接 |
|
| `ccxt` | Unified Exchange API | Multi-exchange integration |
|
||||||
| `coingecko` | 行情数据 API | 价格查询 |
|
| `coingecko` | Market Data API | Price queries |
|
||||||
| `cryptofeed` | 实时数据流 | WebSocket 行情 |
|
| `cryptofeed` | Real-time Data Stream | WebSocket market data |
|
||||||
| `hummingbot` | 量化交易框架 | 自动化交易 |
|
| `hummingbot` | Quant Trading Framework | Automated trading |
|
||||||
| `polymarket` | 预测市场 API | 预测市场交易 |
|
| `polymarket` | Prediction Market API | Prediction market trading |
|
||||||
|
|
||||||
#### 🛠️ 开发工具
|
#### 🛠️ Development Tools
|
||||||
|
|
||||||
| 技能 | 说明 | 推荐场景 |
|
| Skill | Description | Recommended Scenarios |
|
||||||
|------|------|----------|
|
|---|---|---|
|
||||||
| `telegram-dev` | Telegram Bot 开发 | Bot 开发 |
|
| `telegram-dev` | Telegram Bot Development | Bot development |
|
||||||
| `twscrape` | Twitter 数据抓取 | 社交媒体数据 |
|
| `twscrape` | Twitter Data Scraping | Social media data |
|
||||||
| `snapdom` | DOM 快照 | 前端测试 |
|
| `snapdom` | DOM Snapshots | Frontend testing |
|
||||||
| `proxychains` | 代理链配置 | 网络代理 |
|
| `proxychains` | Proxy Chains Configuration | Network proxy |
|
||||||
|
|
||||||
## Skills vs Prompts 的区别
|
## Difference Between Skills vs Prompts
|
||||||
|
|
||||||
| 维度 | Prompts(提示词) | Skills(技能) |
|
| Dimension | Prompts | Skills |
|
||||||
|------|------------------|----------------|
|
|---|---|---|
|
||||||
| 粒度 | 单次任务指令 | 完整能力封装 |
|
| Granularity | Single task instruction | Complete capability encapsulation |
|
||||||
| 复用性 | 复制粘贴 | 配置后自动生效 |
|
| Reusability | Copy-paste | Automatically effective after configuration |
|
||||||
| 上下文 | 需手动提供 | 内置领域知识 |
|
| Context | Needs manual provision | Built-in domain knowledge |
|
||||||
| 适用场景 | 临时任务 | 长期项目 |
|
| Use Case | Temporary tasks | Long-term projects |
|
||||||
| 结构 | 单文件 | 目录(含 assets/scripts/references) |
|
| Structure | Single file | Directory (includes assets/scripts/references) |
|
||||||
|
|
||||||
## 技能目录结构
|
## Skill Directory Structure
|
||||||
|
|
||||||
每个技能遵循统一结构:
|
Each skill follows a unified structure:
|
||||||
|
|
||||||
```
|
```
|
||||||
skill-name/
|
skill-name/
|
||||||
├── SKILL.md # 技能主文件,包含领域知识和规则
|
├── SKILL.md # Main skill file, contains domain knowledge and rules
|
||||||
├── assets/ # 静态资源(图片、配置模板等)
|
├── assets/ # Static resources (images, config templates, etc.)
|
||||||
├── scripts/ # 辅助脚本
|
├── scripts/ # Helper scripts
|
||||||
└── references/ # 参考文档
|
└── references/ # Reference documents
|
||||||
```
|
```
|
||||||
|
|
||||||
## 快速使用
|
## Quick Start
|
||||||
|
|
||||||
### 1. 查看技能
|
### 1. View a Skill
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 查看元技能
|
# View meta-skill
|
||||||
cat i18n/zh/skills/claude-skills/SKILL.md
|
cat i18n/zh/skills/claude-skills/SKILL.md
|
||||||
|
|
||||||
# 查看 PostgreSQL 技能(最详细)
|
# View PostgreSQL skill (most detailed)
|
||||||
cat i18n/zh/skills/postgresql/SKILL.md
|
cat i18n/zh/skills/postgresql/SKILL.md
|
||||||
|
|
||||||
# 查看 Telegram Bot 开发技能
|
# View Telegram Bot development skill
|
||||||
cat i18n/zh/skills/telegram-dev/SKILL.md
|
cat i18n/zh/skills/telegram-dev/SKILL.md
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. 复制到项目中使用
|
### 2. Copy to Project for Use
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 复制整个技能目录
|
# Copy entire skill directory
|
||||||
cp -r i18n/zh/skills/postgresql/ ./my-project/
|
cp -r i18n/zh/skills/postgresql/ ./my-project/
|
||||||
|
|
||||||
# 或只复制主文件到 CLAUDE.md
|
# Or just copy main file to CLAUDE.md
|
||||||
cp i18n/zh/skills/postgresql/SKILL.md ./CLAUDE.md
|
cp i18n/zh/skills/postgresql/SKILL.md ./CLAUDE.md
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. 结合 Claude Code 使用
|
### 3. Use with Claude Code
|
||||||
|
|
||||||
在项目根目录创建 `CLAUDE.md`,引用技能:
|
Create `CLAUDE.md` in the project root, referencing skills:
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
# 项目规则
|
# Project Rules
|
||||||
|
|
||||||
请参考以下技能文件:
|
Please refer to the following skill files:
|
||||||
@i18n/zh/skills/postgresql/SKILL.md
|
@i18n/zh/skills/postgresql/SKILL.md
|
||||||
@i18n/zh/skills/telegram-dev/SKILL.md
|
@i18n/zh/skills/telegram-dev/SKILL.md
|
||||||
```
|
```
|
||||||
|
|
||||||
## 创建自定义 Skill
|
## Create Custom Skill
|
||||||
|
|
||||||
### 方法一:使用元技能生成(推荐)
|
### Method 1: Generate using Meta Skill (Recommended)
|
||||||
|
|
||||||
1. 准备领域资料(文档、代码、规范)
|
1. Prepare domain materials (documents, code, specifications)
|
||||||
2. 将资料和 `i18n/zh/skills/claude-skills/SKILL.md` 一起提供给 AI
|
2. Provide materials along with `i18n/zh/skills/claude-skills/SKILL.md` to AI
|
||||||
3. AI 会生成针对该领域的专用 Skill
|
3. AI will generate a dedicated Skill for that domain
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 示例:让 AI 读取元技能后生成新技能
|
# Example: Let AI generate a new skill after reading the meta-skill
|
||||||
cat i18n/zh/skills/claude-skills/SKILL.md
|
cat i18n/zh/skills/claude-skills/SKILL.md
|
||||||
# 然后告诉 AI:请根据这个元技能,为 [你的领域] 生成一个新的 SKILL.md
|
# Then tell AI: Based on this meta-skill, please generate a new SKILL.md for [your domain]
|
||||||
```
|
```
|
||||||
|
|
||||||
### 方法二:手动创建
|
### Method 2: Manual Creation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 创建技能目录
|
# Create skill directory
|
||||||
mkdir -p i18n/zh/skills/my-skill/{assets,scripts,references}
|
mkdir -p i18n/zh/skills/my-skill/{assets,scripts,references}
|
||||||
|
|
||||||
# 创建主文件
|
# Create main file
|
||||||
cat > i18n/zh/skills/my-skill/SKILL.md << 'EOF'
|
cat > i18n/zh/skills/my-skill/SKILL.md << 'EOF'
|
||||||
# My Skill
|
# My Skill
|
||||||
|
|
||||||
## 概述
|
## Overview
|
||||||
简要说明技能用途和适用场景
|
Briefly describe skill purpose and applicable scenarios
|
||||||
|
|
||||||
## 领域知识
|
## Domain Knowledge
|
||||||
- 核心概念
|
- Core concepts
|
||||||
- 最佳实践
|
- Best practices
|
||||||
- 常见模式
|
- Common patterns
|
||||||
|
|
||||||
## 规则与约束
|
## Rules & Constraints
|
||||||
- 必须遵守的规则
|
- Mandatory rules
|
||||||
- 禁止的操作
|
- Prohibited operations
|
||||||
- 边界条件
|
- Boundary conditions
|
||||||
|
|
||||||
## 示例
|
## Examples
|
||||||
具体的使用示例和代码片段
|
Specific usage examples and code snippets
|
||||||
|
|
||||||
## 常见问题
|
## FAQ
|
||||||
FAQ 和解决方案
|
FAQ and solutions
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
## 核心技能详解
|
## Core Skill Details
|
||||||
|
|
||||||
### `claude-skills/SKILL.md` - 元技能 ⭐
|
### `claude-skills/SKILL.md` - Meta Skill ⭐
|
||||||
|
|
||||||
**生成 Skills 的 Skills**,是创建新技能的核心工具。
|
**Skills for Generating Skills**, is the core tool for creating new skills.
|
||||||
|
|
||||||
使用方法:
|
Usage:
|
||||||
1. 准备你的领域资料(文档、代码、规范等)
|
1. Prepare your domain materials (documents, code, specifications, etc.)
|
||||||
2. 将资料和 SKILL.md 一起提供给 AI
|
2. Provide materials along with SKILL.md to AI
|
||||||
3. AI 会生成针对该领域的专用 Skill
|
3. AI will generate a dedicated Skill for that domain
|
||||||
|
|
||||||
### `postgresql/SKILL.md` - PostgreSQL 专家 ⭐
|
### `postgresql/SKILL.md` - PostgreSQL Expert ⭐
|
||||||
|
|
||||||
最详细的技能(76KB),包含:
|
The most detailed skill (76KB), includes:
|
||||||
- 数据库设计最佳实践
|
- Database design best practices
|
||||||
- 查询优化技巧
|
- Query optimization techniques
|
||||||
- 索引策略
|
- Indexing strategies
|
||||||
- 性能调优
|
- Performance tuning
|
||||||
- 常见问题解决方案
|
- Common problem solutions
|
||||||
- SQL 代码示例
|
- SQL code examples
|
||||||
|
|
||||||
### `telegram-dev/SKILL.md` - Telegram Bot 开发
|
### `telegram-dev/SKILL.md` - Telegram Bot Development
|
||||||
|
|
||||||
完整的 Telegram Bot 开发指南(18KB):
|
Complete Telegram Bot development guide (18KB):
|
||||||
- Bot API 使用
|
- Bot API usage
|
||||||
- 消息处理
|
- Message handling
|
||||||
- 键盘与回调
|
- Keyboards and callbacks
|
||||||
- Webhook 配置
|
- Webhook configuration
|
||||||
- 错误处理
|
- Error handling
|
||||||
|
|
||||||
### `ccxt/SKILL.md` - 加密货币交易所 API
|
### `ccxt/SKILL.md` - Cryptocurrency Exchange API
|
||||||
|
|
||||||
统一的交易所 API 封装(18KB):
|
Unified exchange API encapsulation (18KB):
|
||||||
- 支持 100+ 交易所
|
- Supports 100+ exchanges
|
||||||
- 统一的数据格式
|
- Unified data format
|
||||||
- 订单管理
|
- Order management
|
||||||
- 行情获取
|
- Market data retrieval
|
||||||
|
|
||||||
## 相关资源
|
## Related Resources
|
||||||
|
|
||||||
- [Skills 生成器](https://github.com/yusufkaraaslan/Skill_Seekers) - 把任何资料转为 AI Skills
|
- [Skills Generator](https://github.com/yusufkaraaslan/Skill_Seekers) - Convert any material into AI Skills
|
||||||
- [元技能文件](./claude-skills/SKILL.md) - 生成 Skills 的 Skills
|
- [Meta Skill File](./claude-skills/SKILL.md) - Skills for Generating Skills
|
||||||
- [提示词库](../prompts/) - 更细粒度的提示词集合
|
- [Prompt Library](../prompts/) - More granular prompt collections
|
||||||
- [Claude Code 指南](./claude-code-guide/SKILL.md) - Claude Code 使用最佳实践
|
- [Claude Code Guide](./claude-code-guide/SKILL.md) - Claude Code Usage Best Practices
|
||||||
- [文档库](../documents/) - 方法论与开发经验
|
- [Document Library](../documents/) - Methodologies and development experiences
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
---
|
---
|
||||||
name: coingecko
|
name: coingecko
|
||||||
description: CoinGecko API documentation - cryptocurrency market data API, price feeds, market cap, volume, historical data. Use when integrating CoinGecko API, building crypto price trackers, or accessing cryptocurrency market data.
|
description: CoinGecko API documentation - cryptocurrency market data API, price feeds, market cap, volume, historical data. Use when integrating CoinGecko API, building crypto price trackers, or accessing cryptocurrency market data.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Coingecko - Authentication
|
# Coingecko - Authentication
|
||||||
|
|
||||||
**Pages:** 3
|
**Pages:** 3
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Coingecko - Coins
|
# Coingecko - Coins
|
||||||
|
|
||||||
**Pages:** 65
|
**Pages:** 65
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Coingecko - Contract
|
# Coingecko - Contract
|
||||||
|
|
||||||
**Pages:** 1
|
**Pages:** 1
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Coingecko - Exchanges
|
# Coingecko - Exchanges
|
||||||
|
|
||||||
**Pages:** 14
|
**Pages:** 14
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Coingecko - Introduction
|
# Coingecko - Introduction
|
||||||
|
|
||||||
**Pages:** 4
|
**Pages:** 4
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Changelog
|
# Changelog
|
||||||
Source: https://docs.coingecko.com/changelog
|
Source: https://docs.coingecko.com/changelog
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# CoinGecko API
|
# CoinGecko API
|
||||||
|
|
||||||
## Docs
|
## Docs
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Coingecko - Market Data
|
# Coingecko - Market Data
|
||||||
|
|
||||||
**Pages:** 3
|
**Pages:** 3
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Coingecko - Nfts
|
# Coingecko - Nfts
|
||||||
|
|
||||||
**Pages:** 2
|
**Pages:** 2
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Coingecko - Other
|
# Coingecko - Other
|
||||||
|
|
||||||
**Pages:** 16
|
**Pages:** 16
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Coingecko - Pricing
|
# Coingecko - Pricing
|
||||||
|
|
||||||
**Pages:** 1
|
**Pages:** 1
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Coingecko - Reference
|
# Coingecko - Reference
|
||||||
|
|
||||||
**Pages:** 9
|
**Pages:** 9
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Coingecko - Trending
|
# Coingecko - Trending
|
||||||
|
|
||||||
**Pages:** 2
|
**Pages:** 2
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
---
|
---
|
||||||
name: cryptofeed
|
name: cryptofeed
|
||||||
description: Cryptofeed - Real-time cryptocurrency market data feeds from 40+ exchanges. WebSocket streaming, normalized data, order books, trades, tickers. Python library for algorithmic trading and market data analysis.
|
description: Cryptofeed - Real-time cryptocurrency market data feeds from 40+ exchanges. WebSocket streaming, normalized data, order books, trades, tickers. Python library for algorithmic trading and market data analysis.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Cryptocurrency Exchange Feed Handler
|
# Cryptocurrency Exchange Feed Handler
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||

|

|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Cryptofeed Documentation Index
|
# Cryptofeed Documentation Index
|
||||||
|
|
||||||
## Categories
|
## Categories
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Cryptofeed - Other
|
# Cryptofeed - Other
|
||||||
|
|
||||||
**Pages:** 1
|
**Pages:** 1
|
||||||
|
|
|
||||||
|
|
@ -1,109 +1,230 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
---
|
---
|
||||||
name: timescaledb
|
name: timescaledb
|
||||||
description: TimescaleDB - PostgreSQL extension for high-performance time-series and event data analytics, hypertables, continuous aggregates, compression, and real-time analytics
|
description: Manage time-series data in PostgreSQL with TimescaleDB. Use this skill to install, configure, optimize, and interact with TimescaleDB for high-performance time-series data storage and analysis. This includes creating hypertables, continuous aggregates, handling data retention, and querying time-series data efficiently.
|
||||||
---
|
---
|
||||||
|
|
||||||
# Timescaledb Skill
|
# TimescaleDB Skill
|
||||||
|
|
||||||
Comprehensive assistance with timescaledb development, generated from official documentation.
|
Manage time-series data in PostgreSQL using TimescaleDB, extending PostgreSQL for high-performance time-series workloads.
|
||||||
|
|
||||||
## When to Use This Skill
|
## When to Use This Skill
|
||||||
|
|
||||||
This skill should be triggered when:
|
Use this skill when you need to:
|
||||||
- Working with timescaledb
|
- Work with time-series data in PostgreSQL
|
||||||
- Asking about timescaledb features or APIs
|
- Install and configure TimescaleDB
|
||||||
- Implementing timescaledb solutions
|
- Create and manage hypertables
|
||||||
- Debugging timescaledb code
|
- Optimize performance for time-series data
|
||||||
- Learning timescaledb best practices
|
- Implement continuous aggregates for rollup data
|
||||||
|
- Manage data retention and compression
|
||||||
|
- Query and analyze time-series data
|
||||||
|
- Migrate existing PostgreSQL tables to hypertables
|
||||||
|
- Integrate with other PostgreSQL tools and extensions
|
||||||
|
|
||||||
|
## Not For / Boundaries
|
||||||
|
|
||||||
|
This skill is NOT for:
|
||||||
|
- General PostgreSQL administration (use a specific PostgreSQL skill for that)
|
||||||
|
- Deep database tuning unrelated to time-series performance
|
||||||
|
- Replacing dedicated time-series databases if TimescaleDB's PostgreSQL foundation is not a requirement
|
||||||
|
- Providing data visualization beyond basic SQL queries (use a BI tool or separate visualization library)
|
||||||
|
|
||||||
## Quick Reference
|
## Quick Reference
|
||||||
|
|
||||||
### Common Patterns
|
### Installation & Configuration
|
||||||
|
|
||||||
*Quick reference patterns will be added as you use the skill.*
|
**Install TimescaleDB Extension (Debian/Ubuntu):**
|
||||||
|
|
||||||
### Example Code Patterns
|
|
||||||
|
|
||||||
**Example 1** (bash):
|
|
||||||
```bash
|
```bash
|
||||||
rails new my_app -d=postgresql
|
sudo apt install -y postgresql-{{pg_version}}-timescaledb
|
||||||
cd my_app
|
sudo pg_createcluster {{pg_version}} main --start
|
||||||
|
sudo pg_ctlcluster {{pg_version}} main start
|
||||||
|
sudo -u postgres psql -c "CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;"
|
||||||
```
|
```
|
||||||
|
*(Replace `{{pg_version}}` with your PostgreSQL version, e.g., 16)*
|
||||||
|
|
||||||
**Example 2** (ruby):
|
**Configuration (postgresql.conf):**
|
||||||
```ruby
|
```ini
|
||||||
gem 'timescaledb'
|
# Add to postgresql.conf
|
||||||
|
shared_preload_libraries = 'timescaledb'
|
||||||
|
timescaledb.max_background_workers = 8 # Adjust based on CPU cores
|
||||||
|
max_connections = 100 # Adjust based on workload
|
||||||
```
|
```
|
||||||
|
*(After changes, restart PostgreSQL: `sudo systemctl restart postgresql`)*
|
||||||
|
|
||||||
**Example 3** (shell):
|
### Hypertables
|
||||||
```shell
|
|
||||||
kubectl create namespace timescale
|
|
||||||
```
|
|
||||||
|
|
||||||
**Example 4** (shell):
|
**Create Hypertables:**
|
||||||
```shell
|
|
||||||
kubectl config set-context --current --namespace=timescale
|
|
||||||
```
|
|
||||||
|
|
||||||
**Example 5** (sql):
|
|
||||||
```sql
|
```sql
|
||||||
DROP EXTENSION timescaledb;
|
CREATE TABLE sensor_data (
|
||||||
|
time TIMESTAMPTZ NOT NULL,
|
||||||
|
device_id INT,
|
||||||
|
temperature DOUBLE PRECISION,
|
||||||
|
humidity DOUBLE PRECISION
|
||||||
|
);
|
||||||
|
|
||||||
|
SELECT create_hypertable('sensor_data', 'time');
|
||||||
```
|
```
|
||||||
|
|
||||||
## Reference Files
|
**Convert Existing Table to Hypertable:**
|
||||||
|
```sql
|
||||||
|
SELECT create_hypertable('your_existing_table', 'time_column', migrate_data => true);
|
||||||
|
```
|
||||||
|
|
||||||
This skill includes comprehensive documentation in `references/`:
|
**Show Hypertables:**
|
||||||
|
```sql
|
||||||
|
\d+
|
||||||
|
SELECT * FROM timescaledb_information.hypertables;
|
||||||
|
```
|
||||||
|
|
||||||
- **api.md** - Api documentation
|
### Continuous Aggregates
|
||||||
- **compression.md** - Compression documentation
|
|
||||||
- **continuous_aggregates.md** - Continuous Aggregates documentation
|
|
||||||
- **getting_started.md** - Getting Started documentation
|
|
||||||
- **hyperfunctions.md** - Hyperfunctions documentation
|
|
||||||
- **hypertables.md** - Hypertables documentation
|
|
||||||
- **installation.md** - Installation documentation
|
|
||||||
- **other.md** - Other documentation
|
|
||||||
- **performance.md** - Performance documentation
|
|
||||||
- **time_buckets.md** - Time Buckets documentation
|
|
||||||
- **tutorials.md** - Tutorials documentation
|
|
||||||
|
|
||||||
Use `view` to read specific reference files when detailed information is needed.
|
**Create Continuous Aggregate:**
|
||||||
|
```sql
|
||||||
|
CREATE MATERIALIZED VIEW device_hourly_summary
|
||||||
|
WITH (timescaledb.continuous) AS
|
||||||
|
SELECT
|
||||||
|
time_bucket('1 hour', time) AS bucket,
|
||||||
|
device_id,
|
||||||
|
AVG(temperature) AS avg_temp,
|
||||||
|
MAX(temperature) AS max_temp
|
||||||
|
FROM sensor_data
|
||||||
|
GROUP BY time_bucket('1 hour', time), device_id
|
||||||
|
WITH NO DATA; -- Initially create without data
|
||||||
|
|
||||||
## Working with This Skill
|
-- Refresh the continuous aggregate
|
||||||
|
CALL refresh_continuous_aggregate('device_hourly_summary', NULL, NULL);
|
||||||
|
```
|
||||||
|
|
||||||
### For Beginners
|
**Get Continuous Aggregates Info:**
|
||||||
Start with the getting_started or tutorials reference files for foundational concepts.
|
```sql
|
||||||
|
SELECT * FROM timescaledb_information.continuous_aggregates;
|
||||||
|
```
|
||||||
|
|
||||||
### For Specific Features
|
### Data Retention & Compression
|
||||||
Use the appropriate category reference file (api, guides, etc.) for detailed information.
|
|
||||||
|
|
||||||
### For Code Examples
|
**Set Data Retention Policy (Drop data older than 3 months):**
|
||||||
The quick reference section above contains common patterns extracted from the official docs.
|
```sql
|
||||||
|
SELECT add_retention_policy('sensor_data', INTERVAL '3 months');
|
||||||
|
```
|
||||||
|
|
||||||
## Resources
|
**Enable Compression (Compress data older than 7 days):**
|
||||||
|
```sql
|
||||||
|
ALTER TABLE sensor_data SET (timescaledb.compress = TRUE);
|
||||||
|
SELECT add_compression_policy('sensor_data', INTERVAL '7 days');
|
||||||
|
```
|
||||||
|
|
||||||
### references/
|
**Show Compression Status:**
|
||||||
Organized documentation extracted from official sources. These files contain:
|
```sql
|
||||||
- Detailed explanations
|
SELECT * FROM timescaledb_information.compression_settings;
|
||||||
- Code examples with language annotations
|
```
|
||||||
- Links to original documentation
|
|
||||||
- Table of contents for quick navigation
|
|
||||||
|
|
||||||
### scripts/
|
### Querying Time-Series Data
|
||||||
Add helper scripts here for common automation tasks.
|
|
||||||
|
|
||||||
### assets/
|
**Basic Time-Range Query:**
|
||||||
Add templates, boilerplate, or example projects here.
|
```sql
|
||||||
|
SELECT * FROM sensor_data
|
||||||
|
WHERE time >= NOW() - INTERVAL '1 day'
|
||||||
|
AND time < NOW()
|
||||||
|
ORDER BY time DESC;
|
||||||
|
```
|
||||||
|
|
||||||
## Notes
|
**Gapfilling and Interpolation:**
|
||||||
|
```sql
|
||||||
|
SELECT
|
||||||
|
time_bucket('1 hour', time) AS bucket,
|
||||||
|
AVG(temperature) AS avg_temp,
|
||||||
|
locf(AVG(temperature)) OVER (ORDER BY time_bucket('1 hour', time)) AS avg_temp_locf
|
||||||
|
FROM sensor_data
|
||||||
|
GROUP BY bucket
|
||||||
|
ORDER BY bucket;
|
||||||
|
```
|
||||||
|
|
||||||
- This skill was automatically generated from official documentation
|
### High-Performance Queries
|
||||||
- Reference files preserve the structure and examples from source docs
|
|
||||||
- Code examples include language detection for better syntax highlighting
|
|
||||||
- Quick reference patterns are extracted from common usage examples in the docs
|
|
||||||
|
|
||||||
## Updating
|
**Approximate Count:**
|
||||||
|
```sql
|
||||||
|
SELECT COUNT(*) FROM sensor_data TABLESAMPLE BERNOULLI (1);
|
||||||
|
```
|
||||||
|
|
||||||
To refresh this skill with updated documentation:
|
**Top-N Queries:**
|
||||||
1. Re-run the scraper with the same configuration
|
```sql
|
||||||
2. The skill will be rebuilt with the latest information
|
SELECT time, device_id, temperature
|
||||||
|
FROM sensor_data
|
||||||
|
WHERE time >= NOW() - INTERVAL '1 day'
|
||||||
|
ORDER BY temperature DESC
|
||||||
|
LIMIT 10;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Example 1: IoT Sensor Data Pipeline
|
||||||
|
|
||||||
|
- Input: Stream of sensor readings (time, device_id, value)
|
||||||
|
- Steps:
|
||||||
|
1. Create a hypertable for `iot_readings`.
|
||||||
|
2. Ingest data into the hypertable.
|
||||||
|
3. Create a continuous aggregate to compute hourly average readings.
|
||||||
|
4. Query the continuous aggregate for a specific device's hourly trend.
|
||||||
|
5. Set a retention policy to keep only 1 year of raw data.
|
||||||
|
- Expected output / acceptance: Efficient storage, automatic hourly rollups, and proper data pruning.
|
||||||
|
|
||||||
|
### Example 2: Financial Tick Data Analysis
|
||||||
|
|
||||||
|
- Input: High-frequency financial tick data (timestamp, symbol, price, volume)
|
||||||
|
- Steps:
|
||||||
|
1. Create a hypertable `tick_data` with proper chunk sizing for high ingest rate.
|
||||||
|
2. Enable compression for older `tick_data`.
|
||||||
|
3. Query `tick_data` to calculate 5-minute VWAP (Volume Weighted Average Price) for a specific symbol.
|
||||||
|
4. Visualize the VWAP over the last trading day.
|
||||||
|
- Expected output / acceptance: Ability to ingest and analyze millions of rows/second, with optimized storage and fast analytical queries.
|
||||||
|
|
||||||
|
### Example 3: Monitoring System Metrics
|
||||||
|
|
||||||
|
- Input: Server metrics (timestamp, host_id, cpu_usage, memory_usage, network_io)
|
||||||
|
- Steps:
|
||||||
|
1. Create a hypertable `system_metrics` partitioned by `time` and `host_id`.
|
||||||
|
2. Use a `time_bucket_gapfill` query to find CPU usage for all hosts over the last 24 hours, filling in missing data points.
|
||||||
|
3. Create an alert based on `MAX(cpu_usage)` exceeding a threshold using a continuous aggregate.
|
||||||
|
- Expected output / acceptance: Comprehensive monitoring with gap-filled data for visualization and real-time alerting.
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
|
- `references/installation.md`: Detailed installation and setup
|
||||||
|
- `references/hypertables.md`: Deep dive into hypertable management
|
||||||
|
- `references/continuous_aggregates.md`: Advanced continuous aggregate techniques
|
||||||
|
- `references/compression.md`: Comprehensive guide to data compression
|
||||||
|
- `references/api.md`: TimescaleDB SQL functions and commands reference
|
||||||
|
- `references/performance.md`: Performance tuning and best practices
|
||||||
|
- `references/getting_started.md`: Official TimescaleDB Getting Started Guide
|
||||||
|
- `references/llms.md`: Using TimescaleDB with LLMs (e.g., storing embeddings, RAG)
|
||||||
|
- `references/llms-full.md`: Full LLM integration scenarios
|
||||||
|
- `references/tutorials.md`: Official TimescaleDB Tutorials and Use Cases
|
||||||
|
- `references/time_buckets.md`: Guide to `time_bucket` and gapfilling functions
|
||||||
|
- `references/hyperfunctions.md`: Advanced analytical functions for time-series
|
||||||
|
|
||||||
|
## Maintenance
|
||||||
|
|
||||||
|
- Sources: Official TimescaleDB Documentation, GitHub repository, blog posts.
|
||||||
|
- Last updated: 2025-12-17
|
||||||
|
- Known limits: This skill focuses on core TimescaleDB features. Advanced PostgreSQL features (e.g., PostGIS, JSONB) are covered by other specialized skills.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Slow Queries
|
||||||
|
- Ensure indexes are on `time` and other frequently queried columns.
|
||||||
|
- Verify chunk sizing is appropriate for your data ingestion rate.
|
||||||
|
- Use `EXPLAIN ANALYZE` to identify bottlenecks.
|
||||||
|
- Consider creating continuous aggregates for frequently accessed aggregated data.
|
||||||
|
|
||||||
|
### High Disk Usage
|
||||||
|
- Implement data retention policies for older, less critical data.
|
||||||
|
- Enable compression for older chunks.
|
||||||
|
- Regularly run `VACUUM ANALYZE` on your tables.
|
||||||
|
|
||||||
|
### Failed to Create Hypertable
|
||||||
|
- Ensure the `time` column is `TIMESTAMPTZ` or a supported integer type.
|
||||||
|
- The table must be empty or you must use `migrate_data => true`.
|
||||||
|
- Check for existing triggers or foreign keys that might conflict.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**This skill provides a robust foundation for managing time-series data with TimescaleDB!**
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Timescaledb - Api
|
# Timescaledb - Api
|
||||||
|
|
||||||
**Pages:** 100
|
**Pages:** 100
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Timescaledb - Compression
|
# Timescaledb - Compression
|
||||||
|
|
||||||
**Pages:** 19
|
**Pages:** 19
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Timescaledb - Getting Started
|
# Timescaledb - Getting Started
|
||||||
|
|
||||||
**Pages:** 3
|
**Pages:** 3
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Timescaledb - Hyperfunctions
|
# Timescaledb - Hyperfunctions
|
||||||
|
|
||||||
**Pages:** 34
|
**Pages:** 34
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Timescaledb - Hypertables
|
# Timescaledb - Hypertables
|
||||||
|
|
||||||
**Pages:** 103
|
**Pages:** 103
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Timescaledb Documentation Index
|
# Timescaledb Documentation Index
|
||||||
|
|
||||||
## Categories
|
## Categories
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Timescaledb - Other
|
# Timescaledb - Other
|
||||||
|
|
||||||
**Pages:** 248
|
**Pages:** 248
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Timescaledb - Performance
|
# Timescaledb - Performance
|
||||||
|
|
||||||
**Pages:** 2
|
**Pages:** 2
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Timescaledb - Time Buckets
|
# Timescaledb - Time Buckets
|
||||||
|
|
||||||
**Pages:** 16
|
**Pages:** 16
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
TRANSLATED CONTENT:
|
|
||||||
# Timescaledb - Tutorials
|
# Timescaledb - Tutorials
|
||||||
|
|
||||||
**Pages:** 12
|
**Pages:** 12
|
||||||
|
|
|
||||||
|
|
@ -455,6 +455,241 @@ build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
在**编程 / 软件开发**里,**项目架构(Project Architecture / Software Architecture)**指的是:
|
||||||
|
|
||||||
|
> **一个项目在“整体层面”是如何被拆分、组织、通信和演进的设计方案**
|
||||||
|
> ——它决定了代码怎么分层、模块怎么分工、数据怎么流动、系统如何扩展和维护。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 一句话理解
|
||||||
|
|
||||||
|
**项目架构 = 不写具体业务代码之前,就先决定“代码怎么放、模块怎么连、职责怎么分”。**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 一、项目架构主要解决什么问题?
|
||||||
|
|
||||||
|
项目架构不是“写代码的技巧”,而是解决这些**更高层问题**:
|
||||||
|
|
||||||
|
* 📦 代码怎么组织才不乱?
|
||||||
|
* 🔁 模块之间怎么通信?
|
||||||
|
* 🧱 哪些地方可以独立修改而不影响全局?
|
||||||
|
* 🚀 项目以后怎么扩展?
|
||||||
|
* 🧪 如何方便测试、调试、部署?
|
||||||
|
* 👥 多人协作如何不互相踩代码?
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 二、项目架构一般包含哪些内容?
|
||||||
|
|
||||||
|
### 1️⃣ 目录结构(最直观)
|
||||||
|
|
||||||
|
```text
|
||||||
|
project/
|
||||||
|
├── src/
|
||||||
|
│ ├── main/
|
||||||
|
│ ├── services/
|
||||||
|
│ ├── models/
|
||||||
|
│ ├── utils/
|
||||||
|
│ └── config/
|
||||||
|
├── tests/
|
||||||
|
├── docs/
|
||||||
|
└── README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
👉 决定 **“不同类型代码放哪里”**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2️⃣ 分层设计(核心)
|
||||||
|
|
||||||
|
最常见的是 **分层架构(Layered Architecture)**:
|
||||||
|
|
||||||
|
```text
|
||||||
|
表示层(UI / API)
|
||||||
|
↓
|
||||||
|
业务逻辑层(Service)
|
||||||
|
↓
|
||||||
|
数据访问层(DAO / Repository)
|
||||||
|
↓
|
||||||
|
数据库 / 外部系统
|
||||||
|
```
|
||||||
|
|
||||||
|
**规则:**
|
||||||
|
|
||||||
|
* 上层可以调用下层
|
||||||
|
* 下层不能反过来依赖上层
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3️⃣ 模块划分(职责边界)
|
||||||
|
|
||||||
|
比如一个交易系统:
|
||||||
|
|
||||||
|
```text
|
||||||
|
- market_data # 行情
|
||||||
|
- strategy # 策略
|
||||||
|
- risk # 风控
|
||||||
|
- order # 下单
|
||||||
|
- account # 账户
|
||||||
|
```
|
||||||
|
|
||||||
|
👉 每个模块:
|
||||||
|
|
||||||
|
* 只做一类事情
|
||||||
|
* 尽量低耦合、高内聚
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4️⃣ 数据与控制流
|
||||||
|
|
||||||
|
* 数据从哪里来?
|
||||||
|
* 谁负责处理?
|
||||||
|
* 谁负责存储?
|
||||||
|
* 谁负责对外输出?
|
||||||
|
|
||||||
|
例如:
|
||||||
|
|
||||||
|
```text
|
||||||
|
WebSocket → 数据清洗 → 指标计算 → AI评分 → SQLite → API → 前端
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5️⃣ 技术选型(架构的一部分)
|
||||||
|
|
||||||
|
* 编程语言(Python / Java / Go)
|
||||||
|
* 框架(FastAPI / Spring / Django)
|
||||||
|
* 通信方式(HTTP / WebSocket / MQ)
|
||||||
|
* 存储(SQLite / Redis / PostgreSQL)
|
||||||
|
* 部署(本地 / Docker / 云)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 三、常见项目架构类型(入门必懂)
|
||||||
|
|
||||||
|
### 1️⃣ 单体架构(Monolith)
|
||||||
|
|
||||||
|
```text
|
||||||
|
一个项目,一个进程
|
||||||
|
```
|
||||||
|
|
||||||
|
**适合:**
|
||||||
|
|
||||||
|
* 个人项目
|
||||||
|
* 原型
|
||||||
|
* 小系统
|
||||||
|
|
||||||
|
**优点:**
|
||||||
|
|
||||||
|
* 简单
|
||||||
|
* 好调试
|
||||||
|
|
||||||
|
**缺点:**
|
||||||
|
|
||||||
|
* 后期难扩展
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2️⃣ 分层架构(最常见)
|
||||||
|
|
||||||
|
```text
|
||||||
|
Controller → Service → Repository
|
||||||
|
```
|
||||||
|
|
||||||
|
**适合:**
|
||||||
|
|
||||||
|
* Web 后端
|
||||||
|
* 业务系统
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3️⃣ 模块化架构
|
||||||
|
|
||||||
|
```text
|
||||||
|
core + plugins
|
||||||
|
```
|
||||||
|
|
||||||
|
**适合:**
|
||||||
|
|
||||||
|
* 可插拔系统
|
||||||
|
* 策略 / 指标系统
|
||||||
|
|
||||||
|
👉 **你做量化、AI分析,非常适合这个**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4️⃣ 微服务架构(进阶)
|
||||||
|
|
||||||
|
```text
|
||||||
|
每个服务一个独立进程 + API 通信
|
||||||
|
```
|
||||||
|
|
||||||
|
**适合:**
|
||||||
|
|
||||||
|
* 大团队
|
||||||
|
* 高并发
|
||||||
|
* 长期演进
|
||||||
|
|
||||||
|
❌ **新手不建议一开始用**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 四、用一个“真实例子”理解(贴近你现在做的)
|
||||||
|
|
||||||
|
假设你做 **币安永续 AI 分析系统**:
|
||||||
|
|
||||||
|
```text
|
||||||
|
backend/
|
||||||
|
├── data/
|
||||||
|
│ └── binance_ws.py # 行情订阅
|
||||||
|
├── indicators/
|
||||||
|
│ └── vpvr.py
|
||||||
|
├── strategy/
|
||||||
|
│ └── signal_score.py
|
||||||
|
├── storage/
|
||||||
|
│ └── sqlite_writer.py
|
||||||
|
├── api/
|
||||||
|
│ └── http_server.py
|
||||||
|
└── main.py
|
||||||
|
```
|
||||||
|
|
||||||
|
这就是**项目架构设计**:
|
||||||
|
|
||||||
|
* 每个文件夹只负责一件事
|
||||||
|
* 可替换、可测试
|
||||||
|
* 后面想接 Telegram Bot / Web 前端都不用重写核心
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 五、初学者常见误区 ⚠️
|
||||||
|
|
||||||
|
❌ 一开始就搞微服务
|
||||||
|
❌ 所有代码写在一个文件
|
||||||
|
❌ 架构追求“高级感”,而不是“可维护”
|
||||||
|
❌ 没想清楚数据流就开始写
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 六、学习路线建议(很重要)
|
||||||
|
|
||||||
|
你现在学 CS,很推荐这个顺序:
|
||||||
|
|
||||||
|
1. **先写能跑的项目(不完美)**
|
||||||
|
2. **代码开始乱 → 才学架构**
|
||||||
|
3. 学会:
|
||||||
|
|
||||||
|
* 模块拆分
|
||||||
|
* 分层
|
||||||
|
* 依赖方向
|
||||||
|
4. 再学:
|
||||||
|
|
||||||
|
* 设计模式
|
||||||
|
* 微服务 / 消息队列
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
**版本**: 1.0
|
**版本**: 1.0
|
||||||
**更新日期**: 2025-11-24
|
**更新日期**: 2025-11-24
|
||||||
**维护**: CLAUDE,CODEX,KIMI
|
**维护**: CLAUDE,CODEX,KIMI
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue