返回 Skill 列表
extension
分类: 开发与工程无需 API Key

laravel-docs

使用语义向量搜索查找官方Laravel生态系统文档。仅当需要针对Laravel生态系统包的特定版本信息时(例如,检查不同版本之间的API更改、确认特定版本的当前语法或验证某个版本中可用的功能)才使用此技能。不要将此技能用于代理已经知道的一般Laravel知识——只有在需要准确的、特定版本的文档时才使用。涵盖laravel/framework, livewire, inertia, filament及其他生态系统包。重要提示 - 使用2-4个技术术语查询(如,“hasMany belongsTo”),而不是自然语言问题(如,“如何创建关系”)。

person作者: jakexiaohubgithub

Laravel Docs Search (delegated)

Why delegate

Raw docs chunks are large (~1500 tokens/call) and often include prose you won't reuse. A sub-agent can absorb the full markdown, synthesise a compact answer (method signatures, version notes, gotchas), and hand only that back — keeping your working context clean.

Workflow

  1. Read composer.json in the project — grab laravel/framework version, normalize to major.x (e.g. ^13.013.x).
  2. Spawn one sub-agent using the Agent tool (subagent_type: general-purpose) with the prompt template below. Wait for it — you need the answer before writing code.
  3. Use the returned synthesis to write the implementation. If gaps remain after reading the answer, spawn one follow-up sub-agent with the missing queries. Don't exceed 2 sub-agent calls per task.

Agent tool invocation

  • description: short label, e.g. "Laravel docs: <topic>"
  • subagent_type: general-purpose
  • prompt: use the template below, filling in {VERSION} and {QUERIES}

Prompt template for the sub-agent

You are looking up Laravel framework documentation and returning a compact synthesis. Do not do anything else.

Laravel version: {VERSION}
Queries (2-4 word technical terms, already crafted): {QUERIES}

Steps:
1. Call the Laravel docs API in a single request:

   curl -sS -X POST https://boost.laravel.com/api/docs \
     -H "Content-Type: application/json" \
     -d '{"queries": {QUERIES_JSON_ARRAY}, "packages": [{"name":"laravel/framework","version":"{VERSION}"}], "token_limit": 1500, "format": "markdown"}'

2. If the first call misses the target API or returns nothing useful, make at most one follow-up call with refined queries. Hard cap: 2 calls total.

3. Return a synthesis with this structure (markdown, ~150-300 words):

   ## API
   - method/class signatures the caller needs, one per line
   - include namespace if non-obvious

   ## Usage
   - 1-3 minimal code snippets showing the canonical pattern

   ## Version notes
   - anything that changed in recent versions, deprecations, or gotchas
   - say "no version-specific notes found" if none

   ## Source
   - doc page titles/paths the info came from

Do NOT return raw doc chunks. Do NOT include unrelated methods. If the docs contradict common older patterns, call that out explicitly.

Query crafting rules (apply before sending to sub-agent)

  • 2-4 word technical terms — NO natural language questions
  • Use Laravel vocabulary: "eloquent" not "database model", "mailable" not "email class"
  • Use method/class names when known: hasMany belongsTo, Cache::remember
  • Word order matters — prefer natural technical order
  • Batch all queries for one topic into a single sub-agent call

Example

Task: user wants to add per-user rate limiting to an API route on Laravel 13.

  1. Detect 13.x from composer.json.
  2. Spawn sub-agent with queries like ["rate limiting api", "RateLimiter::for", "throttle middleware"].
  3. Receive synthesis — something like:
    ## API
    - RateLimiter::for('api', fn (Request $r) => Limit::perMinute(60)->by($r->user()?->id))
    - Route::middleware('throttle:api')
    ## Usage
    ...
    ## Version notes
    - no version-specific notes found
    
  4. Write the code using the synthesis — no raw docs in your context.