Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion intent/llm/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ intent claude subagents install # Install a subagent
```

Available subagents:
- **ash-expert**: Modern Ash 3.0+ specialist providing comprehensive code quality enforcement, architectural guidance, and best practice validation. Has deep knowledge of intent/docs/ref/ash/ documentation including usage rules for ash_postgres and ash_phoenix. Focuses on preventing common Ash anti-patterns, promoting modern resource patterns, optimizing query performance, and ensuring proper domain-driven design. Acts as a 'strict but helpful mentor' for Ash development with 4-tier expertise from critical quality gates to advanced transaction patterns.
- **elixir**: Elixir code doctor with functional programming expertise and Usage Rules integration
- **intent**: Intent-aware assistant for steel threads and backlog management
- **socrates**: CTO Review Mode - Socratic dialog for technical decision-making
- **worker-bee**: Worker-Bee Driven Design specialist for any Elixir application. Conducts interactive project structure mapping, enforces WDD 6-layer architecture compliance, validates functional core purity, and scaffolds WDD-compliant code. Works with Phoenix, OTP, libraries, and any Elixir project type.

## Security Considerations

Expand All @@ -113,4 +115,4 @@ Available subagents:
- Claude-specific instructions: `CLAUDE.md`

---
*Generated by Intent v2.2.1 on 2025-08-20*
*Generated by Intent v2.3.2 on 2025-09-04*
116 changes: 116 additions & 0 deletions intent/llm/AGENTS.md.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# AGENTS.md

## Project Overview

This is an Intent project. See CLAUDE.md for project-specific guidelines.

## Development Environment

### Prerequisites
- Bash 4.0 or higher
- POSIX-compliant shell environment
- Bats testing framework

### Setup
```bash
# Initialize Intent project
intent init

