← Back to Skills Marketplace
imcaptor

Junqi Dark Layout

by imcaptor · GitHub ↗ · v1.1.0 · MIT-0
cross-platform ✓ Security Clean
93
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install junqi-dark-layout
Description
使用大模型生成中国军棋双人 25 格暗棋阵型,再用 Python 做硬规则校验与图片渲染。用于用户想要军棋暗棋摆阵、想按风格生成更有策略感的布局、想输出图片卡片、或需要先生成再严格验合法性的场景。
README (SKILL.md)

军棋暗棋摆阵 V2

本技能采用 大模型生成阵型 + Python 严格校验 + Python 渲染图片 的流程。

目标不是让 Python 负责“想阵”,而是:

  • 让大模型负责策略感、迷惑性、风格差异和具体摆阵
  • 让 Python 负责硬规则裁判和图片输出
  • 为避免代理误判主路径,仓库中不再保留 Python 自动摆阵脚本

核心原则

  1. 阵型优先由大模型生成,不由 Python 随机生成器主导。
  2. Python 只负责两件事:校验合法性、渲染图片。
  3. 任何未通过 Python 校验的阵型,一律禁止返回给用户。
  4. 如果第一次生成不合法,应根据校验错误让大模型重试,而不是硬着头皮输出。

工作流

第一步:大模型生成阵型

这是唯一推荐的主生成路径。不要再调用 Python 生成器代替大模型摆阵。

根据用户要求的风格(如稳健、激进、阴阵、均衡)直接生成一个完整 30 格布局数组。

要求:

  • 使用 30 个位置表示棋盘
  • 其中 5 个固定禁摆位必须写成
  • 其余 25 个位置填入实际棋子名称
  • 输出应尽量为 JSON,不要输出松散自然语言

第二步:Python 校验

scripts/validate_layout.py 校验大模型输出的阵型。

如果校验失败:

  • 不要返回给用户
  • 把错误点反馈给大模型
  • 让大模型在保持原风格目标的前提下修正后重试

第三步:Python 渲染图片

校验通过后,再用 scripts/render_layout.py 生成最终图片卡片。

推荐输出格式

优先让大模型按下面结构输出,且除了 JSON 之外不要附加解释性文本:

{
  "style": "阴阵",
  "focus": "迷惑",
  "layout": ["连长", "师长", "排长", "团长", "司令", "炸弹", "禁", "工兵", "禁", "旅长", "连长", "工兵", "禁", "军长", "营长", "师长", "禁", "炸弹", "禁", "旅长", "地雷", "地雷", "团长", "营长", "排长", "工兵", "军旗", "连长", "排长", "地雷"],
  "notes": ["左侧示弱", "中后场藏核心大子", "保留一个较活工兵"]
}

如果无法输出完整对象,至少要输出 layout 数组。

推荐字段约束:

  • style:字符串,可选,例如 稳健 / 激进 / 阴阵 / 均衡
  • focus:字符串,可选,例如 均衡 / 保旗 / 中攻 / 侧攻 / 迷惑
  • layout:长度必须为 30 的字符串数组
  • notes:可选,0 到 3 条简短说明

标准 25 格棋盘模型

己方区域按 6 行 × 5 列表示,共 30 个位置,其中 25 个可摆棋,5 个固定禁摆位。

可摆位置:

  • 第 1 排:第 1、2、3、4、5 列
  • 第 2 排:第 1、3、5 列
  • 第 3 排:第 1、2、4、5 列
  • 第 4 排:第 1、3、5 列
  • 第 5 排:第 1、2、3、4、5 列
  • 第 6 排:第 1、2、3、4、5 列

固定禁摆位:

  • 第 2 排第 2 列
  • 第 2 排第 4 列
  • 第 3 排第 3 列
  • 第 4 排第 2 列
  • 第 4 排第 4 列

大本营位置:

  • 第 6 排第 2 列
  • 第 6 排第 4 列

地雷合法位置:

  • 第 5 排第 1、2、3、4、5 列
  • 第 6 排第 1、3、5 列

棋子集合

除非用户明确要求其他变体,否则使用以下标准 25 子:

  • 司令 ×1
  • 军长 ×1
  • 师长 ×2
  • 旅长 ×2
  • 团长 ×2
  • 营长 ×2
  • 连长 ×3
  • 排长 ×3
  • 工兵 ×3
  • 炸弹 ×2
  • 地雷 ×3
  • 军旗 ×1

硬规则(必须由 Python 校验)

违反任意一条即为非法阵型:

  1. 布局长度必须为 30。
  2. 5 个固定禁摆位必须为
  3. 25 个合法格必须全部填满,不得留空。
  4. 军旗必须且只能放在大本营(第 6 排第 2 列或第 4 列)。 4.1 两个大本营必须且只能分别放:军旗、排长。因为大本营棋子不能动,排长是最小牺牲。
  5. 地雷只能放在后两排合法雷区。
  6. 地雷不得进入大本营。
  7. 炸弹不得出现在第一排。
  8. 每种棋子的数量必须完全正确。
  9. 重要的子(至少司令、军长、师长、旅长、团长、营长、工兵)不能被封死,尤其不能夹在地雷和大本营棋子之间。因为地雷不能动,大本营棋子也不能动;而工兵一旦被封死,后续排雷能力会被直接废掉。
  10. 由于另一个大本营固定放排长,所以不要再把“连长也可放大本营”当成可接受方案。此规则已废止,统一改为“军旗 + 排长”。

给大模型的生成要求

