.github/skills/agent-skills-writing/SKILL.md
Guidelines for writing new agent skills in skills/ (user-facing) and .github/skills/ (internal). Use when creating a new skill, adding a reference file, or refactoring an existing skill that has grown too large.
npx skillsauth add govtechsg/sgds-web-component agent-skills-writingInstall 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.
Standards and patterns for authoring AI agent skills in this repository.
| Location | Purpose | Audience |
|----------|---------|---------|
| skills/sgds-utilities/ | All SGDS utility classes in one consolidated skill with a reference file per utility category | external |
| skills/sgds-components/ | All 46 SGDS web components in one consolidated skill with a reference file per component | external |
| .github/skills/ | Internal tools for SGDS maintainers | internal (no audience field) |
Folder naming convention: All skills/ folders use a domain prefix so agents and users can discover them by category:
sgds-utilities — consolidated skill for all SGDS utility classes (sgds: Tailwind prefix); reference files in sgds-utilities/reference/sgds-components — consolidated skill for all SGDS web components (<sgds-*>); reference files in sgds-components/reference/---
name: sgds-utilities-{skill-name} # or sgds-components-{skill-name}
description: "One sentence. What the skill teaches. Include trigger keywords (Use when users ask about...)."
metadata:
author: singapore-design-system
version: "0.0.0"
audience: external # external skills only; omit for internal skills
category: {category} # e.g. color, border, spacing, typography, component
---
Important: Always quote the
descriptionvalue. YAML will error if the value contains a colon (e.g.,sgds: prefix).
--- — no wrapping code fences"0.0.0" until officially released; bump major version on breaking changesSimple skill (no reference files needed, under ~500 lines):
skills/utilities-{name}/
└── SKILL.md
skills/components-{name}/
└── SKILL.md
Complex skill (semantic categories, would exceed ~500 lines):
skills/utilities-{name}/
├── SKILL.md ← navigation hub + Quick Decision Guide only
└── reference/
├── base.md
├── primary.md
├── danger.md
└── ...
Consolidated skill (many related items grouped into one skill with a reference file per item):
skills/sgds-components/
├── SKILL.md ← setup content + component index table with links to reference/
└── reference/
├── accordion.md
├── alert.md
├── button.md
└── ... ← one file per component, no frontmatter, no Prerequisites section
Use the consolidated pattern when a domain has many parallel items (e.g., all SGDS web components) that would otherwise create dozens of top-level skill folders. The consolidated SKILL.md acts as both the setup guide and the navigation index.
Split into reference/ when any of these are true:
Do not extract if the skill is a single focused topic (e.g., spacing utilities, opacity).
Reference files in a consolidated skill differ from standalone SKILL.md files:
# heading../SKILL.md; links to sibling reference files use ./other.md or just other.mdModel: see skills/utilities-background-color/SKILL.md and skills/utilities-border-color/SKILL.md.
The SKILL.md is a navigation hub and decision guide — not an example gallery.
# {Name} Utilities Skill
One-line description of what it helps with.
## Prerequisites
## Core Concept
## Token Categories Overview ← conceptual bullets + links to reference files; NO long code examples
## Quick Decision Guide ← decision tree (Step 1 / Step 2 / Step 3)
## Reference Documentation ← one entry per reference file (name, covers, use for)
---
**For AI Agents**: Key principles summary (numbered list, ~8–10 items)
→ token format, not code blocksCovers: and Use for: lineModel: see skills/sgds-components/reference/button.md.
Component skills document an <sgds-*> element's usage. Their SKILL.md structure differs from utility skills:
# SGDS {Name} Component Skill
One-line role of the component and when to prefer it over a native element.
## Prerequisites
## Quick Decision Guide ← variant/tone/size/mode decision tree
## API Summary ← all attributes as a compact table (name | type | default | purpose)
## Slots ← slot name + purpose table
## Events ← event name | when fired | React prop
## Reference Documentation
---
**For AI agents**: Key rules — default element to reach for, dangerous combinations to avoid,
related components to mention.
<sgds-{name}> HTML@event, Angular (event)) belongs in sgds-components-setup, not the individual component skillcomponents-setup in Prerequisites — every component skill's Prerequisites section links to sgds-components-setup<sgds-icon-button> from a <sgds-button> skill)reference/ may combine the component's own attributes freely — the single-token isolation rule applies to utility skills onlyModel: see any file in skills/utilities-background-color/reference/.
# {Category} {Skill Name} Reference
**Meaning**: One phrase
**Usage**: One phrase
## Design Semantics
- Bullet list explaining the intent and when to use this category
- Applied at which level (component only / page only / both)
- Contrast with adjacent categories if helpful (e.g., neutral vs purple/cyan)
## Available Tokens
### `sgds:{prefix}-{category}-{modifier}`
**One-line description.**
**When to use:**
- Bullet list of specific use cases
```html
<div class="sgds:{THIS-TOKEN-ONLY}">
label
</div>
(Repeat for each token in the category)
Note: Use library components like
<sgds-alert>,<sgds-badge>when available. {Category} tokens are for creating custom components when library components don't meet your needs.
(pattern example)
## HTML Example Hygiene
**The single most important rule for reference files:**
HTML examples must contain **only the token(s) being documented in that file** — no unrelated utilities.
```html
<!-- ✅ Correct — only the token under documentation -->
<div class="sgds:bg-danger-surface-default">
Error message
</div>
<!-- ❌ Wrong — noise from other utility categories -->
<div class="sgds:bg-danger-surface-default sgds:p-4 sgds:rounded-lg sgds:text-sm">
Error message
</div>
Rationale: examples teach the token, not a complete component. Surrounding utilities distract from what is being demonstrated and create false impressions about required pairings.
Exception: Common Patterns section may combine tokens from the same category (e.g., showing border-l-4 alongside border-danger-default in a border-color reference).
When two or more skills share the same suffix modifier vocabulary (e.g., default, emphasis, muted, fixed-light, fixed-dark, inverse), extract the definitions into a dedicated shared skill rather than duplicating them.
Pattern used: skills/utilities-color-semantics/SKILL.md is the shared reference for all suffix modifiers used by utilities-background-color, utilities-border-color, and utilities-text-color.
Each consumer skill replaces its duplicated prose with:
For full definitions of suffix modifiers, see **[`utilities-color-semantics`](../utilities-color-semantics/SKILL.md)**.
Apply this pattern whenever you notice the same conceptual definitions appearing verbatim across multiple SKILL.md files.
Every reference/ file must include a library-first note at the top of the Common Patterns section:
> **Note**: Use library components like `<sgds-{component}>` when available.
> {Category} tokens are for creating custom components when library components don't meet your needs.
Name specific relevant library components (e.g., <sgds-alert> in danger/warning files, <sgds-badge> in neutral/purple/cyan files). This reminds developers to check the component library before reaching for raw utility tokens.
When running the skill-creator eval loop for any skill in skills/, always place the workspace directory under:
test/skills/{skill-folder-name}-workspace/
For example:
skills/components-masthead/ → test/skills/components-masthead-workspace/skills/utilities-spacing/ → test/skills/utilities-spacing-workspace/This keeps generated eval artefacts (iteration dirs, benchmark.json, grading files, feedback.json) out of src/ and co-located with the project's other test outputs in test/.
All SGDS utility categories live in the consolidated skills/sgds-utilities/ skill. To add a new utility category reference:
skills/sgds-utilities/reference/{category-name}.md — no frontmatter, no Prerequisites section.
reference/{category-name}.md + a subfolder reference/{category-name}/ with individual topic files.## Available Utilities table in skills/sgds-utilities/SKILL.md.description frontmatter of skills/sgds-utilities/SKILL.md to include the new category.CLAUDE.md if the description blurb for sgds-utilities needs updating.All SGDS web components live in the consolidated skills/sgds-components/ skill. To add a new component reference:
skills/sgds-components/reference/{component-name}.md — no frontmatter, no Prerequisites section.## Available Components table in skills/sgds-components/SKILL.md.description frontmatter of skills/sgds-components/SKILL.md to include the new component name.CLAUDE.md if the description blurb for sgds-components needs updating.Before considering a skill complete:
All skills
--- frontmatter (no wrapping fences)version: "0.0.0" setdescription value is quoted (required if it contains a colon).github/copilot-instructions.mdUtilities skills only
color-semantics.md, not duplicated## Available Utilities table in skills/sgds-utilities/SKILL.mdsgds-utilities frontmatter descriptionComponent skills only
<sgds-*> HTMLlib/react/skill-creator covers the process, agent-skills-writing covers SGDS-specific conventionstools
Complete reference for all SGDS web components including installation and framework integration. Use when users ask about any <sgds-*> component — accordion, alert, badge, breadcrumb, button, card, checkbox, close-button, combo-box, datepicker, description-list, divider, drawer, dropdown, file-upload, footer, icon, icon-button, icon-card, icon-list, image-card, input, link, mainnav, masthead, modal, overflow-menu, pagination, progress-bar, quantity-toggle, radio, select, sidebar, sidenav, skeleton, spinner, stepper, subnav, switch, system-banner, tab, table, table-of-contents, textarea, thumbnail-card, toast, or tooltip. Also covers React 19+, React ≤18, Vue, Angular, and Next.js integration.
testing
Use this skill when users ask about form validation in SGDS, hasFeedback prop, constraint validation, custom validation, noValidate, setInvalid, form submission, or reading FormData from SGDS form components.
tools
Complete catalog of page layout patterns for SGDS applications. Use this skill whenever a user asks about page layouts, content arrangement, aside panels, split views, sidebar layouts, breadcrumb layouts, or viewport-height layouts — even if they just say 'how should I lay out my page' or 'I need a two-column layout'. Covers Full Width layouts (public-facing pages with sgds-container) and With Sidebar layouts (dashboards/internal tools with sgds-container-sidebar). Trigger on: layout, aside, split view, sidebar layout, two-column, three-column, content arrangement, page structure with aside.
tools
Complete ready-to-use page templates built with SGDS components and utilities. Use this skill whenever a user asks to build a page, dashboard, login page, form page, settings page, list page, or any full-page UI — even if they don't say 'template'. Apply when starting a new app, building internal tools, dashboards, admin portals, authentication flows, or data table views.