# What Is the dyp-ask Skill and How Does It Simulate Duan Yongping’s Thinking?

> Discover the dyp-ask skill simulating Duan Yongping s thinking. Learn how this Claude-Code command injects a value-investing persona into LLMs for structured reasoning. Explore its implementation.

- Repository: [Xbt Lin/ai-berkshire](https://github.com/xbtlin/ai-berkshire)
- Tags: deep-dive
- Published: 2026-07-25

---

**The dyp-ask skill is a specialized Claude-Code slash command that injects a Duan Yongping persona into a large language model, forcing structured, value-investing reasoning through a predefined prompt template stored in [`skills/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/dyp-ask.md).**

The **dyp-ask** skill is implemented in the open-source **xbtlin/ai-berkshire** repository as a reproducible workflow for emulating the investment mindset of Duan Yongping (DYP), the Chinese entrepreneur and value investor renowned for his disciplined fundamental analysis. By codifying DYP’s decision heuristics into a machine-readable prompt template, the repository lets users invoke institutional-grade value investing logic via natural language queries.

## Architectural Overview of the dyp-ask Skill

The implementation spans three core artifacts that separate the prompt definition from the execution runtime:

- **[`skills/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/dyp-ask.md)** – The authoritative source definition for the Claude-Code slash command. This file declares the persona prompt, required parameter schema, and the transformation logic that converts user queries into DYP-style responses.
- **[`codex-prompts/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-prompts/dyp-ask.md)** – An auto-generated, Codex-compatible mirror of the skill definition. This artifact ensures that environments without Claude-Code can access identical behavior through a standard OpenAI-style completion API.
- **[`scripts/sync-codex-skills.py`](https://github.com/xbtlin/ai-berkshire/blob/main/scripts/sync-codex-skills.py)** – The synchronization engine that regenerates the Codex prompt whenever the source definition in [`skills/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/dyp-ask.md) changes, guaranteeing a single source of truth across both runtimes.

## How the dyp-ask Skill Simulates Duan Yongping’s Thinking

The simulation relies on four deliberate design choices that bias the model toward DYP’s documented investment philosophy.

### Persona Injection

The prompt template in [`skills/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/dyp-ask.md) explicitly instructs the LLM to adopt the voice and perspective of Duan Yongping. By prefixing the system context with **“You are Duan Yongping, a disciplined value investor…”**, the skill anchors the model’s output to DYP’s characteristic vocabulary and conservative temperament, suppressing generic speculative advice.

### Focused Decision Framework

Embedded within the template is DYP’s classic investment checklist: **valuation**, **cash-flow sustainability**, and **competitive advantage (moats)**. When processing a query, the model evaluates the target company through these specific lenses rather than applying broad technical analysis or momentum-based metrics.

### Iterative Reasoning

The skill enforces a step-by-step analytical workflow by expanding the user’s question into a series of sub-queries. The prompt asks the model to sequentially determine intrinsic value, calculate margin-of-safety buffers, and stress-test competitive positioning—mirroring the methodical due diligence DYP applies to Berkshire Hathaway-style holdings.

### Structured Result Formatting

Final outputs are rendered in structured markdown tables that mimic the format of DYP’s published research notes. This normalization makes the generated analysis machine-readable for downstream automation, such as populating investment memos or risk dashboards.

## Implementation Details and Code Examples

Users can trigger the skill through either the Claude-Code CLI or a direct Codex API call. Both paths ultimately resolve to the same underlying template in [`skills/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/dyp-ask.md).

Invoke the skill inside a Claude-Code session:

```markdown
/ask dyp-ask "Evaluate the investment case for Kuaishou Technology (1024.HK)."

```

Example response structure:

```markdown
> **Response (as Duan Yongping)**  
- **Intrinsic Value:** ¥110 / share  
- **Margin of Safety:** 20 % (current price ¥88)  
- **Key Moats:** Network effects, strong cash-flow generation, expanding overseas user base.  
- **Recommendation:** BUY – aligns with DYP’s long-term growth thesis.

```

For programmatic access via the Codex runtime, send a POST request to the generated prompt:

```bash
curl -X POST https://api.codex.ai/v1/execute \
  -H "Authorization: Bearer <YOUR_TOKEN>" \
  -d '{
        "prompt_id": "dyp-ask",
        "variables": {"question":"Is Tesla a good long-term hold for a value investor?"}
      }'

```

After any edit to [`skills/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/dyp-ask.md), the maintainer runs `python3 scripts/sync-codex-skills.py` to regenerate [`codex-prompts/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-prompts/dyp-ask.md), ensuring that both invocation methods remain bitwise consistent.

## Summary

- The **dyp-ask skill** is defined in [`skills/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/dyp-ask.md) as a Claude-Code slash command that simulates Duan Yongping’s value-investing methodology.
- A synchronization script, [`scripts/sync-codex-skills.py`](https://github.com/xbtlin/ai-berkshire/blob/main/scripts/sync-codex-skills.py), keeps the Codex-compatible version in [`codex-prompts/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-prompts/dyp-ask.md) identical to the source.
- The skill uses **persona injection** and a **focused decision framework** to constrain the LLM to fundamental analysis, margin-of-safety calculations, and moat evaluation.
- Outputs are formatted as structured markdown tables suitable for automated investment research pipelines.

## Frequently Asked Questions

### What file contains the official definition of the dyp-ask skill?

The canonical definition lives in **[`skills/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/dyp-ask.md)** at the repository root. This markdown file contains the system prompt, parameter schema, and logic required by the Claude-Code runtime. A derivative copy is auto-generated at [`codex-prompts/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-prompts/dyp-ask.md) for API compatibility.

### How does the repository keep Claude-Code and Codex prompts synchronized?

The Python utility **[`scripts/sync-codex-skills.py`](https://github.com/xbtlin/ai-berkshire/blob/main/scripts/sync-codex-skills.py)** parses the source definitions under `skills/` and regenerates the Codex-compatible versions under `codex-prompts/`. Running this script after any edit ensures that both execution paths reference the same Duan Yongping persona and investment checklist.

### Can I use the dyp-ask skill outside of Claude-Code?

Yes. While the slash-command syntax (`/ask dyp-ask`) is specific to Claude-Code, the **[`codex-prompts/dyp-ask.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-prompts/dyp-ask.md)** file exposes the same functionality as a standard completion prompt. Any HTTP client can call the Codex endpoint using the prompt ID `dyp-ask` to receive DYP-style analysis without the CLI.

### What investment methodology does the dyp-ask skill follow?

The skill implements **Berkshire Hathaway-style value investing** as practiced by Duan Yongping. It emphasizes intrinsic value calculation, rigorous margin-of-safety requirements, and durable competitive advantages (moats), while explicitly excluding growth-at-any-price or technical trading heuristics.