daBongo LMS AI Training Courses

Building Reusable Claude Code Skills

Lesson 2: Writing Effective Skills

Lesson Objectives

By the end of this lesson, students should be able to:

  • Write trigger conditions that activate reliably and specifically
  • Structure Skill instructions for Claude's effective use
  • Apply the Skill writing patterns that produce consistent behavior
  • Avoid the common Skill writing mistakes that produce unreliable activation

Lesson Content

Skill file structure.

A Skill is a markdown file with a frontmatter header and instruction content (verify current format at docs.anthropic.com/en/docs/claude-code):

“`markdown

name: pr-code-review description: Step-by-step code review checklist for pull requests triggers:

  • "review this PR"
  • "review this code"
  • "code review"
  • "check this diff"

PR Code Review Checklist

When reviewing a PR, check in this order:

  1. Security: Input validation on user-supplied data, authentication/authorization checks, no hardcoded credentials
  2. Test coverage: Are the happy path and error cases covered? Do tests test behavior or implementation?
  3. Error handling: Are errors caught and handled or propagated appropriately?
  4. Readability: Variable names, function names, and logic are clear without comments
  5. Performance: Are there obvious N+1 queries, unnecessary re-computation, or missing indexes?

For each item: pass, flag for discussion, or request change. “`

Writing effective triggers.

Triggers are the phrases or conditions that activate the Skill. Effective triggers:

  • Match the natural language a user would use when requesting the task
  • Include variations (formal and informal phrasings)
  • Are specific enough to avoid false activation
  • Are not so narrow that they miss legitimate requests

For a code review Skill: ["review this PR", "code review", "review this code", "check this diff", "review my changes"] – multiple phrasings of the same intent.

Instruction structure for Skills.

Structure Skill instructions as procedural guidance Claude follows:

  • Use numbered steps for ordered workflows
  • Use checklists for evaluation tasks
  • Use clear headers to organize multi-part instructions
  • Keep instructions actionable ("check for X", "verify that Y") not descriptive ("X is important")

Common Skill writing mistakes.

  • Triggers too broad: A trigger of "code" activates for any code-related task – not just review
  • Triggers too narrow: A trigger of "review PR #123" activates for nothing useful
  • Instructions too vague: "Review for quality" is not actionable; "Check for unhandled null returns" is
  • Instructions too long: A 500-word Skill dilutes the key points; keep Skills focused on the most important checks for the specific task

Practical Example

A developer writes a documentation generation Skill for his team.

First draft triggers: ["write docs", "document this", "add documentation"].

He tests it: it activates when he asks Claude to "document why we chose this architecture" – not a documentation generation task, more of an inline comment.

He refines: ["generate API docs", "write JSDoc", "document this function", "add docstring"].

Much more specific.

The refined triggers activate for documentation generation tasks and not for incidental documentation discussions.

Safety Notes

Skills containing security-sensitive instructions (credential handling, authentication workflows, data access patterns) should be reviewed by a security-aware team member before distribution. A poorly-written security Skill that Claude follows incorrectly can introduce consistent security issues across a team's code – the opposite of its intended effect.

Log in and enroll to access lesson quizzes.

Scroll to Top