These are five copy-paste briefs for AI coding tools such as Claude Code, Cursor and Lovable. They tell the agent how to connect your app to Tripletex, add Stripe Checkout, push leads to Pipedrive without duplicates, audit an existing integration, and add monitoring. Each brief states the safety rules the agent must follow, because the most common failures in AI-built integrations are secrets in the browser, no duplicate protection and errors nobody sees.
Written by Rocksoft. Rocksoft is a software company with teams in Poland and Norwegian-speaking staff, building integrations and custom software for companies in Norway and across Europe. The API details in the briefs come from the official documentation, linked below each brief.
How do I use these briefs?
- Copy one brief into your tool: the chat in Lovable, the agent panel in Cursor, or the prompt in Claude Code. One brief per task.
- Fill in the parts in square brackets, such as [your stack] or [which events].
- Ask the agent to write a short plan first and wait for your OK before it writes code. All three tools can do this.
- Put secrets in your platform's secret store yourself. Never paste a real key into the chat.
- Test in a sandbox or test account first: the Tripletex test environment, Stripe test mode, a Pipedrive sandbox or a test pipeline.
- When it's done, run brief 4 (the audit) on the result.
In Claude Code and Cursor you can also save the safety rules in a project instruction file (CLAUDE.md, or Cursor rules) so they apply to every task.
Brief 1: Connect my app to Tripletex
For an internal integration: your app talks to your own company's Tripletex account.
Goal: connect this app to our company's Tripletex account through the
Tripletex API v2, so that it can [read customers / create orders and
invoices / read invoice status]. Stack: [your stack].
Facts (from developer.tripletex.no, do not guess others):
- Production base URL: https://tripletex.no/v2
- Test environment: https://api-test.tripletex.tech (test credentials do not
work in production).
- This is an internal integration. A user admin created a refresh token
(JWT, starts with tlxr_) under Company > API Tokens. It is stored as the
server-side secret TRIPLETEX_REFRESH_TOKEN.
- Get a session token with:
POST /token/session/:createFromRefreshToken
body {refreshToken, ttlSeconds}, ttlSeconds between 300 and 28800.
The response is {value: {token, expirationDate, ...}}.
- Every other call uses HTTP Basic auth: username 0 (our own company),
password = the session token.
- Related objects are referenced by Tripletex internal id,
e.g. customer: {id: 123}.
- Rate limit: 100 requests per 10 seconds per employee and integration.
Read X-Rate-Limit-Remaining and X-Rate-Limit-Reset; on 429 wait for
Retry-After, then back off with jitter. Creating session tokens is also
rate limited, so never create one per request.
- POST /order then PUT /order/{id}/:invoice, or POST /invoice, creates an
invoice. sendToCustomer defaults to true.
Rules you must follow:
1. All Tripletex calls run on the server (API route, edge function or
backend). Nothing Tripletex-related in browser code, and no secret in
any variable that is bundled into the frontend.
2. Create one session token, cache it server-side with its expiry, reuse
it, and only create a new one when it is about to expire or a call
returns 401.
3. Never log tokens or full request bodies with personal data.
4. Every create is protected against running twice: store the Tripletex
id on our record and check it before creating.
5. Set sendToCustomer to false unless I explicitly say otherwise.
6. Do not retry 4xx errors unchanged. Log status, code, message,
validationMessages and the x-tlx-request-id header.
7. Use the test environment until I say we go to production.
8. Write a plan first and wait for my OK.
If any of this is unclear, stop and ask.Sources: Tripletex authentication and tokens, rate limiting, API reference. If you sell the integration to several Tripletex customers, you need a commercial integration with a consumer token instead; that changes the auth part of the brief.
Brief 2: Add Stripe Checkout with webhooks
Goal: let customers pay for [product / plan] with Stripe Checkout and give
them [access / an order confirmation] only after payment is confirmed.
Stack: [your stack]. Mode: [payment / subscription].
Facts (from docs.stripe.com, do not guess others):
- Create the Checkout Session on the server. Set success_url to our
landing page with ?session_id={CHECKOUT_SESSION_ID}.
- Fulfil from a webhook: listen for checkout.session.completed and
checkout.session.async_payment_succeeded. Optionally handle
checkout.session.async_payment_failed.
- Verify every webhook signature with the endpoint secret (whsec_...) and
the RAW request body, using the Stripe library's constructEvent.
- The fulfil function can be called several times, even concurrently, for
the same session. It retrieves the session with line_items expanded,
checks payment_status, fulfils, and records that it has fulfilled.
- Also call the same fulfil function from the landing page, because
webhooks can be delayed. Never rely on the landing page alone.
- Test locally with: stripe listen --forward-to localhost:[port]/[path]
Rules you must follow:
1. The secret key and webhook secret live only in server-side secrets.
Only the publishable key may reach the browser.
2. Prices come from Stripe Price ids on the server, never from an amount
sent by the browser.
3. Fulfilment is idempotent: store the Checkout Session id with a unique
constraint and skip if already fulfilled.
4. Do not parse the body as JSON before verifying the signature.
5. The webhook handler returns 2xx quickly and does slow work after.
6. Use test mode keys until I say we go live.
7. Write a plan first and wait for my OK.
If any of this is unclear, stop and ask.Source: Stripe: fulfill orders. Longer explanation: Add Stripe payments to an AI-built app safely.
Brief 3: Push leads to Pipedrive without duplicates
Goal: when someone submits [the contact form / signs up], create or update
the person and organization in Pipedrive and add a [lead / deal] in
[pipeline name]. Stack: [your stack].
Facts (from developers.pipedrive.com, do not guess others):
- API v2: GET /api/v2/persons/search (term, fields=email,
exact_match=true) and POST /api/v2/persons.
- GET /api/v2/organizations/search can search custom fields, e.g. the
organization number, with exact_match. POST /api/v2/organizations.
- Rate limits: a daily token budget per company and a burst limit per
2 seconds. Search has its own limit of 10 requests per 2 seconds.
Read x-ratelimit-remaining and back off on 429.
Rules you must follow:
1. The Pipedrive API token lives only in a server-side secret. The form
posts to our server, and our server calls Pipedrive.
2. Normalize before matching: lowercase and trim the email; organization
number to digits only.
3. Match the person on email and the organization on organization number
(fallback: exact name). Update if found, create if not.
4. Store the Pipedrive person and organization ids on our record and use
them next time instead of searching again.
5. Two submissions in a row from the same person must not create two
persons: process one submission per email at a time.
6. Validate and rate-limit the public form so bots cannot fill Pipedrive.
7. Only send the fields Pipedrive needs. No passwords, no free-text fields
beyond the message.
8. If Pipedrive is down, save the lead in our database and retry later.
Never lose a lead.
9. Write a plan first and wait for my OK.
If any of this is unclear, stop and ask.Sources: Pipedrive persons, organizations, rate limiting.
Brief 4: Audit my existing integration
Run this on any integration before it handles real money, invoices or customer data. Ask for a report only, no changes.
Goal: audit the integrations in this codebase with [Tripletex / Stripe /
Pipedrive / other] for security and reliability. Do NOT change any code.
Write a report.
Check and report, with file and line for each finding:
1. Secrets: any API key, token or webhook secret in frontend code, in a
variable bundled into the browser, in the repo, or in logs.
2. Where calls run: any third-party API call made from the browser.
3. Webhooks: is every incoming webhook's signature verified against the
raw body? Are duplicate deliveries ignored?
4. Duplicates: can a retry, a double click or a repeated webhook create
the same customer, invoice, order or payment twice?
5. Errors: is every API response checked? Are failures logged with
enough detail? Does anyone get notified?
6. Retries: are 429 and 5xx retried with back-off? Are 4xx retried
forever?
7. Tokens: how are tokens refreshed or renewed, and what happens when one
expires?
8. Personal data: which personal data goes to which system, and is any of
it logged?
9. Access: does the app use broader permissions or scopes than it needs?
10. Tests: is there any test for the integration paths?
Format: a table with severity (critical / high / medium / low), finding,
location, and suggested fix. Critical first. Say plainly when you could
not verify something.
If any of this is unclear, stop and ask.Brief 5: Add monitoring and alerts
Goal: make sure we find out within [1 hour / 1 day] when an integration
stops working. Integrations: [list]. Alert channel: [email / Slack /
Teams]. Stack: [your stack].
Build:
1. A table or log of integration runs and events: time, integration,
operation, our id, the other system's id, status, error message.
2. An alert when an operation fails after its last retry.
3. An alert when a scheduled sync has not succeeded for longer than
[expected interval x 2]. A silent stop is the most common failure.
4. An alert on repeated 401 or 403 responses: usually an expired or
revoked token.
5. An alert when the webhook endpoint returns errors, because providers
disable or delete failing webhook subscriptions after a while.
6. A simple page or query that shows the last successful run per
integration.
Rules you must follow:
1. Alerts must not contain tokens or full personal data. Ids and error
messages only.
2. Group repeated alerts so one failure does not send a hundred messages.
3. Use our existing hosting and tools where possible. Ask before adding a
new paid service.
4. Write a plan first and wait for my OK.
If any of this is unclear, stop and ask.Background on why point 5 matters: Tripletex disables a webhook subscription after a week of constant failure, Shopify deletes Admin API subscriptions after 8 consecutive failed deliveries, and Pipedrive deletes webhooks with no successful delivery for 3 days. See Tripletex webhooks, Shopify webhooks and Pipedrive webhooks.
When the brief isn't enough
A good brief gets you far. It is not enough when:
- The agent keeps fixing one error and creating another, and you have stopped understanding the code.
- The integration creates invoices or vouchers in Tripletex, takes payments, or moves personal data at scale, and a mistake costs real money or trust.
- The audit brief finds critical issues and you are not sure the fixes are right.
- You need several systems to agree on the same customer, order or payment over time.
That is where we come in. We usually keep your app and fix what's around it: integrations for AI-built apps. If you want an independent look first, a code audit gives you a written report on what is solid and what is risky. Also worth reading: You have vibe-coded an app. But is it safe?
Related guides
- Connecting a vibe-coded app to real systems: why these safety rules matter, with code.
- Before you switch on an integration in production: a checklist
- Tripletex API authentication and session tokens: the background to brief 1.
- Send leads from your AI-built app to Pipedrive: the background to brief 3.
FAQ
Do these briefs work in Lovable, Cursor and Claude Code?
Yes. They are plain text and don't depend on a specific tool. In Lovable, make sure server-side code runs in a backend function, not in the page. In Claude Code and Cursor, you can keep the safety rules in a project instruction file.
Can I paste my API keys into the brief?
No. Put keys in your platform's secret store or server environment variables yourself, and tell the agent the name of the variable. Anything pasted into a chat can end up in logs or in code.
Why does every brief end with "stop and ask"?
Because an agent that guesses an endpoint, a field name or a business rule produces code that looks right and is wrong. Asking costs you a minute; a wrong guess in an accounting integration can cost much more.
Why ask for a plan first?
It lets you catch a wrong approach, such as calling an API from the browser, before any code is written.
Is the Tripletex brief for commercial integrations too?
No. It covers an internal integration for your own company. A commercial integration, used by several Tripletex customers, uses a consumer token and an employee token per customer to create sessions.

