pa1nrui1/enterprise-legal-ops / skills/enterprise-legal-ops
enterprise-legal-ops
Verified中小企业本地法务运营管理 Skill。用于企业内部管理合同、员工/劳动合同/年假/制度、公章证照、章程权限、股东出资、提醒和本地自然语言问库。用户要初始化企业法务工作区、上传历史合同/员工花名册/劳动制度/证照/章程/授权/用印记录、生成本地台账、查询到期提醒、做企业内部合同审查 Word 修订稿、合同起草、HR 风险预判、制度冲突检查、旧制度合法性审查、公章用印权限校验、股东出资提醒、飞书日历提醒配置时触发。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.2 KB |
| agents/openai.yaml | config | 330 B |
| references/contracts.md | markdown | 4.4 KB |
| references/hr.md | markdown | 5.5 KB |
| references/local-query.md | markdown | 2.5 KB |
| references/reminders.md | markdown | 2.8 KB |
| references/seals-licenses-governance.md | markdown | 5.3 KB |
| references/strict-review.md | markdown | 2.3 KB |
| references/workspace-data-standard.md | markdown | 2.7 KB |
| scripts/archive_record.py | script | 19.7 KB |
| scripts/contract_redline_review.py | script | 4.1 KB |
| scripts/import_document.pyexecutable | script | 11.3 KB |
| scripts/import_roster.py | script | 11.9 KB |
| scripts/init_workspace.pyexecutable | script | 11.4 KB |
| scripts/ledger.pyexecutable | script | 7.4 KB |
| scripts/query_workspace.pyexecutable | script | 5.8 KB |
| scripts/reminders.pyexecutable | script | 20.9 KB |
| scripts/strict_review_record.py | script | 5.3 KB |
| tests/test_enterprise_legal_ops.pyexecutable | script | 19.3 KB |
scripts/ledger.py
View on GitHub#!/usr/bin/env python3
"""Append common Enterprise Legal Ops ledger records."""
from __future__ import annotations
import argparse
import csv
from datetime import datetime
from pathlib import Path
LEDGERS = {
"contract": {
"path": "01-合同管理/contracts.csv",
"id": "contract_id",
"fields": {
"contract_id", "contract_name", "contract_type", "our_party", "our_role",
"counterparty", "review_position", "amount", "effective_date", "end_date",
"auto_renewal", "notice_days", "latest_notice_date", "status",
"original_file_path", "record_md_path", "latest_review_date", "risk_level",
"next_action", "created_at", "updated_at",
},
},
"employee": {
"path": "02-人力资源/employees.csv",
"id": "employee_id",
"fields": {
"employee_id", "name", "department", "position", "employment_status",
"entry_date", "probation_end_date", "contract_start_date", "contract_end_date",
"work_location", "working_hours_system", "salary_structure",
"social_insurance_status", "contract_file_path", "record_md_path",
"risk_flags", "next_action", "created_at", "updated_at",
},
},
"annual_leave": {
"path": "02-人力资源/annual-leave.csv",
"id": "leave_record_id",
"fields": {
"leave_record_id", "employee_id", "employee_name", "year", "entry_date",
"continuous_work_years", "statutory_annual_leave_days",
"company_annual_leave_days", "used_annual_leave_days",
"remaining_annual_leave_days", "carryover_rule", "expiry_date",
"compensation_required", "compensation_amount", "calculation_basis",
"source_file_path", "record_md_path", "risk_flags", "created_at", "updated_at",
},
},
"license": {
"path": "03-公章证照/licenses.csv",
"id": "license_id",
"fields": {
"license_id", "license_name", "license_type", "holder", "license_number",
"issue_authority", "issue_date", "expiry_date", "annual_check_required",
"annual_check_deadline", "file_path", "record_md_path", "status",
"risk_flags", "next_action", "created_at", "updated_at",
},
},
"seal": {
"path": "03-公章证照/seals.csv",
"id": "seal_id",
"fields": {
"seal_id", "seal_name", "seal_type", "custodian", "authorized_scope",
"approval_rule", "storage_location", "status", "record_md_path",
"created_at", "updated_at",
},
},
"authorization": {
"path": "03-公章证照/authorizations.csv",
"id": "authorization_id",
"fields": {
"authorization_id", "authorization_name", "grantor", "grantee", "scope",
"start_date", "end_date", "revocation_status", "file_path", "record_md_path",
"risk_flags", "created_at", "updated_at",
},
},
"capital": {
"path": "03-公章证照/capital-contributions.csv",
"id": "contribution_id",
"fields": {
"contribution_id", "shareholder_name", "shareholder_type", "subscribed_amount",
"paid_amount", "unpaid_amount", "contribution_method", "subscription_deadline",
"paid_date", "equity_ratio", "source_document", "source_file_path",
"proof_file_path", "status", "risk_flags", "next_action", "created_at",
"updated_at",
},
},
}
def read_headers(path: Path) -> list[str]:
if not path.exists():
raise SystemExit(f"ledger not found; initialize workspace first: {path}")
with path.open(newline="", encoding="utf-8") as f:
reader = csv.reader(f)
return next(reader)
def read_rows(path: Path) -> list[dict[str, str]]:
with path.open(newline="", encoding="utf-8") as f:
return list(csv.DictReader(f))
def write_rows(path: Path, headers: list[str], rows: list[dict[str, str]]) -> None:
with path.open("w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=headers)
writer.writeheader()
writer.writerows(rows)
def parse_values(values: list[str], allowed: set[str]) -> dict[str, str]:
parsed: dict[str, str] = {}
for item in values:
if "=" not in item:
raise SystemExit(f"invalid --set value, expected key=value: {item}")
key, value = item.split("=", 1)
key = key.strip()
if key not in allowed:
raise SystemExit(f"field {key!r} is not allowed for this ledger")
parsed[key] = value
return parsed
def upsert(args: argparse.Namespace) -> int:
spec = LEDGERS[args.ledger]
workspace = Path(args.workspace).expanduser().resolve()
path = workspace / spec["path"]
headers = read_headers(path)
rows = read_rows(path)
now = datetime.now().isoformat(timespec="seconds")
data = parse_values(args.set, spec["fields"])
id_field = spec["id"]
record_id = data.get(id_field)
if not record_id:
raise SystemExit(f"missing required field: {id_field}")
data.setdefault("created_at", now)
data["updated_at"] = now
matched = False
for row in rows:
if row.get(id_field) == record_id:
row.update(data)
matched = True
break
if not matched:
row = {header: "" for header in headers}
row.update(data)
rows.append(row)
write_rows(path, headers, rows)
print("台账已更新。")
print(f"台账类型:{args.ledger}")
print(f"记录编号:{record_id}")
print(f"台账位置:{path}")
print("下一步:如涉及日期、风险或法律判断,请生成提醒并进入严审流程。")
return 0
def list_cmd(args: argparse.Namespace) -> int:
spec = LEDGERS[args.ledger]
path = Path(args.workspace).expanduser().resolve() / spec["path"]
rows = read_rows(path)
if args.query:
q = args.query.lower()
rows = [row for row in rows if q in " ".join(row.values()).lower()]
print(f"台账位置:{path}")
print(f"匹配数量:{len(rows)}")
for row in rows[: args.limit]:
record_id = row.get(spec["id"], "")
name = row.get("contract_name") or row.get("name") or row.get("license_name") or row.get("seal_name") or row.get("authorization_name") or row.get("shareholder_name") or ""
status = row.get("status") or row.get("employment_status") or row.get("risk_flags") or ""
print(f"- {record_id} | {name} | {status}")
return 0
def main() -> int:
parser = argparse.ArgumentParser(description="Append or update Enterprise Legal Ops ledgers.")
sub = parser.add_subparsers(dest="cmd", required=True)
upsert_parser = sub.add_parser("upsert")
upsert_parser.add_argument("--workspace", required=True)
upsert_parser.add_argument("--ledger", required=True, choices=sorted(LEDGERS))
upsert_parser.add_argument("--set", action="append", default=[], help="field=value; repeatable")
upsert_parser.set_defaults(func=upsert)
list_parser = sub.add_parser("list")
list_parser.add_argument("--workspace", required=True)
list_parser.add_argument("--ledger", required=True, choices=sorted(LEDGERS))
list_parser.add_argument("--query")
list_parser.add_argument("--limit", type=int, default=20)
list_parser.set_defaults(func=list_cmd)
args = parser.parse_args()
return args.func(args)
if __name__ == "__main__":
raise SystemExit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |