Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计通过

provide-inject提供注入

Agent Skill

provide-inject 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,717

周安装

73

GitHub Stars

173

下载量

602
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:provide-inject(提供注入)
来源仓库:https://github.com/patternsdev/skills
仓库路径:skills/provide-inject
安装命令:
npx skills add https://github.com/patternsdev/skills --skill provide-inject
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/patternsdev/skills --skill provide-inject

简介

provide-inject 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用。
  • 安装前需确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。
  • 建议结合原始 README 核验具体用法和功能边界。

SKILL.md

Provide/Inject

When managing data between parent and child components, Vue gives us the ability to use something known as props to pass data down from parent to child. Props can only flow in one direction, from parent components to child components (and further down). When state changes occur on parent elements, Vue will re-render components that depend on those values.

Using props works well in most cases. However, when working in large applications with a large number of components in the component tree, props can become hard to maintain since props need to be declared in *each and every component* in the component tree.

When to Use

  • Use this when you need to pass data through deeply nested component trees without prop drilling
  • This is helpful for application-wide data like themes, locale, or authentication state

When NOT to Use

  • For parent-child communication where props are simpler, more explicit, and easier to trace
  • When the implicit dependency makes components harder to test in isolation or reuse outside the provider tree
  • When a state management solution (Pinia) is already in place and provides the same shared state capability

Instructions

  • Use provide() in a parent or ancestor component to make data available to all descendants
  • Use inject() in child components to access provided data
  • Use app-level app.provide() for data needed across the entire application (e.g., plugins)
  • Prefer props for data isolated to a specific set of components; use provide/inject for cross-cutting concerns
  • Be aware that debugging can be harder with provide/inject in large apps with many providers

Details

When considering how data can be managed between a large number of components, it's often best to work towards a solution that allows the management of application-level state in a maintainable and manageable manner (e.g. creating a reusable store, using Pinia, etc.). We talk about this in more detail in the State Management guide.

However, Vue also provides a certain pattern to help avoid the need for complex prop drilling in a Vue application known as the provide/inject pattern.

Provide/Inject

The provide() function in Vue allows us to pass data through a component tree without the need to *prop-drill* (i.e., pass props down manually at every level). On the other hand, the inject() option is used in child components to access the provided data or methods from their parent or any ancestor component.

We'll go through a simple example to illustrate how this can be done. Suppose we have a parent component called App that wants to share a piece of data with its child component, ChildComponent. Instead of passing this data as a prop, we can use provide() in the parent component to make the data available to all its child components.

<template>
  <div id="app">
    <ChildComponent />
  </div>
</template>

<script setup>
  import { provide } from "vue";
  import ChildComponent from "./components/ChildComponent";

  provide("data", "Data from parent!");
</script>

We can then access this provided data in the ChildComponent with the help of the inject() function.

<template>
  <div>
    <p>{{ data }}</p>
  </div>
</template>

<script setup>
  import { inject } from "vue";

  const data = inject("data");
</script>

By specifying inject("data") in the child component (ChildComponent), we directly access the provided data value from the parent component. We then bind data to the template to display its value.

With provide/inject, we would notice the same behavior even if we had numerous child components within the component hierarchy tree. Data from the parent <App /> component will be rendered in any deeply nested child component without the need to prop-drill data through every component in the tree, thanks to provide/inject!

In addition to being able to provide() data from a parent component, we can lift the provide() up to the app level as well (i.e. where we instantiate our Vue application).

import { createApp } from "vue";
import App from "./App.vue";
import "./styles.css";

const app = createApp(App);

// app-level provide
app.provide("data", "Data from parent!");

app.mount("#app");

Since app-level provides make data available to *all* components, they are often helpful when creating plugins — self-contained code that adds functionality to the entire Vue app.

Props vs. provide/inject

When do we choose between props and the provide/inject pattern? Both approaches have their advantages and disadvantages.

With props:

  • We follow a clear pattern of passing data incrementally from one level to another (advantage).
  • However, if our component hierarchy tree contains a large number of components, the process of passing props data one level at a time can become cumbersome (disadvantage).

With provide/inject

  • Child components can directly access data from parent components located multiple levels above, eliminating the need for passing down data at each level (advantage).
  • However, when bugs arise, debugging can be more challenging with provide/inject. This challenge becomes more pronounced in large-scale applications with numerous different providers (disadvantage).

The provide/inject pattern is most suitable for application-wide client data, such as theme information, locale/language preferences, and user authentication details. These types of data are better managed with provide/inject since any component within the application may require access to them at any given time.

On the other hand, props are ideal when data needs to be isolated within a specific set of components only.

Source

References

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.52%
按下载量换算232

Claude

28.19%
按下载量换算170

Cursor

18.75%
按下载量换算113

Gemini CLI

9.21%
按下载量换算55

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills