MCPInstall

skill-writing

Write and improve agent skills (SKILL.md files). Use when creating new skills, refactoring existing ones, debugging why an agent ignores instructions, or improving compliance. Covers prompt structure, TDD for skills, description optimization, and rationalization bulletproofing.

Installs
83
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/millionco/expect --skill skill-writing
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads skill-writing automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Skill Writing

Skills are bundled instruction modules that load into an agent's context when activated. They are the highest-leverage mechanism for controlling agent behavior because they deliver focused instructions at the moment of relevance.

The Iron Law

No skill without a failing test first. Before writing a skill, run a subagent on the target task WITHOUT the skill. Document what it gets wrong — the exact rationalizations, shortcuts, and skipped steps. Then write the skill addressing those specific failures. This is TDD applied to documentation.

TDD StepSkill Equivalent
REDRun scenario without skill. Document what the agent does wrong.
GREENWrite minimal skill addressing those specific failures. Verify agent now complies.
REFACTORFind new rationalizations the agent invents. Close loopholes. Re-test.

When to Create a Skill

Create when: the technique wasn't obvious, you'd reference it across projects, others would benefit, or the agent repeatedly fails without it.

Don't create for: one-off solutions, standard practices documented elsewhere, project-specific conventions (use CLAUDE.md), or mechanical constraints (enforce with linters/hooks instead).

Core Principles

Instructions are a finite budget. Models reliably follow ~150 instructions. The system prompt burns ~50. Every instruction you add degrades compliance across ALL instructions. Be ruthless about what earns a slot.

Peripheral positions get more attention. First and last sections receive disproportionate attention. Bury a critical rule in the middle and it gets skipped.

Specificity drives compliance. "Consider running audits" gets ignored. "Call accessibility_audit before emitting RUN_COMPLETED" gets followed.

Unconditional beats conditional. "You MUST call X" works. "When appropriate, consider X" does not.

Description Optimization

The description field controls when the skill activates. The agent reads it to decide: "Should I load this right now?" Describe triggering conditions, not workflow.

Bad: description: A skill for TDD - write test first, watch it fail, write code Good: description: Use when tests have race conditions, timing dependencies, or pass/fail inconsistently. Covers flaky tests, hanging tests, zombie processes.

Checklist for descriptions:

  • Start with "Use when..." focusing on triggering conditions
  • Include specific symptoms and error messages the user would mention
  • Include synonyms (timeout/hang/freeze, cleanup/teardown/afterEach)
  • Name tools, commands, file types that signal relevance
  • Max 500 characters. Under 200 for frequently-loaded skills
  • Never summarize the skill's process — this causes agents to follow the description instead of loading the full skill

Skill Structure

.agents/skills/<skill-name>/
  SKILL.md          # Required. Under 200 lines.
  references/       # Optional. Heavy reference docs (100+ lines).

Frontmatter

---
name: kebab-case-name
description: Use when [triggering conditions]. Covers [symptoms, tools, keywords].
---

Use verb-first active naming: creating-skills not skill-creation, condition-based-waiting not async-helpers.

Writing Instructions That Get Followed

Lead with identity, then constraints

One-line role statement, then hard constraints immediately. Do not build up to them.

# Browser Test Executor

You are executing adversarial browser tests against code changes.

REQUIRED for every test run:
1. Call accessibility_audit before completing
2. Call performance_metrics before completing
3. Call close to flush the session

Use numbered checklists gated on completion

Numbered lists signal sequence and completeness. Tie them to whatever marks the task "done."

Before marking the task complete, you MUST:
1. Run the linter
2. Run the type checker
3. Run the test suite
Do not skip any step. A skipped step is a failed task.

The trailing "do not skip" is not redundant — it closes the escape hatch.

Name tools and commands exactly

Never "run the appropriate checks." Always call accessibility_audit or run pnpm typecheck.

Put mandatory behaviors at the end

The last section is the last thing read before acting. Put the non-negotiable checklist there.

One good example, one bad example

Examples are worth more than explanations.

**Bad:** `test the login page`
**Good:** `Submit login with empty fields, invalid email, wrong password, valid credentials. Verify errors and redirect.`

Bulletproofing Against Rationalization

Agents invent reasons to skip rules. Anticipate and close every loophole explicitly.

Close escape hatches: After every mandatory rule, add: "No exceptions for 'just this once', 'it's simple enough', or 'I'll do it next time'."

Build a rationalization table from your RED phase testing. Every excuse the agent made becomes an explicit counter in the skill:

Agent SaysSkill Responds
"This change is too small to test"Every change gets tested. Size is not an exemption.
"I already verified manually"Manual verification is not a substitute. Run the tool.
"The user didn't ask for this"The skill requires it. User silence is not opt-out.

Create a red flags list: "If you catch yourself thinking any of these, stop and follow the checklist."

Anti-Patterns

PatternWhy It Fails
"Consider running X when appropriate"Conditional + vague = ignored
Giant skill files (>200 lines)Exceeds instruction budget, compliance drops
Duplicating CLAUDE.md rulesBurns budget twice for the same instruction
Listing every edge caseShow one example, not twenty — the agent infers the rest
"Be thorough" / "Be careful"Vibes, not instructions. Say what "thorough" means concretely
Multi-paragraph justificationsThe agent needs the rule, not the backstory. One sentence of "why" max
Critical rules in the middleMiddle-of-prompt blindspot. Move to top or bottom
Writing a skill without testing firstYou don't know what failures to address. Delete it, start with RED.
Workflow-summarizing descriptionsAgent follows the summary instead of loading the full skill

Checklist: Before Shipping

  • Tested without the skill first (RED phase) and documented failures
  • Skill addresses those specific failures, not hypothetical ones
  • Description starts with "Use when..." and lists triggering conditions, not workflow
  • Under 200 lines total
  • Mandatory behaviors in a numbered checklist at top or bottom
  • Every tool/command named exactly — no "appropriate" or "relevant"
  • No hedging ("consider", "when appropriate", "if needed")
  • At least one good/bad example pair
  • No duplication with CLAUDE.md or other skills
  • Escape hatches closed with explicit "no exceptions" language
  • Re-tested with the skill (GREEN phase) and agent now complies

FAQ

What does the skill-writing skill do?

Write and improve agent skills (SKILL.md files). Use when creating new skills, refactoring existing ones, debugging why an agent ignores instructions, or improving compliance. Covers prompt structure, TDD for skills, description optimization, and rationalization bulletproofing.

How do I install skill-writing?

Run npx skills add https://github.com/millionco/expect --skill skill-writing in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/skill-writing/ (personal) or .claude/skills/skill-writing/ (project).

Which AI agents can use skill-writing?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is skill-writing safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains skill-writing?

It is published by millionco in millionco/expect. It has 83 recorded installs.

More from millionco/expect

View all →

expect

millionco/expect

Use when editing .tsx/.jsx/.css/.html, React components, pages, routes, forms, styles, or layouts. Also when asked to test, verify, validate, QA, find bugs, check for issues, or fix expect-cli failures.

Frontend & Design1.9K installs

deslop

millionco/expect

Simplify and refine recently modified code while preserving functionality. Use when asked to "deslop", "clean up code", "simplify code", or after making changes that could benefit from refinement.

181 installs

code-review

millionco/expect

Perform code reviews. Use when reviewing pull requests, examining code changes, or providing feedback on code quality. Covers security, performance, testing, and design review.

debug-agent

millionco/expect

Systematic evidence-based debugging using runtime logs. Generates hypotheses, instruments code with NDJSON logs, guides reproduction, analyzes log evidence, and iterates until root cause is proven with cited log lines. Use when the user reports a bug, unexpected behavior, or asks to debug an issue.

effect-portable-patterns

millionco/expect

Portable Effect patterns for robust promise execution. Use when wrapping async operations with timeouts, retries, tagged errors, caching, concurrency, pattern matching, or tracing - all designed to resolve to a plain Promise via Effect.runPromise.

64 installs

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

Popular docs & writing skills

View category →

grill-with-docs

mattpocock/skills

A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.

Docs & Writing1.2M installs

lark-markdown

open.feishu.cn

飞书 Markdown:查看、创建、上传、编辑和比较飞书中的原生 Markdown 文件。当用户要操作飞书 Markdown 文件,或比较其远端版本及本地草稿时使用。纯本地 Markdown 文件操作不触发本 skill。不负责将 Markdown 导入为飞书在线文档,也不负责文件搜索、权限、评论、移动、删除等云空间管理操作。

Docs & Writing778.7K installs

writing-beats

mattpocock/skills

Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.

Docs & Writing490.7K installs

writing-shape

mattpocock/skills

Writing, exploit: shape raw material into an article, paragraph by paragraph.

Docs & Writing490.2K installs

writing-fragments

mattpocock/skills

Writing, explore: mine raw fragments, no structure yet.

Docs & Writing489.6K installs

writing-for-agents

mattpocock/skills

Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.

Docs & Writing479.3K installs