scripts-strategy-brief-templates
#!/usr/bin/env python3 """
title: "Strategy Brief Templates" component_type: script version: "1.0.0" audience: contributor status: stable summary: "Strategy Brief Template Engine ==============================" keywords: ['analysis', 'brief', 'git', 'review', 'strategy'] tokens: ~500 created: 2025-12-22 updated: 2025-12-22 script_name: "strategy-brief-templates.py" language: python executable: true usage: "python3 scripts/strategy-brief-templates.py [options]" python_version: "3.10+" dependencies: [] modifies_files: false network_access: false requires_auth: false
Strategy Brief Template Engine
Converts research findings into polished, professional markdown briefs. Templates follow McKinsey/BCG/Bain formatting standards.
Usage: python3 scripts/strategy-brief-templates.py --input findings.json --output brief.md python3 scripts/strategy-brief-templates.py --demo # Run with sample data
Source: Adapted from ANALYZE-REVIEW/extracted-consulting/brief_templates.py """
import argparse import json import sys from dataclasses import dataclass from datetime import datetime, timezone from pathlib import Path from typing import Dict, List, Any, Optional
@dataclass class MarketMetrics: """Key market metrics for header display.""" market_size: str growth_rate: str key_stat_1: Optional[str] = None key_stat_2: Optional[str] = None
class TemplateEngine: """Generate formatted sections from research findings."""
@staticmethod
def generate_header(industry: str, geography: str, horizon: str,
client_type: str, metrics: Optional[MarketMetrics] = None) -> str:
"""Generate brief header with key metrics."""
now = datetime.now(timezone.utc)
header = f"""# {industry}
Strategic Market & Competitive Brief | {geography} | {horizon}
Prepared {now.strftime('%B %Y')} | Client Type: {client_type}
""" if metrics: header += f"""
| Metric | Value |
|---|---|
| Market Size | {metrics.market_size} |
| Growth Rate | {metrics.growth_rate} |
| """ |
if metrics.key_stat_1:
header += f"| Key Metric 1 | {metrics.key_stat_1} |\n"
if metrics.key_stat_2:
header += f"| Key Metric 2 | {metrics.key_stat_2} |\n"
header += "\n"
return header
@staticmethod
def generate_executive_snapshot(takeaways: List[str], implications: List[str],
recommendations: List[str]) -> str:
"""Generate A. Executive Snapshot section."""
section = """## A. Executive Snapshot
Key Takeaways
""" for i, takeaway in enumerate(takeaways, 1): # Bold the first sentence sentences = takeaway.split('. ', 1) if len(sentences) > 1: section += f"{i}. {sentences[0]}. {sentences[1]}\n\n" else: section += f"{i}. {takeaway}\n\n"
section += '\n### "So What" — Implications\n\n'
for implication in implications:
section += f"- {implication}\n"
section += '\n### Recommended Moves (Next 12–24 Months)\n\n'
for i, rec in enumerate(recommendations, 1):
parts = rec.split(':', 1)
if len(parts) == 2:
section += f"{i}. **{parts[0]}:** {parts[1].strip()}\n\n"
else:
section += f"{i}. {rec}\n\n"
return section
@staticmethod
def generate_market_context(definition: str, drivers: List[str],
segments: List[Dict[str, str]],
value_chain: Dict[str, List[str]],
unit_economics: List[str]) -> str:
"""Generate B. Market Context section."""
section = """## B. Market Context: Current State
Market Definition & Boundaries
""" section += definition + "\n\n"
section += "### Demand Drivers\n\n"
for driver in drivers:
parts = driver.split(':', 1)
if len(parts) == 2:
section += f"**{parts[0]}:** {parts[1].strip()}\n\n"
else:
section += f"- {driver}\n\n"
section += "### Customer Segments\n\n"
section += "| Segment | Characteristics | Typical Profile |\n"
section += "|---------|-----------------|----------------|\n"
for seg in segments:
section += f"| {seg.get('name', 'N/A')} | {seg.get('characteristics', 'N/A')} | {seg.get('profile', 'N/A')} |\n"
section += "\n"
section += "### Value Chain Map\n\n"
section += f"**Upstream** → {' | '.join(value_chain.get('upstream', ['N/A']))}\n\n"
section += f"**Core** → {' | '.join(value_chain.get('core', ['N/A']))}\n\n"
section += f"**Downstream** → {' | '.join(value_chain.get('downstream', ['N/A']))}\n\n"
section += "### Unit Economics Levers\n\n"
for lever in unit_economics:
parts = lever.split(':', 1)
if len(parts) == 2:
section += f"- **{parts[0]}:** {parts[1].strip()}\n"
else:
section += f"- {lever}\n"
section += "\n"
return section
@staticmethod
def generate_trends_table(trends: List[Dict[str, Any]]) -> str:
"""Generate C. Key Trends section with structured table."""
section = """## C. Key Trends, Threats & Disruptions
| Trend / Threat | Description | Impact | Horizon | Confidence |
|---|---|---|---|---|
| """ |
for trend in trends:
name = trend.get('name', 'Unknown')
desc = trend.get('description', '')[:80]
impact = trend.get('impact', '')[:80]
horizon = trend.get('horizon', 'Unknown')
confidence = trend.get('confidence', '?')
section += f"| {name} | {desc} | {impact} | {horizon} | {confidence}% |\n"
section += "\n"
return section
@staticmethod
def generate_competitor_profile(competitor: Dict[str, Any]) -> str:
"""Generate individual competitor analysis."""
profile = f"""### {competitor.get('rank', '')}. {competitor.get('name', 'Unknown')}
{competitor.get('revenue', 'Revenue not disclosed')}
""" profile += f"Positioning: {competitor.get('positioning', 'N/A')}\n\n" profile += f"Business Model: {competitor.get('business_model', 'N/A')}\n\n"
if 'strengths' in competitor:
profile += f"**Strengths:** {competitor['strengths']}\n\n"
if 'weaknesses' in competitor:
profile += f"**Weaknesses:** {competitor['weaknesses']}\n\n"
if 'moat' in competitor:
profile += f"**Moat:** {competitor['moat']}\n\n"
if 'vulnerability' in competitor:
profile += f"**Vulnerability:** {competitor['vulnerability']}\n\n"
return profile
@staticmethod
def generate_competitive_landscape(competitors: List[Dict[str, Any]]) -> str:
"""Generate D. Competitive Landscape section."""
section = """## D. Competitive Landscape
Competitor details based on publicly available information.
""" for competitor in competitors: section += TemplateEngine.generate_competitor_profile(competitor) section += "\n"
return section
@staticmethod
def generate_swot(swot: Dict[str, List[str]], client_type: str = "Incumbent") -> str:
"""Generate SWOT analysis."""
analysis = f"""### SWOT Analysis ({client_type})
Strengths
""" for item in swot.get('strengths', ['N/A']): analysis += f"- {item}\n"
analysis += "\n**Weaknesses**\n\n"
for item in swot.get('weaknesses', ['N/A']):
analysis += f"- {item}\n"
analysis += "\n**Opportunities**\n\n"
for item in swot.get('opportunities', ['N/A']):
analysis += f"- {item}\n"
analysis += "\n**Threats**\n\n"
for item in swot.get('threats', ['N/A']):
analysis += f"- {item}\n"
analysis += "\n"
return analysis
@staticmethod
def generate_porters_five_forces(forces: Dict[str, Dict[str, str]]) -> str:
"""Generate Porter's Five Forces analysis."""
analysis = """### Porter's Five Forces
| Force | Intensity | Key Drivers |
|---|---|---|
| """ |
force_order = [
('competitive_rivalry', 'Competitive Rivalry'),
('threat_of_new_entrants', 'Threat of New Entrants'),
('supplier_power', 'Supplier Power'),
('buyer_power', 'Buyer Power'),
('threat_of_substitutes', 'Threat of Substitutes')
]
for force_key, force_name in force_order:
if force_key in forces:
force = forces[force_key]
intensity = force.get('intensity', 'Unknown')
drivers = force.get('drivers', 'Not specified')
analysis += f"| {force_name} | {intensity} | {drivers} |\n"
analysis += "\n"
return analysis
@staticmethod
def generate_strategy_option(option: Dict[str, Any]) -> str:
"""Generate single strategy option."""
opt = f"""### Option {option.get('number', '')}: {option.get('name', 'Strategy')}
Where to Play: {option.get('where_to_play', 'Not specified')}
How to Win: {option.get('how_to_win', 'Not specified')}
Capabilities Required:
""" for cap in option.get('capabilities', ['N/A']): opt += f"- {cap}\n"
opt += "\n**Risks & Mitigations:**\n\n"
for risk in option.get('risks', []):
opt += f"- **Risk:** {risk.get('risk', 'Unknown')}\n"
opt += f" **Mitigation:** {risk.get('mitigation', 'Not specified')}\n\n"
opt += "**First 90 Days:**\n\n"
for action in option.get('first_90_days', ['Define detailed plan']):
opt += f"- {action}\n"
opt += "\n"
return opt
@staticmethod
def generate_disclaimers(assumptions: List[str], data_gaps: List[Dict[str, str]],
validation_plan: List[Dict[str, str]]) -> str:
"""Generate H. Transparency & Disclaimers section."""
now = datetime.now(timezone.utc)
section = """## H. Transparency & Disclaimers
Key Assumptions
""" for assumption in assumptions: section += f"- {assumption}\n"
section += "\n### Data Gaps\n\n"
for gap in data_gaps:
section += f"**{gap.get('area', 'Unknown')}:** {gap.get('description', 'N/A')}\n\n"
section += "### Validation Plan\n\n"
section += "| Gap | Validation Approach | Timeline |\n"
section += "|-----|---------------------|----------|\n"
for item in validation_plan:
section += f"| {item.get('gap', 'N/A')} | {item.get('approach', 'N/A')} | {item.get('timeline', 'N/A')} |\n"
section += f"""
Disclaimer: This strategic brief is based on publicly available information, industry research, and general market analysis. It does not constitute investment, legal, or financial advice.
Analysis date: {now.strftime('%B %Y')} | Sources: Web research, industry publications """ return section
def get_demo_data() -> Dict[str, Any]: """Return demo data for testing.""" return { 'params': { 'industry': 'AI-Powered Software Development Tools', 'geography': 'Global', 'time_horizon': '12-24 months', 'client_type': 'Incumbent Expanding' }, 'metrics': { 'market_size': '$43B', 'growth_rate': '18-22%', 'key_stat_1': '78% adoption', 'key_stat_2': '4M+ developers' }, 'executive_snapshot': { 'takeaways': [ "Exceptional growth trajectory. The global market was valued at $43B in 2024.", "AI is transforming delivery models fundamentally across all segments.", "Persistent talent shortage creates opportunity for AI-augmented solutions." ], 'implications': [ "AI adoption is no longer optional for competitive positioning", "Talent strategy requires global reach and AI augmentation", "Compliance expertise is becoming a revenue opportunity" ], 'recommendations': [ "Accelerate AI integration: Deploy AI coding assistants within 6 months", "Diversify delivery footprint: Establish nearshore capabilities", "Build compliance offerings: Develop dedicated practice areas" ] }, 'competitors': [ { 'rank': 1, 'name': 'GitHub Copilot', 'revenue': '$500M+ ARR (estimated)', 'positioning': 'Market leader in AI pair programming', 'business_model': 'Subscription ($10-19/user/month)', 'strengths': 'Microsoft ecosystem, training data, brand recognition', 'weaknesses': 'Privacy concerns, enterprise customization limits', 'moat': 'GitHub integration, developer familiarity', 'vulnerability': 'Specialized alternatives for specific languages' } ], 'swot': { 'strengths': ['Existing customer base', 'Domain expertise', 'Talent pool'], 'weaknesses': ['Legacy systems', 'Slower innovation cycles'], 'opportunities': ['AI integration', 'New market segments', 'Geographic expansion'], 'threats': ['Disruptive startups', 'Talent competition', 'Regulatory changes'] }, 'porters': { 'competitive_rivalry': {'intensity': 'High', 'drivers': 'Many players, low switching costs'}, 'threat_of_new_entrants': {'intensity': 'Medium', 'drivers': 'AI lowers barriers'}, 'supplier_power': {'intensity': 'Medium', 'drivers': 'Cloud infrastructure concentrated'}, 'buyer_power': {'intensity': 'High', 'drivers': 'Enterprise buyers have leverage'}, 'threat_of_substitutes': {'intensity': 'Medium', 'drivers': 'In-house development, no-code'} }, 'disclaimers': { 'assumptions': [ 'Market growth continues at current trajectory', 'No major regulatory disruption in key markets', 'AI technology advances remain predictable' ], 'data_gaps': [ {'area': 'Competitor Revenue', 'description': 'Private company financials not disclosed'}, {'area': 'Market Share', 'description': 'Varies significantly by segment'} ], 'validation_plan': [ {'gap': 'Revenue estimates', 'approach': 'Industry analyst calls', 'timeline': '30 days'}, {'gap': 'Customer preferences', 'approach': 'Survey research', 'timeline': '60 days'} ] } }
def main(): """Main entry point.""" parser = argparse.ArgumentParser( description="Strategy Brief Template Engine", formatter_class=argparse.RawDescriptionHelpFormatter ) parser.add_argument('--input', help='Input JSON file with research findings') parser.add_argument('--output', help='Output markdown file') parser.add_argument('--demo', action='store_true', help='Run with demo data')
args = parser.parse_args()
# Load data
if args.demo:
data = get_demo_data()
elif args.input:
data = json.loads(Path(args.input).read_text())
else:
print("Error: Provide --input file or use --demo", file=sys.stderr)
sys.exit(1)
# Generate brief
template = TemplateEngine()
sections = []
params = data.get('params', {})
metrics = data.get('metrics')
# Header
if metrics:
metrics_obj = MarketMetrics(**metrics)
else:
metrics_obj = None
sections.append(template.generate_header(
params.get('industry', 'Unknown Industry'),
params.get('geography', 'Global'),
params.get('time_horizon', '12-24 months'),
params.get('client_type', 'Incumbent Expanding'),
metrics_obj
))
# Executive Snapshot
if 'executive_snapshot' in data:
sections.append(template.generate_executive_snapshot(
data['executive_snapshot']['takeaways'],
data['executive_snapshot']['implications'],
data['executive_snapshot']['recommendations']
))
# Competitive Landscape
if 'competitors' in data:
sections.append(template.generate_competitive_landscape(data['competitors']))
# SWOT
if 'swot' in data:
sections.append(template.generate_swot(
data['swot'],
params.get('client_type', 'Incumbent')
))
# Porter's Five Forces
if 'porters' in data:
sections.append(template.generate_porters_five_forces(data['porters']))
# Disclaimers
if 'disclaimers' in data:
sections.append(template.generate_disclaimers(
data['disclaimers']['assumptions'],
data['disclaimers']['data_gaps'],
data['disclaimers']['validation_plan']
))
brief = '\n'.join(sections)
# Output
if args.output:
Path(args.output).write_text(brief)
print(f"Brief saved to: {args.output}")
else:
print(brief)
if name == "main": main()