SuperAPI AI Directory

first-principles

General & other

View repository

Updated 10-15 17:28

About this skill

First Principles Thinking

Pre-protocol

Environment Detection

# 检测当前项目信息
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "unknown")
BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")

echo "PROJECT: $PROJECT_ROOT"
echo "BRANCH: $BRANCH"
echo "COMMIT: $COMMIT"

Pre-skill Check

benefits-from Check(Recommended but not required):

# 检查 goal-oriented 工件
GOAL_ARTIFACT="memory/artifacts/goal-oriented/latest.json"

if [ -f "$GOAL_ARTIFACT" ]; then
  echo "FOUND: goal-oriented artifact"
  # 提取目标信息(使用 Read 工具读取)
  # 在分析中参考目标上下文
else
  echo "INFO: No goal-oriented artifact found"
  echo "Consider running /goal-oriented first for better context"
fi

Artifact Directory Initialization:

# 确保工件目录存在
mkdir -p memory/artifacts/first-principles

User Intent Confirmation

Determine based on the user message:

Checkpoint:

  • Does the problem the user faces require an innovative solution
  • Is it necessary to break existing assumptions and conventions
  • Is the problem complexity suitable for first principles analysis

Intent Classification:

  1. Innovation Problem: Need to rebuild the solution from the essence
  2. Performance Optimization: Find the root cause of the bottleneck
  3. Technology Selection: Analyze requirements fundamentally
  4. Architecture Design: Design the system from the essence

Overview

First principles thinking is a way of thinking that starts from the most basic and fundamental truths or facts and rebuilds solutions to problems. It requires setting aside existing assumptions, conventions, or analogies, directly asking "What is the essence of this matter?" and "What are the most basic constituent elements?", and then deriving new possibilities based on these foundational elements.

Core Difference:

  • Analogical Thinking: Improve based on existing solutions ("Whatever others do, I can do too")
  • First Principles: Rebuild from the essence ("There is no need to do it this way at all")

Typical Example: When Elon Musk thought about the cost of rocket manufacturing, he did not accept the market price but instead started from raw material costs and concluded that manufacturing them himself would be cheaper.

When to Use

Applicable Scenarios:

  • Complex problems require innovative solutions
  • Conventional methods fail and a breakthrough is needed
  • Existing assumptions and conventions need to be broken
  • Cost/efficiency requires a fundamental breakthrough
  • Key decisions such as technology selection and architecture design
  • The user explicitly requests "thinking from the essence"

Inapplicable Scenarios:

  • Simple, already solved problems
  • Standardized, mature practices
  • Time is urgent and existing solutions need to be reused quickly

The Process

digraph first_principles {
    rankdir=TB;

    "识别问题" [shape=box, style=filled, fillcolor="#e0e0e0"];
    "拆解到基础元素" [shape=box, style=filled, fillcolor="#c8e6c9"];
    "质疑假设" [shape=box, style=filled, fillcolor="#fff9c4"];
    "重建方案" [shape=box, style=filled, fillcolor="#bbdefb"];
    "验证可行性" [shape=box, style=filled, fillcolor="#f8bbd0"];
    "保存工件" [shape=box, style=filled, fillcolor="#81c784"];

    "识别问题" -> "拆解到基础元素";
    "拆解到基础元素" -> "质疑假设";
    "质疑假设" -> "重建方案";
    "重建方案" -> "验证可行性";
    "验证可行性" -> "识别问题" [label="不可行", style=dashed];
    "验证可行性" -> "保存工件" [label="可行"];
}

Detailed Steps

Step 1: Identify the Problem

  • Clearly state the problem currently faced
  • Distinguish between "symptoms" and the "root problem"
  • Clarify the boundaries and constraints of the problem
  • If a goal-oriented artifact exists, refer to the goal context

Step 2: Break Down to Basic Elements

  • Decompose the problem into its most basic components
  • Ask "What cannot be broken down further?"
  • Identify unshakable foundations such as physical laws and logical truths

Step 3: Question Assumptions

  • List all assumptions that are taken for granted
  • Ask "Is this really necessary?"
  • Ask "What would happen if this assumption did not exist?"
  • Distinguish between "must be this way" and "habitually this way"

Step 4: Rebuild the Solution

  • Rebuild the solution based on the basic elements
  • Not limited by existing solutions
  • Explore multiple possibilities
  • Record the rationale and trade-offs of each solution

Step 5: Verify Feasibility

  • Check whether it conforms to basic laws
  • Evaluate implementation cost and risk
  • If it is not feasible, return to step 1 and re-examine the problem
  • If it is feasible, proceed to the artifact saving stage

Step 6: Save the artifact

  • Generate the artifact JSON file
  • Record the analysis process and results
  • Recommend follow-up skills

Thinking Framework

Use the following table to systematically engage in first-principles thinking:

Level Question Prompt Example (rocket cost)
Surface What is the current problem? Describe the symptoms and phenomena Rockets are too expensive, $65M each
Assumptions What do we believe "must be so"? List all assumptions Must buy off-the-shelf, supplier pricing is reasonable
Essence What are the most fundamental constituent elements? Laws of physics, raw materials, basic principles Aluminum, titanium, carbon fiber, material cost $800K
Rebuild How can it be rebuilt from the essence? Ignore existing solutions and design from scratch Manufacture it yourself, reducing cost to $8M

Thinking prompts:

  1. Surface level: Do not mistake symptoms for the problem itself
  2. Assumption level: Every "must" must be questioned
  3. Essence level: Find the unshakable foundation (physics, logic, mathematics)
  4. Rebuild level: Boldly hypothesize, carefully verify

Examples

Case 1: Database query performance optimization

Problem: Queries are too slow, averaging 10 seconds

Surface: Queries are slow, SQL needs to be optimized

Assumptions:

  • The indexes are already good enough
  • Large data volume is the bottleneck
  • Faster hardware is needed

Essence:

  • Disk I/O is the real bottleneck (accounting for 70%)
  • A large number of unnecessary full table scans
  • Redundant query logic

Rebuild:

  • Start with I/O optimization, not SQL tuning
  • Introduce a caching layer to reduce disk access
  • Rewrite the query logic to query only necessary fields
  • Result: Query time reduced to 0.8 seconds

Case 2: Software architecture technology selection

Problem: Need to choose a microservices framework

Surface: Which is better: Spring Cloud, Dubbo, or gRPC?

Assumptions:

  • A mature framework must be used
  • The more features, the better
  • Community activity is the most important

Essence:

  • The business requirement is "inter-service communication"
  • The current team size is < 10 people
  • Traffic < 1K QPS

Rebuild:

  • No complex microservices framework is needed
  • Using simple HTTP REST + service discovery is sufficient
  • Can migrate smoothly later
  • Result: Reduced complexity, accelerated development speed

Common Pitfalls

Misconception 1: Over-decomposition, ignoring practicality

  • Manifestation: Decomposing for the sake of decomposition, falling into endless philosophical discussion
  • Correct approach: Breaking it down to an "actionable" level is sufficient, balancing depth and efficiency.

Misconception 2: Ignoring existing knowledge accumulation

  • Manifestation: Starting from scratch and reinventing the wheel, repeatedly reinventing
  • Correct approach: First principles means questioning assumptions, not denying everything. Verified knowledge should be inherited.

Misconception 3: Confusing "essence" with "appearance"

  • Manifestation: Mistaking surface phenomena for root causes
  • Correct approach: Continuously ask "why" at least 5 times (5 Whys method)

Misconception 4: Lack of a verification step

  • Manifestation: Directly implementing a proposed theoretical solution
  • Correct approach: Feasibility verification must be conducted, with small-scale pilot testing

Post-protocol

Artifact output

Save the first principles analysis results to the artifact file:

# 生成工件文件名
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
ARTIFACT_FILE="memory/artifacts/first-principles/result-$TIMESTAMP.json"

# 写入工件
cat > "$ARTIFACT_FILE" <<EOF
{
  "skill": "first-principles",
  "version": "2.0.0",
  "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
  "project": "$PROJECT_ROOT",
  "branch": "$BRANCH",
  "commit": "$COMMIT",
  "input": {
    "user_request": "用户的原始请求"
  },
  "output": {
    "problem": "识别的问题",
    "assumptions": [
      "假设1",
      "假设2"
    ],
    "fundamentals": [
      "基础元素1",
      "基础元素2"
    ],
    "solution": "重建的解决方案",
    "validation": "可行性验证结果"
  },
  "next_skills": [
    "ddd-strategic-design",
    "mvp-first",
    "pdca-cycle"
  ]
}
EOF

echo "ARTIFACT SAVED: $ARTIFACT_FILE"

# 创建 latest.json 符号链接
ln -sf "$ARTIFACT_FILE" memory/artifacts/first-principles/latest.json

Target file update

If a target file exists, record the completion of the analysis:

# 检查是否有 pending 目标
GOAL_FILE=$(ls -t memory/goals/*.md 2>/dev/null | head -1)

if [ -n "$GOAL_FILE" ]; then
  GOAL_STATUS=$(grep "状态:" "$GOAL_FILE" | awk '{print $2}')

  if [ "$GOAL_STATUS" = "pending" ]; then
    echo "GOAL STATUS: $GOAL_STATUS"
    echo "Adding milestone: 第一性原理分析完成"

    # 使用 Edit 工具添加里程碑
    # 例如:"第一性原理分析完成 - {时间}"
  fi
fi

Recommended follow-up skills

Based on the analysis results, recommend follow-up skills:

Recommended format:

## 后续建议

基于第一性原理分析结果,建议继续执行:

**推荐技能链**:
1. /ddd-strategic-design - 如果涉及系统架构设计
2. /mvp-first - 如果是新系统或新功能
3. /pdca-cycle - 进入迭代执行阶段

**根据解决方案类型选择**:
- **架构设计类** → /ddd-strategic-design → /ddd-tactical-design
- **新系统开发** → /mvp-first → /pdca-cycle
- **性能优化类** → /pdca-cycle
- **技术选型类** → 直接进入实施

是否继续执行?
- A) 执行推荐的技能链
- B) 只执行第一个技能
- C) 不继续,结束当前任务

References

  • "First Principles" - Aristotelian philosophical foundation
  • Elon Musk on First Principles Thinking - TED Talk
  • Zero to One - Peter Thiel
  • First Principles Thinking Mind Map