Code prompts
Code prompt

Anchor new code to an existing pattern

You want the new thing to look like the team's existing things, not the AI's default style.

Works best in: Claude

Look at how {{example: e.g. the GitHub webhook handler at src/webhooks/github.ts}} is implemented. Read it carefully, including its tests and any helpers it uses.

Then build {{new: e.g. a Stripe webhook handler}} following the same pattern.

Match:
- File and folder structure
- Naming conventions (functions, types, files)
- Error handling style
- Logging shape
- Test structure (test runner, assertion style, fixtures location)
- How configuration and secrets are read
- Any project-specific helpers used (don't reinvent what already exists)

When you have to make a choice the reference doesn't cover, say so explicitly and explain which option you picked and why. Don't silently introduce a new style.
·Open in·Share
patternsconsistencyai-agents

More code prompts

All code prompts

Go deeper