Learn project conventions, detect patterns, suggest consistency improvements
/plugin marketplace add bryonjacob/aug/plugin install bryonjacob-aug-core-aug-core@bryonjacob/augThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Analyze codebase to learn conventions, detect patterns, suggest consistency improvements.
Learn: Analyze how project does things (error handling, testing, naming, architecture)
Detect: Find patterns via statistical analysis (80% do X = convention)
Suggest: Compare code to conventions, recommend consistency improvements
"What's the convention here?" - Derive from code, not impose external standards.
Analyze:
Example patterns:
# Pattern A (80% adoption)
try:
result = do_something()
except Exception as e:
raise ErrorWrapper(e, context="operation_name")
# Pattern B (15% adoption)
if not valid:
return None
# Pattern C (5% adoption)
# Mix of approaches
Convention: 80% = standard pattern to follow
Analyze:
test_*.py vs *_test.py vs *Test.java)test_function_scenario vs testFunctionScenario)Example patterns:
# Naming pattern (90% adoption)
test_<function>_<scenario>
# Fixture pattern (85% adoption)
@pytest.fixture
def user():
return User(name="Test")
def test_user_validation(user):
assert user.validate()
# Mock pattern (80% adoption)
@patch('module.external_call')
def test_function(mock_call):
...
Analyze:
Example patterns:
# Import style (95% adoption)
from myapp.models import User # Absolute
from ..models import User # Relative (5%)
# Import grouping (90% adoption)
import os # stdlib
import sys
import requests # external
import pytest
from myapp.models import User # internal
from myapp.utils import helpers
Analyze:
Example patterns:
# Function naming (98% adoption)
def get_user_data(): # snake_case
# Class naming (100% adoption)
class UserValidator: # PascalCase
# Constant naming (95% adoption)
MAX_RETRY_COUNT = 3 # UPPER_SNAKE_CASE
# Private naming (90% adoption)
def _internal_helper(): # _leading underscore
# Boolean naming (85% adoption)
is_valid, has_permission, can_edit # is_/has_/can_ prefix
Analyze:
Example patterns:
# DI pattern (80% adoption)
class UserController:
def __init__(self, auth_service: AuthService):
self.auth_service = auth_service # Constructor injection
# Layer pattern (75% adoption)
Controller → Service → Repository
(API layer) (Business logic) (Data access)
# Return type pattern (70% adoption)
def get_user() -> User: # Return objects, not dicts
return User(...)
Analyze:
Note: Many captured by formatters (Black, Prettier), but some choices remain.
For each pattern type:
Scan codebase:
Calculate adoption:
adoption_rate = count(pattern) / count(all_instances)
Determine convention:
Examples:
For code structure analysis:
Python:
import ast
tree = ast.parse(source_code)
# Find function definitions
functions = [node for node in ast.walk(tree) if isinstance(node, ast.FunctionDef)]
# Analyze naming
snake_case = sum(1 for f in functions if '_' in f.name)
camel_case = sum(1 for f in functions if f.name[0].islower() and any(c.isupper() for c in f.name))
JavaScript/TypeScript:
// Use babel parser or typescript compiler API
const ast = parser.parse(sourceCode);
// Traverse AST
traverse(ast, {
FunctionDeclaration(path) {
// Analyze function patterns
}
});
Java:
// Use JavaParser or similar
CompilationUnit cu = StaticJavaParser.parse(sourceCode);
cu.findAll(MethodDeclaration.class).forEach(method -> {
// Analyze method patterns
});
For simple patterns:
Error handling:
try_except = len(re.findall(r'try:.*?except', code, re.DOTALL))
if_return_none = len(re.findall(r'if.*?return None', code))
Imports:
absolute = len(re.findall(r'from \w+\.\w+', code))
relative = len(re.findall(r'from \.', code))
Compare file to conventions:
Analyze codebase for specific pattern type.
Usage:
/learn error-handling
/learn testing
/learn naming
/learn imports
/learn architecture
Output:
Error Handling Patterns
=======================
Analyzed: 156 error handling blocks
Pattern Distribution:
ErrorWrapper class: 125 (80%) ← Convention
Status codes: 23 (15%)
Mixed approaches: 8 (5%)
Convention: ErrorWrapper class
Example:
try:
result = do_something()
except Exception as e:
raise ErrorWrapper(e, context="validation")
Adoption:
src/auth: 100% (45/45)
src/api: 85% (40/47)
src/utils: 60% (15/25) ← Needs improvement
Non-conforming files:
src/utils/helpers.py (mixes status codes and exceptions)
src/legacy/old_api.py (uses status codes throughout)
Compare file to project conventions, recommend improvements.
Usage:
/suggest src/features/new-auth.py
/suggest tests/test_new_feature.py
Output:
Consistency Analysis: src/features/new-auth.py
=============================================
Inconsistencies found: 4
1. Import style (lines 1-8)
Current: from ..models import User
Convention: from myapp.models import User (95% adoption)
Severity: High
Fix: Use absolute imports
2. Error handling (line 45)
Current: if not valid: return None
Convention: raise ErrorWrapper (80% adoption)
Severity: Medium
Fix: Replace with ErrorWrapper pattern
3. Function naming (line 67)
Current: def getUserData()
Convention: snake_case (98% adoption)
Severity: High
Fix: Rename to get_user_data
4. Test location
Current: tests/new_auth_test.py
Convention: tests/features/test_new_auth.py (85% adoption)
Severity: Low
Fix: Move to match source structure
Summary:
2 high severity (imports, naming)
1 medium severity (error handling)
1 low severity (file location)
Recommendation: Address high severity issues before merge.
Show all detected patterns in project.
Usage:
/patterns
/patterns --summary # Just conventions, no examples
/patterns --detailed # Include adoption rates per module
Output:
Project Conventions
===================
Error Handling:
Style: ErrorWrapper class (80% adoption)
Logging: Always log with context
Example:
try:
result = operation()
except Exception as e:
raise ErrorWrapper(e, context="operation")
Testing:
Naming: test_<function>_<scenario> (90% adoption)
Fixtures: conftest.py (pytest) (85% adoption)
Mocking: @patch decorator (80% adoption)
Example:
@pytest.fixture
def user():
return User(name="Test")
def test_user_validation(user):
assert user.validate()
Imports:
Style: Absolute only (95% adoption)
Grouping: stdlib, external, internal (90% adoption)
Example:
import os
import requests
from myapp.models import User
Naming:
Functions: snake_case (98% adoption)
Classes: PascalCase (100% adoption)
Constants: UPPER_SNAKE_CASE (95% adoption)
Private: _leading_underscore (90% adoption)
Booleans: is_/has_/can_ prefix (85% adoption)
Architecture:
DI: Constructor injection (80% adoption)
Layers: controllers → services → repositories (75% adoption)
Returns: Objects not dicts (70% adoption)
Code Style:
Line length: 88 chars (Black) (100% adoption)
Quotes: Double quotes (95% adoption)
Trailing commas: Always in multiline (90% adoption)
After implementation, check consistency:
/work 123
# Implementation complete
/suggest src/features/new_feature.py
# Check consistency
# If major issues found:
# Create follow-up issue or fix before PR
Part of code review:
/autocommit 123
→ Review includes:
- Acceptance criteria ✓
- Tests ✓
- Coverage ✓
- Consistency check (/suggest on modified files)
- Imports: Non-standard ✗
- Recommendation: Fix before merge
Inconsistency as code smell:
/refactor
→ Finds:
- Complexity issues
- Duplicate code
- Inconsistent patterns ← NEW
- src/utils/helpers.py uses 3 different error handling styles
→ Creates issue:
[refactoring] Standardize error handling in src/utils/helpers.py
Statistical, not semantic:
Language-specific:
No learning across repos:
Regular analysis:
# After major features
/patterns --detailed
# Check if conventions changed
# Before merging
/suggest <modified-files>
# Ensure consistency
Convention documentation:
/patterns > docs/CONVENTIONS.md
# Document for team reference
Onboarding:
# New developer:
/learn error-handling
/learn testing
/learn naming
# Quick convention overview
Works well if:
Descriptive, not prescriptive - Learn from code, don't impose external rules.
Statistical, not dogmatic - 80% = convention, but context matters.
Consistency over perfection - Better to have clear convention than "best" approach.
Team-specific - Each project defines its own conventions through usage.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.