notion-local-dev-loop
Configure Notion local development with a dedicated dev integration, test mocking, and hot reload. Use when setting up a development environment, writing tests for Notion code, or establishing a fast iteration cycle with the Notion API. Trigger: "notion dev setup", "notion local development", "mock notion", "notion test environment".
What this skill does
# Notion Local Dev Loop
## Overview
Set up a fast, reproducible local development workflow for Notion integrations. This skill covers creating a dedicated dev integration with its own token, structuring the project for testability, mocking the Notion SDK in unit tests, and running integration tests against a sandboxed dev workspace. The approach keeps production data safe while enabling rapid iteration.
## Prerequisites
- Completed `notion-install-auth` setup (you have a working Notion integration)
- Node.js 18+ with npm/pnpm, or Python 3.10+
- A Notion workspace where you can create test pages and databases
## Instructions
### Step 1: Create a Dev Integration and Workspace Sandbox
Create a separate integration exclusively for development. This prevents accidental writes to production data.
1. Go to **Settings & Members > Connections > Develop or manage integrations** (or visit [developers.notion.com](https://developers.notion.com))
2. Click **New integration** and name it `My App — Dev`
3. Copy the token (starts with `ntn_`) into `.env.development`
4. Create a dedicated **Dev Workspace** page (or a top-level "Dev Testing" page) and share it with the dev integration
5. Inside that page, create test databases that mirror your production schema
```bash
# .env.development — git-ignored, dev only
NOTION_TOKEN=ntn_dev_xxxxxxxxxxxxxxxxxxxx
NOTION_TEST_DATABASE_ID=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
NOTION_TEST_PAGE_ID=ffffffff-0000-1111-2222-333333333333
# .env.example — commit this as a template
NOTION_TOKEN=ntn_your_dev_token_here
NOTION_TEST_DATABASE_ID=your_test_db_id
NOTION_TEST_PAGE_ID=your_test_page_id
```
Project structure:
```
my-notion-project/
├── src/
│ ├── notion/
│ │ ├── client.ts # Singleton with retry + rate-limit awareness
│ │ ├── queries.ts # Database query wrappers
│ │ └── helpers.ts # Property extractors, rich text builders
│ └── index.ts
├── tests/
│ ├── unit/
│ │ └── notion.test.ts # Mocked SDK tests
│ └── integration/
│ └── notion.test.ts # Live API tests (gated)
├── .env.development # Dev token (git-ignored)
├── .env.example # Template for team
├── .gitignore
├── package.json
├── tsconfig.json
└── vitest.config.ts
```
### Step 2: Configure the Client with Retry and Rate-Limit Handling
The Notion API enforces a hard limit of **3 requests per second** across all pricing tiers. Build retry logic into your client from day one.
```typescript
// src/notion/client.ts
import { Client, LogLevel, isNotionClientError, APIResponseError } from '@notionhq/client';
let instance: Client | null = null;
export function getNotionClient(): Client {
if (!instance) {
instance = new Client({
auth: process.env.NOTION_TOKEN, // SDK reads NOTION_TOKEN automatically if omitted
logLevel: process.env.NODE_ENV === 'development' ? LogLevel.DEBUG : LogLevel.WARN,
// baseUrl can be overridden for proxy/mock servers:
// baseUrl: process.env.NOTION_BASE_URL || 'https://api.notion.com',
});
}
return instance;
}
// Retry wrapper with exponential backoff for rate limits
export async function withRetry<T>(
fn: () => Promise<T>,
maxRetries = 3
): Promise<T> {
for (let attempt = 0; attempt <= maxRetries; attempt++) {
try {
return await fn();
} catch (error) {
if (
isNotionClientError(error) &&
error instanceof APIResponseError &&
error.status === 429 &&
attempt < maxRetries
) {
const retryAfter = parseInt(error.headers?.get('retry-after') || '1', 10);
const delay = retryAfter * 1000 * Math.pow(2, attempt);
console.warn(`Rate limited. Retrying in ${delay}ms (attempt ${attempt + 1}/${maxRetries})`);
await new Promise(resolve => setTimeout(resolve, delay));
continue;
}
throw error;
}
}
throw new Error('Unreachable');
}
```
```json
{
"scripts": {
"dev": "tsx watch src/index.ts",
"dev:debug": "NOTION_LOG_LEVEL=debug tsx watch src/index.ts",
"test": "vitest",
"test:watch": "vitest --watch",
"test:integration": "INTEGRATION=true vitest run tests/integration/",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@notionhq/client": "^2.2.0"
},
"devDependencies": {
"tsx": "^4.0.0",
"typescript": "^5.0.0",
"vitest": "^2.0.0",
"dotenv": "^16.0.0"
}
}
```
### Step 3: Write Unit Tests with Mocked SDK and Integration Tests
**Unit tests** mock the entire `@notionhq/client` module so they run instantly with no network calls. **Integration tests** hit the real API but are gated behind an environment variable and target only the dev workspace.
```typescript
// tests/unit/notion.test.ts
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { Client } from '@notionhq/client';
vi.mock('@notionhq/client', () => ({
Client: vi.fn().mockImplementation(() => ({
databases: {
query: vi.fn(),
retrieve: vi.fn(),
create: vi.fn(),
update: vi.fn(),
},
pages: {
create: vi.fn(),
update: vi.fn(),
retrieve: vi.fn(),
},
blocks: {
children: { list: vi.fn(), append: vi.fn() },
retrieve: vi.fn(),
update: vi.fn(),
delete: vi.fn(),
},
search: vi.fn(),
users: { list: vi.fn(), retrieve: vi.fn() },
})),
isNotionClientError: vi.fn((err) => err?.code !== undefined),
LogLevel: { DEBUG: 'debug', WARN: 'warn' },
}));
describe('Database queries', () => {
let notion: InstanceType<typeof Client>;
beforeEach(() => {
notion = new Client({ auth: 'ntn_test_token' });
});
it('queries database with a status filter', async () => {
const mockResponse = {
results: [
{
id: 'page-1',
properties: {
Name: { type: 'title', title: [{ plain_text: 'Task 1' }] },
Status: { type: 'select', select: { name: 'Done' } },
},
},
],
has_more: false,
next_cursor: null,
};
(notion.databases.query as ReturnType<typeof vi.fn>).mockResolvedValue(mockResponse);
const result = await notion.databases.query({
database_id: 'test-db-id',
filter: { property: 'Status', select: { equals: 'Done' } },
});
expect(result.results).toHaveLength(1);
expect(notion.databases.query).toHaveBeenCalledWith(
expect.objectContaining({
filter: { property: 'Status', select: { equals: 'Done' } },
})
);
});
it('handles pagination across multiple pages', async () => {
const queryMock = notion.databases.query as ReturnType<typeof vi.fn>;
queryMock
.mockResolvedValueOnce({ results: [{ id: '1' }], has_more: true, next_cursor: 'cursor-abc' })
.mockResolvedValueOnce({ results: [{ id: '2' }], has_more: false, next_cursor: null });
const page1 = await notion.databases.query({ database_id: 'db' });
expect(page1.has_more).toBe(true);
const page2 = await notion.databases.query({
database_id: 'db',
start_cursor: page1.next_cursor,
});
expect(page2.has_more).toBe(false);
expect(queryMock).toHaveBeenCalledTimes(2);
});
});
```
```typescript
// tests/integration/notion.test.ts
import { describe, it, expect } from 'vitest';
import { Client } from '@notionhq/client';
const SKIP = !process.env.INTEGRATION;
describe.skipIf(SKIP)('Notion Integration (live API)', () => {
const notion = new Client({ auth: process.env.NOTION_TOKEN! });
const testDbId = process.env.NOTION_TEST_DATABASE_ID!;
it('connects and lists workspace users', async () => {
const { results } = await notion.users.list({});
expect(results.length).toBeGreaterThan(0);
});
it('queries the test database', async () => {
const response = await notion.databases.query({
database_id: testDbId,
page_size: 1,
});
expect(response.results).toBeDefined();
});
it('creates and archives a test page (cleanup)', async () => {Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.