AI implementation prompt
LedgerLine integration implementation prompt for Codex
A repo-action prompt that tells Codex to audit first, plan, then implement only the selected LedgerLine workflows.
Review before pasting
- Review the generated prompt before pasting it into an AI tool.
- Remove private details before sharing with an external tool.
- Do not include real API keys, customer data, database URLs, or production secrets.
- This is a build plan and prompt, not a guarantee of production readiness.
- The pasted audit text is not copied verbatim into this implementation prompt.
# LedgerLine Integration Build Prompt
You are Codex working inside my application repository, not inside LedgerLine, unless I explicitly say otherwise.
Use the LedgerLine setup pack below as the source of truth for a safe scoped integration.
Audit the codebase first, then propose a file-level plan before editing.
## Context
No app description was provided. Start by inspecting the app structure before making changes.
Selected AI/developer tool: Codex
Selected stack:
- Next.js
- Supabase
- Vercel
## Source Material
No AI-agent audit was provided. Start by inspecting the app structure before making changes.
## Selected Workflows
- Invoices
- Documents
- Reports
## Recommended LedgerLine Modules
- Customers
- Invoices
- Payments
- Accounts Receivable
- Reports
- Documents
- Document Shares
- Document Renders
- Accounts Payable
- 1099 Summary
## Environment Variables
LEDGERLINE_BASE_URL=https://your-ledgerline-domain.example
LEDGERLINE_API_KEY=ll_test_replace_me
LEDGERLINE_WEBHOOK_SECRET=whsec_test_replace_me
These are placeholders. Do not commit real values.
## Server-Only Rules
- First inspect the codebase before changing files.
- Do not expose or print real secrets.
- Use fake placeholder env values only in explanations.
- Keep LedgerLine API keys server-side only.
- Do not put LedgerLine keys in React client components, browser JavaScript, mobile bundles, screenshots, docs, or public repos.
- Do not run migrations unless I explicitly approve them.
- Do not modify accounting/posting/reporting behavior in LedgerLine itself.
- Do not create live payments or production accounting records during setup.
- Use test mode and test keys first.
- Make a plan before editing.
- Ask for confirmation before destructive or high-risk changes.
- Run lint, typecheck, and build after changes.
- Provide a final summary of files changed, tests run, and risks.
## Implementation Plan
- Audit existing customer, user, organization, payment, vendor, and document models.
- Add a server-only LedgerLine client module.
- Add test environment placeholders in the server runtime.
- Start with GET /api/v1/auth/check from trusted server code.
- Implement the selected workflow routes or server actions behind your own app server.
- Create fake test data only.
- Run mutating test workflows only with ll_test_ keys and human review.
- Verify reports and accounting impact notes against the selected workflows.
- Review generated code before migrations, deploys, or production access.
## Tool-Specific Instructions
- Implement only selected workflows.
- Create a server-only LedgerLine client.
- Add placeholder env var names but never real values.
- Wire selected workflow routes/components according to this app's stack.
- Add smoke tests or a manual QA checklist.
- Do not change unrelated product behavior.
- Stop and report if the app architecture is unclear.
## Workflow Guidance
- Start with customer records, then create draft invoices from server-side code.
- Use idempotency keys and external IDs for test invoice creation where supported.
- Review the invoice state before any accounting-impacting post action.
- Keep files private and route downloads through server-side access controls.
- Never expose storage paths or service-role credentials.
- Start with read-only report checks before adding mutating workflows.
- Use reports to verify that test records changed the expected accounting view.
## API/Docs Links
Open the LedgerLine docs at these paths:
- View Developer Docs: /developers
- Start Quickstart: /developers/get-started
- Browse API Console: /developers/api-console
- View Recipes: /developers/recipes
- Webhooks: /developers/webhooks
## Test Data Plan
- Create a fake test customer.
- Create a draft invoice with small line items.
- Post the invoice only in test mode after review.
- Record a test payment and verify the A/R report changes.
- Attach a fake sample document to an invoice, estimate, or bill.
- Verify document share/download behavior with test data only.
- Create fake test records through selected workflows.
- Verify summary, A/R, or A/P reports reflect the expected records.
## Smoke Checklist
- App loads without exposing LedgerLine secrets.
- Server-only auth check works.
- Test records can be created only when a test workflow is intentionally selected.
- Selected workflows show expected statuses.
- Reports reflect test data.
- No real customer data used.
- No live payments processed.
- No production environment used without review.
## Accounting Impact Notes
- Posted invoices can increase receivables and revenue depending on the workflow state.
- Draft invoices should remain reviewable before posting.
- Documents are evidence and workflow context; they do not automatically create accounting impact.
- Reports are only as accurate as the records posted into LedgerLine.
- Review every generated AI change before running production workflows.
## Stop Conditions
Stop and ask/report if:
- you need real secrets
- you need a migration
- you need to change payment provider logic
- you need to change auth behavior
- you find missing customer, organization, or payment models
- you cannot keep LedgerLine API calls server-side
## Final Response Required
- files changed
- env vars added
- routes/components added
- tests run
- smoke QA checklist
- unresolved risks
- confirmation no real secrets were exposed