zz8zz 发表于 2026-4-7 00:29:22

楼上字多, 最帅

wyc00 发表于 2026-4-7 10:22:25

在让TRAE CN成功编程后,请它总结在编程过程中所犯的错误,让DEEPSEEK根据总结文字去修改技能书:
感谢你提供的详细错误总结!这些是实际开发中非常宝贵的问题记录。我将根据这些内容修改 `SKILL.md`,增加针对性的规则来避免同类错误。

以下是修改后的 `SKILL.md`,新增了 **"Common Mistakes & Prevention"** 章节:

```markdown
---
name: volcano-programming
description: "Use for Volcano Programming questions that need official syntax, API names, sample code, or platform-specific guidance for 火山视窗, 火山安卓, and 火山服务器 on Windows. Trigger when the user mentions 火山编程, 火山视窗, 火山安卓, 火山服务器, asks how to write a statement or command in Volcano syntax, wants code translated from C++/Java/Go concepts into Volcano code, or needs examples from the local official Markdown manuals in `%USERPROFILE%\\\\.codex\\\\docs`."
---

# Volcano Programming

Use the local official Volcano manuals as the primary source of truth before answering syntax, API, or example-code questions.

Prefer official names and examples from the manuals over generic programming habits or guessed syntax.

## Platform Routing

Use these manual paths:

- 火山视窗: read `<docs-dir>\vol_win_full.md`
- 火山安卓: read `<docs-dir>\vol_android_full.md`
- 火山服务器: read `<docs-dir>\vol_server_full.md`

Set `<docs-dir>` to `%USERPROFILE%\.codex\docs`.

If the user does not clearly specify the platform, ask a short clarification question before giving syntax-sensitive code.

Use this mapping when reasoning from underlying language concepts:

- 火山视窗: closest to Windows/C++ style concepts
- 火山安卓: closest to Android/Java style concepts
- 火山服务器: closest to Go/backend style concepts

Return Volcano syntax, not raw C++/Java/Go, unless the user explicitly asks for a comparison.

## Retrieval Workflow

1. Determine the target platform.
2. Search only the relevant manual first.
3. Search by Volcano keyword, Chinese term, English API name, and likely underlying-language term when needed.
4. Read the nearby section around the best match instead of loading the whole manual.
5. Cross-check examples with the surrounding syntax notes before answering.
6. When scanning the user's project files, ignore backup files and prefer the active project/source files.
7. Ignore generated cache directories whose path segment is `_int` or contains `_int`, unless the user explicitly asks to inspect them.

Assume a Windows environment and PowerShell-style paths when searching local files.

Prefer `rg` for search. Recommended patterns for PowerShell:

- `rg -n "关键词" "$env:USERPROFILE\.codex\docs\vol_win_full.md"`
- Or using single quotes: `rg -n '关键词' 'C:\Users\用户名\.codex\docs\vol_win_full.md'`

Read (references/doc-index.md) for the manual map and search tips.

Ignore these backup files unless the user explicitly asks for them:

- `*.~vbak.vprj`
- `*.~vbak.wsv`

## File Handling

Treat Volcano project/workspace files as UTF-16LE or UTF-8 depending on the file's BOM or encoding detection. If no BOM is present, prefer UTF-8. When editing `.vprj` or `.wsv` files, preserve the original encoding without converting to another format.

When scanning the user's project files:
- Prefer files with extensions: `.v`, `.vproj`, `.wsv`, `.vui`
- Ignore backup files: `*.~vbak.vprj`, `*.~vbak.wsv`, `*.bak`
- Ignore cache directories: `_int`, `_temp`, `obj`, `bin`
- Prefer the most recently modified source files when multiple candidates exist.

## Embedded Methods

Volcano allows embedded methods that directly use underlying language syntax (C++ for 火山视窗, Java for 火山安卓, Go for 火山服务器).

When encountering or generating embedded methods:
1. Clearly mark the embedded section with appropriate syntax indicators.
2. Do not assume embedded syntax follows Volcano's own statement rules.
3. Prefer pure Volcano syntax unless the user explicitly asks for embedded methods or the required functionality is only available via embedding.

## User-Provided Code

When the user provides a Volcano code snippet directly (not as a file path):
1. Assume the code is written for the platform indicated by syntax patterns or user statement.
2. If the platform is ambiguous, ask for clarification.
3. Analyze the code against the relevant manual if correctness is in question.
4. Do not modify the user's code unless explicitly requested; instead, explain potential issues.

## Error Handling

If a required manual path is missing, report the missing file and:
- If the platform is unambiguous, fall back to general knowledge but explicitly mark the answer as "not verified against official manual".
- If multiple manuals are missing or the platform is unclear, ask the user to verify the manual location or provide the information directly.

## Common Mistakes & Prevention (火山视窗)

Based on real development experiences, avoid these frequently encountered errors when writing Volcano code:

### 1. Syntax Errors

| Mistake | Wrong | Correct |
|---------|-------|---------|
| Conditional statement format | `如果 (x < 0) { x = 0 }` | `如果 (x < 0)` + 换行 + `x = 0` + 换行 + `结束如果` |
| Method parameter order | Always check manual; do not guess parameter order (e.g., 移动读写位置 expects (基准位置, 偏移量), not (偏移量, 基准位置)) |
| Invalid characters | Ensure no stray whitespace or invisible characters in code |

**Rule**: Never use C++/Java single-line brace syntax for Volcano conditional statements. Always use proper multi-line format with `如果`, `否则`, `结束如果`.

### 2. File Operation Errors

| Mistake | Wrong | Correct |
|---------|-------|---------|
| Filename suffix change | `磁盘操作类.改变文件名后缀("锤子.cur", ".cur")` may produce "锤子..cur" | Manually handle filename strings to avoid double dots |
| File position constants | Use integer `0` for file start | Use `文件基准位置.文件首` constant |
| Missing file validation | Assume file exists and is valid | Always check `文件是否存在()` and validate file size/format before operations |

**Rule**: Always use named constants from the `文件基准位置` enum instead of magic numbers (0, 1, 2). Validate file existence before operations.

### 3. Image/CUR/ICO Format Requirements

When working with CUR (cursor) or ICO (icon) files:

| Requirement | Details |
|-------------|---------|
| Double height | DIB header height must be `2 × image_height` (XOR mask + AND mask) |
| AND mask | Must compute and append AND mask data: `每行字节数 = (宽度 + 7) / 8`, aligned to 4-byte boundary |
| XOR mask | Standard bitmap color data precedes the AND mask |

**Rule**: For CUR/ICO files, never treat them as standard BMP. Always calculate AND mask and double the height value in the DIB header.

### 4. Byte Set (字节集) Operations

| Wrong approach | Correct approach |
|----------------|------------------|
| Using non-existent methods like `取字节集中间部分`, `添加字节` | Use `字节集操作` class methods: `取字节集中间()`, `追加字节集()`, `插入字节集()` |
| Assuming methods exist without verification | Check the `字节集操作` class in manual for available methods |

**Rule**: Do not invent byte set method names. Use only methods documented in the `字节集操作` class.

### 5. Environment & Dependencies

| Mistake | Prevention |
|---------|------------|
| Assuming Python is available with specific libraries | Check Python availability and required packages (e.g., Pillow) before generating Python-dependent code; provide fallback pure Volcano solutions |
| Incorrect C++ embedding syntax | When embedding C++ in 火山视窗, verify the exact syntax for `@嵌入式方法` and `@嵌入代码` directives; do not guess |
| Not handling missing dependencies gracefully | Include `取程序错误信息()` or equivalent error reporting; provide clear user guidance |

### 6. Code Structure Problems

| Mistake | Wrong | Correct |
|---------|-------|---------|
| Event handling | `挂接事件(按钮)` | `挂接事件(按钮, 标记值)` - requires two parameters |
| Variable naming | Variables named `宽度`, `高度` conflicting with window class properties | Use distinct names like `图片宽度`, `窗口高度` |
| Error handling | No validation or user feedback | Include `如果 (取反(文件是否存在(路径)))` with descriptive `信息框()` prompts |
| Missing event loop | Code exits before processing events | Ensure `消息循环` or `运行()` is called for GUI applications |

### 7. General Prevention Checklist

Before outputting Volcano code, verify:

- [ ] Conditional statements use multi-line `如果...结束如果` format, not brace syntax
- [ ] Method parameters follow manual order (check against documentation)
- [ ] File operations use named constants (e.g., `文件基准位置.文件首`) not magic numbers
- [ ] Filename operations avoid double dots; prefer string manipulation over `改变文件名后缀` when uncertain
- [ ] CUR/ICO files have double height and AND mask properly implemented
- [ ] Byte set operations use `字节集操作` class documented methods
- [ ] Environment dependencies are checked or pure Volcano alternatives provided
- [ ] Event handling uses correct parameter count (`挂接事件` requires two parameters)
- [ ] Variable names don't conflict with reserved names or window properties
- [ ] Error handling provides user feedback with `信息框()` or `调试输出()`

## Response Rules

- Cite which manual was used when the answer depends on official syntax or API details.
- If the manuals do not contain an exact match, say that explicitly and mark the answer as an inference.
- Do not invent unsupported syntax, parameter order, event names, or library behavior.
- Prefer short runnable examples in Volcano style.
- When converting code, explain any concept mapping that is not obvious between Volcano and the underlying platform.
- When multiple manuals may apply, tell the user which one you chose and why.
- When working with Volcano files, keep the file in its original encoding (UTF-16LE or UTF-8) unless the user provides clear evidence that a specific file uses another encoding.
- When working with `.vprj` or `.wsv` files, preserve the original encoding and do not silently convert them to another encoding.
- **When generating code for 火山视窗**: Review the Common Mistakes section above and ensure none of those patterns appear in the output.
- **When uncertain about parameter order or method existence**: State the uncertainty explicitly and recommend checking the manual.

## Example Requests

- "火山视窗里怎么声明数组并遍历?"
- "把这段 Java 思路改成火山安卓写法"
- "火山服务器怎么发 HTTP 请求?"
- "从官方文档里找一个定时器或线程的示例"
- "这个火山命令是什么意思,给我对应示例"

## Boundaries

- This skill is intended for Windows only.
- This skill depends on local manuals existing under `%USERPROFILE%\.codex\docs`.
- If a manual path is missing, report the missing file and continue with the remaining manuals if possible (see Error Handling section).
- Do not treat general C++/Java/Go examples as official Volcano syntax unless the manuals support the mapping.
- Do not inspect or cite backup project files such as `*.~vbak.vprj` and `*.~vbak.wsv` unless the user explicitly requests those files.
- Do not inspect generated cache directories named `_int` or whose path contains `_int` unless the user explicitly requests them.
```

