API Security Recommendations Prompt
Security fixes are easy to postpone because the list feels endless. This prompt reviews a .NET API and returns a prioritized set of recommendations, such as rate limiting, with code and configuration. Use it before launch or during a regular review.
Act as an application security engineer reviewing an ASP.NET Core Web API. Provide security recommendations based on the code and configuration below. Check: 1. Authentication and authorization (JWT setup, policies, missing [Authorize]). 2. Rate limiting for incoming requests, with an example using the built-in rate limiter middleware. 3. Input validation and model binding (over-posting, missing validation). 4. Error handling that avoids leaking stack traces. 5. CORS, HTTPS, HSTS and security headers. 6. Secrets management and configuration. 7. Logging that avoids sensitive data. 8. Outdated or risky packages. For each finding: severity, location, why it matters, and the exact fix as code or configuration. Order by severity. .NET version: [version] Project files (Program.cs, controllers, appsettings without secrets): [paste]
Adapted from a prompt in awesome-chatgpt-prompts (CC0), rewritten by Retext.
How to use this prompt
- 1
Copy the prompt
Use the copy button, or type its Retext trigger in any app to paste it.
- 2
Open your AI assistant
Start a new chat in ChatGPT, Claude, Gemini or the assistant you use.
- 3
Fill in the details
Replace any [bracketed] parts with your own details.
- 4
Check and refine
Read the answer, then reply with one change at a time.
Tips for better results
- •Remove secrets before pasting. Replace keys and connection strings with placeholders.
- •Treat the result as a checklist for your own review. Verify each fix in a test environment.
- •Rate limits need tuning to your traffic. Ask for per user and per IP versions.
Get the free prompt pack
Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.
Variations
Public API
Add this line: Assume the API is internet-facing and used by third parties; add API key and abuse handling.
Short list
Add this line: Give only the five most critical findings.
Save it as a Retext snippet
Retext is a free text expander for Mac. Save this prompt once, then type ;api-security in any app (ChatGPT, Claude, your editor, a browser tab) and the full prompt is pasted in.
- Click Add to Retext. The prompt installs as a snippet with the trigger ;api-security.
- Change the trigger in Retext if you prefer a different one.
- Type the trigger wherever you want the prompt, then fill in the brackets.
Frequently asked questions
What does the API Security Recommendations prompt do?
Security fixes are easy to postpone because the list feels endless. It's written for developers.
Which AI tools does it work with?
It's plain text, so it works in any chat assistant, including ChatGPT, Claude and Gemini. Paste it as the first message of a new chat.
What do I need to fill in?
Replace [Authorize], [version], [paste] with your own details. Leave the rest as it is unless you want to change how the AI answers.
Can I save this prompt as a snippet?
Yes. Click Add to Retext and it installs as a snippet with the trigger ;api-security. Type that in any Mac app to paste the full prompt.
Related Templates
Get the free prompt pack
Our best coding prompts in one Markdown file, delivered by email. The templates here stay free either way — the pack just saves you the copying.