anbeime/skill / skills/legal-assistant-skills-main/contract-review
contract-review
Verified律师助理与法律助手、项目管理专家在审核合同、排查条款风险时必备。自动执行基础、商业、法律三层审查,仅添加批注不改原文,一键生成带批注合同、审查摘要、综合意见及业务流程图,让合同风控与业务梳理更高效专业。
| File | Kind | Size |
|---|---|---|
| LICENSE.txt | markdown | 11.1 KB |
| SKILL.md | skill md | 5.4 KB |
| references/checklist.md | markdown | 5.3 KB |
| references/examples.md | markdown | 5.5 KB |
| references/flowchart.md | markdown | 1.8 KB |
| references/language.md | markdown | 2.0 KB |
| references/opinion.md | markdown | 1.3 KB |
| references/summary.md | markdown | 2.8 KB |
| references/technical.md | markdown | 2.7 KB |
| scripts/__init__.py | script | 50 B |
| scripts/contract_analyzer.py | script | 9.2 KB |
| scripts/document.py | script | 11.3 KB |
| scripts/error_handling.py | script | 16.3 KB |
| scripts/mermaid_renderer.py | script | 6.9 KB |
| scripts/ooxml/__init__.py | script | 189 B |
| scripts/ooxml/pack.py | script | 3.5 KB |
| scripts/ooxml/unpack.py | script | 1.1 KB |
| scripts/ooxml/validate.py | script | 1.7 KB |
| scripts/ooxml/validation/__init__.py | script | 433 B |
| scripts/ooxml/validation/base.py | script | 1.5 KB |
| scripts/ooxml/validation/docx.py | script | 311 B |
| scripts/ooxml/validation/pptx.py | script | 274 B |
| scripts/ooxml/validation/redlining.py | script | 217 B |
| scripts/opinion_renderer.py | script | 4.2 KB |
| scripts/summary_renderer.py | script | 9.1 KB |
| scripts/utilities.py | script | 3.1 KB |
| scripts/workflow.py | script | 59.2 KB |
scripts/utilities.py
View on GitHub#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Lightweight XML helpers for OOXML editing.
"""
from __future__ import annotations
from pathlib import Path
from typing import Dict, Iterable, List, Optional
from defusedxml import minidom
def _matches_attrs(node, attrs: Optional[Dict[str, str]]) -> bool:
if not attrs:
return True
for key, value in attrs.items():
if node.getAttribute(key) != value:
return False
return True
def _parse_fragment(fragment: str) -> List[minidom.Node]:
wrapper = f"<root>{fragment}</root>"
frag_dom = minidom.parseString(wrapper)
nodes = []
for child in frag_dom.documentElement.childNodes:
if child.nodeType == child.ELEMENT_NODE:
nodes.append(child)
return nodes
class XMLEditor:
"""Simple XML editor built on minidom."""
def __init__(self, xml_path: str | Path):
self.xml_path = Path(xml_path)
if not self.xml_path.exists():
raise FileNotFoundError(f"XML not found: {self.xml_path}")
self.dom = minidom.parse(str(self.xml_path))
def save(self) -> None:
data = self.dom.toxml(encoding="utf-8")
self.xml_path.write_bytes(data)
def get_nodes(self, tag: Optional[str] = None, attrs: Optional[Dict[str, str]] = None) -> List[minidom.Element]:
if tag:
nodes = self.dom.getElementsByTagName(tag)
else:
nodes = self.dom.getElementsByTagName("*")
return [node for node in nodes if _matches_attrs(node, attrs)]
def get_node(self, tag: Optional[str] = None, attrs: Optional[Dict[str, str]] = None, line_number: Optional[int] = None):
nodes = self.get_nodes(tag=tag, attrs=attrs)
if line_number is not None:
index = max(line_number - 1, 0)
return nodes[index] if index < len(nodes) else None
return nodes[0] if nodes else None
def append_to(self, parent, xml_fragment: str) -> List[minidom.Node]:
nodes = _parse_fragment(xml_fragment)
inserted = []
for node in nodes:
imported = self.dom.importNode(node, deep=True)
parent.appendChild(imported)
inserted.append(imported)
return inserted
def insert_before(self, node, xml_fragment: str) -> List[minidom.Node]:
parent = node.parentNode
if parent is None:
return []
nodes = _parse_fragment(xml_fragment)
inserted = []
for frag in nodes:
imported = self.dom.importNode(frag, deep=True)
parent.insertBefore(imported, node)
inserted.append(imported)
return inserted
def insert_after(self, node, xml_fragment: str) -> List[minidom.Node]:
parent = node.parentNode
if parent is None:
return []
nodes = _parse_fragment(xml_fragment)
inserted = []
reference = node.nextSibling
for frag in nodes:
imported = self.dom.importNode(frag, deep=True)
parent.insertBefore(imported, reference)
inserted.append(imported)
return inserted
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |