usage-rules
FreeNo executable scriptsNot checkedSearch for package-specific usage rules and best practices from Elixir packages. Use when you need coding conventions, patterns, common mistakes, or good/bad…
About this skill
Usage Rules Search
Comprehensive search for Elixir and Erlang package usage rules and best practices, following a cascading strategy to find the most relevant coding conventions and patterns.
When to use this skill
Use this skill when you need to:
- Look up coding conventions for a Hex package
- Find best practices and recommended patterns
- See good/bad code examples for proper usage
- Understand common mistakes to avoid
- Learn package-specific idioms and conventions
- Get context-aware recommendations for implementation
Search strategy
This skill implements a cascading search that prioritizes local and contextual information:
- Local dependencies - Search installed packages in
deps/directory for usage-rules.md - Fetched cache - Check previously fetched usage rules in
.usage-rules/ - Progressive fetch - Automatically fetch package and extract usage-rules.md if missing
- Context-aware extraction - Extract relevant sections based on coding context
- Fallback - Note when package doesn't provide usage rules, suggest alternatives
Instructions
Step 1: Identify the package and context
Extract the package name and identify the coding context from the user's question.
Package name examples:
- "Ash best practices" → Package:
ash - "Phoenix LiveView patterns" → Package:
phoenix_live_view - "How to use Ecto properly?" → Package:
ecto
Context keywords:
- Querying: "query", "filter", "search", "find", "list"
- Error handling: "error", "validation", "exception", "handle"
- Actions: "create", "update", "delete", "action", "change"
- Relationships: "relationship", "association", "belongs_to", "has_many"
- Testing: "test", "testing", "mock", "fixture"
- Authorization: "authorization", "permissions", "policy", "access"
- Structure: "structure", "organization", "architecture", "setup"
Step 2: Search local dependencies
Use the Glob and Grep tools to search the deps/ directory for usage rules:
Find the package directory with usage-rules.md:
Use Glob: pattern="deps/<package_name>/usage-rules.md"If no results, the package isn't installed locally or doesn't provide usage rules. Skip to Step 3.
Check for sub-rules (advanced packages may have specialized rules):
Use Glob: pattern="deps/<package_name>/usage-rules/*.md"Search for relevant sections based on context keywords:
Use Grep: pattern="^## (Querying|Error Handling|Actions)", path="deps/<package_name>/usage-rules.md", output_mode="content", -n=trueThis finds section headings with line numbers.
Extract relevant sections:
Use Grep: pattern="^## Error Handling", path="deps/<package_name>/usage-rules.md", output_mode="content", -A=50Use
-Aflag to get section content (adjust number based on typical section length).Read the complete file if needed for broader context:
Use Read: file_path="deps/<package_name>/usage-rules.md"
Step 3: Check fetched cache and fetch if needed
If the package wasn't found in deps/, check for previously fetched usage rules, or fetch them now.
3.1: Check fetched cache
Use the Glob tool to check if usage rules were previously fetched:
Use Glob: pattern=".usage-rules/<package_name>-*/usage-rules.md"
If found, search the cached rules using the same patterns as Step 2 (sections 3-5).
3.2: Determine version to fetch
If no cached rules found, determine which version to fetch:
Check mix.lock for locked version:
Use Bash: grep '"<package_name>"' mix.lock | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'Check mix.exs for version constraint:
Use Bash: grep -E '\{:<package_name>' mix.exs | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'Get latest version from hex.pm:
Use Bash: curl -s "https://hex.pm/api/packages/<package_name>" | jq -r '.releases[0].version'If version ambiguous, use AskUserQuestion to prompt:
Question: "Package '<package_name>' usage rules not found locally. Which version would you like to fetch?" Options: - "Latest (X.Y.Z)" - Fetch most recent release - "Project version (X.Y.Z)" - Use version from mix.exs/mix.lock (if available) - "Specific version" - User provides custom version in "Other" field - "Skip fetching" - Continue without usage rules
3.3: Fetch package and extract usage rules
Once version is determined, fetch the package and extract usage-rules.md:
# Create temp directory and fetch package
mkdir -p .usage-rules/.tmp
mix hex.package fetch <package_name> <version> --unpack --output .usage-rules/.tmp/<package_name>-<version>
# Check if usage-rules.md exists
if [ -f ".usage-rules/.tmp/<package_name>-<version>/usage-rules.md" ]; then
# Create version-specific directory
mkdir -p ".usage-rules/<package_name>-<version>"
# Copy main usage rules file
cp ".usage-rules
Install usage-rules in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
ReadGrepGlobBashAskUserQuestionBundled files
FAQ
What does the usage-rules skill do?
Search for package-specific usage rules and best practices from Elixir packages. Use when you need coding conventions, patterns, common mistakes, or good/bad examples for packages like Ash, Phoenix, Ecto, etc.
How do I install the usage-rules skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the usage-rules skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic