Duan Yongping Thinking Framework: A Complete Technical Guide to the dyp-ask AI Skill

The dyp-ask skill encodes Duan Yongping's value investing philosophy into a deterministic AI persona that evaluates investments through nine strict framework rules, rejects prohibited behaviors like shorting or margin trading, and validates financial data through cross-validation before rendering terse, first-person responses.

The dyp-ask skill (段永平问答) transforms Duan Yongping’s investment and life philosophy into a reproducible AI framework within the xbtlin/ai-berkshire repository. Located at skills/dyp-ask.md, this markdown-based skill defines a complete persona that enforces strict adherence to Duan’s thinking framework across both Claude Code and OpenAI Codex environments.

Architecture of the dyp-ask Skill

The dyp-ask skill operates within the Skill layer of the AI Berkshire architecture, where the markdown file under skills/dyp-ask.md serves as the canonical definition. When invoked, the Agent layer creates a single "Duan Yongping Agent" that parses the request, loads the skill definition, and produces responses using the Tool layer for precise calculations.

The response pipeline follows a deterministic sequence: parse the request, select the relevant framework component, apply the framework rules, and render the answer using the prescribed tone and utterances. This architecture ensures consistent application of the Duan Yongping thinking framework without requiring custom code beyond the markdown definition.

The Nine Pillars of the Duan Yongping Thinking Framework

The framework consists of nine numbered sections that the Agent consults for every question, plus an execution block that enforces tone and style. Each section functions as a self-contained rule that the model must honor.

1. Investment Belief: Cash Flow Foundation

Section 1 (投资信仰) establishes that "买股票就是买公司,买公司就是买公司的未来现金流折现" (buying stocks is buying companies, buying companies is buying the discounted future cash flow) according to lines 19-21 in skills/dyp-ask.md.

When processing investment queries, the Agent begins all responses by emphasizing cash-flow-based valuation rather than price-movement speculation. This foundational rule prevents the AI from engaging in technical analysis or market-timing discussions.

2. Business Model Evaluation

Section 2 (生意模式) requires evaluating five specific criteria: differentiation (差异化), moat (护城河), pricing power (定价权), asset lightness (轻资产), and user-orientation (用户导向) as defined in lines 32-38.

For commercial questions, the Agent evaluates companies against these five dimensions, producing a "好生意" (good business) score. The skill explicitly references these characteristics when analyzing competitive advantages and business quality.

3. The Stop-Doing List

Section 3 defines strict prohibitions including no margin trading (不做空), no shorting, no investment in unknown companies, no frequent trading, ignoring macroeconomic trends, and no price forecasts according to lines 43-53.

The Agent automatically filters requests that violate these prohibitions. For example, a query asking "should I short X?" receives an immediate rejection ("不做空") rather than an analysis, maintaining strict adherence to Duan's risk management principles.

4. Circle of Competence

Section 4 (能力圈) mandates investing only in understandable businesses, as stated in lines 62-69.

The Agent first asks "我能看懂吗?" (Can I understand this?) and aborts the analysis if the answer is negative. This guardrail prevents the AI from opining on complex derivatives, obscure cryptocurrencies, or businesses outside established competence boundaries.

5. Valuation and Timing

Section 5 (估值与买卖时机) prescribes rough estimations rather than precise models, using PE ratios as reference points, buying when prices are cheap relative to intrinsic value, and selling only when better opportunities appear (lines 72-82).

When valuation is required, the Agent invokes tools/financial_rigor.py for back-of-the-envelope calculations. The framework explicitly prohibits giving precise target prices, instead emphasizing approximate ranges and margin-of-safety concepts.

6. Corporate Culture Assessment

Section 6 (企业文化) evaluates companies on "本分" (integrity/focus), user-orientation, avoiding profit-above-all mentalities, result-orientation, and the "clock-builder vs time-teller" distinction (造钟人 vs 报时人) per lines 88-99.

For management-oriented queries, the Agent evaluates corporate culture along these dimensions and will recommend "不投" (do not invest) if a company lacks the required "本分" culture, regardless of financial metrics.

7. Management Integrity Check

Section 7 (管理层评估) focuses on trustworthiness, historic capital allocation patterns, founder versus professional manager dynamics, and integrity red flags (lines 103-110).

The Agent examines governance data for integrity issues. Any indication of untrustworthy behavior triggers an immediate rejection of the investment opportunity, as Duan's framework prioritizes trustworthy management over attractive valuations.

8. Macro and Market Ignorance

Section 8 (宏观与市场) establishes that Duan ignores macroeconomic trends because they are short-term phenomena, believing that good companies survive macro cycles (lines 112-120).

Macro questions receive the standardized response "我不看宏观" (I don't look at macro), preventing the AI from engaging in economic forecasting, interest rate speculation, or market timing based on political events.

9. Investment Mindset and the Mirror Test

Section 9 (投资心态) emphasizes maintaining a "平常心" (ordinary mind), avoiding short-term price action, and respecting the 5-sentence "镜子测试" (mirror test) as detailed in lines 122-130.

The Agent ends every investment answer with a concise 5-sentence summary. If any sentence is missing, the answer is considered a "不买" (do not buy) under the framework's rules, ensuring disciplined decision-making.

Framework Enforcement Mechanisms

The deterministic application of the Duan Yongping thinking framework relies on three enforcement layers that operate during every invocation.

Prompt Templating and System Instructions

The skill file is concatenated to the LLM prompt each time the skill runs, guaranteeing that all nine framework sections are present in the context window. This prompt templating occurs in skills/dyp-ask.md and propagates to the generated codex-skills/dyp-ask/SKILL.md and codex-prompts/dyp-ask.md files.

Rule-Driven Guardrails

The skill includes explicit "不要" (do not) and "要" (must) lists that the Agent checks before emitting any response. These guardrails prevent violations of the Stop-Doing List and enforce the first-person voice requirement specified in the execution block (lines 134-188).

Financial Data Validation

When valuations or financial metrics are required, the Agent calls tools/financial_rigor.py to cross-validate data from at least two independent sources. This tool ensures that all numerical claims in the response meet the framework's standard for rigorous financial analysis.

Practical Usage and Code Examples

The dyp-ask skill integrates with both Claude Code and OpenAI Codex environments using slash commands and text prompts.

Claude Code Integration

Invoke the skill using the slash command:

/dyp-ask 拼多多的护城河到底在哪里?

Internal execution flow:

  1. The /dyp-ask command loads skills/dyp-ask.md into the context
  2. The Agent selects Section 2 (Business Model) because the query concerns moats
  3. It evaluates the five criteria: differentiation, moat, pricing power, asset lightness, and user-orientation
  4. The response renders in Duan's terse style and concludes with the 5-sentence mirror test

OpenAI Codex Integration

For Codex environments, use the generated skill package:

使用 dyp-ask 为我分析一下小米的投资价值。

This invokes the generated Codex skill via codex-skills/dyp-ask/SKILL.md, executing the same pipeline through the codex run dyp-ask command structure.

Sample output structure:

好生意特征:
- 差异化:小米的硬件 + 互联网服务生态形成一定差异化。
- 护城河:品牌溢价、规模效应、供应链议价力(宽护城河)。
- 定价权:能够在中低端定位保持较高毛利。
- 轻资产:主要依赖代工,资本投入相对轻。
- 用户导向:以性价比驱动用户需求。

镜子测试(5句话):
1. 我能看懂小米的业务模型——硬件加服务的“双轮”。
2. 护城河宽且在扩大——规模效应与供应链优势。
3. 管理层本分,雷军坚持长期价值观。
4. 当前股价约为内在价值的 9 折,有安全边际。
5. 如果出现更好的成长机会,我会考虑卖出。
✅ 通过镜子测试 → 推荐逢低建仓。

Summary

  • The dyp-ask skill encodes Duan Yongping's complete investment philosophy into nine strict framework sections defined in skills/dyp-ask.md.
  • The framework prohibits margin trading, shorting, macro analysis, and price forecasting through an enforced Stop-Doing List.
  • Every investment recommendation must pass the 5-sentence mirror test and demonstrate understanding of the business model, moat, and management integrity.
  • Financial data is validated through tools/financial_rigor.py before inclusion in responses.
  • The skill operates across Claude Code and OpenAI Codex through generated skill packages that maintain deterministic behavior.

Frequently Asked Questions

What is the dyp-ask skill?

The dyp-ask skill is a markdown-based AI persona that implements Duan Yongping's value investing framework within the xbtlin/ai-berkshire repository. It transforms Duan's philosophy into executable rules that guide an AI agent to evaluate investments using specific criteria like cash flow valuation, business moats, and management integrity while rejecting prohibited behaviors like shorting or macro speculation.

How does the mirror test work?

The mirror test is a 5-sentence summary requirement defined in Section 9 of the framework (lines 122-130 in skills/dyp-ask.md). Every investment answer must conclude with five specific sentences covering: understanding of the business, moat assessment, management evaluation, valuation/margin of safety, and opportunity cost considerations. Missing any sentence results in a "不买" (do not buy) classification.

Why does the framework reject macro analysis?

Section 8 (宏观与市场) explicitly ignores macroeconomic trends because Duan considers them short-term noise that cannot be predicted consistently. The framework asserts that good companies survive macro cycles, so the Agent responds to macro questions with "我不看宏观" (I don't look at macro) and redirects focus to business-quality analysis instead.

Can I modify the Duan Yongping thinking framework?

Yes. The canonical definition in skills/dyp-ask.md serves as the source of truth, while codex-skills/dyp-ask/SKILL.md and codex-prompts/dyp-ask.md are generated artifacts. You can modify the framework by editing the nine sections or execution rules in the main skill file; changes propagate automatically to the generated Codex packages when the build pipeline runs.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →