SuperAPI AI Directory

contract-gen

General & other

View repository

Updated 10-16 06:51

About this skill

Contract Generation

In the capacity of a senior legal expert, generate a complete and rigorous contract based on the information provided by the user. Three-stage workflow: information collection → contract generation → quality verification and output.

Workflow

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

Stage One: Information Collection and Completeness Check

Collect the following 6 items of input information:

No. Information Item Required or Not Description
1 Contract Type Required E.g.: sales contract, service contract, lease contract, labor contract, construction project contract, partnership agreement, loan contract, equity transfer agreement, etc.
2 Contract Position Required E.g.: buyer/seller, Party A/Party B, lessor/lessee, employer/employee
3 Contract Background Required The background, purpose, and reason for entering into the contract
4 Subject Information Required Names/names of the parties, ID numbers, contact information, addresses, etc.
5 Business Model Required Core business terms: subject matter/service content, price, payment method, delivery method, term, etc.
6 Other Requirements Optional Special clause requirements, industry practices, reference templates, etc.

Execution Rules:

  1. Adaptive Mode: If the user has already provided all key information in the initial message, proceed directly to Stage Two without unnecessary confirmation
  2. When key information is missing: Ask the user directly to complete the missing key information. Key information refers to legally necessary elements (such as subject identity, subject matter, price, performance method, etc.), not whether the expression is professional
  3. No Separate Optimization Step: Do not perform a separate optimization confirmation on user input. Regardless of whether the user uses professional legal terminology or everyday natural language, as long as the key content is clearly expressed, automatically incorporate professional phrasing when generating the contract in Stage Two
  4. Information Inference: For information that the user has not specified but can be reasonably inferred (such as Chinese law applies to a domestic contract), it may be directly inferred and filled in; for specific data that cannot be inferred (such as amounts, dates), use [____] placeholders

Stage Two: Contract Generation

Generate the contract according to the following steps:

2.1 Load Contract Framework

Read references/00-Contract Framework.md, to obtain the contract framework (including 6 structural elements + 17 types of substantive clauses) and drafting points.

2.2 Apply Position Strategy

Read references/01-Position Strategy.md, and based on the position selected by the user, design key clauses such as price, breach of contract, risk transfer, and dispute jurisdiction in a biased manner.

Position application principles:

  • The tilt must be within the scope permitted by law and must not violate mandatory provisions
  • The tilt should be reasonable; excessive tilt may cause the clause to be deemed invalid
  • The other party's interests should also have basic protection to avoid obvious unfairness

2.3 Contract Type Adaptation

Read references/02-contract-type-adaptation.md, according to the contract type:

  • Add the mandatory clauses for that type
  • Delete inapplicable clauses
  • Apply the special rules for that type

Fallback strategy: If the contract type requested by the user is not listed in the adaptation rules (such as a confidentiality agreement, franchise contract, insurance contract, etc.), then use only the general contract framework and determine clause additions and deletions on your own based on the industry practices and legal requirements of that type.

2.4 Generate the Contract Body

As a senior legal expert, synthesize the above information to generate a complete contract in Markdown format.

Generation principles:

  1. Clear but lawful stance: The tilted stance must not violate mandatory legal provisions
  2. Intelligently add and delete clauses: Add or delete clauses according to the contract type and business model, and do not generate irrelevant clauses
  3. Accurate terminology: Use accurate legal terminology and avoid vague expressions such as "reasonable time" and "appropriate manner"
  4. Standardized placeholders: For specific numbers not provided by the user, use [____] placeholders
  5. Output only the contract body: Do not output explanatory prefixes or suffixes, acknowledgments, or prompts
  6. Include a disclaimer: Attach a disclaimer at the end of the contract, separated from the contract body by a divider line

Markdown format requirements:

  • Use a level-one heading for the contract title (#)
  • Use level-two headings for section titles (##)
  • Use ordered lists or hierarchical numbering for clauses
  • Use bold for key information such as amounts and dates
  • Do not wrap the contract body in code block markers

Disclaimer template:

---

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

Stage Three: Quality Verification and Output

3.1 Quality Self-Check

According to references/03-quality-standards.md , perform a self-check on the generated contract, covering five dimensions:

  1. Structural completeness: Whether the mandatory clauses are complete, whether the clause numbering is continuous, and whether the signature and seal area is complete
  2. Content consistency: Whether terminology references are unified, whether numerical amounts are consistent, whether the logic is self-consistent, and whether cross-references are correct
  3. Stance consistency: Whether liability for breach/payment conditions/risk allocation/dispute jurisdiction reflect the user's stance, and whether the tilt is lawful and reasonable
  4. Enforceability: Whether the clauses are operable, whether legal citations are accurate, and whether the arbitration/jurisdiction agreement is valid
  5. Format standardization: Whether the Markdown format is correct, whether legal terminology is accurate, and whether the placeholder format is unified

When problems are found, correct them yourself before output; there is no need to report the self-check process to the user.

3.2 File Output

Write the contract to .md file, file name format:{合同类型}_{日期}.md(such as 销售合同_20260212.md)。

3.3 DOCX Export (Optional)

If the user requests a Word document, additionally perform the following steps:

  1. Write the contract information to a JSON file, with the following structure:
{
  "title": "合同标题",
  "type": "合同类型",
  "parties": {
    "甲方": "甲方名称",
    "乙方": "乙方名称"
  },
  "content": "完整的 Markdown 合同正文",
  "date": "生成日期"
}
  1. Run the generation script:
node scripts/generate_contract.js <input.json> [output.docx]

Script location: in this skill directory scripts/generate_contract.js。

3.4 Linkage prompt

After the contract output is complete, prompt the user:

The contract has been generated. If professional review of the contract is needed, you can use the /contract-review skill to perform three-layer review (text quality, commercial terms, legal terms).

Note: Prompt only, do not automatically execute contract-review.

Global rules

Conflict handling priority

When conflicts arise among stance strategy, type adaptation, and mandatory legal provisions, handle them according to the following priority:

  1. Mandatory legal provisions > stance strategy (e.g., labor contracts must not stipulate employee liquidated damages)
  2. Contract type adaptation rules > general contract framework (e.g., labor contracts must use "labor remuneration" rather than "contract price")
  3. User's explicit requirements > default stance strategy (e.g., if the user requests a neutral stance, do not lean)

Stance inference rules

When the user only says "I am Party A" without clarifying the meaning of the stance, infer based on the contract type:

  • Sales contract: Party A = buyer
  • Service contract: Party A = client/principal
  • Lease contract: Party A = lessor
  • Construction project contract: Party A = employer/owner
  • Other types: Party A = payer/rights claimant

License

SPDX-License-Identifier: Apache-2.0

Copyright (c) 2026 JiCheng

Licensed under the Apache License 2.0; the original license text is in the repository root directory LICENSE。