# Add Routes

> Add Sylius admin routes for an existing Resource with a Grid

- Skill: `guiziweb/add-routes` (Agent Skill)
- Install (CLI): `npx skillmds@latest add guiziweb/add-routes`
- Raw SKILL.md: https://api.skillmd.com/api/skills/guiziweb/add-routes/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: guiziweb (https://skillmd.com/u/guiziweb)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/guiziweb/add-routes

---


# Add admin Routes for a Sylius Resource

Ask the user for the ModelName if not provided.

**Prerequisites:**
- Model exists as a Sylius Resource (`/sylius-app:add-model`)
- Grid is configured (`/sylius-app:add-grid`)

## 1. Add the routes

Edit `config/routes/admin.yaml` (create if missing). Append a new resource block:

```yaml
app_admin_{model_snake}:
    resource: |
        alias: app.{model_snake}
        section: admin
        templates: '@SyliusAdmin/shared/crud'
        except: ['show']
        redirect: update
        grid: app_admin_{model_snake}
        vars:
            all:
                subheader: app.ui.manage_{model_snake_plural}
            index:
                icon: 'tabler:list'
    type: sylius.resource
    prefix: /admin
```

The top-level key and the `grid:` value must match the grid name from `/sylius-app:add-grid`. Remove `except: ['show']` to enable the show route (also requires a show template).

## 2. Ensure the file is imported

`config/routes/*.yaml` files are auto-loaded by Symfony. Usually nothing to do — verify via §3 before adding any import.

## 3. Clear cache

```bash
bin/console cache:clear
```

## 4. Verify

- [ ] `bin/console debug:router | grep {model_snake}` lists 4 routes (`_index`, `_create`, `_update`, `_delete`) — plus `_show` if the show action was enabled

## Next steps

- Add admin menu entry → `/sylius-app:add-menu`
- Add translations for `app.ui.manage_{model_snake_plural}` in the project's default translations file (run `bin/console debug:container --parameter=kernel.default_locale` to get the locale)

