writing-skills
Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dependencies, and rust-documentation skills.
What this skill does
# Writing Claude Code Skills for HASH
## Purpose
Comprehensive guide for creating and managing skills in Claude Code with auto-activation system, following Anthropic's official best practices including the 500-line rule and progressive disclosure pattern.
## When to Use This Skill
Automatically activates when you mention:
- Creating or adding skills
- Modifying skill triggers or rules
- Understanding how skill activation works
- Debugging skill activation issues
- Working with skill-rules.json
- Hook system mechanics
- Claude Code best practices
- Progressive disclosure
- YAML frontmatter
- 500-line rule
---
## System Overview
### Current Implementation
**UserPromptSubmit Hook** (Proactive Suggestions)
- **File**: `.claude/hooks/skill-activation-prompt.ts`
- **Trigger**: BEFORE Claude sees user's prompt
- **Purpose**: Suggest relevant skills based on keywords + intent patterns
- **Method**: Injects formatted reminder as context (stdout → Claude's input)
- **Use Cases**: Topic-based skills, implicit work detection
- **Debug**: Run with `SKILL_DEBUG=true` to see matching logic
- **Validation**: Run with `--validate` flag to check configuration
### Configuration File
**Location**: `.claude/skills/skill-rules.json`
Defines:
- All skills and their trigger conditions
- Enforcement levels (currently only `"suggest"` is implemented)
- Keyword triggers (exact substring matching)
- Intent pattern triggers (regex matching)
---
## Skill Types
### Domain Skills (Currently Implemented)
**Purpose:** Provide comprehensive guidance for specific areas
**Characteristics:**
- Type: `"domain"`
- Enforcement: `"suggest"` (advisory, non-blocking)
- Priority: `"high"` or `"medium"`
- Activated by keyword or intent pattern matching
- Topic or domain-specific
- Comprehensive documentation with progressive disclosure
**Examples in HASH:**
- `rust-error-stack` - Error handling with error-stack crate
- `cargo-dependencies` - Cargo.toml dependency management patterns
- `rust-documentation` - Rust doc comment best practices
- `writing-skills` - This skill! Meta-guidance for creating skills
**When to Use:**
- Complex systems requiring deep knowledge
- Best practices documentation
- Architectural patterns
- How-to guides
### Future: Guardrail Skills (Not Yet Implemented)
Guardrail skills with blocking enforcement (`"block"`) are designed but not yet implemented. These would enforce critical patterns and prevent common mistakes.
---
## Quick Start: Creating a New Skill
### Step 1: Create Skill File
**Location:** `.claude/skills/{skill-name}/SKILL.md`
**Template:**
```markdown
---
name: my-new-skill
description: Brief description including keywords that trigger this skill. Mention topics, file types, and use cases. Be explicit about trigger terms.
---
# My New Skill
## Purpose
What this skill helps with
## When to Use
Specific scenarios and conditions
## Key Information
The actual guidance, documentation, patterns, examples
```
**Best Practices:**
- ✅ **Name**: Lowercase, hyphens, gerund form (verb + -ing) preferred
- ✅ **Description**: Include ALL trigger keywords/phrases (max 1024 chars)
- ✅ **Content**: Under 500 lines - use reference files for details
- ✅ **Examples**: Real code examples
- ✅ **Structure**: Clear headings, lists, code blocks
### Step 2: Add to skill-rules.json
See [SKILL_RULES_REFERENCE.md](SKILL_RULES_REFERENCE.md) for complete schema.
**Basic Template:**
```json
{
"my-new-skill": {
"type": "domain",
"enforcement": "suggest",
"priority": "medium",
"promptTriggers": {
"keywords": ["keyword1", "keyword2"],
"intentPatterns": ["(create|add).*?something"]
}
}
}
```
### Step 3: Test and Validate
**Test with specific prompt:**
```bash
echo '{"session_id":"test","prompt":"your test prompt","cwd":".","permission_mode":"auto","transcript_path":""}' | \
yarn workspace @local/claude-hooks run:skill
```
**Validate configuration:**
```bash
yarn lint:skill
```
**Debug matching logic:**
```bash
echo '{"session_id":"test","prompt":"your test prompt","cwd":".","permission_mode":"auto","transcript_path":""}' | \
yarn workspace @local/claude-hooks dev:skill
```
### Step 4: Refine Patterns
Based on testing:
- Add missing keywords that should trigger the skill
- Refine intent patterns to reduce false positives
- Use word boundaries in regex: `\\b(keyword)\\b` instead of just `keyword`
### Step 5: Follow Anthropic Best Practices
✅ Keep SKILL.md under 500 lines
✅ Use progressive disclosure with reference files
✅ Add table of contents to reference files > 100 lines
✅ Write detailed description with trigger keywords
✅ Test with 3+ real scenarios before documenting
✅ Iterate based on actual usage
---
## Current Implementation Details
### Enforcement
Currently only **SUGGEST** enforcement is implemented:
- Suggestion injected before Claude sees prompt via UserPromptSubmit hook
- Claude becomes aware of relevant skills
- Not enforced or blocking - purely advisory
- All existing skills use this pattern
**Future:** Blocking enforcement (`"block"`) and warning enforcement (`"warn"`) are designed in the schema but not yet implemented.
### Debugging and Validation
**Yarn Commands:**
- `yarn lint:skill` - Validate configuration
- `yarn workspace @local/claude-hooks run:skill` - Run skill activation with test prompt
- `yarn workspace @local/claude-hooks dev:skill` - Run with debug output enabled
**Environment Variables:**
- `SKILL_DEBUG=true` - Show detailed matching logic to stderr (automatically set by `yarn dev:skill`)
- `CLAUDE_PROJECT_DIR` - Override project directory (auto-detected if not set)
**Validation shows:**
- Project directory
- Rules file location
- Configured skills with trigger counts
- Verification that SKILL.md files exist
---
## Testing Checklist
When creating a new skill, verify:
- [ ] Skill file created in `.claude/skills/{name}/SKILL.md`
- [ ] Proper frontmatter with name and description
- [ ] Entry added to `skill-rules.json`
- [ ] Keywords tested with real prompts
- [ ] Intent patterns tested with variations
- [ ] Priority level matches importance
- [ ] No false positives in testing (use `yarn workspace @local/claude-hooks dev:skill`)
- [ ] No false negatives in testing
- [ ] JSON syntax validated: `jq . .claude/skills/skill-rules.json`
- [ ] Validation passes: `yarn lint:skill`
- [ ] **SKILL.md under 500 lines** ⭐
- [ ] Reference files created if needed
- [ ] Table of contents added to files > 100 lines
---
## Reference Files
For detailed information on specific topics, see:
### [trigger-types.md](resources/trigger-types.md)
Complete guide to trigger types (currently implemented):
- Keyword triggers (explicit topic matching)
- Intent patterns (implicit action detection)
- Best practices and examples for each
- Common pitfalls and testing strategies
**Note:** File path and content pattern triggers are documented but not yet used by the hook.
### [skill-rules-reference.md](resources/skill-rules-reference.md)
Complete skill-rules.json schema:
- Full TypeScript interface definitions
- Field-by-field explanations
- Complete guardrail skill example
- Complete domain skill example
- Validation guide and common errors
### [hook-mechanisms.md](resources/hook-mechanisms.md)
Deep dive into hook internals:
- UserPromptSubmit flow (detailed)
- Hook architecture and implementation
- Exit code behavior
- Performance considerations
**Note:** PreToolUse hooks and session state management are documented but not yet implemented.
### [troubleshooting.md](resources/troubleshooting.md)
Comprehensive debugging guide:
- Skill not triggering (use `SKILL_DEBUG=true`)
- False positives (too many triggers)
- Hook not executing at all
- Configuration validation
- Performance issues
### [patterns-library.md](resources/patterns-library.md)
Ready-to-use pattern collection:
- Intent pattern library (regex)
- Keyword pattern examples
- Organized by use case
- Copy-paste readyRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.