PHPSW TIPS FOR AGENTIC DEVELOPMENT @drewm

TIPS FOR USING AI CODING ASSISTANTS

TIPS FOR AGENTIC DEVELOPMENT WHAT ARE AI CODING ASSISTANTS? AI coding assistants (or agents) are tools that assist developers by generating code, finding bugs, writing documentation, and more. They act as a powerful pair programmer, helping you move faster and focus on the bigger picture. They’re really good at taking the busywork out of being a software engineer.

THE TIPS

TIP #1 BE SPECIFIC

TIPS FOR AGENTIC DEVELOPMENT REMEMBER INPUTS, PROCESSES & OUTPUTS Write a function to calculate the area of a circle. 👎

TIPS FOR AGENTIC DEVELOPMENT REMEMBER INPUTS, PROCESSES & OUTPUTS Write a PHP function called calculateArea that takes a radius and returns the area of a circle. 👍

TIPS FOR AGENTIC DEVELOPMENT REMEMBER INPUTS, PROCESSES & OUTPUTS Write a PHP function called calculateArea that takes a radius and returns the area of a circle. Make sure it has documentation and tests. 🫶

TIPS FOR AGENTIC DEVELOPMENT ANATOMY OF A GREAT PROMPT ▸ Role & Task ▸ Context & Examples ▸ Constraints & Format

TIPS FOR AGENTIC DEVELOPMENT ROLE & TASK Act as a Staff Engineer. Refactor this function to improve performance, testability and readability.

TIPS FOR AGENTIC DEVELOPMENT CONTEXT & EXAMPLES When I run x command with the -test flag I receive this error message: “Error: …” But when I run without the command completes successfully.

TIPS FOR AGENTIC DEVELOPMENT CONSTRAINTS & FORMAT Scores are showing in the UI as 0-1 values instead of percentages. We cannot modify the API endpoint. Update the frontend to show whole-integer percentages. According to corporate policy, every file we change must have an update to its test file. Check to make sure we’re complying and update tests if necessary.

TIP #2 ITERATE & REFINE

TIPS FOR AGENTIC DEVELOPMENT ITERATE & REFINE ▸ You don’t need to accept the first answer. Treat it like a conversation, not a command. ▸ Ask follow-up questions. Ask the AI to refine its code, explain its reasoning, or provide alternatives. ▸ Use planning mode to try before you buy.

TIPS FOR AGENTIC DEVELOPMENT PLANNING MODE I’d like to add rate-limiting to the API, with configurable rates per endpoint. Plan some ways that could be done and show me the options so I can choose.

TIP #3 LET IT DO THE DONKEY WORK

TIPS FOR AGENTIC DEVELOPMENT LET IT DO THE DONKEY WORK ▸ Generating boilerplate ▸ Understanding & debugging complex codebases ▸ Writing documentation

TIPS FOR AGENTIC DEVELOPMENT GENERATING BOILERPLATE Plan a full-stack project setup: Symfony 7 (API Platform) backend, React 18/Vite (TypeScript) frontend. The entire stack must be Docker Compose-enabled for local development (including PostgreSQL, Mercure, Redis). Provide the step-by-step structure, necessary Dockerfiles/YAML, and an outline for DigitalOcean deployment.

TIPS FOR AGENTIC DEVELOPMENT UNDERSTANDING & DEBUGGING COMPLEX CODEBASES Which file is responsible for rendering requests to /projects/:1234? The database query for this endpoint is performing a SELECT *. Is the frontend using all the fields or can this be optimized?

TIPS FOR AGENTIC DEVELOPMENT WRITING DOCUMENTATION Docs for this project are in /docs. Create a new doc for this change and also add a note in the Quickstart Guide with any setup changes required. Write a commit message and PR description for these changes.

TIP #4 DON’T TRUST, VERIFY

TIPS FOR AGENTIC DEVELOPMENT DON’T TRUST, VERIFY ▸ Read and Understand. AI can be confidently wrong. Always read and understand the code it generates. ▸ Test Thoroughly. Treat AI-generated code as if you wrote it. Run unit tests and integration tests to ensure it works as expected. ▸ Check for Security. Be vigilant for security vulnerabilities. Don’t assume the code is secure. Test with security tools, e.g. snyk test

TIP #5 STAY IN CHARGE

TIPS FOR AGENTIC DEVELOPMENT STAY IN CHARGE Break this task down into logical steps. Between each step I’d like to review the code and make a commit so that the commit history is progressive and easily understandable. After each step provide a suggested git commit message and then wait for me to verify before you proceed to the next step.

TIP #6 CONTEXT IS KING

TIPS FOR AGENTIC DEVELOPMENT CONTEXT IS KING ▸ As you work with an agent it builds up context about your project and your task. ▸ This all informs the decisions made with each subsequent step. ▸ Context is hard earned and easily lost (e.g. if you restart your editor)

TIPS FOR AGENTIC DEVELOPMENT AGENTS.MD ▸ An AGENTS.md file is like a README.txt but for agents. ▸ Each project can have one or more AGENTS.md files. ▸ It’s supported by all major vendors.

TIPS FOR AGENTIC DEVELOPMENT AGENTS.MD ▸ It stores project overviews, build & test commands, code style guidelines, testing instructions, security considerations. ▸ Extra instructions like commit message or pull request guidelines, deployment guidelines, anything you’d tell a new team mate. ▸ Large monorepo? You can nest AGENTS.md files for each subproject with project-specific instructions.

TIPS FOR AGENTIC DEVELOPMENT AGENTS.MD Create an AGENTS.md file for this project. Add a note to the AGENTS.md file that it should be kept up to date with any changes to the project.

TIPS FOR AGENTIC DEVELOPMENT AGENTS.MD https://agents.md

THOSE WERE THE TIPS

THANKS! @drewm https://noti.st/drewm/Kbzn7w