home / skills / reddit / devvit-skills / devvit-docs

devvit-docs skill

/skills/devvit-docs

This skill looks up Devvit documentation from the reddit/devvit-docs repository to answer questions about APIs, patterns, and configurations.

npx playbooks add skill reddit/devvit-skills --skill devvit-docs

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
2.1 KB
---
name: devvit-docs
description: 'Look up Devvit documentation from the reddit/devvit-docs repository. Use when the user asks about Devvit APIs, patterns, configuration, or examples (trigger phrases: "how do I", "devvit docs", "show me the docs", "API reference").'
---

# Devvit Docs

Look up Devvit documentation from `reddit/devvit-docs`.

**Constraints:**

- Use **only** `reddit/devvit-docs` as the source of truth.
- Do not use other repos, forks, blog posts, or web search results.
- If the answer isn't found, say so and cite the closest relevant file.

## How It Works

1. Run the `ensure-docs.js` script to clone or refresh the local docs cache.
2. Read the JSON output to get the docs directory path.
3. Search that directory to answer the user's question.
4. Cite specific files/sections in your answer.

## Usage

```bash
node ./scripts/ensure-docs.cjs [--force] [--ttl <hours>] [--project-dir <path>]
```

Script path is relative to this skill's directory.

- `--force` — Pull regardless of cache age
- `--ttl <hours>` — Cache TTL in hours (default: 24)
- `--project-dir <path>` — User's project root for version detection (default: cwd)

**Examples:**

```bash
node ./scripts/ensure-docs.cjs
node ./scripts/ensure-docs.cjs --force
```

## Output

```json
{
  "docsRoot": "node_modules/.cache/devvit-docs/versioned_docs/version-0.11",
  "repoDir": "node_modules/.cache/devvit-docs",
  "appDevvitVersion": "0.11"
}
```

- `docsRoot` — The directory to search. Versioned if a matching version was found, otherwise `docs/`.
- `repoDir` — Root of the cloned repo (use as fallback if versioned docs are incomplete).
- `appDevvitVersion` — Devvit version from the user's `package.json`, or `null`.

## Present Results to User

- Quote the specific doc file and section supporting each claim.
- Provide a minimal code example if the docs include one.
- If the docs don't cover it, say so and suggest the closest material found.

## Troubleshooting

- **`git` not found** — Requires `git` on PATH.
- **Network errors** — Script uses existing cache if pull fails.
- **Stale docs** — Use `--force` to bypass the TTL cache.

Overview

This skill looks up Devvit documentation from the reddit/devvit-docs repository to answer questions about Devvit APIs, patterns, configuration, and examples. It uses a local docs cache produced by a helper script and always cites the exact doc files and sections that support each answer.

How this skill works

Run the provided ensure-docs script to clone or refresh a local copy of the docs, then read the script's JSON output to determine the docs root to search. The skill searches that directory for relevant files, extracts supporting text and code snippets, and returns answers with explicit file/section citations. If the docs lack an answer, the skill states that and points to the closest related file.

When to use it

  • You need an authoritative answer about a Devvit API, configuration option, or recommended pattern.
  • You want a minimal example or code snippet that is present in the official Devvit docs.
  • You need the exact file and section from the docs to cite in your code review or documentation.
  • You want to verify behavior for a specific Devvit version listed in package.json.
  • You need troubleshooting steps documented for Devvit tooling or the ensure-docs script.

Best practices

  • Run node ./scripts/ensure-docs.cjs before asking to ensure the local cache is up to date.
  • Provide the Devvit version or your package.json so the skill can choose a versioned docsRoot.
  • Copy the quoted file path and section into your issue or PR to make verification easy.
  • If network or git fails, use --force after resolving connectivity to refresh stale docs.
  • Ask focused questions (API name, config key, or example) so the skill can return exact file citations.

Example use cases

  • How do I register an API route in Devvit? (returns the exact doc file and snippet describing registration).
  • Show me the example for creating a widget or module included in the docs.
  • Which configuration keys control Devvit versioning and where are they documented?
  • Troubleshoot ensure-docs errors like git not found or stale cache and get the documented remedies.
  • Find the referenced Devvit version from package.json and locate the matching versioned docsRoot.

FAQ

What if the docs don't contain an answer?

I'll tell you the docs lacked a direct answer and point to the closest related file or section found in the repo.

How do I refresh the cached docs?

Run node ./scripts/ensure-docs.cjs --force, or include --ttl <hours> to adjust cache age before searching.