Agent skill

Contract Gen

by zh-xx in zh-xx/legal-assistant-skills

合同生成技能,以资深法律专家身份生成完整合同。适用场景:(1) 用户要求'起草合同''生成合同''拟定协议''写合同''草拟合同'时;(2) 用户提供合同类型和交易信息,要求生成完整合同文本时;(3) 用户要求根据特定立场(甲方/乙方/买方/卖方/出租方/承租方)起草倾斜性合同时;(4) 用户要求将已有合同要点或业务条件生成为正式合同文本时。输出 Markdown 格式,可选导出 .docx。

Apache-2.0Auto-check passedDocuments & Office

Install Contract Gen

skills CLI
$ npx skills add zh-xx/legal-assistant-skills --skill contract-gen -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install zh-xx/legal-assistant-skills contract-gen --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/zh-xx/legal-assistant-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/contract-gen .claude/skills/contract-gen && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
contract-gen
GitHub stars
174
Token cost
~897 tokens
SKILL.md length
187 words
Files
6 (incl. scripts, references)
Skills in repo
8
Repo updated
First seen
Licence
Apache-2.0

At a glance

合同生成技能,以资深法律专家身份生成完整合同。适用场景:(1) 用户要求'起草合同''生成合同''拟定协议''写合同''草拟合同'时;(2) 用户提供合同类型和交易信息,要求生成完整合同文本时;(3) 用户要求根据特定立场(甲方/乙方/买方/卖方/出租方/承租方)起草倾斜性合同时;(4) 用户要求将已有合同要点或业务条件生成为正式合同文本时。输出 Markdown 格式,可选导出 .docx。

  • Works in 4 steps: 自适应模式:如用户已在初始消息中提供了全部关键信息,直接进入阶段二,不做多余确认 → 关键信息缺失时:直接向用户提问以补全缺失的关键信息。关键信息指法律上必需的要素(如… → 无单独优化步骤:不对用户输入做单独的优化确认。无论用户使用专业法律术语还是日常自然… → …
  • Tasks that involve Word documents
  • SKILL.md covers 工作流程, 阶段一:信息收集与完整性检查, 阶段二:合同生成 and 阶段三:质量校验与输出, plus 2 more sections
  • Runs JavaScript scripts from its folder; calls node

What it does

Contract Gen is an agent skill from zh-xx/legal-assistant-skills. 合同生成技能,以资深法律专家身份生成完整合同。适用场景:(1) 用户要求'起草合同''生成合同''拟定协议''写合同''草拟合同'时;(2) 用户提供合同类型和交易信息,要求生成完整合同文本时;(3) 用户要求根据特定立场(甲方/乙方/买方/卖方/出租方/承租方)起草倾斜性合同时;(4) 用户要求将已有合同要点或业务条件生成为正式合同文本时。输出 Markdown 格式,可选导出 .docx。

Its SKILL.md is about 900 tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts and reference files (for example `references/00-合同框架.md`, `references/01-立场策略.md` and `references/02-合同类型适配.md`).

It sits in Documents & Office, covering Word documents. It works with Microsoft Word. The repository describes itself as: AI assistant skills for legal work. Compatible with Claude Code, Codex, and other platforms. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Word documents

Example prompts

  • “/contract-gen”

Requirements

  • Node.js

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. 自适应模式:如用户已在初始消息中提供了全部关键信息,直接进入阶段二,不做多余确认
  2. 关键信息缺失时:直接向用户提问以补全缺失的关键信息。关键信息指法律上必需的要素(如主体身份、标的物、价款、履行方式等),而非表达是否专业
  3. 无单独优化步骤:不对用户输入做单独的优化确认。无论用户使用专业法律术语还是日常自然语言,只要关键内容表达清楚,在阶段二生成合同时自动融入专业化表述
  4. 信息推断:对于用户未明确但可合理推断的信息(如国内合同适用中国法律),可直接推断填入;对于无法推断的具体数据(如金额、日期),使用 [____] 占位符

What it can do on your machine

Read from SKILL.md and the folder at commit 3094afd. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (JavaScript), which the agent can run.

    Shell commands in SKILL.md call:

    • node

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Contract Gen loads about 897 tokens when it runs, and up to ~8.5k if it reads all its reference files. Until then it costs about 53 tokens; SKILL.md has 187 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~53
When it runs · the whole SKILL.md, loaded when a task matches
~897
With references · SKILL.md plus every file in references/, read only if the agent opens them
~8.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from zh-xx/legal-assistant-skills at commit 3094afd, republished under its Apache-2.0 licence (© zh-xx). 187 words, ~897 tokens.

Download SKILL.mdSave it as .claude/skills/contract-gen/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
contract-gen
description
合同生成技能,以资深法律专家身份生成完整合同。适用场景:(1) 用户要求'起草合同''生成合同''拟定协议''写合同''草拟合同'时;(2) 用户提供合同类型和交易信息,要求生成完整合同文本时;(3) 用户要求根据特定立场(甲方/乙方/买方/卖方/出租方/承租方)起草倾斜性合同时;(4) 用户要求将已有合同要点或业务条件生成为正式合同文本时。输出 Markdown 格式,可选导出 .docx。

合同生成

以资深法律专家身份,根据用户提供的信息生成完整、严谨的合同。三阶段工作流:信息收集 → 合同生成 → 质量校验与输出。

工作流程

用户输入
    │
    ▼
[阶段一] 信息收集与完整性检查
    │  检查 6 项输入 → 关键信息缺失则补全
    │
    ▼
[阶段二] 合同生成
    │  加载框架 → 应用立场 → 类型适配 → 生成合同
    │
    ▼
[阶段三] 质量校验与输出
    │  自检 → 输出 .md → 可选 .docx

阶段一:信息收集与完整性检查

收集以下 6 项输入信息:

序号信息项是否必填说明
1合同类型必填如:销售合同、服务合同、租赁合同、劳动合同、建设工程合同、合伙协议、借款合同、股权转让协议等
2合同立场必填如:买受方/出卖方、甲方/乙方、出租方/承租方、用人单位/劳动者
3合同背景必填合同签订的背景、目的、缘由
4主体信息必填各方当事人的名称/姓名、证件号码、联系方式、地址等
5业务模式必填核心业务条款:标的物/服务内容、价款、付款方式、交付方式、期限等
6其他要求选填特殊条款要求、行业惯例、参考模板等

执行规则:

  1. 自适应模式:如用户已在初始消息中提供了全部关键信息,直接进入阶段二,不做多余确认
  2. 关键信息缺失时:直接向用户提问以补全缺失的关键信息。关键信息指法律上必需的要素(如主体身份、标的物、价款、履行方式等),而非表达是否专业
  3. 无单独优化步骤:不对用户输入做单独的优化确认。无论用户使用专业法律术语还是日常自然语言,只要关键内容表达清楚,在阶段二生成合同时自动融入专业化表述
  4. 信息推断:对于用户未明确但可合理推断的信息(如国内合同适用中国法律),可直接推断填入;对于无法推断的具体数据(如金额、日期),使用 [____] 占位符

阶段二:合同生成

按以下步骤生成合同:

2.1 加载合同框架

读取 references/00-合同框架.md,获取合同框架(含 6 个结构元素 + 17 类实质条款)及起草要点。

2.2 应用立场策略

读取 references/01-立场策略.md,根据用户选择的立场,对价款、违约、风险转移、争议管辖等关键条款进行倾斜设计。

立场应用原则:

  • 倾斜必须在法律允许范围内,不违反强制性规定
  • 倾斜应当合理,过度倾斜可能导致条款被认定无效
  • 对方利益也应有基本保障,避免显失公平
2.3 合同类型适配

读取 references/02-合同类型适配.md,根据合同类型:

  • 增加该类型的必备条款
  • 删除不适用的条款
  • 应用该类型的特殊规则

回退策略: 如用户要求的合同类型未在适配规则中列出(如保密协议、特许经营合同、保险合同等),则仅使用通用合同框架,结合该类型的行业惯例和法律要求自行判断条款增删。

2.4 生成合同正文

以资深法律专家身份,综合以上信息生成完整的 Markdown 格式合同。

生成原则:

  1. 立场明确但合法:立场倾斜不得违反法律强制性规定
  2. 智能增删条款:根据合同类型和业务模式增删条款,不生成无关条款
  3. 术语准确:使用准确的法律术语,避免"合理时间""适当方式"等模糊表述
  4. 占位符规范:用户未提供的具体数字使用 [____] 占位符
  5. 仅输出合同正文:不输出说明性前后缀、致谢、提示语
  6. 附免责声明:合同末尾附免责声明,与合同正文以分隔线隔开

Markdown 格式要求:

  • 合同标题使用一级标题(#)
  • 章节标题使用二级标题(##)
  • 条款使用有序列表或层级编号
  • 金额、日期等关键信息使用加粗
  • 不使用代码块标记包裹合同正文

免责声明模板:

---

**免责声明:** 本合同由 AI 辅助生成,仅供参考,不构成正式法律意见。建议在签署前由专业律师审核。具体条款应根据实际情况和当地法律法规进行调整。

阶段三:质量校验与输出

3.1 质量自检

按 references/03-质量标准.md 对生成的合同进行自检,覆盖五个维度:

  1. 结构完整性:必备条款是否齐全、条款编号是否连续、签字盖章区域是否完整
  2. 内容一致性:术语指代是否统一、数字金额是否一致、逻辑是否自洽、交叉引用是否正确
  3. 立场一致性:违约责任/付款条件/风险分配/争议管辖是否体现用户立场、倾斜是否合法合理
  4. 可执行性:条款是否可操作、法律引用是否准确、仲裁/管辖约定是否有效
  5. 格式规范性:Markdown 格式是否正确、法律术语是否准确、占位符格式是否统一

发现问题时在输出前自行修正,不需向用户报告自检过程。

3.2 文件输出

将合同写入 .md 文件,文件名格式:{合同类型}_{日期}.md(如 销售合同_20260212.md)。

3.3 DOCX 导出(可选)

如用户要求生成 Word 文档,额外执行以下步骤:

  1. 将合同信息写入 JSON 文件,结构如下:
json
{
  "title": "合同标题",
  "type": "合同类型",
  "parties": {
    "甲方": "甲方名称",
    "乙方": "乙方名称"
  },
  "content": "完整的 Markdown 合同正文",
  "date": "生成日期"
}
  1. 运行生成脚本:
bash
node scripts/generate_contract.js <input.json> [output.docx]

脚本位置:本 skill 目录下的 scripts/generate_contract.js。

3.4 联动提示

合同输出完毕后,提示用户:

合同已生成。如需对合同进行专业审核,可使用 /contract-review 技能进行三层审核(文本质量、商务条款、法律条款)。

注意: 仅提示,不自动执行 contract-review。

全局规则

冲突处理优先级

当立场策略、类型适配、法律强制性规定之间存在冲突时,按以下优先级处理:

  1. 法律强制性规定 > 立场策略(如劳动合同中不得约定劳动者违约金)
  2. 合同类型适配规则 > 通用合同框架(如劳动合同必须使用"劳动报酬"而非"合同价款")
  3. 用户明确要求 > 默认立场策略(如用户要求中立立场则不做倾斜)
立场推断规则

当用户仅说"我是甲方"而未明确立场含义时,根据合同类型推断:

  • 销售合同:甲方 = 买受方
  • 服务合同:甲方 = 委托方/发包方
  • 租赁合同:甲方 = 出租方
  • 建设工程合同:甲方 = 发包方
  • 其他类型:甲方 = 付款方/权利主张方

许可证

SPDX-License-Identifier: Apache-2.0

Copyright (c) 2026 JiCheng

采用 Apache License 2.0 许可,许可证原文见仓库根目录 LICENSE。

© zh-xx, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (scripts, references) in contract-gen of zh-xx/legal-assistant-skills.

  • SKILL.md
  • references/00-合同框架.md
  • references/01-立场策略.md
  • references/02-合同类型适配.md
  • references/03-质量标准.md
  • scripts/generate_contract.js

Open the folder on GitHubat commit 3094afd

Compare with similar skills

Contract Gen next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Contract Gen compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Contract Gen this skillzh-xx/legal-assistant-skills174—~897Automated safety check: PassApache-2.0
MarkitdownImCa0/just-laws78114 repos~3.2kAutomated safety check: NotesMIT
DOCXrvdbreemen/OTGW-firmware20733 repos~4.3kAutomated safety check: PassProprietary
Word Document Reader and WriterHKUDS/DeepTutor41k—~2.5kAutomated safety check: PassApache-2.0
Gzh Designisjiamu/gzh-design-skill4k—~2.2kAutomated safety check: PassAGPL-3.0
GenOffice Document CLIgenspark-ai/genoffice9.2k—~19kAutomated safety check: PassApache-2.0

Similar skills

  • Markitdown

    ImCa0/just-laws

    Convert files and office documents to Markdown. An agent skill from ImCa0/just-laws.

    781 GitHub starsUsed in 14 repos~3.2k tokens
    Documents & OfficeAuto-check: notes
  • DOCX

    rvdbreemen/OTGW-firmware

    A skill your agent uses whenever the user wants to create, read, edit, or manipulate Word documents (.docx files).

    207 GitHub starsUsed in 33 repos~4.3k tokens
    Documents & OfficeAuto-check passed
  • Reads, creates and edits Word .docx files with python-docx, and drops to raw OOXML for tracked changes, comments and byte-exact edits.

    41k GitHub stars~2.5k tokensUpdated 3 days ago
    Documents & OfficeAuto-check passed
  • Gzh Design

    isjiamu/gzh-design-skill

    微信公众号文章排版引擎,将 Markdown 转换为可直接粘贴到公众号编辑器的 HTML。主题风格从 references/theme-index.md 注册的自定义主题库中选取,自动章节编号、关键词下划线标记、引言卡片、目录导航、代码块、图片/GIF、作者签名。支持 Markdown / Word(.docx) / PDF / 纯文本输入(非 Markdown…

    4k GitHub stars~2.2k tokensUpdated 2 days ago
    Documents & OfficeAuto-check passed
  • GenOffice Document CLI

    genspark-ai/genoffice

    Creates, converts, reads and edits real pptx, xlsx, docx and PDF files locally through the genoffice command line.

    9.2k GitHub stars~19k tokensUpdated today
    Documents & OfficeAuto-check passed
  • DOCX

    zai-org/ZCode

    Complete DOCX document creation, editing, and analysis capabilities with support for revisions, comments, formatting preservation, and text extraction.

    7.7k GitHub stars~4.9k tokensUpdated today
    Documents & OfficeAuto-check: notes

More from zh-xx/legal-assistant-skills

All 8 skills in this repo
  • Legal Risk Visualization

    zh-xx/legal-assistant-skills

    法律风险结构化分析与可视化。基于法律分析文本,执行五步风险抽取模型, 生成四层可视化输出(雷达图数据、风险矩阵、影响路径图、决策树)。

    174 GitHub stars~2.4k tokensUpdated 5 mo ago
    Auto-check passed
  • Ad Compliance Review

    zh-xx/legal-assistant-skills

    广告合规审核技能,用于审核广告素材是否符合中国广告法及相关法规。适用场景:(1) 用户提交广告文案、广告素材要求合规审核时;(2) 用户提到"广告审核""广告合规""广告法审查"等关键词时;(3) 用户要求检查广告内容是否存在违法违规风险时;(4) 用户提交房地产、食品、医疗、药品、互联网等行业广告要求专项审核时。审核依据涵盖《广告法》《反不正当竞争法》及行业专项法规。

    174 GitHub stars~1.2k tokensUpdated 5 mo ago
    Auto-check passed
  • Contract Review

    zh-xx/legal-assistant-skills

    Contract review skill that adds comment-based issue annotations without changing original text.

    174 GitHub stars~1.6k tokensUpdated 5 mo ago
    Auto-check passed
  • Food Label Review

    zh-xx/legal-assistant-skills

    预包装食品标签合规审核技能,用于审核食品标签是否符合 GB 7718(预包装食品标签通则)和 GB 28050(预包装食品营养标签通则)。适用场景:(1) 用户提交食品标签图片、文字或文档要求合规审核时;(2) 用户提到"食品标签审核""标签合规""营养标签审查""GB 7718""GB 28050"等关键词时;(3) 用户要求检查食品标签是否存在缺项、错误或违规风险时。支持 2011 版和…

    174 GitHub stars~1.7k tokensUpdated 5 mo ago
    Auto-check passed
  • Legal Job Search

    zh-xx/legal-assistant-skills

    法律AI求职助手 - 帮助法律人(法务/律师)使用AI辅助求职。支持公司/律所调研、法律风险分析、网页简历生成、针对性材料准备、面试备忘录生成。具备MCP工具级降级能力,无MCP时自动使用Web Search。

    174 GitHub stars~1.7k tokensUpdated 5 mo ago
    Auto-check passed
  • Law To Markdown

    zh-xx/legal-assistant-skills

    将法条/规范文件(.txt/.docx/.pdf)转为 Markdown。适用于用户要求“法条转 markdown”“pdf/docx 转 markdown”。处理 .pdf/.docx 时先检查是否已安装 mineru-ocr skill;未安装先引导安装,安装后优先用 mineru-ocr;仅在用户明确同意时再用本地回退方案。

    174 GitHub starsUsed in 1 repo~669 tokens
    Auto-check passed

Works with

Questions about Contract Gen

What does Contract Gen do?

合同生成技能,以资深法律专家身份生成完整合同。适用场景:(1) 用户要求'起草合同''生成合同''拟定协议''写合同''草拟合同'时;(2) 用户提供合同类型和交易信息,要求生成完整合同文本时;(3) 用户要求根据特定立场(甲方/乙方/买方/卖方/出租方/承租方)起草倾斜性合同时;(4) 用户要求将已有合同要点或业务条件生成为正式合同文本时。输出 Markdown 格式,可选导出 .docx。. Contract Gen is an agent skill from zh-xx/legal-assistant-skills.

When should I use Contract Gen?

Contract Gen fits situations like: tasks that involve Word documents.

How do I install Contract Gen in Claude Code?

Run `npx skills add zh-xx/legal-assistant-skills --skill contract-gen -a claude-code`. Or copy the skill folder (contract-gen in zh-xx/legal-assistant-skills) into .claude/skills/contract-gen in your project. Claude Code loads it when a task matches its description.

How do I install Contract Gen in Codex?

Run `npx skills add zh-xx/legal-assistant-skills --skill contract-gen -a codex`. Or copy the skill folder (contract-gen in zh-xx/legal-assistant-skills) into .agents/skills/contract-gen in your project. Codex loads it when a task matches its description.

Can I use Contract Gen in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add zh-xx/legal-assistant-skills --skill contract-gen -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/contract-gen, .gemini/skills/contract-gen, .github/skills/contract-gen and .opencode/skills/contract-gen in your project.

What does Contract Gen need to run?

Going by SKILL.md and its folder, Contract Gen needs JavaScript for the scripts in its folder and the command-line tools its instructions call (node). Our summary lists: Node.js.

Does Contract Gen access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Contract Gen safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Contract Gen use?

Contract Gen is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Contract Gen use?

About 897 tokens (SKILL.md is roughly 3.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 7.6k tokens, read only when the agent opens those files.

What are the alternatives to Contract Gen?

Skills that share tags, products or a category with Contract Gen: Markitdown (ImCa0/just-laws, 781 stars), DOCX (rvdbreemen/OTGW-firmware, 207 stars), Word Document Reader and Writer (HKUDS/DeepTutor, 41k stars) and Gzh Design (isjiamu/gzh-design-skill, 4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Contract Gen?

zh-xx (a GitHub user) maintains it in zh-xx/legal-assistant-skills, which has 174 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on April 18, 2026.

Source: zh-xx/legal-assistant-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.