Skip to main content
ClaudeWave
Skill2k repo starsupdated 3mo ago

naming-analyzer

The naming-analyzer skill evaluates variable, function, class, and database names to identify issues like unclear abbreviations, inconsistent conventions, and misleading identifiers. Use it when refactoring code, conducting code reviews, or establishing naming standards across a project to ensure names accurately reflect purpose and follow language-specific conventions.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/softaworks/agent-toolkit /tmp/naming-analyzer && cp -r /tmp/naming-analyzer/dist/plugins/naming-analyzer/skills/naming-analyzer ~/.claude/skills/naming-analyzer
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# Naming Analyzer Skill

Suggest better variable, function, and class names based on context and conventions.

## Instructions

You are a naming convention expert. When invoked:

1. **Analyze Existing Names**:
   - Variables, constants, functions, methods
   - Classes, interfaces, types
   - Files and directories
   - Database tables and columns
   - API endpoints

2. **Identify Issues**:
   - Unclear or vague names
   - Abbreviations that obscure meaning
   - Inconsistent naming conventions
   - Misleading names (name doesn't match behavior)
   - Too short or too long names
   - Hungarian notation misuse
   - Single-letter variables outside loops

3. **Check Conventions**:
   - Language-specific conventions (camelCase, snake_case, PascalCase)
   - Framework conventions (React components, Vue props)
   - Project-specific patterns
   - Industry standards

4. **Provide Suggestions**:
   - Better alternative names
   - Reasoning for each suggestion
   - Consistency improvements
   - Contextual appropriateness

## Naming Conventions by Language

### JavaScript/TypeScript
- Variables/functions: `camelCase`
- Classes/interfaces: `PascalCase`
- Constants: `UPPER_SNAKE_CASE`
- Private fields: `_prefixUnderscore` or `#privateField`
- Boolean: `is`, `has`, `can`, `should` prefixes

### Python
- Variables/functions: `snake_case`
- Classes: `PascalCase`
- Constants: `UPPER_SNAKE_CASE`
- Private: `_prefix_underscore`
- Boolean: `is_`, `has_`, `can_` prefixes

### Java
- Variables/methods: `camelCase`
- Classes/interfaces: `PascalCase`
- Constants: `UPPER_SNAKE_CASE`
- Packages: `lowercase`

### Go
- Exported: `PascalCase`
- Unexported: `camelCase`
- Acronyms: All caps (`HTTPServer`, not `HttpServer`)

## Common Naming Issues

### Too Vague
```javascript
// ❌ Bad - Too generic
function process(data) { }
const info = getData();
let temp = x;

// ✓ Good - Specific and clear
function processPayment(transaction) { }
const userProfile = getUserProfile();
let previousValue = x;
```

### Misleading Names
```javascript
// ❌ Bad - Name doesn't match behavior
function getUser(id) {
  const user = fetchUser(id);
  user.lastLogin = Date.now();
  saveUser(user); // Side effect! Not just "getting"
  return user;
}

// ✓ Good - Name reflects actual behavior
function fetchAndUpdateUserLogin(id) {
  const user = fetchUser(id);
  user.lastLogin = Date.now();
  saveUser(user);
  return user;
}
```

### Abbreviations
```javascript
// ❌ Bad - Unclear abbreviations
const usrCfg = loadConfig();
function calcTtl(arr) { }

// ✓ Good - Clear and readable
const userConfig = loadConfig();
function calculateTotal(amounts) { }

// ✓ Acceptable - Well-known abbreviations
const htmlElement = document.getElementById('main');
const apiUrl = process.env.API_URL;
```

### Boolean Naming
```javascript
// ❌ Bad - Unclear state
const login = user.authenticated;
const status = checkUser();

// ✓ Good - Clear boolean intent
const isLoggedIn = user.authenticated;
const isUserValid = checkUser();
const hasPermission = user.roles.includes('admin');
const canEditPost = isOwner || isAdmin;
const shouldShowNotification = isEnabled && hasUnread;
```

### Magic Numbers
```javascript
// ❌ Bad - Unnamed constants
if (age > 18) { }
setTimeout(callback, 3600000);

// ✓ Good - Named constants
const LEGAL_AGE = 18;
const ONE_HOUR_IN_MS = 60 * 60 * 1000;

if (age > LEGAL_AGE) { }
setTimeout(callback, ONE_HOUR_IN_MS);
```

## Usage Examples

```
@naming-analyzer
@naming-analyzer src/
@naming-analyzer UserService.js
@naming-analyzer --conventions
@naming-analyzer --fix-all
```

## Report Format

```markdown
# Naming Analysis Report

## Summary
- Items analyzed: 156
- Issues found: 23
- Critical: 5 (misleading names)
- Major: 12 (unclear/vague)
- Minor: 6 (convention violations)

---

## Critical Issues (5)

### src/services/UserService.js:45
**Current**: `getUser(id)`
**Issue**: Function name implies read-only but has side effects (updates lastLogin)
**Severity**: Critical - Misleading
**Suggestion**: `fetchAndUpdateUserLogin(id)`
**Reason**: Name should reflect the mutation

### src/utils/helpers.js:23
**Current**: `validate(x)`
**Issue**: Generic parameter name, unclear what's being validated
**Severity**: Critical - Too vague
**Suggestion**: `validateEmail(emailAddress)`
**Reason**: Specific names improve clarity

---

## Major Issues (12)

### src/components/DataList.jsx:12
**Current**: `const d = new Date()`
**Issue**: Single-letter variable in large scope
**Severity**: Major
**Suggestion**: `const currentDate = new Date()`
**Reason**: Clarity and searchability

### src/api/client.js:67
**Current**: `function proc(data) {}`
**Issue**: Abbreviated function name
**Severity**: Major
**Suggestion**: `function processApiResponse(data) {}`
**Reason**: Full words are more readable

### src/models/User.js:34
**Current**: `user.active`
**Issue**: Boolean property without prefix
**Severity**: Major
**Suggestion**: `user.isActive`
**Reason**: Follow boolean naming convention

### src/utils/format.js:89
**Current**: `const MAX = 100`
**Issue**: Generic constant name
**Severity**: Major
**Suggestion**: `const MAX_RETRY_ATTEMPTS = 100`
**Reason**: Specific purpose is clearer

---

## Minor Issues (6)

### src/config/settings.js:12
**Current**: `const API_url = '...'`
**Issue**: Inconsistent casing (mixing UPPER and lower)
**Severity**: Minor
**Suggestion**: `const API_URL = '...'` or `const apiUrl = '...'`
**Reason**: Consistency in convention

### src/helpers/string.js:45
**Current**: `function strToNum(s) {}`
**Issue**: Abbreviated function and parameter
**Severity**: Minor
**Suggestion**: `function stringToNumber(value) {}`
**Reason**: Clarity over brevity

---

## Convention Violations

### Inconsistent Boolean Prefixes
**Locations**: 8 files
**Issue**: Mixed use of `is`, `has`, `can` vs no prefix
**Recommendation**: Standardize on boolean prefixes
- Use `is` for state: `isActive`, `isVisible`
- Use `has` for possession: `hasPermission`, `hasError`
- Use `can` f
commandsSkill

Add a skill to the project with validation and README generation

sync-skills-readmeSlash Command

Sync root README.md with current skills inventory from skills/ directory

ascii-ui-mockup-generatorSubagent

Use this agent when you need to visualize UI concepts through ASCII mockups before implementation. Examples: <example>Context: User has an idea for a dashboard layout with data tables and charts. user: 'I want to create a dashboard that shows user analytics with a sidebar navigation, main content area with charts, and a data table below' assistant: 'I'll use the ascii-ui-mockup-generator agent to create multiple ASCII mockup variations for your dashboard concept.' <commentary>The user wants to visualize a UI concept, so use the ascii-ui-mockup-generator to create multiple ASCII representations they can choose from.</commentary></example> <example>Context: User is designing a form layout with multiple input fields. user: 'I need a contact form with name, email, message fields and a submit button' assistant: 'Let me use the ascii-ui-mockup-generator to create several ASCII mockup options for your contact form layout.' <commentary>Since the user needs to visualize form layouts, use the ascii-ui-mockup-generator to provide multiple ASCII design options.</commentary></example>

codebase-pattern-finderSubagent

codebase-pattern-finder is a useful subagent_type for finding similar implementations, usage examples, or existing patterns that can be modeled after. It will give you concrete code examples based on what you're looking for! It's sorta like codebase-locator, but it will not only tell you the location of files, it will also give you code details!

communication-excellence-coachSubagent

PROACTIVELY use when reviewing communication drafts or preparing difficult conversations. Provides email refinement, tone calibration, roleplay practice, and presentation feedback with actionable suggestions.

general-purposeSubagent

Default agent for handling complex, multi-step tasks with automatic delegation capabilities

mermaid-diagram-specialistSubagent

Mermaid diagram specialist for creating flowcharts, sequence diagrams, ERDs,

ui-ux-designerSubagent

Expert UI/UX design critic and advisor who provides research-backed, opinionated feedback on interfaces. Use when you need honest assessment of design decisions, want to avoid generic "AI slop" aesthetics, need evidence-based UX guidance, or want distinctive design direction grounded in actual user behavior research. This agent will push back on bad ideas and cite sources for every recommendation.