Set up your AI assistant

Add Nark instructions to your project so AI coding assistants generate error-handled code from the start. Copy, paste, done.

Add this to your project's CLAUDE.md file so Claude Code writes error-handled code by default.

CLAUDE.md

CLAUDE.md
# Nark Profiles — Error Handling Quality

This project uses [nark](https://nark.sh) to enforce error handling standards.
Nark ships Nark Profiles for 160+ npm packages — axios, prisma, stripe, redis,
openai, and more — that define how each package fails at runtime. Run `npx nark`
to scan for missing error handling.

## Rules for generated code

When writing code that calls npm packages (axios, prisma, stripe, pg, redis,
openai, aws-sdk, etc.), ALWAYS wrap calls in try-catch with package-specific
error types. Examples:

- axios: catch AxiosError, check error.response vs error.request
- prisma: catch PrismaClientKnownRequestError, check error.code
- stripe: catch Stripe.errors.StripeError subtypes (CardError, RateLimitError)
- pg: catch errors and inspect error.code for PostgreSQL error codes
- redis: register .on('error') listener on client before issuing commands

Do NOT generate bare unhandled calls to external APIs or databases.

## Agent integration

Nark ships a FORAIAGENTS.md with detailed instructions for AI agents. Load it:

```bash
npx nark --instructions-path   # prints the path to FORAIAGENTS.md
```

After generating code that calls external services, run `npx nark` and fix any
reported violations. Use `npx nark ci` in CI for diff-aware PR scanning.

Don't have Nark yet?

Run one command to scan your project against profiles for axios, prisma, stripe, and 160+ more npm packages.

npx nark