agentleFS
AnyOrgNameAnyOrgName/php-skills/skills/codeigniter/routing/SKILL.md

routing

Skill4 starsChanged 4 months agoMITView on GitHub

Define CodeIgniter 4 routes in Routes.php — explicit routes over auto-routing, route groups with shared prefixes and namespaces, and filters for cross-cutting concerns. Use when the user wants to attach a before/after filter such as auth or CSRF to specific CodeIgniter routes or groups; the user wants to map URLs to controller actions in CodeIgniter 4 by declaring routes in Config/Routes.php; the user needs to group CodeIgniter routes under a shared URL prefix, namespace, or filter set. Keywords: codeigniter, routing, routes, route-groups, filters, auto-routing.

13 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use parallelization, prompt-chaining and 1 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • hajekimSkill

    parallelization

    This skill should be used when the user wants to "run tasks in parallel", "concurrent LLM calls", "fan-out and fan-in", "parallel agents", "simultaneous execution", "reduce latency with concurrency", "parallel sub-tasks", "parallel processing", "concurrent agent execution", "run agents simultaneously", "speed up with parallelism", "async agent execution", "batch LLM calls", "parallel workflow", "parallelize agent tasks", or needs to execute multiple independent tasks simultaneously. Also responds to Korean: "병렬 작업 실행", "동시 LLM 호출", "팬아웃 팬인 패턴", "병렬 에이전트", "동시 실행", "동시성으로 지연 시간 감소", "병렬로 실행", "동시에 여러 작업", "병렬 처리", "동시에 돌려줘", "빠르게 병렬로", "여러 작업 동시 실행해줘". Also responds to Japanese: "並列処理", "同時実行", "並列エージェント", "並行LLM呼び出し", "ファンアウト・ファンイン", "複数タスクを同時に実行したい", "処理速度を上げたい", "非同期エージェント", "バッチ処理", "並列で動かしたい" Also responds to Chinese: "并行处理", "并发执行", "并行智能体", "同时调用多个LLM", "扇出扇入模式", "多任务并行运行", "加快处理速度", "异步智能体", "批量LLM调用", "同时运行多个任务".. Apply this skill to design or implement the Parallelization agentic design pattern.

    Also in 3 projects that use this

  • hajekimSkill

    prompt-chaining

    This skill should be used when the user wants to "chain prompts", "build a pipeline", "break down complex tasks into steps", "sequential LLM calls", "multi-step reasoning", "pipeline pattern", "sequential agent pipeline", "multi-step prompt pipeline", "LLM chain", "step-by-step agent", "prompt pipeline", "decompose task into prompts", "stage-by-stage processing", "chained LLM calls", or when a task is too complex for a single prompt and needs to be decomposed into sequential sub-tasks. Also responds to Korean: "프롬프트 체이닝", "체인 방식 에이전트", "단계별 LLM 호출", "복잡한 작업 분해", "순차적 프롬프트 파이프라인", "단계적 작업 처리", "단계별 처리", "순차 처리 에이전트", "파이프라인 만들어줘", "단계적으로 처리해줘", "연속 프롬프트", "체이닝 해줘". Also responds to Japanese: "プロンプトチェーニング", "ステップごとに処理", "順次LLM呼び出し", "パイプライン構築", "複雑なタスクを分解", "段階的エージェント", "連続プロンプト", "LLMパイプライン", "順番に処理してほしい", "チェーン方式エージェント" Also responds to Chinese: "提示词链", "顺序调用LLM", "构建流水线", "分解复杂任务", "逐步处理", "链式提示", "多步骤流水线", "按顺序处理任务", "提示词管道", "帮我一步一步处理".. Apply this skill to design, implement, or explain the Prompt Chaining agentic design pattern.

    Also in 3 projects that use this

  • NVIDIASkill

    testing

    Run Python and Rust tests for physicsnemo-curator using uv + pytest with coverage reporting via pytest-cov, and cargo-nextest for Rust tests. Includes benchmark workflows with pytest-benchmark and criterion.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do not apply this skill to CodeIgniter 3 $route[] array config.

    line 64
  2. Distinctive:

    Do not use this skill to write the controller action body itself.

    line 65
  3. Very specific:

    Add the filter to Config\Filters::$aliases, e.g.

    line 76
  4. Distinctive:

    Not applicable — no I/O, auth, or untrusted input.

    line 113

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- generated: do not edit — source: knowledge/atoms/codeigniter/routing/ --><!-- schema: atomVersion=3 skillVersion=2 graphVersion=1 --><!-- compile: @php-skills/compiler v1.0.0 (deterministic build) -->

