> ## Documentation Index
> Fetch the complete documentation index at: https://litprotocol-vincent.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

Create your first Vincent Policy in under 20 minutes using the Vincent Starter Kit.

<Card title="Ability Starter Kit" icon="github" href="https://github.com/LIT-Protocol/vincent-ability-starter-kit">
  Clone the Vincent Starter Kit repository for quick setup
</Card>

## Prerequisites

<CardGroup cols={3}>
  <Card title="Node.js" icon="node" href="https://nodejs.org/en/download">
    Version 20.19.4 or higher
  </Card>

  <Card title="Corepack" icon="box" href="https://github.com/nodejs/corepack">
    Version 20.19.4 or higher
  </Card>

  <Card title="Pinata Account" icon="cloud" href="https://pinata.cloud">
    For IPFS storage of your Policy code
  </Card>
</CardGroup>

## Setup

<Steps>
  <Step title="Clone the Starter Kit">
    ```bash theme={null}
    git clone git@github.com:LIT-Protocol/vincent-ability-starter-kit.git
    cd vincent-ability-starter-kit
    ```
  </Step>

  <Step title="Ensure Corepack is Updated">
    ```bash theme={null}
    # Verify your corepack version (should be > 0.31.0)
    corepack -v

    # If needed, update corepack to the latest version
    npm install -g corepack@latest

    # Enable Corepack globally
    corepack enable
    ```
  </Step>

  <Step title="Run Bootstrap">
    ```bash theme={null}
    corepack enable pnpm
    pnpm bootstrap
    ```

    The bootstrap will prompt you for:

    * **Pinata JWT**: Get from [Pinata](https://pinata.cloud) after creating an account
    * **Test wallet private key**: Fund with test tokens from the [Lit Faucet](https://faucet.litprotocol.com)
  </Step>

  <Step title="Verify Setup">
    ```bash theme={null}
    pnpm test-e2e
    ```

    If successful, you'll see all tests passing and your environment is ready.
  </Step>
</Steps>

## Create Your Policy

<Steps>
  <Step title="Copy the Template">
    ```bash theme={null}
    # Replace 'my-policy' with your desired package name
    mkdir -p packages/my-policy
    rsync -a --exclude='node_modules/' --exclude='dist/' \
      packages/policy-counter/ packages/my-policy/
    ```
  </Step>

  <Step title="Update Package Configuration">
    **1. Edit `packages/my-policy/package.json`:**

    ```json theme={null}
    {
      "name": "@your-org/my-policy",
      "version": "0.0.1",
      "description": "Your policy description here"
    }
    ```

    **2. Edit `packages/my-policy/project.json`:**

    Replace all occurrences of `policy-counter` with `my-policy`:

    * `"name": "my-policy"`
    * `"sourceRoot": "packages/my-policy/src"`
    * `"cwd": "packages/my-policy"` (all instances)
    * `"input": "packages/my-policy/src/generated"`
    * `"outputPath": "packages/my-policy/dist"`
    * `"main": "packages/my-policy/src/index.ts"`
    * `"tsConfig": "packages/my-policy/tsconfig.lib.json"`
    * All asset paths

    **3. Edit `packages/my-policy/jest.config.js`:**

    ```javascript theme={null}
    module.exports = {
      displayName: '@your-org/my-policy', // Update this
      // ... rest of config
    };
    ```

    **4. Update `nx.json` in repository root:**

    Add your package to the release projects:

    ```json theme={null}
    {
      "release": {
        "projects": ["ability-native-send", "policy-counter", "test-e2e", "my-policy"]
      }
    }
    ```
  </Step>

  <Step title="Define Your Policy Logic">
    Edit `packages/my-policy/src/lib/vincent-policy.ts`:

    ```typescript theme={null}
    export const vincentPolicy = createVincentPolicy({
      packageName: '@your-org/my-policy',

      // There are other configurations here, not covered in the Quick Start.
      // Please read the other guides for more details.

      // Schemas for parameters and results
      abilityParamsSchema,
      userParamsSchema,
      commitParamsSchema,

      // Local validation - runs before execution
      precheck: async ({ abilityParams, userParams }, { allow, deny }) => {
        // Validate parameters and current state
        if (/* validation passes */) {
          return allow({ /* validation data */ });
        }
        return deny({ reason: 'Validation failed' });
      },

      // Evaluation - runs in Lit Action environment
      evaluate: async ({ abilityParams, userParams }, { allow, deny }) => {
        // Check policy state and determine if execution allowed
        if (/* policy allows execution */) {
          return allow({ /* evaluation data */ });
        }
        return deny({ reason: 'Policy denied execution' });
      },

      // State update - runs after successful execution
      commit: async (commitParams, { allow, deny }) => {
        // Update policy state
        return allow({ /* commit success data */ });
      },
    });
    ```
  </Step>

  <Step title="Configure User Interface">
    Edit `packages/my-policy/src/inputUiSchema.json` to define how users configure your Policy:

    ```json theme={null}
    {
      "jsonSchema": {
        "type": "object",
        "properties": {
          "maxAmount": {
            "type": "number",
            "title": "Maximum Amount",
            "description": "Maximum amount allowed per transaction"
          }
        }
      },
      "uiSchema": {
        "maxAmount": {
          "ui:placeholder": "Enter maximum amount"
        }
      }
    }
    ```
  </Step>

  <Step title="Build and Test">
    ```bash theme={null}
    pnpm install
    pnpm nx build my-policy
    pnpm test-e2e
    ```
  </Step>

  <Step title="Deploy to IPFS">
    ```bash theme={null}
    pnpm nx action:deploy my-policy
    ```

    Your Policy is now deployed and ready to be used by Vincent Abilities!
  </Step>

  <Step title="Publish Your Policy">
    When you're prepared, you can publish the Policy to `npm`. This will make it publishable
    in the Vincent Registry.

    ```bash theme={null}
    cd packages/my-policy
    pnpm publish
    ```
  </Step>

  <Step title="Register in Vincent Registry">
    See the [Publishing Guide](/ability/policy/publishing) for details on registering your Policy in the Vincent Registry.
  </Step>
</Steps>

## Quick Commands

<ParamField path="build" type="command">
  `pnpm nx build my-policy` - Build your Policy package
</ParamField>

<ParamField path="test" type="command">
  `pnpm test-e2e` - Run end-to-end tests with the Vincent system
</ParamField>

<ParamField path="deploy" type="command">
  `pnpm nx action:deploy my-policy` - Deploy to IPFS via Pinata
</ParamField>

<ParamField path="clean" type="command">
  `pnpm clean` - Remove build artifacts
</ParamField>

## What's Next?

<CardGroup cols={3}>
  <Card title="Policy Structure" icon="code" href="/ability/policy/explaining-policies">
    Learn how Policies work under the hood
  </Card>

  <Card title="Example Policies" icon="github" href="https://github.com/LIT-Protocol/vincent-starter-kit/tree/main/packages">
    Study the included examples
  </Card>

  <Card title="Integration Guide" icon="link" href="/ability/supporting-policies">
    Connect Policies with Abilities
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.