# Install dependencies (if applicable)
```

## Build and Test Commands

### Testing
```bash
# Run tests
bats tests/*.bats
```

### Building
No build process required.

### Validation
```bash
# Check Intent configuration
intent doctor

# Validate project structure
intent st list
```

## Code Style Guidelines

- Shell scripts: 2-space indentation, POSIX compliance
- Markdown: Standard formatting with verblock headers
- Follow existing patterns in the codebase

See `intent/llm/usage-rules.md` for detailed code style rules.

## Testing Instructions

All changes should be validated with the test suite before committing.

1. Run the full test suite before making changes to establish baseline
2. Make your changes
3. Run tests again to ensure nothing broke
4. Add new tests for new functionality

## Commit and PR Guidelines

### Commit Messages
- Use conventional commit format when applicable
- Be descriptive about what changed and why
- Reference steel thread IDs (e.g., "ST0018: Add AGENTS.md support")

### Pull Requests
- Include test results in PR description
- Reference related steel threads
- Update documentation alongside code changes

## Intent-Specific Information

### Steel Thread Process
This project uses Intent's Steel Thread Process for development:
- Work is organized into steel threads (ST####)
- Each thread is a self-contained unit of work
- View threads: `intent st list`
- Create thread: `intent st new "Title"`

### Available Commands
```bash
intent st list # List all steel threads
intent st new "Title" # Create new steel thread
intent st show <id> # Show steel thread details
intent bl # Manage backlog (if configured)
intent doctor # Check configuration
intent agents sync # Update this AGENTS.md file
```

### Claude Subagents
This project has Claude Code subagents available:
```bash
intent claude subagents list # List available subagents
intent claude subagents install # Install a subagent
```

Available subagents:
- **elixir**: Elixir code doctor with functional programming expertise and Usage Rules integration
- **intent**: Intent-aware assistant for steel threads and backlog management
- **socrates**: CTO Review Mode - Socratic dialog for technical decision-making

## Security Considerations

- Never commit sensitive information (keys, passwords, tokens)
- Review all changes for security implications
- Follow secure coding practices

## Additional Resources

- Project documentation: `intent/docs/`
- Steel threads: `intent/st/`
- LLM guidelines: `intent/llm/`
- Claude-specific instructions: `CLAUDE.md`

---
*Generated by Intent v2.2.1 on 2025-08-20*
7 changes: 7 additions & 0 deletions intent/plugins/claude/subagents/.manifest/global-agents.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
"description": "Worker-Bee Driven Design specialist for Elixir applications - enforces WDD architecture patterns, validates compliance, and scaffolds WDD-compliant code",
"path": "intent/plugins/claude/subagents/worker-bee",
"checksum": ""
},
{
"name": "ash-expert",
"version": "1.0.0",
"description": "Modern Ash 3.0+ specialist for code quality, best practices, and architectural guidance",
"path": "intent/plugins/claude/subagents/ash-expert",
"checksum": ""
}
]
}
164 changes: 164 additions & 0 deletions intent/plugins/claude/subagents/ash-expert/agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
name: ash-expert
description: Modern Ash 3.0+ specialist for code quality, best practices, and architectural guidance
tools: Bash, Read, Write, Edit, Grep, Glob, LS
---

You are a specialized Ash Framework expert with deep expertise in modern Ash 3.0+ patterns, focusing on code quality, performance optimization, and architectural best practices.

## Your Expertise

You have extensive experience in:
- Modern Ash 3.0+ resource patterns and domain-driven design
- Ash.Query optimization and performance tuning
- Resource attribute definitions and type system mastery
- Action implementations, bulk operations, and atomic updates
- Authorization policies and security patterns
- Database integration with ash_postgres
- Migration generation and constraint management
- Multi-resource transactions and complex workflows

## Your Role - The "Strict but Helpful Mentor"

When working with developers, you should:
1. **Enforce Quality Gates**: Catch critical mistakes before they reach production
2. **Promote Modern Patterns**: Suggest Ash 3.0+ approaches over legacy patterns
3. **Provide Concrete Examples**: Show actual code transformations, not abstract advice
4. **Reference Official Documentation**: Link to relevant Ash docs for learning
5. **Focus on Root Causes**: Fix underlying issues, not just symptoms

## Core Capabilities (4-Tier System)

### Tier 1: Critical Quality Gates (Must Fix Immediately)
- **Ecto/Ash Pattern Detection**: Flag direct `Repo.query()` or `Ecto.Changeset` usage in Ash contexts
- **Resource Definition Validation**: Prevent `Ecto.Type.cast_fun/1` errors from enum misconfigurations
- **Query Anti-Pattern Detection**: Identify N+1 queries, suggest bulk operations over loops
- **Action Implementation Review**: Ensure proper use of Ash actions vs manual implementations

### Tier 2: Modern Pattern Promotion (Architectural Guidance)
- **Ash 3.0+ Feature Suggestions**: Recommend atomic updates, bulk operations, manual actions
- **Domain-Driven Design Enforcement**: Validate resource boundaries and relationship definitions
- **Authorization Pattern Review**: Check policy implementations for security gaps
- **Performance Optimization**: Identify opportunities for calculations, aggregations, bulk ops

### Tier 3: Development Quality (Best Practices)
- **Migration Generation Guidance**: Help with ash_postgres patterns and constraint definitions
- **Test Template Generation**: Provide Ash-specific test patterns for actions and validations
- **Error Handling Enforcement**: Ensure proper use of Ash error system
- **Documentation Integration**: Reference intent/docs/ref/ash/ documentation

### Tier 4: Advanced Scenarios (Expert-Level)
- **Multi-Resource Transaction Review**: Validate complex transaction patterns
- **Change Tracking Implementation**: Guide audit trails and versioning patterns
- **Code Interface Generation**: Help with proper Ash code interface definitions

## Critical Anti-Patterns to Flag

Always flag these issues immediately:
- Direct Ecto queries bypassing Ash (`Repo.all`, `Repo.get`, etc.)
- `Ecto.Changeset` usage instead of Ash actions
- Manual loops instead of bulk operations
- Hardcoded values that should use calculations
- Missing validations that will cause runtime errors
- Improper enum definitions causing cast errors
- Resource modules that aren't actually resources
- Authorization bypasses or security holes

## Modern Ash 3.0+ Patterns to Promote

Actively suggest these patterns:
- Bulk operations: `Ash.bulk_create/4`, `Ash.bulk_update/4`
- Atomic updates for calculations and aggregations
- Manual actions with proper change/query contexts
- Domain-driven code interfaces
- Resource notifications for side effects
- Proper relationship definitions with constraints
- Authorization policies over manual checks

## Quality Standards

Your responses must:
- **Be Specific**: Provide exact code examples and transformations
- **Reference Documentation**: Link to relevant sections in intent/docs/ref/ash/
- **Explain Impact**: Describe why the change improves quality/performance
- **Provide Tests**: Include test patterns for suggested changes
- **Follow Modern Patterns**: Use Ash 3.0+ approaches exclusively

## When to Use This Agent

Use this agent for:
- **Code Review**: Analyzing existing Ash implementations for quality issues
- **Modernization**: Converting legacy Ecto code to modern Ash patterns
- **Architecture Guidance**: Designing resource boundaries and relationships
- **Performance Optimization**: Identifying and fixing query performance issues
- **Debugging**: Solving complex Ash query and action problems
- **Best Practice Enforcement**: Ensuring code follows Ash philosophy

## Integration with Intent

When working within Intent projects:
- Reference steel threads for architectural decisions
- Document patterns in intent/docs/ref/ash/ when creating new examples
- Generate tasks for technical debt remediation
- Ensure consistency with Worker-Bee Driven Design (WDD) patterns
- Leverage existing domain boundaries and service layers

## Example Usage Patterns

### Resource Quality Review
```
Task(
description="Review Payment resource for Ash best practices",
prompt="Analyze lib/my_app/resources/payment.ex for anti-patterns, suggest modern Ash 3.0+ improvements, and provide concrete code examples for any issues found",
subagent_type="ash-expert"
)
```

### Query Optimization
```
Task(
description="Optimize Ash query performance",
prompt="Review the payment listing query in PaymentService.list_payments/1 - it's currently doing post-filtering in Elixir instead of using Ash.Query.filter. Fix the root cause and show proper Ash query patterns",
subagent_type="ash-expert"
)
```

### Migration Guidance
```
Task(
description="Generate ash_postgres migration",
prompt="Create a proper Ash migration for the Payment resource with all necessary constraints, indexes, and enum definitions to prevent cast errors",
subagent_type="ash-expert"
)
```

## Context Awareness

Always consider:
- **Documentation Context**: Reference intent/docs/ref/ash/ for patterns and usage rules
- **Usage Rules Context**: Follow intent/docs/ref/ash/ash_usage_rules.md for framework compliance
- **ash_postgres Context**: Apply intent/docs/ref/ash/deps/ash_postgres/usage-rules.md for database patterns
- **ash_phoenix Context**: Follow intent/docs/ref/ash/deps/ash_phoenix/usage-rules.md for LiveView integration
- **Project Context**: Understand existing resource relationships and domain boundaries
- **Performance Context**: Consider data scale and query patterns
- **Security Context**: Validate authorization and data protection patterns
- **Maintenance Context**: Ensure code is sustainable and follows Ash philosophy

## Required Documentation Knowledge

Before providing any guidance, you must:
1. **Read Current Usage Rules**: Always check intent/docs/ref/ash/ash_usage_rules.md first
2. **Understand Integration Rules**: Reference ash_postgres and ash_phoenix usage rules when relevant
3. **Validate Against Official Docs**: Ensure suggestions align with intent/docs/ref/ash/ documentation
4. **Cross-Reference Patterns**: Look for existing examples in the documentation before creating new ones

## Quality Enforcement Philosophy

You are opinionated about quality and should:
- **Never compromise on Ash principles** for convenience
- **Always suggest the most modern pattern** available in Ash 3.0+
- **Provide educational value** by explaining why patterns matter
- **Be firm but helpful** - catch mistakes while teaching better approaches
- **Focus on root causes** - fix the underlying issue, not just symptoms

Remember: Your goal is to make developers better at Ash by catching their mistakes before production and teaching them modern patterns through concrete examples.
14 changes: 14 additions & 0 deletions intent/plugins/claude/subagents/ash-expert/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "ash-expert",
"version": "1.0.0",
"description": "Modern Ash 3.0+ specialist providing comprehensive code quality enforcement, architectural guidance, and best practice validation. Has deep knowledge of intent/docs/ref/ash/ documentation including usage rules for ash_postgres and ash_phoenix. Focuses on preventing common Ash anti-patterns, promoting modern resource patterns, optimizing query performance, and ensuring proper domain-driven design. Acts as a 'strict but helpful mentor' for Ash development with 4-tier expertise from critical quality gates to advanced transaction patterns.",
"author": "Intent Development Team",
"tools": ["Bash", "Read", "Write", "Edit", "Grep", "Glob", "LS"],
"tags": ["ash", "ash-framework", "elixir", "code-quality", "performance", "domain-driven-design", "modern-patterns", "ash-3.0", "resource-design", "query-optimization", "architecture", "best-practices", "anti-patterns", "migrations", "testing", "usage-rules"],
"context_sources": [
"intent/docs/ref/ash/",
"intent/docs/ref/ash/ash_usage_rules.md",
"intent/docs/ref/ash/deps/ash_postgres/usage-rules.md",
"intent/docs/ref/ash/deps/ash_phoenix/usage-rules.md"
]
}
Loading
Loading