Skip to content

galyarderlabs/galyarder-framework / integrations/antigravity/contract-and-proposal-writer

contract-and-proposal-writer

Verified

Generate production-ready business documents including freelance contracts, project proposals, SOWs, NDAs, and MSAs with jurisdiction-aware clauses. Covers US (Delaware), EU (GDPR), UK, and DACH (German law) legal frameworks. Includes contract templates, clause libraries, and DOCX conversion. Use when starting client engagements, writing proposals, drafting partnership agreements, or needing GDPR-compliant data processing addenda.

FileKindSize
SKILL.mdskill md21.5 KB
scripts/contract_clause_checker.pyexecutablescript12.6 KB
scripts/contract_comparison_analyzer.pyexecutablescript8.7 KB
scripts/proposal_cost_estimator.pyexecutablescript9.2 KB

scripts/proposal_cost_estimator.py

View on GitHub
#!/usr/bin/env python3
"""
Proposal Cost Estimator

Generate a project cost estimate with phase breakdown, payment schedule,
and margin analysis. Supports multiple billing models and currencies.

Usage:
    python proposal_cost_estimator.py --hourly-rate 150 --hours 200 --phases 4
    python proposal_cost_estimator.py --hourly-rate 150 --hours 200 --phases 4 --json
"""

import argparse
import json
import math
import sys


DEFAULT_PHASE_NAMES = [
    "Discovery & Planning",
    "Development",
    "Testing & QA",
    "Launch & Handoff",
    "Post-Launch Support",
]

DEFAULT_PHASE_WEIGHTS = [0.10, 0.50, 0.20, 0.15, 0.05]

PAYMENT_SCHEDULES = {
    "milestone": {
        "description": "Milestone-based (recommended for >$10K)",
        "schedule": [
            {"milestone": "Contract signing", "percentage": 50},
            {"milestone": "Beta delivery", "percentage": 25},
            {"milestone": "Final acceptance", "percentage": 25},
        ],
    },
    "monthly": {
        "description": "Monthly invoicing (recommended for hourly/retainer)",
        "schedule": [
            {"milestone": "Monthly invoice", "percentage": "pro-rata"},
        ],
    },
    "phased": {
        "description": "Per-phase payment (recommended for multi-phase projects)",
        "schedule": [],  # Generated dynamically
    },
}


def estimate_cost(hourly_rate: float, hours: float, num_phases: int,
                  margin: float, currency: str) -> dict:
    """Generate project cost estimate."""
    base_cost = hourly_rate * hours
    margin_amount = base_cost * (margin / 100.0)
    total_cost = base_cost + margin_amount

    # Phase breakdown
    phases = []
    phase_names = DEFAULT_PHASE_NAMES[:num_phases]
    phase_weights = DEFAULT_PHASE_WEIGHTS[:num_phases]

    # Normalize weights
    weight_sum = sum(phase_weights)
    phase_weights = [w / weight_sum for w in phase_weights]

    for i, (name, weight) in enumerate(zip(phase_names, phase_weights)):
        phase_hours = round(hours * weight, 1)
        phase_cost = round(total_cost * weight, 2)
        phases.append({
            "phase": i + 1,
            "name": name,
            "weight_pct": round(weight * 100, 1),
            "estimated_hours": phase_hours,
            "estimated_cost": phase_cost,
        })

    # Payment schedule options
    milestone_schedule = []
    milestone_schedule.append({
        "event": "Contract signing (50%)",
        "amount": round(total_cost * 0.50, 2),
    })
    if num_phases >= 3:
        milestone_schedule.append({
            "event": "Beta delivery (25%)",
            "amount": round(total_cost * 0.25, 2),
        })
        milestone_schedule.append({
            "event": "Final acceptance (25%)",
            "amount": round(total_cost * 0.25, 2),
        })
    else:
        milestone_schedule.append({
            "event": "Final delivery (50%)",
            "amount": round(total_cost * 0.50, 2),
        })

    phased_schedule = []
    for p in phases:
        phased_schedule.append({
            "event": f"{p['name']} completion",
            "amount": p["estimated_cost"],
        })

    # Estimated duration (assuming 6 productive hours per day, 5 days per week)
    productive_hours_per_week = 30
    estimated_weeks = math.ceil(hours / productive_hours_per_week)

    # Risk buffer
    risk_buffer_hours = round(hours * 0.15, 1)
    risk_buffer_cost = round(risk_buffer_hours * hourly_rate, 2)

    return {
        "inputs": {
            "hourly_rate": hourly_rate,
            "total_hours": hours,
            "num_phases": num_phases,
            "margin_pct": margin,
            "currency": currency,
        },
        "cost_summary": {
            "base_cost": round(base_cost, 2),
            "margin_amount": round(margin_amount, 2),
            "total_project_cost": round(total_cost, 2),
            "effective_hourly_rate": round(total_cost / hours, 2),
            "currency": currency,
        },
        "phase_breakdown": phases,
        "timeline": {
            "estimated_weeks": estimated_weeks,
            "productive_hours_per_week": productive_hours_per_week,
            "total_hours": hours,
        },
        "payment_options": {
            "milestone": milestone_schedule,
            "phased": phased_schedule,
        },
        "risk_buffer": {
            "buffer_hours": risk_buffer_hours,
            "buffer_cost": risk_buffer_cost,
            "total_with_buffer": round(total_cost + risk_buffer_cost, 2),
            "note": "15% contingency for scope changes and unforeseen complexity",
        },
        "recommendations": _generate_recommendations(total_cost, hours, num_phases),
    }


def _generate_recommendations(total_cost: float, hours: float, phases: int) -> list:
    """Generate recommendations for proposal."""
    recs = []
    if total_cost > 50000:
        recs.append({
            "priority": "HIGH",
            "recommendation": "Project over $50K -- use milestone-based payments and include legal review.",
        })
    if total_cost > 10000:
        recs.append({
            "priority": "MEDIUM",
            "recommendation": "Use milestone payments over net-30 to reduce cash flow risk.",
        })
    if hours > 500:
        recs.append({
            "priority": "MEDIUM",
            "recommendation": "Large project -- consider phased contracting with go/no-go gates between phases.",
        })
    recs.append({
        "priority": "MEDIUM",
        "recommendation": "Include a change order clause for scope changes with pricing mechanism.",
    })
    recs.append({
        "priority": "LOW",
        "recommendation": "Present the client with 2-3 pricing options (basic, recommended, premium) to avoid a yes/no decision.",
    })
    return recs


def format_text(result: dict) -> str:
    """Format results as human-readable text."""
    lines = []
    cur = result["inputs"]["currency"]
    lines.append("=" * 60)
    lines.append("PROPOSAL COST ESTIMATOR")
    lines.append("=" * 60)

    cs = result["cost_summary"]
    lines.append(f"\n--- Cost Summary ---")
    lines.append(f"Hourly Rate:           {cur} {result['inputs']['hourly_rate']:>10,.2f}")
    lines.append(f"Total Hours:           {result['inputs']['total_hours']:>10,.1f}")
    lines.append(f"Base Cost:             {cur} {cs['base_cost']:>10,.2f}")
    lines.append(f"Margin ({result['inputs']['margin_pct']}%):          {cur} {cs['margin_amount']:>10,.2f}")
    lines.append(f"Total Project Cost:    {cur} {cs['total_project_cost']:>10,.2f}")
    lines.append(f"Effective Rate:        {cur} {cs['effective_hourly_rate']:>10,.2f}/hr")

    lines.append(f"\n--- Phase Breakdown ---")
    lines.append(f"{'Phase':<25} {'Hours':>8} {'Cost':>12} {'%':>6}")
    for p in result["phase_breakdown"]:
        lines.append(f"{p['name']:<25} {p['estimated_hours']:>8.1f} {cur} {p['estimated_cost']:>8,.2f} {p['weight_pct']:>5.1f}%")

    tl = result["timeline"]
    lines.append(f"\n--- Timeline ---")
    lines.append(f"Estimated Duration: {tl['estimated_weeks']} weeks")
    lines.append(f"Productive Hours/Week: {tl['productive_hours_per_week']}")

    rb = result["risk_buffer"]
    lines.append(f"\n--- Risk Buffer ---")
    lines.append(f"Buffer Hours: {rb['buffer_hours']}")
    lines.append(f"Buffer Cost: {cur} {rb['buffer_cost']:,.2f}")
    lines.append(f"Total with Buffer: {cur} {rb['total_with_buffer']:,.2f}")

    lines.append(f"\n--- Payment Options ---")
    lines.append(f"\n  Milestone-based:")
    for m in result["payment_options"]["milestone"]:
        lines.append(f"    {m['event']:<35} {cur} {m['amount']:>10,.2f}")

    lines.append(f"\n  Per-phase:")
    for m in result["payment_options"]["phased"]:
        lines.append(f"    {m['event']:<35} {cur} {m['amount']:>10,.2f}")

    lines.append(f"\n--- Recommendations ---")
    for r in result["recommendations"]:
        lines.append(f"[{r['priority']}] {r['recommendation']}")

    lines.append("")
    return "\n".join(lines)


def main():
    parser = argparse.ArgumentParser(
        description="Generate project cost estimate with phase breakdown and payment schedule."
    )
    parser.add_argument("--hourly-rate", type=float, required=True,
                        help="Hourly rate in dollars")
    parser.add_argument("--hours", type=float, required=True,
                        help="Estimated total hours")
    parser.add_argument("--phases", type=int, default=3,
                        help="Number of project phases (default: 3, max: 5)")
    parser.add_argument("--margin", type=float, default=20,
                        help="Desired profit margin percentage (default: 20)")
    parser.add_argument("--currency", default="USD",
                        help="Currency code (default: USD)")
    parser.add_argument("--json", action="store_true",
                        help="Output results as JSON")

    args = parser.parse_args()

    if args.hourly_rate <= 0:
        print("Error: --hourly-rate must be positive.", file=sys.stderr)
        sys.exit(1)
    if args.hours <= 0:
        print("Error: --hours must be positive.", file=sys.stderr)
        sys.exit(1)

    num_phases = max(1, min(5, args.phases))

    result = estimate_cost(args.hourly_rate, args.hours, num_phases,
                           args.margin, args.currency)

    if args.json:
        print(json.dumps(result, indent=2))
    else:
        print(format_text(result))


if __name__ == "__main__":
    main()
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall