diff --git a/.github/workflows/quality-assurance.yml b/.github/workflows/quality-assurance.yml index f67f932..f88f6ca 100644 --- a/.github/workflows/quality-assurance.yml +++ b/.github/workflows/quality-assurance.yml @@ -19,7 +19,6 @@ jobs: config: .markdownlint.json files: "**/*.md" ignore: "node_modules" - template-compliance: runs-on: ubuntu-latest name: Template Compliance Check @@ -35,3 +34,18 @@ jobs: run: | python scripts/check-template-compliance.py continue-on-error: true + + internal-links: + runs-on: ubuntu-latest + name: Internal File Link Check + steps: + - uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + + - name: Check internal file links + run: | + python scripts/check-internal-links.py --verbose diff --git a/README.md b/README.md index 25eb852..1d9d9b4 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,6 @@ Streamline business operations with AI assistance for strategy, analysis, and pr | **[Proposal Writer](business/proposal-writer.md)** | Create compelling business proposals and bids | Client proposals, project estimates, partnerships | | **[Strategic Planner](business/strategic-planner.md)** | Develop comprehensive business strategies | Business planning, competitive analysis, growth strategies | | **[Market Analysis](business/market-analysis.md)** | Analyze markets, competitors, and opportunities | Market research, competitive intelligence, business development | -| **[Financial Analyzer](business/financial-analyzer.md)** | Financial analysis and business metrics evaluation | Financial planning, investment analysis, budget review | | **[Xianyu Product Description](business/xianyu-product-description.md)** | Create compelling product descriptions for Xianyu marketplace | E-commerce listings, second-hand sales, marketplace optimization | ### šŸ“Š Analysis diff --git a/business/README.md b/business/README.md index 5c87f60..8e91372 100644 --- a/business/README.md +++ b/business/README.md @@ -18,7 +18,6 @@ This directory contains prompts for business and professional applications. - `proposal-writer.md` - Create compelling business proposals and bids - `strategic-planner.md` - Develop comprehensive business strategies - `market-analysis.md` - Analyze markets, competitors, and opportunities -- `financial-analyzer.md` - Financial analysis and business metrics evaluation - `xianyu-product-description.md` - Create effective Xianyu marketplace listings ## Business Applications diff --git a/business/financial-analyzer.md b/business/financial-analyzer.md deleted file mode 100644 index ab0629d..0000000 --- a/business/financial-analyzer.md +++ /dev/null @@ -1,410 +0,0 @@ -# Financial Analyzer - -## Description - -This prompt helps you analyze financial data, create financial models, evaluate investment opportunities, and provide insights for financial decision-making and business performance assessment. - -## Usage - -Perfect for financial planning, investment analysis, budgeting, financial reporting, valuation models, risk assessment, and making data-driven financial decisions for businesses and investments. - -## Prompt - -```markdown -You are an expert financial analyst with deep expertise in financial modeling, valuation, and investment analysis. I need comprehensive financial analysis to support important financial decisions. - -**Analysis Type:** -- Analysis purpose: [INVESTMENT_DECISION/BUSINESS_VALUATION/FINANCIAL_PLANNING/PERFORMANCE_ANALYSIS] -- Focus area: [PROFITABILITY/CASH_FLOW/VALUATION/RISK_ASSESSMENT/BUDGETING] -- Time horizon: [SHORT_TERM/ANNUAL/MULTI_YEAR_PROJECTION] -- Decision context: [ACQUISITION/FUNDING/STRATEGIC_PLANNING/OPERATIONAL_IMPROVEMENT] - -**Financial Data Available:** -- Historical financials: [YEARS_OF_DATA_AVAILABLE] -- Revenue data: [REVENUE_FIGURES_AND_TRENDS] -- Cost structure: [MAJOR_COST_CATEGORIES] -- Balance sheet items: [KEY_ASSETS_AND_LIABILITIES] -- Cash flow information: [OPERATING/INVESTING/FINANCING_FLOWS] - -**Analysis Requirements:** -- Industry: [RELEVANT_INDUSTRY_FOR_BENCHMARKING] -- Company size: [REVENUE_RANGE_OR_EMPLOYEE_COUNT] -- Growth stage: [STARTUP/GROWTH/MATURE/DECLINING] -- Risk factors: [KEY_RISKS_TO_CONSIDER] -- Benchmarks needed: [INDUSTRY_PEERS_OR_STANDARDS] - -**Specific Questions:** -- [CUSTOM_FINANCIAL_QUESTION_1] -- [CUSTOM_FINANCIAL_QUESTION_2] -- [CUSTOM_FINANCIAL_QUESTION_3] - -Please provide comprehensive financial analysis including: - -1. **Executive Summary:** - - Key financial health indicators - - Major findings and concerns - - Investment recommendation or strategic insights - - Risk assessment summary - -2. **Financial Performance Analysis:** - - Revenue analysis and growth trends - - Profitability analysis (gross, operating, net margins) - - Efficiency ratios (ROA, ROE, asset turnover) - - Liquidity analysis (current ratio, quick ratio, cash conversion) - - Leverage analysis (debt ratios, interest coverage) - -3. **Financial Modeling:** - - Historical trend analysis and drivers - - Forward-looking projections (3-5 years) - - Scenario analysis (best case, base case, worst case) - - Sensitivity analysis for key variables - - Break-even analysis where applicable - -4. **Valuation Analysis:** - - Multiple valuation approaches (DCF, comparables, precedent transactions) - - Key valuation drivers and assumptions - - Valuation range and target price/value - - Peer comparison and industry multiples - -5. **Cash Flow Analysis:** - - Operating cash flow quality and sustainability - - Capital expenditure requirements and efficiency - - Free cash flow generation and uses - - Working capital management analysis - - Cash runway and funding requirements - -6. **Risk Assessment:** - - Financial risk factors and mitigation strategies - - Market and operational risks - - Competitive position and market share trends - - Regulatory and macroeconomic risks - - Stress testing and downside scenarios - -7. **Recommendations:** - - Strategic financial priorities - - Investment decision recommendations - - Operational improvements for financial performance - - Capital structure optimization - - Key performance metrics to monitor - -Include supporting charts, ratios, and benchmarks where relevant, with clear methodology and assumptions stated. -``` - -## Example Input - -```markdown -Analysis purpose: Investment decision for potential acquisition -Focus area: Comprehensive financial and valuation analysis -Time horizon: 5-year projection with exit scenario -Decision context: Private equity acquisition of profitable SaaS company - -Historical financials: 3 years of audited financials available -Revenue data: $15M ARR, growing 35% annually, 85% recurring revenue -Cost structure: 60% gross margin, 25% S&M, 15% R&D, 12% G&A -Balance sheet: $8M cash, minimal debt, $5M in deferred revenue -Cash flow: Generating $3M annual free cash flow, improving margins - -Industry: B2B SaaS software -Company size: $15M revenue, 75 employees -Growth stage: Growth stage, expanding market share -Risk factors: Competitive market, customer concentration, talent retention - -Specific questions: -- What's the fair valuation range for this acquisition? -- What are the key value creation opportunities? -- What financial risks should we be most concerned about? -``` - -## Example Output - -```markdown -# SaaS Company Financial Analysis & Valuation - -## Executive Summary - -**Investment Recommendation: PROCEED with acquisition at $45-55M valuation** - -**Key Findings:** -- **Strong Growth**: 35% ARR growth with improving unit economics -- **Quality Revenue**: 85% recurring, low churn (<5% annually) -- **Path to Profitability**: Already FCF positive with expanding margins -- **Scalable Model**: High gross margins (60%) with operating leverage potential - -**Primary Value Creation Opportunities:** -1. **Margin Expansion**: Potential to reach 75%+ gross margins through pricing optimization -2. **Sales Efficiency**: CAC payback period can improve from 18 to 12 months -3. **Market Expansion**: Addressable market growing 25% annually - -**Key Risks**: Customer concentration (top 10 = 45% revenue), competitive pressures, talent retention in growth phase - ---- - -## Financial Performance Analysis - -### Revenue Analysis -**Historical Growth:** -- 2021: $8.1M ARR (+28% YoY) -- 2022: $11.2M ARR (+38% YoY) -- 2023: $15.1M ARR (+35% YoY) - -**Revenue Quality Metrics:** -- **Recurring Revenue**: 85% (industry avg: 75-80%) -- **Net Revenue Retention**: 112% (strong expansion) -- **Gross Revenue Retention**: 95% (low churn) -- **Average Contract Value**: $18K annually (+15% YoY) - -### Profitability Analysis - -``` - - 2021 2022 2023 Trend -Revenue $8.1M $11.2M $15.1M +35% CAGR -Gross Profit $4.7M $6.5M $9.1M +39% CAGR -Gross Margin 58% 58% 60% Improving -EBITDA ($0.5M) $0.8M $2.3M Strong -EBITDA Margin -6% 7% 15% +21pp -Net Income ($1.1M) $0.2M $1.8M Positive - -``` - -**Efficiency Ratios:** - -- **Rule of 40**: 50% (35% growth + 15% EBITDA margin) - Excellent -- **CAC Payback**: 18 months (target: <12 months) -- **LTV/CAC Ratio**: 4.2x (healthy, target: >3.0x) - -### Liquidity & Leverage - -- **Current Ratio**: 3.2x (strong liquidity position) -- **Cash**: $8.1M (16 months runway at current burn) -- **Debt/Equity**: 0.1x (minimal leverage) -- **Interest Coverage**: 25x+ (minimal interest expense) - ---- - -## Financial Modeling & Projections - -### Base Case 5-Year Projections - -``` - -Year 2024E 2025E 2026E 2027E 2028E -ARR $20.4M $26.0M $32.5M $39.0M $44.9M -Growth Rate 35% 27% 25% 20% 15% -Gross Margin 62% 65% 68% 70% 72% -EBITDA Margin 18% 22% 26% 28% 30% -FCF $4.2M $6.8M $10.1M $12.8M $15.2M - -``` - -### Key Assumptions - -- **Revenue Growth**: Decelerating but healthy (35% → 15% by 2028) -- **Gross Margin Expansion**: Pricing optimization and scale effects -- **OpEx Scaling**: 75% variable with revenue (improving efficiency) -- **Capital Requirements**: Minimal CapEx, working capital neutral - -### Scenario Analysis - -**Bull Case** (+25% revenue, +500bp margins): $75M+ valuation - -**Base Case** (model above): $50M valuation - -**Bear Case** (-20% revenue, -300bp margins): $35M valuation - ---- - -## Valuation Analysis - -### DCF Valuation: $48-52M - -**Key Assumptions:** - -- **Discount Rate**: 12% (risk-adjusted for private SaaS) -- **Terminal Growth**: 3% (conservative for mature SaaS) -- **Terminal EBITDA Margin**: 35% (industry leaders) -- **FCF Projection**: $53M cumulative 5-year FCF - -### Comparable Company Analysis: $45-55M - -**Public SaaS Multiples (Revenue):** - -- High-growth (>30%): 8-12x revenue -- Mid-growth (15-30%): 5-8x revenue -- **Target Multiple**: 3.0-3.7x revenue (growth-adjusted) - -**Peer Comparison:** - -- **HubSpot** (larger, more mature): 12x revenue, 40% growth -- **Freshworks** (similar size): 6x revenue, 25% growth -- **Target Range**: 3.2x revenue = $48M valuation - -### Precedent Transactions: $42-58M - -**Recent SaaS Acquisitions:** - -- Similar size/growth: 2.5-4.0x revenue multiples -- Strategic premium: +15-25% vs. financial buyer -- **Range**: 2.8-3.8x revenue - -### Valuation Summary - -``` - -Method Low High Midpoint -DCF Analysis $48M $52M $50M -Comparable Companies $45M $55M $50M -Precedent Transactions $42M $58M $50M -Weighted Average $45M $55M $50M - -``` - ---- - -## Cash Flow Analysis - -### Operating Cash Flow Quality - -- **Cash Conversion**: 95%+ of EBITDA converts to cash -- **Working Capital**: Positive from deferred revenue -- **Seasonality**: Minimal (subscription model) -- **Predictability**: High visibility from recurring revenue - -### Capital Requirements - -- **CapEx**: <2% of revenue (mostly IT equipment) -- **R&D Investment**: 15% of revenue (product development) -- **Sales & Marketing**: 25% of revenue (customer acquisition) - -### Free Cash Flow Generation - -``` - -Year 2024E 2025E 2026E 2027E 2028E -OCF $4.5M $7.2M $10.6M $13.4M $15.9M -CapEx ($0.3M) ($0.4M) ($0.5M) ($0.6M) ($0.7M) -FCF $4.2M $6.8M $10.1M $12.8M $15.2M -FCF Margin 21% 26% 31% 33% 34% - -``` - ---- - -## Risk Assessment - -### Financial Risks - -**Medium Risk:** - -- **Customer Concentration**: Top 10 customers = 45% revenue -- **Competitive Pressure**: Well-funded competitors entering market -- **Growth Sustainability**: Can the 35% growth rate be maintained? - -**Low Risk:** - -- **Cash Position**: Strong balance sheet, 16+ months runway -- **Revenue Quality**: High recurring, low churn, strong retention -- **Unit Economics**: Proven LTV/CAC ratios and payback periods - -### Operational Risks - -- **Talent Retention**: Key developers and sales team retention critical -- **Product Development**: Need continued innovation in competitive market -- **Scalability**: Systems and processes must scale with growth - -### Market Risks - -- **Economic Downturn**: SaaS resilient but SMB customers vulnerable -- **Market Saturation**: TAM growing but competitive intensity increasing -- **Technology Disruption**: AI/automation could change competitive landscape - -### Stress Testing - -**Downside Scenario**: 20% revenue decline, 500bp margin compression - -- **Impact**: Valuation drops to $35M (-30%) -- **Mitigation**: Strong cash position provides 2+ year runway - ---- - -## Investment Recommendations - -### Strategic Priorities Post-Acquisition - -**1. Sales & Marketing Optimization** (6-12 months) - -- Improve CAC payback from 18 to 12 months -- Implement account-based marketing for enterprise segment -- **Target**: 40% improvement in sales efficiency - -**2. Pricing Strategy Enhancement** (3-6 months) - -- Value-based pricing to improve gross margins to 70%+ -- Introduce premium tiers with advanced features -- **Target**: 500bp gross margin improvement - -**3. Product Development Acceleration** (12-18 months) - -- AI/automation features to differentiate from competitors -- Enterprise features to move upmarket -- **Target**: 20%+ improvement in win rates vs. competitors - -**4. Market Expansion** (18-24 months) - -- Geographic expansion to European markets -- Adjacent vertical markets with similar workflows -- **Target**: 25% of revenue from new markets by Year 3 - -### Financial Targets (5-Year) - -- **Revenue**: $45M ARR (15% CAGR) -- **EBITDA Margin**: 30%+ (vs. 15% current) -- **Enterprise Value**: $100M+ (2.0x multiple expansion) -- **IRR Target**: 25%+ for PE investment - -### Key Metrics to Monitor - -- **Growth**: Monthly ARR, net new ARR, logo retention -- **Efficiency**: CAC payback, LTV/CAC, magic number -- **Quality**: NPS, churn rate, expansion revenue -- **Profitability**: Gross margin, EBITDA margin, FCF conversion - -#### Recommended Acquisition Price Range: $45-55M - -#### Target IRR: 25-30% over 5-year hold period - -#### Exit Multiple Assumption: 4-5x revenue at 15-20% growth rates - -``` - -## Variations - -### Investment Due Diligence - -Focus on comprehensive financial analysis for investment decisions, including risk assessment, valuation models, and return projections. - -### Business Performance Review - -Analyze ongoing business performance, identify improvement opportunities, and create action plans for financial optimization. - -### Budget Planning & Forecasting - -Develop detailed financial budgets, forecasts, and variance analysis for operational planning and performance tracking. - -## Tips - -- Always provide multiple valuation methods and cross-check results for reasonableness -- Include sensitivity analysis to understand how changes in key assumptions affect outcomes -- Use industry benchmarks and peer comparisons to validate analysis and assumptions -- Clearly state methodology, assumptions, and limitations of the analysis -- Focus on cash flow generation and sustainability rather than just accounting profits - -## Related Prompts - -- [Market Analysis](./market-analysis.md) - For understanding market dynamics affecting financials -- [Strategic Planner](./strategic-planner.md) - For translating financial insights into strategy -- [Data Interpreter](../analysis/data-interpreter.md) - For analyzing financial datasets - -## Tags - -`financial-analysis` `valuation` `financial-modeling` `investment-analysis` `due-diligence` `budgeting` `financial-planning` `risk-assessment` diff --git a/business/market-analysis.md b/business/market-analysis.md index de829ce..0654a97 100644 --- a/business/market-analysis.md +++ b/business/market-analysis.md @@ -336,7 +336,6 @@ Focus on emerging technologies, disruptions, and innovation trends that could im ## Related Prompts - [Strategic Planner](./strategic-planner.md) - For developing business strategies -- [Financial Analyzer](./financial-analyzer.md) - For financial modeling and analysis - [Research Synthesizer](../analysis/research-synthesizer.md) - For processing research data ## Tags diff --git a/business/strategic-planner.md b/business/strategic-planner.md index fb66247..949bb83 100644 --- a/business/strategic-planner.md +++ b/business/strategic-planner.md @@ -392,7 +392,6 @@ Create recovery plans for struggling businesses, including cost reduction, reven ## Related Prompts - [Market Analysis](./market-analysis.md) - For understanding market dynamics -- [Financial Analyzer](./financial-analyzer.md) - For financial modeling and projections - [Goal Setter](../productivity/goal-setter.md) - For setting and tracking objectives ## Tags diff --git a/scripts/check-internal-links.py b/scripts/check-internal-links.py new file mode 100644 index 0000000..7ddd562 --- /dev/null +++ b/scripts/check-internal-links.py @@ -0,0 +1,181 @@ +#!/usr/bin/env python3 +""" +Internal file link checker for the prompt library. +This script validates internal file links (relative paths) while ignoring external HTTP(S) links. +""" + +import argparse +import re +import sys +from pathlib import Path + + +def find_markdown_files(root_path: Path) -> list[Path]: + """Find all markdown files in the repository.""" + return list(root_path.rglob("*.md")) + + +def extract_internal_links(content: str, file_path: Path) -> list[tuple[str, int, str]]: + """ + Extract internal file links from markdown content. + Returns list of tuples: (link_text, line_number, link_target) + """ + internal_links = [] + lines = content.split("\n") + + # Patterns for different markdown link formats + patterns = [ + # [text](path) - standard markdown links + r"\[([^\]]*)\]\(([^)]+)\)", + # [text]: path - reference-style links + r"^\s*\[([^\]]+)\]:\s*(.+)$", + ] + + for line_num, line in enumerate(lines, 1): + for pattern in patterns: + matches = re.finditer(pattern, line, re.MULTILINE) + for match in matches: + link_text = match.group(1) + link_target = match.group(2).strip() + + # Skip HTTP(S) links + if link_target.startswith(("http://", "https://")): + continue + + # Skip mailto links + if link_target.startswith("mailto:"): + continue + + # Skip fragment-only links (anchors within same page) + if link_target.startswith("#"): + continue + + # Remove fragment part from file links + clean_target = link_target.split("#")[0] + + # Skip empty targets + if not clean_target: + continue + + internal_links.append((link_text, line_num, clean_target)) + + return internal_links + + +def resolve_relative_path(source_file: Path, target_path: str) -> Path: + """Resolve a relative path from the source file's directory.""" + source_dir = source_file.parent + + # Handle different path formats + if target_path.startswith("./"): + target_path = target_path[2:] + elif target_path.startswith("../"): + # Keep the ../ for proper resolution + pass + + return (source_dir / target_path).resolve() + + +def check_file_links(root_path: Path, verbose: bool = False) -> tuple[int, int]: + """ + Check all internal file links in markdown files. + Returns tuple: (total_links_checked, broken_links_count) + """ + markdown_files = find_markdown_files(root_path) + total_links = 0 + broken_links = 0 + + print(f"šŸ” Checking internal file links in {len(markdown_files)} markdown files...") + + for md_file in markdown_files: + try: + content = md_file.read_text(encoding="utf-8") + internal_links = extract_internal_links(content, md_file) + + if verbose and internal_links: + print(f"\nšŸ“„ {md_file.relative_to(root_path)}") + + for link_text, line_num, link_target in internal_links: + total_links += 1 + + # Resolve the target path + try: + resolved_path = resolve_relative_path(md_file, link_target) + + # Check if the target file exists + if not resolved_path.exists(): + broken_links += 1 + print( + f"āŒ BROKEN LINK in {md_file.relative_to(root_path)}:{line_num}" + ) + print(f" Link text: '{link_text}'") + print(f" Target: '{link_target}'") + print(f" Resolved to: {resolved_path}") + print() + elif verbose: + print(f" āœ… Line {line_num}: '{link_text}' → {link_target}") + + except Exception as e: + broken_links += 1 + print( + f"āŒ ERROR resolving link in " + f"{md_file.relative_to(root_path)}:{line_num}" + ) + print(f" Link text: '{link_text}'") + print(f" Target: '{link_target}'") + print(f" Error: {e}") + print() + + except Exception as e: + print(f"āŒ ERROR reading file {md_file.relative_to(root_path)}: {e}") + continue + + return total_links, broken_links + + +def main(): + """Main function.""" + parser = argparse.ArgumentParser( + description="Check internal file links in markdown files" + ) + parser.add_argument( + "--root", + type=Path, + default=Path.cwd(), + help="Root directory to scan (default: current directory)", + ) + parser.add_argument( + "--verbose", + "-v", + action="store_true", + help="Show all links checked, not just broken ones", + ) + + args = parser.parse_args() + + if not args.root.exists(): + print(f"āŒ Root directory does not exist: {args.root}") + return 1 + + print("šŸ”— Internal File Link Checker") + print("=" * 40) + print(f"Root directory: {args.root.absolute()}") + print() + + total_links, broken_links = check_file_links(args.root, args.verbose) + + print("=" * 40) + print("šŸ“Š Results:") + print(f" Total internal links checked: {total_links}") + print(f" Broken links found: {broken_links}") + + if broken_links == 0: + print("šŸŽ‰ All internal file links are valid!") + return 0 + else: + print(f"āŒ Found {broken_links} broken internal file links") + return 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/validate-library.py b/scripts/validate-library.py index f0761bc..eb25f53 100644 --- a/scripts/validate-library.py +++ b/scripts/validate-library.py @@ -33,6 +33,27 @@ def run_markdown_lint(): return True +def run_internal_link_check(): + """Run internal file link checker.""" + print("šŸ” Running internal file link checks...") + try: + result = subprocess.run( + ["python", "scripts/check-internal-links.py"], + capture_output=True, + text=True, + cwd=Path.cwd(), + ) + + print(result.stdout) + if result.stderr: + print(result.stderr) + + return result.returncode == 0 + except Exception as e: + print(f"āŒ Internal link check failed: {e}") + return False + + def run_template_compliance(): """Run template compliance checker.""" print("šŸ” Running template compliance checks...") @@ -114,12 +135,11 @@ def check_directory_structure(): def main(): """Run all validation checks.""" print("šŸš€ Prompt Library Validation Suite") - print("=" * 40) - - checks = [ + print("=" * 40) checks = [ check_required_files, check_directory_structure, run_template_compliance, + run_internal_link_check, run_markdown_lint, ]