惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
Docker
腾讯CDC
The GitHub Blog
The GitHub Blog
大猫的无限游戏
大猫的无限游戏
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
T
The Blog of Author Tim Ferriss
Vercel News
Vercel News
P
Proofpoint News Feed
雷峰网
雷峰网
博客园_首页
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
爱范儿
爱范儿
V
V2EX
F
Fortinet All Blogs
酷 壳 – CoolShell
酷 壳 – CoolShell
MyScale Blog
MyScale Blog
S
SegmentFault 最新的问题

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
AI Coding Tip 025 - Pair Every Skill With a Pitfalls File
Maxi Contieri · 2026-06-23 · via DEV Community

The happy path isn't enough.

TL;DR: Add a PITFALLS.md next to every SKILL.md so your AI never repeats the same mistake twice.

Common Mistake ❌

You write a great SKILL.md.

The AI follows it well most of the time.

Then it does something wrong.

You correct it in the conversation.

Next session, the AI does the same wrong thing again.

You never wrote it down.

Problems Addressed 😔

  • Hard-won corrections disappear when the session ends

  • Your SKILL.md grows noisy when you add every edge case to it

  • The AI repeats the same mistakes across sessions

  • Silent errors look correct until they cause real damage

  • You spend time re-teaching lessons you already taught

How to Do It 🛠️

  1. Create a PITFALLS.md file in the same folder as your SKILL.md.

  2. After each session, add one entry for each thing the AI got wrong.

  3. Write each entry with three parts: the trigger, the wrong behavior, and the correct behavior.

  4. Reference PITFALLS.md from your SKILL.md so the AI reads it at the start of every session.

  5. Treat it as append-only: never delete entries, only add new ones.

  6. Keep the happy path and the pitfalls apart.

Benefits 🎯

  1. Clean separation: Your SKILL.md stays focused on the happy path while PITFALLS.md handles the exceptions.

  2. Accumulated memory: The AI starts every session knowing what failed before, without you repeating it.

  3. Faster iteration: You stop re-explaining corrections you've already made.

  4. Explicit dark knowledge: You write down lessons that lived only in your head.

  5. Compounding improvement: Your skills get better with every mistake the AI makes, not worse.

  6. Skill brevity: You keep the skill short and focused, with progressive disclosure loading pitfalls only as a final checklist.

Context 🧠

SKILL.md tells the AI what to do.

PITFALLS.md tells the AI what not to do.

They're complementary, not competing.

Anthropic's own skill authors describe the pitfalls section as "the highest-signal content in any skill."

When that section grows too large to stay inside SKILL.md, it earns its own file.

Think of PITFALLS.md as the scar tissue that lives next to the blueprint.

The same way you initialize an AGENTS.md for a project, you pair every skill with its failure log.

When you use modular skills, each skill gets its own folder.

That folder is the right place for PITFALLS.md.

Remember a Skill is a folder with documentation and scripts, not a single file.

The same instinct drives feeding pull request lessons back into the AI brain: you capture what went wrong so the AI doesn't repeat it.

PITFALLS.md applies that exact pattern to individual skills.

Each skill builds its own second brain of failure memory.

This principle has a long history in good programming practices.

The same separation principle applies to code: keep your normal flow in one place and your exceptional cases in another.

Mixing them creates noise, hides intent, and makes maintenance harder.

SKILL.md and PITFALLS.md apply that discipline to AI instructions.

Many AI Coding Tips find their roots in established programming principles.

When you separate concerns in your code, you separate them in your prompts too.

Prompt Reference 📝

Bad Prompt 🚫

Write a SKILL.md for validating markdown articles.
Check for required sections and formatting rules.
If something's wrong, we'll fix it in the chat.

Good Prompt 👉

Write a SKILL.md for validating markdown articles.
Check for required sections and formatting rules.

Also create a PITFALLS.md in the same folder.
Add this first entry:

## Don't use regex to count H2 sections
Trigger: counting sections by heading level
Wrong: regex-based heading detection (/^##/m)
Correct: match section names explicitly by string
Reason: code blocks with # fool regex heading counters

Reference PITFALLS.md at the top of your SKILL.md.
The AI loads it at the start of every session.

Considerations ⚠️

Keep each entry short: trigger, wrong behavior, correct behavior.

Don't delete entries.

Even solved pitfalls can come back after a skill update.

Review PITFALLS.md when you update SKILL.md to check if any entries became obsolete.

Type 📝

[X] Semi-Automatic

Limitations ⚠️

PITFALLS.md only helps if the AI reads it.

Always reference it explicitly inside your SKILL.md so the AI loads it automatically.

Level 🔋

[X] Intermediate

Tags 🏷️

  • Knowledge Management

Related Tips 🔗


Conclusion 🏁

Your SKILL.md is the blueprint.

Your PITFALLS.md is the scar tissue.

You need both.

More Information ℹ️

Lessons from building Claude Code: How we use skills

Designing, Refining, and Maintaining Agent Skills at Perplexity

Code Smell 73 - Exceptions for Expected Cases

Also Known As 🎭

  • Negative-Knowledge-File
  • Skill-Shadow-File
  • Failure-Memory-Companion
  • Anti-Pattern-Log

Disclaimer 📢

The views expressed here are my own.

I am a human who writes as best as possible for other humans.

I use AI proofreading tools to improve some texts.

I welcome constructive criticism and dialogue.

I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.


This article is part of the AI Coding Tip series.