CodeIgniter 4 Routing

When to use

  • The user wants to attach a before/after filter such as auth or CSRF to specific CodeIgniter routes or groups.
  • The user wants to map URLs to controller actions in CodeIgniter 4 by declaring routes in Config/Routes.php.
  • The user needs to group CodeIgniter routes under a shared URL prefix, namespace, or filter set.

When NOT to use

  • Do not apply this skill to CodeIgniter 3 $route[] array config; CI4 uses a fluent RouteCollection API.
  • Do not use this skill to write the controller action body itself; routing only maps a URL to a handler.

Core guidance

  • Prefer explicit routes over auto-routing — Define routes explicitly with $routes->get('/users/(:num)', 'Users::show/$1') and keep auto-routing disabled unless a throwaway prototype needs it.
  • Bind routes to the specific HTTP verb — Use the verb-specific method ($routes->post(...), ->put(...), ->delete(...)) rather than $routes->add(...), so each URL only matches its intended method.

Quick recipe

  1. Add the filter to Config\Filters::$aliases, e.g. 'auth' => \App\Filters\AuthFilter::class, so routes can reference it by name. (verify: The alias resolves without a "filter not found" error)
  2. Wrap the admin routes in $routes->group('admin', ['filter' => 'auth'], function ($r) { ... }) so every route in the group runs the filter. (verify: An unauthenticated request to any admin route is rejected by the filter)
  3. Inside the group, declare $r->get('users/(:num)', 'Users::show/$1') and $r->post('users', 'Users::create') and name them with the as option. (verify: A GET to a numeric id reaches Users::show and route_to() builds the URL)

Best practices

  • Wrap related routes in `$routes->group('admin', ['filter' => 'auth'], function ($r) { ..
  • Give routes a name via the as option and build URLs with route_to('name', $id) instead of hardcoding path strings across views and controllers
  • Constrain dynamic segments with placeholders like (:num), (:alpha), or (:segment) and pass them to the action with $1, $2 in order

Anti-patterns

Anti-patternWhy it failsDo instead
Enforcing auth per action instead of per groupPer-action checks are easy to forget on a new action, leaving a route unprotected.Put protected routes in a group with the auth filter so coverage is structural, not per-method.
Hardcoding URL paths across the appHardcoded paths break every time a route changes and drift out of sync with Routes.php.Name routes and generate URLs with route_to() / url_to().
Business logic inside Routes.php closuresLogic buried in Routes.php is untestable, unloadable by name, and hidden from the controller layer.Route to a controller action and keep Routes.php limited to URL-to-handler mapping.

See references/anti-patterns.md.

Common mistakes

  1. Auto-routing exposes every public method — With auto-routing enabled, every public controller method is reachable at a guessable URL. Fix: Disable auto-routing (setAutoRoute(false)) and declare only the routes you intend to expose.
  2. Filter alias must be registered in Filters config — Referencing a filter by alias in a route fails silently if the alias is not registered in Config\Filters. Fix: Register the alias in Config\Filters::$aliases before using it in a route or group.
  3. A broad route shadows more specific ones — Routes are matched top-down, so a greedy (:any) route declared first swallows later specific routes. Fix: Declare specific routes before catch-all patterns and keep (:any) last.

Version notes

  • CI4 replaced the CI3 route array with RouteCollection — CodeIgniter 4 replaced the CI3 $route[] config array with a fluent $routes RouteCollection API and route groups.

Security

  • Not applicable — no I/O, auth, or untrusted input.

Testing

  • Activation and decision behavior are verified in eval/scenarios/codeigniter/routing.yaml.

Additional resources

  • references/anti-patterns.md
  • references/core.md
  • references/examples.md
  • references/pitfalls.md
  • references/recipes.md
  • references/version-differences.md

Knowledge graph

Related: codeigniter/controllers

<!-- graph-fragment: graph/fragments/codeigniter/routing.yaml -->

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.