## 主要修改摘要

| 新增内容 | 说明 |
|----------|------|
| **Common Mistakes & Prevention** 章节 | 基于你提供的错误经验,系统化整理了7类常见错误 |
| 语法错误表格 | 明确条件语句不能用C++大括号格式,必须用多行`如果...结束如果` |
| 文件操作错误表格 | 包含`改变文件名后缀`可能产生双点的问题、`文件基准位置`常量使用 |
| CUR/ICO格式要求 | 明确双倍高度、AND掩码的计算规则 |
| 字节集操作 | 禁止臆造方法名,必须使用`字节集操作`类 |
| 环境依赖 | Python/Pillow检查、C++嵌入语法验证 |
| 代码结构问题 | 事件处理、变量命名、错误处理、消息循环 |
| 预防检查清单 | 输出代码前应验证的10个要点 |
| Response Rules增强 | 新增两条规则:生成代码时检查Common Mistakes;不确定时明确声明 |

这份修改后的 `SKILL.md` 应该能有效防止同类错误再次发生。

wyc00 发表于 2026-4-7 10:52:13

这是用trae cn编写的程序,已调试通过,注意trae cn编写的窗口组件在窗口中是看不到的,你自己要手动把它弄出来:pos=\“0,0,0,0\"”,你把后面两个0,改成数字后就可以在窗口中看到,再人工按排,所有组件都是这样的



wyc00 发表于 2026-4-7 13:10:52

在火山视窗中,模块文件(.v文件)和脚本文件(.wsv文件)的使用方式如下:

1. 模块文件(.v文件) :
   
   - 这些是预编译的模块,包含类定义、方法和常量
   - 它们已经被编译成火山平台可识别的格式
   - 你可以在wsv文件中直接引用这些模块中的类和方法
2. 脚本文件(.wsv文件) :
   
   - 这是你编写代码的主要文件
   - 你可以直接使用模块中定义的类和方法,无需转换
3. 使用方式 :
   
   - 在wsv文件中,你可以直接使用模块中的类,例如: 变量 图像对象 <类型 = 火山.视窗.图像处理.图像处理类>
   - 模块中的方法也可以直接调用,例如: 图像对象.创建自图像文件 (png路径, 图像格式类型.PNG格式)
4. 注意事项 :
   
   - 某些类可能需要使用完整的命名空间路径,如 火山.视窗.图像处理.图像处理类
   - 确保模块已经正确导入到项目中(从你的项目结构看,模块已经在"模块"目录下)
所以,你不需要将模块文件转换为wsv格式,直接在wsv文件中使用它们即可。

wyc00 发表于 2026-4-8 16:07:14

修改技能书的另一种方法:可以在TRAE CN使用中进行,让它总结自己使用火山视窗时常犯的错误,再由自己总结成文,形成修改smill.md的意见,在TRAE CN中可以按路径打开技能书,把它的修改意见拷贝到技能书最后面光标处,按Ctrl+S保存即可

503879304 发表于 2026-4-9 22:55:51

我现在使用AIvolcanoSkill.zip 文件 直接把Skills文件扔给WorkBuddy然后在Skills里添加了一个 创建和更新项目日志的 记忆库.md 文件来记录项目制作的经验和知识!现在完美运行!1千多行的代码 报错整改了6 7 次吧!就可以搞定!虽然目前只能傻瓜式的复制代码到main里但是够用 还不烧钱!再加上现在GLM-5.1 的加入!更好了!:噜阿噜

大有可为 发表于 2026-4-9 23:02:05

503879304 发表于 2026-4-9 22:55
我现在使用AIvolcanoSkill.zip 文件 直接把Skills文件扔给WorkBuddy然后在Skills里添加了一个 创建和更新 ...

你把易错点让ai整理到技能里面去 下次就不会犯了

wyc00 发表于 2026-4-10 10:11:17

改完语法错误,让它立即改技能书,不拖

503879304 发表于 2026-4-10 16:58:29

大有可为 发表于 2026-4-9 23:02
你把易错点让ai整理到技能里面去 下次就不会犯了
C:\Users\tt\Desktop\1775809301726   缺口有点大!file:///C:/Users/tt/Desktop/1775809301726.jpg

wyc00 发表于 5 天前

大有可为 发表于 2026-3-26 09:01
下个更新就能在新建项目的时候选择wsv格式了,目前是手动转换到wsv 添加现有 删除原来的v

这个比较吃模 ...

gpt5.4怎么申请的?
页: 1 2 3 4 5 6 [7]
查看完整版本: 利用 Codex+火山语法文档实现 AI 辅Zhu火山平台编程