# Build Actors with AI

This guide provides best practices for building new Actors or improving existing ones using AI code generation tools by providing the AI agents with the right instructions and context.

The methods on this page are complementary. Start with the  or  to get going, then add  and the  to give your assistant more context and better results.

## Quick start

* Start with a prompt
* Start with a template

1. Create a directory: `mkdir my-new-actor`.
2. Open the directory in *Cursor*, *Claude Code*, *VS Code with GitHub Copilot*, etc.
3. Copy the  and paste it into your AI coding assistant.
4. Run it, and develop your first Actor with the help of AI.

1) [Install the Apify CLI](https://pr-2338.preview.docs.apify.com/cli/docs/installation) if you haven't already.
2) Run `apify create` to initialize an Actor from a [template](https://apify.com/templates) (includes AGENTS.md).
3) Open the project in *Cursor*, *Claude Code*, *VS Code with GitHub Copilot*, etc.
4) Start developing - your AI coding assistant automatically picks up context from AGENTS.md.

## AI coding assistant instructions

Use the following prompt in your AI coding assistant such as [Cursor](https://cursor.com/), [Claude Code](https://claude.com/product/claude-code), or [GitHub Copilot](https://github.com/features/copilot):

Use pre-built prompt for your AI coding assistant

Show promptCopy prompt

The prompt guides your AI coding assistant to create and deploy an Apify Actor step by step. It walks through setting up the Actor structure, configuring all required files, installing dependencies, running it locally, logging in, and pushing it to the Apify platform.

## Use Actor templates with AGENTS.md

All [Actor Templates](https://apify.com/templates) have AGENTS.md that will help you with AI coding. You can use the [Apify CLI](https://pr-2338.preview.docs.apify.com/cli/docs) to create Actors from Actor Templates.


```
apify create
```


If you do not have Apify CLI installed, see the [installation guide](https://pr-2338.preview.docs.apify.com/cli/docs/installation).

The command above will guide you through Apify Actor initialization, where you select an Actor Template that works for you. The result is an initialized Actor (with AGENTS.md) ready for development.

## Use Agent Skills

[Agent Skills](https://github.com/apify/agent-skills) are official Apify skills for Actor development, web scraping, data extraction, automation, etc. They work with Claude Code, Cursor, Codex, Gemini CLI, and other AI coding assistants.

Install Agent Skills in your project directory:


```
npx skills add apify/agent-skills
```


This adds skill files to your project that AI coding assistants automatically discover and use for context. No additional configuration is needed.

## Use Apify MCP server

The Apify MCP server has tools to search and fetch documentation. If you set it up in your AI editor, it will help you improve the generated code by providing additional context to the AI.

Use Apify MCP server configuration

We have prepared the [Apify MCP server configuration](https://mcp.apify.com/), which you can configure for your needs.

* Cursor
* VS Code
* Claude Code

To add Apify MCP server to Cursor manually:

1. Create or open the `.cursor/mcp.json` file.

2. Add the following to the configuration file:


   ```
   {
     "mcpServers": {
       "apify": {
         "url": "https://mcp.apify.com/?tools=docs"
       }
     }
   }
   ```


VS Code supports MCP through MCP-compatible extensions like *GitHub Copilot*, *Cline*, or *Roo Code*.

1. Install an MCP-compatible extension (e.g., GitHub Copilot, Cline).

2. Locate the extension's MCP settings or configuration file (often `mcp.json`).

   * For *GitHub Copilot*: Run the **MCP: Open User Configuration** command.
   * For *Cline* or *Roo Code*: Go to the **MCP Servers** tab in the extension interface.

3. Add the Apify server configuration:


   ```
   {
     "mcpServers": {
       "apify": {
         "url": "https://mcp.apify.com/?tools=docs"
       }
     }
   }
   ```


Run the following command to add the Apify MCP server:


```
claude mcp add apify "https://mcp.apify.com/?tools=docs" -t http
```


## Provide context to assistants

Every page in the Apify documentation has a **** button. You can use it to add additional context to your AI assistant, or even open the page in ChatGPT, Claude, or Perplexity and ask additional questions.

![Copy for LLM](/assets/images/copy-for-ai-58e407ad80447fe3b2d318bbc151e07d.png)

## Use `/llms.txt` files

The entire Apify documentation is available in Markdown format for use with LLMs and AI coding tools. Two consolidated files are available:

* `https://docs.apify.com/llms.txt`: A Markdown file with an index of all documentation pages in Markdown format, based on the [llmstxt.org](https://llmstxt.org/) standard.
* `https://docs.apify.com/llms-full.txt`: All Apify documentation consolidated in a single Markdown file.

Access Markdown source

Add `.md` to any documentation page URL to view its Markdown source.

Example: `https://docs.apify.com/platform/actors` > `https://docs.apify.com/platform/actors.md`

Provide link to AI assistants

LLMs don't automatically discover `llms.txt` files, you need to add the link manually to improve the quality of answers.

## Best practices

* *Small tasks*: Don't ask AI for many tasks at once. Break complex problems into smaller pieces. Solve them step by step.

* *Iterative approach*: Work iteratively with clear steps. Start with a basic implementation and gradually add complexity.

* *Versioning*: Version your changes often using git. This lets you track changes, roll back if needed, and maintain a clear history.

* *Security*: Don't expose API keys, secrets, or sensitive information in your code or conversations with LLM assistants.