在生成阵型时,优先追求这些目标:

  • 阵型风格明显,不要四种风格长得都差不多
  • 阴阵要有一定迷惑感
  • 激进要有更强前压感
  • 稳健要更注重平衡与护旗
  • 均衡要避免明显偏科
  • 重要的子(包括工兵)要有行动空间,不能被地雷、大本营棋子或其他不能动/不应动的结构封死
  • 两个大本营固定为“军旗 + 排长”,不要再把别的子塞进大本营
  • 尤其避免把重要子摆在“地雷 + 大本营棋子”之间
  • 工兵不能被当成后排死子随便锁住;一旦工兵被封死或兑光,后续排雷会非常被动,甚至无法取胜
  • 允许有创意,但不要违反硬规则

失败处理

如果 validate_layout.py 返回不合法:

  • 不要把非法阵型返回给用户
  • 不要嘴上说“已修正”却不重新校验
  • 应把错误信息喂回模型,要求重生成

推荐重试规则:

  1. 第一次生成后立即校验。
  2. 如果失败,把 errors 原样反馈给大模型。
  3. 要求大模型保留原风格目标,只修正违规点和必要位置。
  4. 最多重试 2 到 3 次。
  5. 如果仍不合法,明确告诉用户本次生成失败,不要输出非法阵型。

例如校验结果可能是:

{
  "valid": false,
  "errors": [
    "炸弹不能放在第一排",
    "军旗必须且只能位于大本营(第6排第2列或第4列)"
  ]
}

输出要求

  • 校验通过前,不要给用户最终阵型
  • 校验通过后,再输出阵型或图片
  • 如用户要求图片,使用 scripts/render_layout.py
  • 解释应简短,不要大段空话

工具文件

  • scripts/validate_layout.py:校验阵型是否合法
  • scripts/render_layout.py:把阵型渲染成图片卡片
Usage Guidance
This skill appears to do what it claims: use an LLM to generate Junqi layouts, validate them with Python, and render an image. There are no network calls or secret requests. Two practical cautions: (1) When invoking validate_layout.py, pass the layout as a JSON array string (or ensure the path argument points to a trusted JSON file). The validate script will treat non-JSON inputs as a path and will read that file from disk — avoid passing untrusted or attacker-controlled path strings. (2) The scripts write image files and read fonts from standard system paths; run them in a sandbox or with limited file permissions if you are concerned. If you need higher assurance, have a developer inspect or harden load_layout to reject path inputs or explicitly require JSON-only input.
Capability Analysis
Type: OpenClaw Skill Name: junqi-dark-layout Version: 1.1.0 The skill bundle is designed to generate, validate, and render Chinese Military Chess (Junqi) layouts. The workflow involves the AI agent generating a layout, which is then processed by `scripts/validate_layout.py` for rule compliance and `scripts/render_layout.py` for image generation using the Pillow library. The code and instructions are strictly aligned with the stated purpose, containing no evidence of data exfiltration, malicious execution, or harmful prompt injection.
Capability Assessment
Purpose & Capability
Name/description match the included artifacts: two Python scripts implement strict validation and image rendering, and the SKILL.md describes using an LLM for generation. No unrelated credentials, binaries, or installs are requested.
Instruction Scope
SKILL.md instructs the agent to have the LLM output a JSON layout string and to use validate_layout.py and render_layout.py for validation and image output. The validate script also accepts a filesystem path (it will read a JSON file if the argument doesn't start with '['), which is not described in SKILL.md — if the agent is given or emits a path instead of JSON, the script can read arbitrary local files. The SKILL.md does not instruct reading arbitrary files, but the code's load_layout behavior is a minor mismatch and a potential local-file-read vector if misused.
Install Mechanism
Instruction-only with included Python scripts and no install spec; no downloads or package installs. Risk is low — user must already have Python and Pillow available to run scripts.
Credentials
No environment variables, credentials, or config paths are requested. The scripts perform only local file read/write for layouts and images and do not access network or secrets.
Persistence & Privilege
Skill does not request persistent/always-on presence and does not modify other skills or system-wide settings.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install junqi-dark-layout
  3. After installation, invoke the skill by name or use /junqi-dark-layout
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.1.0
强制大本营为军旗+排长;新增「重要棋子(含工兵)不可被封死」硬规则;validator 增加大本营棋子约束;删除旧版 Python 摆阵脚本;文档补充 ClawHub 安装说明
v1.0.0
junqi-dark-layout v1.0.0 - Initial release with full support for double-sided (25 piece) Chinese Junqi dark layout generation. - Uses a large model to generate strategic formations with customizable style and focus. - Python scripts strictly validate all layouts against fixed game rules before user output, ensuring legality (including special positions for forbidden squares, mines, and the flag). - Successfully validated layouts can be rendered to images using Python. - Fully documented workflow, recommended output format, and error-handling process included.
Metadata
Slug junqi-dark-layout
Version 1.1.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Junqi Dark Layout?

使用大模型生成中国军棋双人 25 格暗棋阵型,再用 Python 做硬规则校验与图片渲染。用于用户想要军棋暗棋摆阵、想按风格生成更有策略感的布局、想输出图片卡片、或需要先生成再严格验合法性的场景。 It is an AI Agent Skill for Claude Code / OpenClaw, with 93 downloads so far.

How do I install Junqi Dark Layout?

Run "/install junqi-dark-layout" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Junqi Dark Layout free?

Yes, Junqi Dark Layout is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Junqi Dark Layout support?

Junqi Dark Layout is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Junqi Dark Layout?

It is built and maintained by imcaptor (@imcaptor); the current version is v1.1.0.

💬 Comments