skills

命令行工具

mattpocock/skills

面向真实软件工程的AI代理技能集。

项目简介

一套针对Claude Code等编程代理的小型可组合技能。解决对齐、冗长和代码质量等常见问题。包含烧烤式需求澄清、测试驱动开发、诊断和架构改进等技能。

README 预览

\n  \n    \n      \n      \n      \n    \n  \n\n\n# Skills For Real Engineers\n\n[](https://skills.sh/mattpocock/skills)\n\nMy agent skills that I use every day to do real engineering - not vibe coding.\n\nDeveloping real applications is hard. Approaches like GSD, BMAD, and Spec-Kit try to help by owning the process. But while doing so, they take away your control and make bugs in the process hard to resolve.\n\nThese skills are designed to be small, easy to adapt, and composable. They work with any model. They're based on decades of engineering experience. Hack around with them. Make them your own. Enjoy.\n\nIf you want to keep up with changes to these skills, and any new ones I create, you can join ~60,000 other devs on my newsletter:\n\n[Sign Up To The Newsletter](https://www.aihero.dev/s/skills-newsletter)\n\n## Quickstart (30-second setup)\n\n1. Run the skills.sh installer:\n\n```bash\nnpx skills@latest add mattpocock/skills\n```\n\n2. Pick the skills you want, and which coding agents you want to install them on. **Make sure you select `/setup-matt-pocock-skills`**.\n\n3. Run `/setup-matt-pocock-skills` in your agent. It will:\n   - Ask you which issue tracker you want to use (GitHub, Linear, or local files)\n   - Ask you what labels you apply to ticks when you triage them (`/triage` uses labels)\n   - Ask you where you want to save any docs we create\n\n4. Bam - you're ready to go.\n\n## Why These Skills Exist\n\nI built these skills as a way to fix common failure modes I see with Claude Code, Codex, and other coding agents.\n\n### #1: The Agent Didn't Do What I Want\n\n> "No-one knows exactly what they want"\n>\n> David Thomas & Andrew Hunt, [The Pragmatic Programmer](https://www.amazon.co.uk/Pragmatic-Programmer-Anniversary-Journey-Mastery/dp/B0833F1T3V)\n\n**The Problem**. The most common failure mode in software development is misalignment. You think the dev knows what you want. Then you see what they've built - and you realize it didn't understand you at 

常见问题 (5)

故障排除
如何修复 Bash 向导在 TERM=dumb 或 CI pty 环境下,因 tput clear 在 set -e 模式下失败而立即退出的问题?

不要仅仅因为 tput 二进制文件存在就选择 tput clear。应在 if 条件中运行它,并在失败时回退到 ANSI 转义序列:

_clear() {
  if command -v tput >/dev/null 2>&1 && tput clear 2>/dev/null; then
    return 0
  fi
  printf '\033[2J\033[3J\033[H'
}

if 条件中失败的命令不会触发 errexit,因此在 set -euo pipefail 下这是安全的,包括 Bash 3.2。重定向 stderr 可抑制 terminfo 错误。请在 PTY 上重现原始故障(例如 TERM=dumb),而不是通过管道;非 TTY 的 stdout 可能导致 _clear 提前返回。

来源 Issue #1081
故障排除
为什么在 `write_env KEY VALUE` 将值写入 env 文件后,`${KEY:-default}` 仍然使用默认值?

在 mattpocock-skills 1.2.3 中,write_env 只会将 KEY=VALUE 更新插入(upsert)到 $ENV_FILE;它并不会在运行中的 shell 里设置 KEY。因此,后续使用 ${KEY:-default} 的阶段会遇到未设置的变量,从而使用默认值。修复 skills/engineering/wizard/template.sh 的方法是使用 printf -v 给变量赋值,与 ask 和 ask_secret 的做法保持一致:

write_env() {
  local key="$1" value="$2" tmp
  touch "$ENV_FILE"
  tmp=$(mktemp)
  grep -vE "^${key}=" "$ENV_FILE" > "$tmp" || true
  printf '%s=%s\n' "$key" "$value" >> "$tmp"
  mv "$tmp" "$ENV_FILE"

  printf -v "$key" '%s' "$value"

  WRITTEN_ENV+=("$key")
  printf '  %s✓ wrote%s %s → %s\n' "$GREEN" "$RESET" "$key" "$ENV_FILE"
}

对于已经生成的 wizard,一个即时可用的变通方法是:在写入之后显式地为变量赋值,例如 WRITE_KEY_NAME="dealsplash-import-write",或者在后续阶段读取之前 source/重新加载 env 文件。

来源 Issue #1041
故障排除
如何修复由 wizard skill 生成的脚本中未使用的 RED 变量导致的 ShellCheck SC2034 问题?

从 skills/engineering/wizard/template.sh 的彩色和无彩色两个分支中删除未使用的 RED 赋值,例如 RED=$(tput setaf 1) 以及对应的无彩色赋值 RED=''。重新生成 wizard 脚本。使用 grep -n RED skills/engineering/wizard/ 进行验证(应不返回任何内容),并对生成的脚本运行 shellcheck,确认 SC2034 已消失。如果无法立即更新模板,作为临时解决方案,请从生成的脚本中删除未使用的 RED 声明。

来源 Issue #1003
故障排除
为什么在 Bash 脚本等待 read 提示符时编辑该脚本,会导致出现 "syntax error near unexpected token" 错误?

Bash 按字节偏移量增量读取脚本文件,而不是先加载整个文件。如果脚本在提示符处暂停时文件发生变化,Bash 会在新内容中从已过期的偏移量处继续读取,这可能会产生虚假的语法错误,例如 syntax error near unexpected token '('。

修复方法是将向导的可执行阶段代码包装在单个函数中,并仅在最后一行调用该函数,后跟 exit。Bash 会在运行函数之前解析完整的函数,因此在提示期间它不再读取正在变化的脚本文件:

run_wizard() {
  TOTAL_STAGES=1

  banner "Setup"
  # stage prompts and logic here
  finish
}

run_wizard "$@"; exit

保持阶段标记上方的共享库代码不变,将所有阶段逻辑保留在 run_wizard 内部,并且不要改动最后的调用行。使用以下命令验证:

bash -n template.sh

该修复已在 Bash 3.2 和 Bash 5.3 上验证通过。作为临时解决方法,在向导脚本运行期间,不要保存、重新生成、执行 git pull 或以其他方式修改该脚本;请改为运行一个不可变的副本。

来源 Issue #1142
故障排除
如何让AI助手在对话中使用我的项目的通用语言?

通用语言技能现已集成到 /grill-me-docs 命令中。运行该命令可使AI与您的术语保持一致。要使用项目术语构建 CONTEXT.md 文件,请迭代使用 /grill-with-docs。

来源 Issue #29