<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Prompt on 老张开工了</title>
    <link>/prompt/</link>
    <description>Recent content in Prompt on 老张开工了</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Mon, 13 Jul 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="/prompt/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>编写你的第一个 Skill</title>
      <link>/posts/2026/07/first-skill/</link>
      <pubDate>Mon, 13 Jul 2026 00:00:00 +0000</pubDate>
      <guid>/posts/2026/07/first-skill/</guid>
      <description>理论 21 篇讲完了，本章从零写一个真实 Skill，让你看一遍从想法 → 写 SKILL.md → references 拆解 → 测试 → 装入 OpenCode → 上调用的全过程。我们要写的 Skill 叫 tdd-reminder：让主 Agent 在写新代码前先提示用户走 TDD。&#xA;22.1 Skill 想法从哪里来 三步法挖掘想法：&#xA;找你过去 7 天的 OpenCode session log&#xA;grep 模式 &amp;ldquo;你忘了 / 你没做 / 应该先&amp;rdquo;&#xA;rg &amp;#34;忘了\|应该\|未做\|先\|要是之前&amp;#34; .opencode/log/ | head -20 凡是出现 3 次以上的模式，就是候选 Skill&#xA;我自己日志里有一条：&amp;ldquo;每次写完 Python 函数才发现没写测试，又往回加 test_test_xxx，凑合跑&amp;rdquo;——这就是 tdd-reminder 要解决的：让 Agent 在写实现代码前主动说一句&amp;quot;咱们先写 test 行吗&amp;quot;。&#xA;22.2 拆解 Skill 行为需求 维度 spec Trigger 主 Agent 即将写 Python / TS / Go / Rust 代码,且函数 / class 存在 不要触发 1）用户问解释性问题 2）改一行小 bug 3）已有现成测试 行为 提醒想先写 unit test；提供一次 brainstorm 机会,而非强制 DONE 用户明确说 &amp;ldquo;不用 test&amp;rdquo; 或 用户已提供 test 或 单元 test 跑通 失败模式 1）用户说&amp;quot;快点别叨叨&amp;quot; → 跳过加 [tdd-reminder skipped] 自报\n2）该语言无 pytest 等价物 → 改用最简化 shell test 22.</description>
    </item>
    <item>
      <title>Prompt 工程入门：与 LLM 有效沟通</title>
      <link>/posts/2026/06/prompt-engineering/</link>
      <pubDate>Fri, 05 Jun 2026 00:00:00 +0000</pubDate>
      <guid>/posts/2026/06/prompt-engineering/</guid>
      <description>Prompt 工程不是&amp;quot;魔法咒语学&amp;quot;。它是一种把任务讲清楚的能力——本质和你跟同事讲需求时讲得清楚不清楚没差别，只不过对面这个&amp;quot;同事&amp;quot;在某些维度更敏感（对结构、对示例、对上下文），在另一些维度更迟钝（不会自己反问、对领域黑话毫无知觉）。本章让你不是去背 100 句&amp;quot;完美 prompt 模板&amp;quot;，而是建立一套底层心法。&#xA;3.1 一个反直觉：把模型当实习生，而不是当神 坏 prompt：写一个爬虫 好 prompt： 目标：爬取 https://example.com 上分页列表的标题。 输入：起始 URL（list 页第 1 页）。 输出：写入 items.jsonl，每行一个 {url, title}。 约束：使用 httpx + selectolax，遵守 robots.txt，限速 1 req/s。 错误处理：403 跳过该页，其他状态码重试 3 次。 差别不在字数，而在让模型知道边界。模型是个&amp;quot;特别想被使用的实习生&amp;quot;——你给的信息越具体，它越不会瞎发挥。&#xA;3.2 五元素清单 每次写 prompt 默念一遍：&#xA;元素 作用 常被漏掉导致 目标（Goal） 一句话说清产出是什么 跑题、答非所问 输入（Input） 模型能拿到什么数据 自己编数据幻觉 输出（Output） 形式、格式、字段名 你要 csv 它给你 md 约束（Constraints） 不能做什么、用什么库 库不一致、风格漂移 示例（Examples） 1-2 条&amp;quot;输入→输出&amp;quot;样板 边界情况误判 后两个最容易被偷懒省掉，也是新手与熟手 prompt 之间最大的差距来源。&#xA;3.3 三种情境，三种写法 3.3.1 一次性任务（最常见） 任务：把下面 SQL 解释给非技术同事听。 SQL: EXPLAIN ANALYZE SELECT region, sum(revenue) FROM orders WHERE created_at &amp;gt; &amp;#39;2026-01-01&amp;#39; GROUP BY region; 输出要求： - 一句话主旨 - 三到五条要点 - 最后一句给一个最关键的&amp;#34;为什么慢&amp;#34;的提醒 - 不超过 150 字 要点：明确形式 + 字数上限 + 受众。能压字数比讲道理有用。</description>
    </item>
  </channel>
</rss>
