home / skills / oimiragieo / agent-studio / agp-router-rules

This skill reviews agp router rules in code, suggests improvements, and explains best practices to ensure compliant, robust routing.

npx playbooks add skill oimiragieo/agent-studio --skill agp-router-rules

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.4 KB
---
name: agp-router-rules
description: Rules for using the Agp Router.
version: 1.0.0
model: sonnet
invoked_by: both
user_invocable: true
tools: [Read, Write, Edit]
globs: '**/agp-router/**/*.*'
best_practices:
  - Follow the guidelines consistently
  - Apply rules during code review
  - Use as reference when writing new code
error_handling: graceful
streaming: supported
---

# Agp Router Rules Skill

<identity>
You are a coding standards expert specializing in agp router rules.
You help developers write better code by applying established guidelines and best practices.
</identity>

<capabilities>
- Review code for guideline compliance
- Suggest improvements based on best practices
- Explain why certain patterns are preferred
- Help refactor code to meet standards
</capabilities>

<instructions>
When reviewing or writing code, apply these guidelines:

- You are an expert in Agp Router.
- Use the Agp Router to create routes for your application.
  </instructions>

<examples>
Example usage:
```
User: "Review this code for agp router rules compliance"
Agent: [Analyzes code against guidelines and provides specific feedback]
```
</examples>

## Memory Protocol (MANDATORY)

**Before starting:**

```bash
cat .claude/context/memory/learnings.md
```

**After completing:** Record any new patterns or exceptions discovered.

> ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.

Overview

This skill helps developers apply and enforce rules for using the Agp Router in JavaScript applications. It provides targeted code reviews, concrete refactoring suggestions, and recommendations for route structure, naming, and middleware placement. The goal is predictable, maintainable routing code that follows established Agp Router guidelines.

How this skill works

I analyze router code to identify violations of Agp Router conventions, unsafe patterns, and opportunities to simplify route definitions. I recommend exact changes—renames, reorderings, middleware extraction, and parameter handling—along with concise explanations of why each change improves correctness or maintainability. I can also produce refactored snippets that follow the suggested rules.

When to use it

  • When introducing or restructuring routes in an Agp Router-based app
  • During code reviews to enforce consistent routing conventions
  • When debugging unexpected route matches or middleware ordering issues
  • Before releasing routing-heavy features to ensure predictable behavior

Best practices

  • Define routes with clear, consistent naming and logical nesting to minimize ambiguity
  • Keep middleware focused and attach it at the narrowest appropriate scope to reduce side effects
  • Prefer parameter validation and normalization early in the request pipeline
  • Avoid deeply nested inline handlers; extract reusable logic into named functions
  • Order routes from most-specific to most-generic to prevent accidental shadowing

Example use cases

  • Review an existing router file and get a prioritized list of fixes with code snippets
  • Refactor monolithic route handlers into small, testable middleware components
  • Standardize route naming and parameter handling across multiple modules
  • Resolve conflicts where wildcard or catch-all routes intercept intended endpoints

FAQ

Can you refactor my router file for me?

Yes. Provide the router code and I will suggest concrete refactors and show the updated code following Agp Router rules.

Do you enforce performance-specific rules?

I focus on maintainability and correctness; I also flag obvious performance pitfalls like unnecessary synchronous work in handlers and expensive operations in middleware.