cost-of-capital-toolkit

Compute riskfree rates, betas, synthetic ratings, WACC, and optimal capital structure via JSON-driven Python engines.

Updated Sep 9, 2026
One-click install
npx skills add https://github.com/lyndonkl/hermesworld --skill cost-of-capital-toolkit-lyndonkl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cost-of-capital-toolkit
Source: https://github.com/lyndonkl/hermesworld/tree/main/packages/capital-structure-analyst/skills/corporate-finance/cost-of-capital-toolkit
Command: npx skills add https://github.com/lyndonkl/hermesworld --skill cost-of-capital-toolkit-lyndonkl

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Building a discount rate or finding an optimal debt ratio involves error-prone arithmetic across many steps: stripping sovereign spreads from riskfree rates, unlevering and relevering betas, deriving synthetic credit ratings from interest coverage, and solving the circular dependency between interest rates and coverage ratios. This Skill automates that arithmetic with tested, pure-standard-library Python engines so the analyst can focus on choosing and defending the inputs. ## Core Features & Use Cases - Discount rate construction: Compute synthetic ratings and cost of debt, bottom-up and total betas, market value of debt, implied equity risk premiums, currency conversion of rates, and full WACC assembly. - Optimal capital structure: Generate a cost-of-capital schedule across debt ratios, stress it against EBIT haircuts or rating floors, and cross-check the result with an adjusted present value (APV) calculation. - Bundled reference data: Look up 96 industry averages, 186 country risk premiums, synthetic rating tables, and default probabilities, each tagged with a vintage date and staleness warnings. - Use Case: An analyst valuing a Brazilian company with US revenue runs erp-for-operations to weight country risk by operations, builds a bottom-up beta from comparables, then runs debt-schedule and stress to find and defend an optimal debt ratio. ## Quick Start Ask the agent to compute a synthetic credit rating and after-tax cost of debt for a company with EBIT of 2000, interest expense of 250, a 4% riskfree rate, and a 25% marginal tax rate.

Frequently Asked Questions about cost-of-capital-toolkit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate WACC with a synthetic credit rating in Python?

Run the rating subcommand with EBIT, interest expense, riskfree rate, and marginal tax rate to get a synthetic rating and cost of debt, then feed the result into the wacc subcommand with market values of equity and debt. Both scripts read JSON from stdin and print JSON.

How to estimate an equity risk premium for a company operating in multiple countries?

Use the erp-for-operations subcommand with a list of countries and revenue shares. It computes a revenue-weighted equity risk premium from the bundled country risk table, and optionally returns a cost of equity if you also supply a riskfree rate and beta.

Does this cost of capital engine require any Python packages?

No third-party packages are required. Both costofcapital.py and reference_data.py are pure standard library, so they run on any Python 3 installation without pip installs.

How do I find a company's optimal debt ratio?

Run the debt-schedule subcommand with unlevered beta, riskfree rate, ERP, EBIT, tax rate, and firm value. It computes cost of capital at each debt ratio by solving the rating-interest circularity, and reports the ratio that minimizes it plus the value effect of moving there.

Why does the implied equity risk premium come out too low?

The most common cause is using dividends alone instead of dividends plus buybacks as the index cash flow, which roughly halves the answer. A terminal growth rate set above the riskfree rate also inflates terminal value and depresses the solved premium; the engine caps terminal growth at the riskfree rate.

When should the optimal capital structure calculation not be used?

Do not apply it to financial service firms, where regulatory capital sets the financing mix, or to firms with negative EBIT, where coverage is undefined and every debt ratio prices at distressed spreads. Cyclical-peak EBIT also produces implausibly high optima and should be stress tested first.