cnhkmcp 2.1.5__py3-none-any.whl → 2.1.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (17) hide show
  1. cnhkmcp/__init__.py +1 -1
  2. cnhkmcp/untracked/AI/321/206/320/231/320/243/321/205/342/225/226/320/265/321/204/342/225/221/342/225/221/BRAIN_AI/321/206/320/231/320/243/321/205/342/225/226/320/265/321/204/342/225/221/342/225/221Mac_Linux/321/207/320/231/320/230/321/206/320/254/320/274.zip +0 -0
  3. cnhkmcp/untracked/AI/321/206/320/231/320/243/321/205/342/225/226/320/265/321/204/342/225/221/342/225/221//321/205/320/237/320/234/321/205/320/227/342/225/227/321/205/320/276/320/231/321/210/320/263/320/225AI/321/206/320/231/320/243/321/205/342/225/226/320/265/321/204/342/225/221/342/225/221_Windows/321/207/320/231/320/230/321/206/320/254/320/274.exe +0 -0
  4. cnhkmcp/untracked/skills/Claude_Skill_Creation_Guide.md +140 -0
  5. cnhkmcp/untracked/skills/expression_verifier/SKILL.md +51 -0
  6. cnhkmcp/untracked/skills/expression_verifier/scripts/validator.py +889 -0
  7. cnhkmcp/untracked/skills/expression_verifier/scripts/verify_expr.py +52 -0
  8. cnhkmcp/untracked/skills/pull_BRAINSkill/SKILL.md +51 -0
  9. cnhkmcp/untracked/skills/pull_BRAINSkill/scripts/pull_skills.py +188 -0
  10. {cnhkmcp-2.1.5.dist-info → cnhkmcp-2.1.7.dist-info}/METADATA +1 -1
  11. {cnhkmcp-2.1.5.dist-info → cnhkmcp-2.1.7.dist-info}/RECORD +15 -9
  12. cnhkmcp/untracked/APP/Tranformer/ace.log +0 -0
  13. cnhkmcp/untracked/APP/Tranformer/parsetab.py +0 -60
  14. {cnhkmcp-2.1.5.dist-info → cnhkmcp-2.1.7.dist-info}/WHEEL +0 -0
  15. {cnhkmcp-2.1.5.dist-info → cnhkmcp-2.1.7.dist-info}/entry_points.txt +0 -0
  16. {cnhkmcp-2.1.5.dist-info → cnhkmcp-2.1.7.dist-info}/licenses/LICENSE +0 -0
  17. {cnhkmcp-2.1.5.dist-info → cnhkmcp-2.1.7.dist-info}/top_level.txt +0 -0
cnhkmcp/__init__.py CHANGED
@@ -50,7 +50,7 @@ from .untracked.forum_functions import (
50
50
  read_full_forum_post
51
51
  )
52
52
 
53
- __version__ = "2.1.5"
53
+ __version__ = "2.1.7"
54
54
  __author__ = "CNHK"
55
55
  __email__ = "cnhk@example.com"
56
56
 
@@ -0,0 +1,140 @@
1
+ # Claude Code Skill 撰写指南
2
+
3
+ 本指南基于 Claude Code 官方文档整理,旨在帮助开发者快速掌握 Agent Skill (技能) 的创建与管理方法。
4
+
5
+ ## 1. 什么是 Skill?
6
+
7
+ Skill 是一个 Markdown 文件,用于“教会” Claude 如何执行特定任务(如按特定标准审查代码、生成 Git 提交信息等)。
8
+ - **自动触发**:当用户的请求匹配 Skill 的 `description` 时,Claude 会自动应用该 Skill。
9
+ - **作用域**:可以在个人层面(跨项目)或项目层面(特定仓库)定义。
10
+
11
+ ## 2. 目录结构与存放位置
12
+
13
+ ### 存放位置
14
+ - **个人 Skill** (所有项目可用): `~/.claude/skills/<skill-name>/`
15
+ - **项目 Skill** (仅当前项目可用): `.claude/skills/<skill-name>/`
16
+
17
+ ### 文件结构示例
18
+ 一个标准的 Skill 目录结构如下:
19
+ ```text
20
+ my-skill/
21
+ ├── SKILL.md # [必需] 核心定义文件
22
+ ├── reference.md # [可选] 详细参考文档(渐进式加载)
23
+ ├── examples.md # [可选] 示例库
24
+ └── scripts/ # [可选] 工具脚本
25
+ └── helper.py
26
+ ```
27
+
28
+ ## 3. 编写 SKILL.md
29
+
30
+ `SKILL.md` 是 Skill 的核心,由 **YAML Frontmatter (元数据)** 和 **Markdown 正文 (指令)** 组成。
31
+
32
+ ### YAML Frontmatter 参数
33
+
34
+ ```yaml
35
+ ---
36
+ name: my-skill-name # [必需] 技能名称 (小写字母、数字、连字符,max 64字符)
37
+ description: >- # [必需] 描述技能功能及触发时机 (max 1024字符)。
38
+ # Claude 依靠此描述决定何时调用该 Skill。
39
+ # 务必包含用户可能会用到的关键词。
40
+ allowed-tools: # [可选] 限制该 Skill 可用的工具
41
+ - Read
42
+ - Grep
43
+ user-invocable: true # [可选] 是否在 slash (/) 命令菜单中显示。默认为 true。
44
+ context: fork # [可选] 设为 fork 可在隔离的子 Agent 环境中运行
45
+ agent: general-purpose # [可选] 配合 context: fork 使用,指定 Agent 类型
46
+ hooks: # [可选] 定义生命周期钩子
47
+ PreToolUse:
48
+ - matcher: "Bash"
49
+ hooks:
50
+ - type: command
51
+ command: "./scripts/security-check.sh"
52
+ ---
53
+ ```
54
+
55
+ ### Markdown 正文
56
+
57
+ 正文部分是给 Claude 的具体操作指南。
58
+
59
+ ```markdown
60
+ # My Skill Name
61
+
62
+ ## Instructions (指令)
63
+ 清晰、分步骤地告诉 Claude 该怎么做。
64
+ 1. 第一步...
65
+ 2. 第二步...
66
+
67
+ ## Examples (示例)
68
+ 提供具体的输入输出示例,帮助 Claude 理解预期效果。
69
+
70
+ ## Utility Scripts (工具脚本)
71
+ 如果需要执行复杂逻辑,可以引用 scripts 目录下的脚本:
72
+ Run the validation script:
73
+ python scripts/validate.py input.txt
74
+ ```
75
+
76
+ ## 4. 最佳实践:渐进式披露 (Progressive Disclosure)
77
+
78
+ 为了节省 Context Window(上下文窗口),不要将所有内容都塞进 `SKILL.md`。
79
+
80
+ 1. **核心文件 (`SKILL.md`)**:仅包含最核心的指令和导航。
81
+ 2. **支持文件**:将详细的 API 文档、长篇示例放入 `reference.md` 或 `examples.md`。
82
+ 3. **引用方式**:在 `SKILL.md` 中使用相对链接引用支持文件。Claude 会在需要时读取它们。
83
+ - `For API details, see [reference.md](reference.md)`
84
+
85
+ ## 5. 高级配置
86
+
87
+ ### 限制工具权限 (`allowed-tools`)
88
+ 如果你希望 Skill 只能读取文件而不能修改,可以限制其权限:
89
+ ```yaml
90
+ allowed-tools:
91
+ - Read
92
+ - Grep
93
+ - Glob
94
+ ```
95
+
96
+ ### 钩子 (Hooks)
97
+ 可以在工具使用前后执行特定操作,例如安全检查:
98
+ ```yaml
99
+ hooks:
100
+ PreToolUse:
101
+ - matcher: "Bash"
102
+ hooks:
103
+ - type: command
104
+ command: "./scripts/check.sh"
105
+ once: true
106
+ ```
107
+
108
+ ## 6. 测试与调试
109
+
110
+ 1. **验证加载**:
111
+ 在 Claude Code 中输入:`What Skills are available?`
112
+ 如果列表中出现了你的 Skill,说明加载成功。
113
+
114
+ 2. **触发测试**:
115
+ 根据你写的 `description` 提出请求。
116
+ 例如描述是 "Explains code with diagrams",则输入 "How does this code work?"。
117
+ Claude 应提示使用该 Skill。
118
+
119
+ 3. **故障排查**:
120
+ - **不触发**:检查 `description` 是否不够具体?是否包含了用户会说的关键词?
121
+ - **不加载**:检查文件名是否严格为 `SKILL.md` (大小写敏感)?YAML 格式是否正确?
122
+ - **调试模式**:使用 `claude --debug` 启动以查看加载错误。
123
+
124
+ ## 7. 示例:解释代码 Skill
125
+
126
+ **位置**: `~/.claude/skills/explaining-code/SKILL.md`
127
+
128
+ ```yaml
129
+ ---
130
+ name: explaining-code
131
+ description: Explains code with visual diagrams and analogies. Use when explaining how code works or when the user asks "how does this work?".
132
+ ---
133
+
134
+ When explaining code, always include:
135
+
136
+ 1. **Start with an analogy**: Compare the code to something from everyday life.
137
+ 2. **Draw a diagram**: Use ASCII art to show the flow.
138
+ 3. **Walk through the code**: Explain step-by-step.
139
+ 4. **Highlight a gotcha**: Common mistakes.
140
+ ```
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: expression_verifier
3
+ description: Verify the syntax of an alpha expression irrespective of field existence. Use when checking if an alpha expression string is syntactically valid, has correct function arguments, and properly matched parentheses.
4
+ allowed-tools: Bash
5
+ ---
6
+
7
+ # Expression Verifier
8
+
9
+ This skill verifies the syntax of a mathematical/logical expression using the project's `ExpressionValidator`.
10
+
11
+ It performs the following checks:
12
+ 1. **Lexical Analysis**: Identifies valid tokens (operators, functions, variables).
13
+ 2. **Syntax Analysis**: specific grammar rules.
14
+ 3. **Function Validation**: checks argument counts and types for supported functions (e.g., `group_sum`, `rank`).
15
+ 4. **Parenthesis Matching**.
16
+
17
+ **Note**: This skill **does not** validate whether the data fields (variables) mentioned in the expression actually exist in the database. It only checks if they are used as valid identifiers.
18
+
19
+ ## How to use
20
+
21
+ To verify an expression, follow these steps:
22
+
23
+ 1. **Locate the Script**: The verification script is `scripts/verify_expr.py` inside this skill's folder.
24
+ * **Context Check**: Because you (Claude) are running in the user's project directory, `scripts/` might not be in the current path.
25
+ * **Primary Path (Windows)**: Check `%USERPROFILE%\.claude\skills\expression_verifier\scripts\verify_expr.py` first.
26
+ * **Alternative**: If running as a project skill, check `.claude/skills/expression_verifier/scripts/verify_expr.py`.
27
+
28
+ 2. **Execute**: Run the script using python. Ensure you quote the expression to handle spaces and special characters.
29
+
30
+ ```bash
31
+ # Example (adjust path as needed)
32
+ python ".claude/skills/expression_verifier/scripts/verify_expr.py" "ts_rank(close, 10)"
33
+ ```
34
+
35
+ ## Interpreting Results
36
+
37
+ The script outputs a JSON object.
38
+ - If `valid` is `true`, the expression is syntactically correct.
39
+ - If `valid` is `false`, check the `errors` list for details.
40
+
41
+ ## Examples
42
+
43
+ ### Check a valid expression
44
+ ```bash
45
+ python scripts/verify_expr.py "rank(close) / ts_delay(open, 5)"
46
+ ```
47
+
48
+ ### Check an invalid expression
49
+ ```bash
50
+ python scripts/verify_expr.py "rank(close, 5)" # rank only takes 1 argument usually
51
+ ```