DEV Community

William Wang
William Wang

Posted on

I Analyzed 1,377 Investment Rules from 26 Legendary Investors — Here Are the Patterns I Found

As a developer who built keeprule.com, I spent months digitizing investment wisdom from Buffett, Munger, Dalio, Marks, and 22 other legendary investors. After cataloging 1,377 individual investment rules, I started seeing patterns that surprised me — and they map remarkably well to concepts we already understand as developers.

Here are the 5 biggest patterns I found.


Pattern 1: The "Circle of Competence" Is Just Scope Management

23 out of 26 investors have explicit rules about staying within your area of knowledge.

Warren Buffett calls it the "Circle of Competence." Charlie Munger says you need to know "the edge of your own competency." Peter Lynch says "invest in what you know."

As developers, we already understand this instinctively:

// The Circle of Competence, translated to code
function shouldInvest(opportunity) {
  if (!myCompetence.includes(opportunity.industry)) {
    return false; // Stay in your lane
  }
  return analyze(opportunity);
}
Enter fullscreen mode Exit fullscreen mode

You wouldn't deploy code you haven't tested. You wouldn't architect a system in a language you've never used for a production deadline. The same logic applies to investing — don't put money into businesses you don't understand.

The takeaway: Scope creep kills projects AND portfolios.


Pattern 2: Risk Management > Returns (80/20 Rule, Inverted)

This one shocked me. Roughly 80% of all 1,377 rules focus on NOT losing money, not on making money.

function makeInvestmentDecision(opportunity) {
  // Rule #1: Don't lose money
  // Rule #2: Don't forget Rule #1
  if (risk > acceptable) {
    return; // Don't invest. Walk away.
  }

  // Only THEN think about returns
  if (expectedReturn > threshold) {
    invest(opportunity);
  }
}
Enter fullscreen mode Exit fullscreen mode

Howard Marks dedicates entire chapters to "the most important thing" — which is controlling risk, not chasing returns. Seth Klarman wrote a book literally called Margin of Safety. Buffett's famous two rules? "Rule #1: Never lose money. Rule #2: Never forget Rule #1."

The takeaway: Great investors are defensive programmers. They write for the failure case first.


Pattern 3: Emotional Discipline Appears in EVERY Single Framework

This is the only pattern with 100% coverage. Every single one of the 26 investors has at least 2 rules about controlling emotions during investing.

Think about it like this: the stock market is essentially a massive distributed system where most nodes are running emotion.js instead of logic.js.

// What most market participants run:
import { fear, greed, FOMO, panic } from 'emotion.js';

// What legendary investors run:
import { patience, discipline, rationality } from 'logic.js';

class InvestmentDecision {
  constructor() {
    this.checklist = loadRules(); // Pre-written, not emotional
  }

  evaluate(market) {
    // Ignore market sentiment
    // Follow the checklist
    return this.checklist.every(rule => rule.passes(market));
  }
}
Enter fullscreen mode Exit fullscreen mode

Benjamin Graham said it best: "The investor's chief problem — and even his worst enemy — is likely to be himself." Ray Dalio built an entire system of "principles" specifically to remove emotion from decisions.

The takeaway: The best investors are state machines, not event-driven reactors.


Pattern 4: Long-Term Thinking Is the Ultimate Competitive Advantage

The average recommended holding period across all 26 investors? 5+ years minimum. Many advocate for "forever" as the default.

// How legendary investors think about time
const HOLDING_PERIOD = Infinity; // Default

setTimeout(() => {
  sellStock(position);
}, YEARS * 5); // Minimum. Preferably never.

// How most retail investors think
const HOLDING_PERIOD = market.lastBadDay ? 0 : randomInt(1, 30); // Days
Enter fullscreen mode Exit fullscreen mode

Philip Fisher held Motorola for decades. Buffett has held Coca-Cola since 1988. The math is simple: compound interest needs TIME to work. Every time you trade, you pay fees, taxes, and spread — plus you have to be right TWICE (when to sell AND when to buy back in).

The takeaway: git commit your investments. Don't git revert every time the CI pipeline has a flaky test.


Pattern 5: Buy Quality at Fair Prices, Not Cheap Garbage

Charlie Munger changed Buffett's entire investment philosophy with one insight: "A great business at a fair price is superior to a fair business at a great price."

// The old way (value traps)
function oldSchoolValueInvesting(stock) {
  return stock.price < stock.bookValue * 0.5; // Just buy cheap stuff
}

// The evolved way (quality + value)
function modernValueInvesting(stock) {
  const quality = evaluateBusinessQuality(stock);
  const price = evaluatePrice(stock);

  return quality === 'exceptional' && price <= 'fair';
  // NOT: quality === 'mediocre' && price === 'dirt-cheap'
}
Enter fullscreen mode Exit fullscreen mode

This maps perfectly to the build-vs-buy decision in engineering. We've all learned that the "cheapest" solution usually costs the most in the long run. 18 out of 26 investors have explicit rules about prioritizing business quality over cheapness.

The takeaway: Technical debt and investment debt compound the same way. Quality always wins long-term.


What I Built With These Patterns

After finding these patterns, I built KeepRule — a searchable database of all 1,377 investment rules from 26 legendary investors. You can filter by investor, topic (risk management, valuation, psychology), or investment style.

Think of it as man pages for investing wisdom. Instead of Googling "what does Buffett think about X," you get structured, searchable rules with original sources.

If you're a developer interested in investing (or an investor interested in systematic thinking), I think you'll find it useful. Each rule is tagged, categorized, and cross-referenced — built the way a developer would want to consume this information.

Check it out: keeprule.com


What patterns have you noticed in investment advice? Drop a comment below — I'd love to hear from other developer-investors.

Top comments (0)