>> skill/codestyle
stars: 43
forks: 2
watches: 43
last updated: 2026-02-23 13:53:04
Codestyle
Code template management: CLI tools for search/get/upload + AI-guided generation.
Decision Tree
User request
│
├─ "search" / "检索" ──→ Search Workflow (CLI, local+remote)
│
├─ "get" / "获取" ──→ Get Workflow (CLI, local+remote)
│
├─ "generate" / "生成" ──→ Generate Workflow (AI dialog, then upload)
│
└─ "upload" / "上传" ──→ Upload Workflow (CLI, remote)
Commands
| Command | Execution | Description |
|---|---|---|
search | CLI (JAR) | Search templates (local Lucene + remote API) |
get | CLI (JAR) | Get full template content |
generate | AI Dialog | Multi-turn conversation, then call upload |
upload | CLI (JAR) | Upload template to server |
Quick Start
Windows
"<SKILL_DIR>\scripts\codestyle.bat" search "keyword"
"<SKILL_DIR>\scripts\codestyle.bat" get "template-path"
"<SKILL_DIR>\scripts\codestyle.bat" upload --path ./my-template
Linux/macOS
bash <SKILL_DIR>/scripts/codestyle search "keyword"
bash <SKILL_DIR>/scripts/codestyle get "template-path"
bash <SKILL_DIR>/scripts/codestyle upload --path ./my-template
Generate (AI Dialog)
User: 把这段代码做成模板:[代码]
AI: [多轮对话引导生成模板]
AI: [调用 upload 存储]
Workflows
See references/ for detailed workflow instructions:
- Search Workflow - Find templates (local+remote)
- Get Workflow - Retrieve template content by full path
- Generate Workflow - AI-guided template creation
- Upload Workflow - Submit templates (remote)
Generate Workflow Overview
Generate workflow is pure AI dialog, no script calls until final upload.
| Input | Example | Pre-processing |
|---|---|---|
| Code snippet | @RestController ... | None |
| Current file | "当前这个文件" | Read file |
| Local path | /path/to/file.java | Read file |
| GitHub URL | https://github.com/xxx/repo | Clone repo |
| Web URL | https://blog.xxx.com/... | Crawl content |
Process: 识别输入 → 预处理 → 分析结构 → 选择模板 → AI生成 → 去重检测 → 用户确认 → 调用upload
First-Time Use
Automatic initialization on first command:
- Detect no
.initializedmarker - Download JAR file (if needed)
- Clone template repository
- Create
.initializedmarker - Execute original command
Configuration
See references/config.md for configuration options.
Template Format
Directory Structure
Standard template structure with meta.json in version directory:
<artifactId>/
└── <version>/
├── meta.json # Template metadata (required)
├── README.md # Documentation (optional)
└── <subdirectories> # Template files (.ftl)
Example:
CRUD/
└── 1.0.0/
├── meta.json
├── README.md
├── backend/
│ ├── sql/Menu.ftl
│ └── src/main/java/...
└── frontend/
└── src/...
See references/template-format.md for complete format specification.
See references/template-syntax.md for template syntax.
Requirements
- JDK 17+
- Git 2.0+ (for first-time setup and repo cloning)
- Internet connection (for remote API calls)
