Skip to content

Instantly share code, notes, and snippets.

@nickdavis
Last active July 23, 2026 18:48
Show Gist options
  • Select an option

  • Save nickdavis/181f484011d349dfdd33fd992da2251c to your computer and use it in GitHub Desktop.

Select an option

Save nickdavis/181f484011d349dfdd33fd992da2251c to your computer and use it in GitHub Desktop.
the-algorithm.md
name the-algorithm
description Apply Elon Musk's five-step delete-first problem-solving algorithm as an explicit on-demand philosophy/mantra for simplifying requirements, plans, systems, code, products, and workflows. Use only when the user explicitly asks to use/apply/run The Algorithm, Musk's algorithm, or a question-delete-simplify-speed-automate pass.

The Algorithm

Purpose

Use this skill as a disciplined simplification pass before implementation, planning, optimization, or automation. Treat it as a first-principles checkpoint: do not optimize something that should not exist.

Operating Rules

  • Run the steps in order.
  • State assumptions and constraints before challenging them if they materially affect the answer.
  • Be direct, concrete, and willing to recommend deletion.
  • Prefer fewer moving parts, fewer steps, less process, and less code when that still satisfies the user's actual goal.
  • Do not use the skill as a blocker. If the user has already approved implementation, apply the algorithm quickly and then proceed.

The Five Steps

  1. Question the requirements. Ask which requirements are real, outdated, over-specified, inherited, or solving the wrong problem. Identify the source of each requirement when useful. Push especially hard on requirements that increase complexity, cost, latency, coordination, or maintenance.

  2. Delete the part or process. Look for components, fields, screens, abstractions, dependencies, meetings, steps, tests, checks, branches, and code paths that can be removed entirely. If nothing meaningful can be removed, say what you tried to delete and why it has to stay.

  3. Simplify or optimize what remains. After deletion, simplify names, interfaces, flows, data shapes, responsibilities, and implementation details. Optimize only the parts that survived deletion.

  4. Speed it up. Improve throughput, latency, turnaround time, developer feedback loops, or decision speed only after the shape is simpler. Avoid accelerating work that should have been eliminated.

  5. Automate last. Automate the stable, necessary, simplified process. Do not automate ambiguity, unnecessary process, or volatile manual work unless the automation itself helps discover what can be deleted.

Response Shape

When the user asks for a visible Algorithm pass, answer with these short sections:

  • Requirements to question
  • Candidates to delete
  • Simplify/optimize
  • Speed up
  • Automate last
  • Recommendation

For tiny tasks, compress this into a brief paragraph while preserving the order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment