> For the complete documentation index, see [llms.txt](https://docs.specifyapp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.specifyapp.com/resources/best-practices.md).

# Best practices

## Set your Personal Access Token as an environment variable

Your Specify personal access token must always be **private**. We highly recommend you to set it in a private environment variable or in a `.env` file.

### Using an `.env` file in a JavaScript config file

{% code title=".env" %}

```bash
SPECIFY_ACCESS_TOKEN=ab83f8f49f5c65456c7b1fe70efbc804aa08f87150214aa984d4125945ed8283bash
```

{% endcode %}

{% tabs %}
{% tab title="ESM" %}
{% code title=".specifyrc.mjs" %}

```javascript
import path from 'node:path';
import process from 'node:process';
import dotenv from 'dotenv';

dotenv.config({
  path: path.resolve(process.cwd(), '.env.specify-cli'),
});

export default {
  version: '2',
  repository: '@workspace/repository',
  personalAccessToken: process.env.SPECIFY_ACCESS_TOKEN,
  rules: [],
};
```

{% endcode %}
{% endtab %}

{% tab title="CommonJS" %}
{% code title=".specifyrc.cjs" %}

```javascript
const path = require('path');
const envFile = '.env';
require('dotenv').config({ path: path.resolve(process.cwd(), envFile) });

module.exports = {
  version: '2',
  repository: '@workspace/repository',
  personalAccessToken: process.env.SPECIFY_TOKEN,
  rules: [],
};
```

{% endcode %}

{% endtab %}
{% endtabs %}

### Using the `--personal-access-token` CLI flag

You can inject your personal access token through the `--personal-access-token, -p` CLI flag.

```bash
specify pull -p $SPECIFY_TOKEN
```

{% hint style="info" %}
You can use this method to sync Specify with git repositories in [GitLab](https://specifyapp.com/blog/specify-to-gitlab#creating-the-merge-request), [GitHub](https://specifyapp.com/blog/how-to-pull-design-tokens-from-several-specify-repositories-on-github#how-to-use-this-workflow-in-github), [Azure DevOps](https://specifyapp.com/blog/specify-to-azure) or [Bitbucket](https://specifyapp.com/blog/specify-to-bitbucket).
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.specifyapp.com/resources/best-practices.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
