关于 Contract Drafter
Contract Drafter 是用于从模板生成合同与协议的技能,适合需要一致创建常见法律文件的团队。它支持变量替换、条件条款和完整性检查,但不提供法律建议,生成文件仍需律师审核。
主要功能
- 01从模板生成合同文件
- 02替换变量并处理条件条款
- 03生成 NDA 与服务协议
- 04管理可复用条款库
- 05检查必需内容与未替换占位符
适用场景
- 01为双方起草 NDA
- 02依据服务范围和付款条件生成协议
- 03从自定义模板批量创建合同
- 04生成后检查合同字段与签名栏
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ jmsktm/ claude-settings --skill contract-drafter安装后在 Claude Code 中输入/contract-drafter确认已加载。
详细介绍
合同起草工具
Contract Drafter 技能可根据模板自动生成法律合同和协议。它支持变量替换、条件条款、签名栏和文档格式设置。此技能对于一致且高效地创建保密协议、服务协议、劳动合同及其他法律文档至关重要。
重要免责声明: 此技能根据模板生成文档,不提供法律建议。所有生成的合同在使用前都应由具备资质的律师审核。此技能旨在简化文档创建流程,而非取代法律顾问。
核心工作流
工作流 1:根据标准模板生成
用途: 通过替换变量,根据预定义模板创建合同
步骤:
- 选择合同类型(保密协议、服务协议等)
- 加载带占位符的模板
- 收集所需信息(各方、日期、条款)
- 验证所有必填字段均已填写
- 替换模板中的变量
- 根据参数处理条件条款
- 生成最终文档(PDF 或 DOCX)
- 添加签名栏和签署详情
实现:
const Docxtemplater = require('docxtemplater');
const PizZip = require('pizzip');
const fs = require('fs');
function generateContract(templatePath, contractData, outputPath) {
// Load template
const content = fs.readFileSync(templatePath, 'binary');
const zip = new PizZip(content);
const doc = new Docxtemplater(zip, {
paragraphLoop: true,
linebreaks: true
});
// Prepare data with defaults and calculations
const data = {
// Party information
party1Name: contractData.party1.name,
party1Address: contractData.party1.address,
party1Email: contractData.party1.email,
party2Name: contractData.party2.name,
party2Address: contractData.party2.address,
party2Email: contractData.party2.email,
// Contract details
effectiveDate: contractData.effectiveDate,
expirationDate: contractData.expirationDate,
term: contractData.term || 'one (1) year',
// Financial terms (if applicable)
paymentAmount: contractData.paymentAmount,
paymentSchedule: contractData.paymentSchedule,
currency: contractData.currency || 'USD',
// Specific terms
scope: contractData.scope,
deliverables: contractData.deliverables,
// Conditional clauses
includeNonCompete: contractData.includeNonCompete || false,
nonCompetePeriod: contractData.nonCompetePeriod || '12 months',
nonCompeteRadius: contractData.nonCompeteRadius || '50 miles',
includeConfidentiality: contractData.includeConfidentiality !== false,
confidentialityPeriod: contractData.confidentialityPeriod || '5 years',
// Governing law
governingState: contractData.governingState || 'Delaware',
governingCountry: contractData.governingCountry || 'United States',
// Dates
currentDate: new Date().toLocaleDateString(),
currentYear: new Date().getFullYear()
};
// Render template
doc.setData(data);
doc.render();
// Save output
const buf = doc.getZip().generate({
type: 'nodebuffer',
compression: 'DEFLATE'
});
fs.writeFileSync(outputPath, buf);
return {
outputPath,
contractType: contractData.contractType,
parties: [data.party1Name, data.party2Name],
effectiveDate: data.effectiveDate
};
}
工作流 2:保密协议生成器
用途: 使用标准条款或自定义条款创建保密协议
步骤:
- 确定保密协议类型(双向或单向)
- 收集各方信息
- 界定保密信息范围
- 设定披露条款和期限
- 指定保密义务的例外情形
- 添加救济措施和管辖权条款
- 生成签名页
- 创建最终保密协议文档
实现:
function generateNDA(ndaData, outputPath) {
const templatePath = ndaData.type === 'mutual'
? './templates/mutual-nda.docx'
: './templates/one-way-nda.docx';
const contractData = {
contractType: 'Non-Disclosure Agreement',
// Parties
party1: ndaData.disclosingParty,
party2: ndaData.receivingParty,
// NDA-specific terms
effectiveDate: ndaData.effectiveDate || new Date().toISOString().split('T')[0],
confidentialityPeriod: ndaData.confidentialityPeriod || '3 years',
// Purpose of disclosure
purpose: ndaData.purpose || 'evaluation of a potential business relationship',
// Scope definition
confidentialDefinition: ndaData.confidentialDefinition || `any non-public information disclosed by the Disclosing Party to the Receiving Party, whether orally, in writing, or in any other form`,
// Exclusions
exclusions: [
'Information that is publicly available through no breach of this Agreement',
'Information rightfully received from a third party without breach of any confidentiality obligation',
'Information independently developed without use of Confidential Information',
'Information required to be disclosed by law or court order'
],
// Return of materials clause
includeReturnClause: ndaData.includeReturnClause !== false,
returnPeriod: ndaData.returnPeriod || '30 days',
// Governing law
governingState: ndaData.governingState,
arbitration: ndaData.arbitration || false
};
return generateContract(templatePath, contractData, outputPath);
}
// Example usage:
const nda = generateNDA({
type: 'mutual',
disclosingParty: {
name: 'Acme Corp',
address: '123 Business St, City, State 12345',
email: '[email protected]'
},
receivingParty: {
name: 'Widget LLC',
address: '456 Commerce Ave, City, State 67890',
email: '[email protected]'
},
purpose: 'evaluation of potential partnership for joint product development',
confidentialityPeriod: '5 years',
governingState: 'California'
}, './output/nda-acme-widget.docx');
工作流 3:服务协议生成器
用途: 创建包含服务范围、交付成果和付款条款的服务合同
步骤:
- 定义服务提供方和客户信息
- 详细说明服务范围
- 列出交付成果和时间安排
- 设定付款条款(固定费用、按小时计费或按里程碑付款)
- 明确知识产权归属
- 添加终止条款
- 纳入责任限制条款
- 生成包含所有条款的协议
实现:
function generateServiceAgreement(serviceData, outputPath) {
const contractData = {
contractType: 'Service Agreement',
party1: serviceData.serviceProvider,
party2: serviceData.client,
effectiveDate: serviceData.effectiveDate,
term: serviceData.term || 'ongoing until completion',
// Scope of services
scope: serviceData.services.map(s => s.description).join('\n'),
deliverables: serviceData.deliverables,
// Payment terms
paymentStructure: serviceData.paymentStructure, // 'fixed', 'hourly', 'milestone'
totalAmount: serviceData.totalAmount,
hourlyRate: serviceData.hourlyRate,
milestones: serviceData.milestones || [],
paymentSchedule: serviceData.paymentSchedule,
paymentTerms: serviceData.paymentTerms || 'Net 30',
// Intellectual property
ipOwnership: serviceData.ipOwnership || 'client', // 'client', 'provider', 'shared'
includeWorkForHire: serviceData.includeWorkForHire !== false,
// Termination
terminationNotice: serviceData.terminationNotice || '30 days',
includeTerminationForConvenience: serviceData.includeTerminationForConvenience !== false,
// Liability
liabilityLimit: serviceData.liabilityLimit || 'total amount paid under this Agreement',
includeIndemnification: serviceData.includeIndemnification !== false,
// Confidentiality
includeConfidentiality: true,
confidentialityPeriod: '3 years',
governingState: serviceData.governingState
};
return generateContract('./templates/service-agreement.docx', contractData, outputPath);
}
工作流 4:条款库管理
用途: 管理适用于不同情形的可复用合同条款
步骤:
- 按类别定义条款库
- 存储带变量的标准条款
- 为不同场景创建条款变体
- 按司法管辖区和类型为条款添加标签
- 支持在生成合同时选择条款
- 支持插入自定义条款
- 维护条款版本历史
实现:
const clauseLibrary = {
confidentiality: {
standard: `The Receiving Party shall hold in strict confidence and not disclose to any third parties any Confidential Information disclosed by the Disclosing Party, except as approved in writing by the Disclosing Party.`,
withExceptions: `The Receiving Party shall hold in strict confidence and not disclose to any third parties any Confidential Information disclosed by the Disclosing Party, except: (a) to its employees, contractors, and advisors who have a legitimate need to know and are bound by confidentiality obligations; or (b) as required by law.`,
mutual: `Each Party agrees to hold the other Party's Confidential Information in strict confidence and to use such information solely for the purposes of {purpose}.`
},
termination: {
forConvenience: `Either Party may terminate this Agreement at any time, with or without cause, upon {terminationNotice} written notice to the other Party.`,
forCause: `Either Party may terminate this Agreement immediately upon written notice if the other Party materially breaches this Agreement and fails to cure such breach within {cureperiod} days after receiving written notice thereof.`,
combined: `Either Party may terminate this Agreement: (a) for convenience upon {terminationNotice} written notice; or (b) immediately for cause if the other Party materially breaches this Agreement and fails to cure within {curePeriod} days.`
},
liability: {
limitation: `IN NO EVENT SHALL EITHER PARTY'S LIABILITY UNDER THIS AGREEMENT EXCEED {liabilityLimit}.`,
exclusion: `NEITHER PARTY SHALL BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS, LOSS OF DATA, OR BUSINESS INTERRUPTION.`,
combined: `IN NO EVENT SHALL EITHER PARTY'S LIABILITY EXCEED {liabilityLimit}. NEITHER PARTY SHALL BE LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES.`
},
payment: {
net30: `Client shall pay all undisputed invoices within thirty (30) days of the invoice date.`,
upfront: `Client shall pay {percentage}% of the total fees upon execution of this Agreement, with the remainder due upon {milestone}.`,
milestone: `Payments shall be made according to the following milestones:\n{milestoneList}`
}
};
function insertClause(clauseCategory, clauseType, variables = {}) {
let clause = clauseLibrary[clauseCategory][clauseType];
// Replace variables
Object.keys(variables).forEach(key => {
const regex = new RegExp(`{${key}}`, 'g');
clause = clause.replace(regex, variables[key]);
});
return clause;
}
工作流 5:合同审核清单
用途: 根据必需元素清单验证生成的合同
步骤:
- 为合同类型定义清单
- 解析生成的合同
- 检查是否包含必需章节
- 验证各方信息是否完整
- 确认日期是否合理(生效日期早于到期日期)
- 确保存在签名栏
- 检查是否有未替换的占位文本
- 生成审核报告
实现:
function reviewContract(contractPath, contractType) {
const content = fs.readFileSync(contractPath, 'utf8');
const checklist = {
nda: [
{ item: 'Party names and addresses', required: true },
{ item: 'Effective date', required: true },
{ item: 'Definition of confidential information', required: true },
{ item: 'Obligations of receiving party', required: true },
{ item: 'Exclusions from confidentiality', required: true },
{ item: 'Term/duration of confidentiality', required: true },
{ item: 'Return of materials clause', required: false },
{ item: 'Governing law and jurisdiction', required: true },
{ item: 'Signature blocks', required: true }
],
serviceAgreement: [
{ item: 'Party names and addresses', required: true },
{ item: 'Scope of services', required: true },
{ item: 'Deliverables', required: true },
{ item: 'Payment terms and amounts', required: true },
{ item: 'Timeline/term', required: true },
{ item: 'Intellectual property ownership', required: true },
{ item: 'Termination provisions', required: true },
{ item: 'Limitation of liability', required: true },
{ item: 'Governing law', required: true },
{ item: 'Signature blocks', required: true }
]
};
const items = checklist[contractType] || checklist.nda;
const results = [];
items.forEach(checkItem => {
// Simple text search (in production, use more sophisticated parsing)
const found = content.toLowerCase().includes(checkItem.item.toLowerCase());
results.push({
item: checkItem.item,
required: checkItem.required,
present: found,
status: found ? 'PASS' : (checkItem.required ? 'FAIL' : 'WARN')
});
});
// Check for unreplaced placeholders
const placeholders = content.match(/\{[^}]+\}/g) || [];
return {
contractType,
checklistResults: results,
passedRequired: results.filter(r => r.required).every(r => r.present),
unreplacedPlaceholders: placeholders,
review: {
passed: results.filter(r => r.status === 'PASS').length,
failed: results.filter(r => r.status === 'FAIL').length,
warnings: results.filter(r => r.status === 'WARN').length
}
};
}
快速参考
| 操作 | 命令/触发语 |
|---|---|
| 生成合同 | "为 [各方] 创建 [合同类型]" |
| 保密协议 | "生成 [一方] 与 [另一方] 之间的保密协议" |
| 服务协议 | "创建服务协议" |
| 添加条款 | "插入 [条款类型] 条款" |
| 审核合同 | "检查合同是否完整" |
| 自定义模板 | "使用自定义合同模板" |
| 批量生成 | "为 [列表] 创建合同" |
最佳实践
- 法律审查: 使用前务必让律师审查合同
- 版本控制: 跟踪模板版本和变更
- 司法管辖区适用性: 使用适用于管辖司法辖区的模板
- 通俗易懂: 尽可能使用清晰易懂的语言
- 定义: 在合同中清晰定义所有关键术语
- 完整性: 定稿前确保包含所有必需章节
- 变量: 生成最终文档前,验证所有变量均已替换
- 格式: 保持格式一致,确保外观专业
- 签名: 添加规范的签名栏,并包含日期和职务字段
- 备份: 安全存储所有生成的合同
- 审计跟踪: 保留合同生成时间和方式的记录
- 具体情况审查: 根据具体情况审查每份合同
常见模式
雇佣合同:
const employmentData = {
contractType: 'Employment Agreement',
employer: { name: 'Acme Corp', address: '...' },
employee: { name: 'John Doe', address: '...' },
position: 'Senior Developer',
startDate: '2025-02-01',
salary: 120000,
benefits: ['Health insurance', '401k matching', 'PTO'],
probationPeriod: '90 days',
includeNonCompete: true,
nonCompetePeriod: '12 months'
};
咨询协议:
const consultingData = {
serviceProvider: { name: 'Jane Smith Consulting', ... },
client: { name: 'Widget Inc', ... },
services: [
{ description: 'Strategic planning consultation', hours: 20 },
{ description: 'Market analysis', hours: 40 }
],
paymentStructure: 'hourly',
hourlyRate: 250,
term: '3 months',
ipOwnership: 'client'
};
依赖项
安装所需软件包:
npm install docxtemplater pizzip
npm install pdf-lib # For PDF manipulation
npm install handlebars # Alternative templating
错误处理
- 缺少必填字段: 生成前验证所有必需数据
- 无效日期: 确保生效日期早于到期日期
- 未找到模板: 处理前确认模板文件存在
- 变量不匹配: 检查模板中的所有变量是否都有对应数据
- 文件权限: 妥善处理读写错误
- 法律合规: 添加关于必须进行法律审查的免责声明
高级功能
电子签名集成:
const docusign = require('docusign-esign');
async function sendForSignature(contractPath, signers) {
// DocuSign or other e-signature integration
// Send contract for electronic signature
}
合同版本管理:
const contractVersion = {
version: '1.2',
templateId: 'service-agreement-v1.2',
changes: 'Updated liability clause per legal review',
approvedBy: 'Legal Team',
approvedDate: '2025-01-01'
};
多司法管辖区支持:
const jurisdictionClauses = {
california: {
governingLaw: 'This Agreement shall be governed by the laws of the State of California.',
arbitration: 'Mandatory arbitration under California law'
},
newYork: {
governingLaw: 'This Agreement shall be governed by the laws of the State of New York.',
arbitration: 'JAMS arbitration in New York County'
}
};
评论
支持 Markdown