Skip to content
Back to skills

Smart Routing

ASecurity

--- name: smart-routing description: Intelligently route files, requests, and tasks to appropriate handlers ---

  • 33 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 10, 2026
developmentjavascripttypescriptjavareactnextjstestingdebuggingrefactoringapisecurity

Works with

  • api

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add lovedragonball/power-ranger-toolkit --skill smart-routing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Smart Routing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Smart Routing
[![Security: A β€” Skills Directory](https://www.skillsdirectory.com/api/skills/lovedragonball-smart-routing/badge)](https://www.skillsdirectory.com/skills/lovedragonball-smart-routing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# πŸ›€οΈ Smart Routing Skill

---
name: smart-routing
description: Intelligently route files, requests, and tasks to appropriate handlers
---

## 🎯 Purpose

Automatically determine the best location, handler, or approach for files, requests, and tasks.

## πŸ“‹ When to Use

- Creating new files
- Organizing codebase
- Routing API requests
- Assigning tasks to agents

## πŸ—‚οΈ File Routing

### By File Type
| Extension | Location | Purpose |
|-----------|----------|---------|
| `.tsx`, `.jsx` | `src/components/` | React components |
| `.ts`, `.js` | `src/utils/` | Utility functions |
| `.css`, `.scss` | `src/styles/` | Stylesheets |
| `.test.ts` | Same dir as source | Tests |
| `.md` | `docs/` | Documentation |
| `.json` | `config/` or root | Configuration |

### By Purpose
| Purpose | Location |
|---------|----------|
| Page component | `src/pages/` or `app/` |
| Shared component | `src/components/` |
| API route | `src/api/` or `app/api/` |
| Hook | `src/hooks/` |
| Context | `src/contexts/` |
| Type definitions | `src/types/` |
| Constants | `src/constants/` |

## πŸ”€ Request Routing

### API Patterns
```javascript
// RESTful routing
GET    /api/users        β†’ List users
GET    /api/users/:id    β†’ Get user
POST   /api/users        β†’ Create user
PUT    /api/users/:id    β†’ Update user
DELETE /api/users/:id    β†’ Delete user
```

### Route Naming
```javascript
// Naming conventions
/api/v1/resource           // Versioned API
/api/resource/:id/subresource  // Nested resource
/api/resource?filter=value     // Query params
```

## πŸ€– Task Routing

### To Appropriate Skill
| Task Type | Route To |
|-----------|----------|
| Bug fix | `debugging` |
| New feature | `code-generation` |
| UI work | `design-mastery` |
| Testing | `testing` |
| Deployment | `deployment` |
| Security | `security-audit` |

### By Complexity
| Complexity | Approach |
|------------|----------|
| Simple | Direct implementation |
| Medium | Plan then implement |
| Complex | Design doc β†’ Review β†’ Implement |

## πŸ“ Project Structure Templates

### Web App (Vite/React)
```
src/
β”œβ”€β”€ components/    ← UI components
β”œβ”€β”€ pages/         ← Page components
β”œβ”€β”€ hooks/         ← Custom hooks
β”œβ”€β”€ utils/         ← Helper functions
β”œβ”€β”€ services/      ← API calls
β”œβ”€β”€ stores/        ← State management
β”œβ”€β”€ types/         ← TypeScript types
└── assets/        ← Static assets
```

### Next.js App Router
```
app/
β”œβ”€β”€ (auth)/        ← Auth routes group
β”œβ”€β”€ api/           ← API routes
β”œβ”€β”€ dashboard/     ← Dashboard pages
β”œβ”€β”€ layout.tsx     ← Root layout
└── page.tsx       ← Home page
```

## πŸ”§ Routing Logic

```javascript
function routeFile(filename, purpose) {
  // By extension
  if (filename.endsWith('.test.ts')) {
    return 'alongside source';
  }
  
  // By purpose
  const routes = {
    'component': 'src/components/',
    'page': 'src/pages/',
    'hook': 'src/hooks/',
    'util': 'src/utils/',
    'type': 'src/types/',
    'api': 'src/api/'
  };
  
  return routes[purpose] || 'src/';
}
```

## πŸ’‘ Best Practices

1. **Consistent naming**: Use same pattern throughout
2. **Group by feature**: When project grows
3. **Flat when possible**: Avoid deep nesting
4. **Co-locate related**: Tests near source
5. **Clear boundaries**: Separate concerns

## πŸ”— Related Skills

- `project-setup` - Initial structure
- `refactoring` - Reorganize existing code
- `documentation` - Document routing decisions

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…