ameba-custom-rules

Create custom Ameba lint rules for Crystal code with AST traversal and tests.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill ameba-custom-rules
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ameba-custom-rules
Source: https://github.com/TheBushidoCollective/han/tree/main/jutsu/jutsu-ameba/skills/ameba-custom-rules
Command: npx skills add https://github.com/TheBushidoCollective/han --skill ameba-custom-rules

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ameba.

What problem does it solve?

This Skill guides creating custom Ameba rules to enforce code quality and project-specific constraints in Crystal projects.

Core Features & Use Cases

  • Rule Anatomy: Understand structure, messages, and AST visitors.
  • Custom Rules: Implement domain-specific checks.
  • Testing: Provide spec coverage for rules.

Quick Start

Create a simple Ameba rule that flags usage of a dangerous Crystal method.

Frequently Asked Questions about ameba-custom-rules

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create custom lint rules for Crystal code?

Custom Ameba rules enforce project-specific lint standards by implementing Ameba::Rule::Custom modules that inherit from Ameba::Rule::Base. Each rule traverses the Crystal AST, defines a MSG constant, configures a properties block, and provides test(source) overloads to catch domain-specific code smells in large codebases.

What's the structure of an Ameba custom rule?

An Ameba custom rule requires a module inheriting from Ameba::Rule::Base, a properties block for configuration, a MSG string for violation messages, and test methods accepting Crystal source code or AST nodes. Automatic registration occurs through inheritance and configuration without manual setup.

Can I test custom Ameba rules before deployment?

Yes. Ameba custom rules support spec coverage through test(source) and test(source, node) overloads that validate rule behavior against Crystal AST nodes. This allows you to verify that rules correctly identify code smells before enforcing them across your codebase.

Do I need knowledge of Crystal's AST to write Ameba rules?

Yes. Writing effective custom Ameba rules requires understanding Crystal's Abstract Syntax Tree structure, as rules traverse and inspect AST nodes to detect violations. The Skill covers AST visitor patterns and node analysis within the rule implementation framework.

How do custom Ameba rules integrate with existing static analysis?

Custom Ameba rules register automatically through inheritance from Ameba::Rule::Base and configuration, extending Ameba's existing static analysis pipeline. This allows domain-specific checks to run alongside built-in linting rules in your Crystal project's analysis workflow.