skills/nlpm/writing-skills/SKILL.md
How to write SKILL.md files that trigger reliably and teach effectively. Use when creating, improving, or reviewing Claude Code skills.
npx skillsauth add xiaolai/nlpm-for-claude writing-skillsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Scope: covers SKILL.md authoring. For agent writing, see [[writing-agents]]. For plugin architecture, see [[writing-plugins]].
The description field determines when Claude loads this skill. It is not a summary -- it is a trigger mechanism.
Bad (score 55):
description: "Helpful skill for React development"
Good (score 95):
description: "Use when building React components, debugging re-renders, optimizing performance with useMemo/useCallback, or fixing hook dependency arrays"
| Criterion | Test | |-----------|------| | 3+ trigger phrases | Count distinct action phrases separated by commas | | Action-oriented | Starts with "Use when..." or "How to..." | | Includes tool/framework name | The technology name appears explicitly | | Matches real queries | Would a user's actual question contain any of your trigger words? |
Map real user queries to trigger phrases:
| User says | Trigger phrase to include | |-----------|--------------------------| | "My component re-renders too much" | "debugging re-renders" | | "How do I memoize this?" | "optimizing performance with useMemo/useCallback" | | "My useEffect runs in a loop" | "fixing hook dependency arrays" | | "I need a new component for..." | "building React components" |
Rule: if you can't list 3 real user queries that match your description, rewrite it.
#): skill title only (one per file)##): major sections (numbered: ## 1. Section Name)###): subsections within a major sectionEvery code example must show the problem, then the solution:
### Bad (breaks on concurrent requests)
` ` `python
global_state = {} # shared mutable state
` ` `
### Good (request-scoped)
` ` `python
def handler(request):
state = {} # local to this request
` ` `
Rules for code examples:
Keep SKILL.md under 500 lines. Use the file system for depth:
skills/my-domain/my-skill/
SKILL.md # core patterns (< 500 lines)
references/ # deep dives, edge cases, full API docs
advanced.md
api-reference.md
examples/ # working code samples
basic-setup.ts
advanced-config.ts
scripts/ # utility scripts
validate.sh
| Content type | Keep in SKILL.md? | Extract to references/? | |-------------|-------------------|------------------------| | Top 5 patterns everyone needs | Yes | No | | Full API reference (50+ entries) | No | Yes | | Edge cases (< 5% of users) | No | Yes | | Configuration matrix (20+ options) | No | Yes | | Quick decision table (< 10 rows) | Yes | No |
---
name: docker-helper
description: "Information about Docker"
version: 0.1.0
---
# Docker Helper
Docker is a containerization platform. Here are some useful commands.
## Commands
- `docker build` - builds an image
- `docker run` - runs a container
- `docker ps` - lists containers
## Dockerfile
A Dockerfile contains instructions for building an image.
## Docker Compose
Docker Compose is for multi-container applications.
Problems:
---
name: docker-helper
description: "Use when writing Dockerfiles, debugging container networking, optimizing image size with multi-stage builds, or configuring Docker Compose services. Covers build cache, volume mounts, health checks, and compose profiles."
version: 0.1.0
---
# Docker Helper
> Scope: covers Docker CLI, Dockerfiles, and Compose. For Kubernetes deployment, see [[k8s-deploy]].
## 1. Image Size Optimization
### Before (1.2 GB)
` ` `dockerfile
FROM node:20
COPY . .
RUN npm install
RUN npm run build
CMD ["node", "dist/index.js"]
` ` `
### After (148 MB -- 88% smaller)
` ` `dockerfile
FROM node:20-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
FROM node:20-slim
WORKDIR /app
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
CMD ["node", "dist/index.js"]
` ` `
Key changes: multi-stage build, slim base, copy only production artifacts.
## 2. Base Image Selection
| Use case | Base image | Size |
|----------|-----------|------|
| Node.js production | node:20-slim | 180 MB |
| Node.js minimal | node:20-alpine | 130 MB |
| Python production | python:3.12-slim | 150 MB |
| Static files only | nginx:alpine | 40 MB |
| From scratch (Go/Rust) | scratch | < 20 MB |
Changes made:
| Mistake | Why it hurts | Fix | |---------|-------------|-----| | Description is a feature list | Claude can't match user queries to the skill | Rewrite as trigger phrases starting with "Use when..." | | Body teaches theory | Wastes tokens on content Claude already knows | Show patterns and decisions, not definitions | | Over 500 lines | Bloats context window, penalized by linters | Extract to references/, keep core patterns only | | No scope note | Claude doesn't know when to use THIS skill vs a related one | Add scope note referencing related skills | | Pseudocode examples | Not actionable, can't be copy-pasted | Use runnable code with enough context | | Every section has equal weight | Buries the most useful content | Lead with the 80% patterns, push edge cases to references/ |
Before shipping a skill, verify:
development
Use when scoring NL artifact quality, applying penalties, or calibrating lint judgment — contains the 100-point rubric with penalty tables per artifact type and 4 worked calibration examples.
tools
Use when writing, reviewing, or validating Claude Code plugin artifacts — check frontmatter schemas, hook event names, naming conventions, prompt structure, or reference syntax. Loaded by the NLPM scorer and checker agents for schema validation.
documentation
How to write .claude/rules/ files that Claude actually follows. Use when creating, improving, or reviewing project rules.
documentation
How to write effective system prompts for any LLM. Universal prompt engineering -- role clarity, structured output, injection resistance, few-shot examples. Use when writing prompts, system instructions, or AI configuration.