A basic guide to writing code using Claude 3.5

Discover how software developers leverage AI assistant Claude 3.5 Sonnet for coding projects. Break down complex tasks, generate code, and test efficiently. Master the art of writing prompts for effective communication with AI systems. Enhance your coding skills with industry insights and expert advice.
A basic guide to writing code using Claude 3.5
Representative Image
We asked software developers how they would use an AI assistant like Claude 3.5 Sonnet for a coding project. A frequently cited starting tip is to break down a complex problem into smaller, manageable parts. Software development, especially at the enterprise level, is a complex orchestra of parts that need to come together, so whatever your coding task is for the day, you can always get help from an AI assistant, as long as you have a specific task in mind.

Screenshot 2024-07-05 090925
Snip from TOI e-paper

How to start
Shauvik Mazumdar, senior director of front-end engineering at Ascendion, says he has been amazed by Claude 3.5 Sonnet’s capabilities in generating websites, apps, and even games. “With the recent addition of ‘artifacts,’ it allows us to view and interact with the results in real time too.”
He says if Artifacts is not enabled, you should do that by going to the left sidebar, clicking on your name, and navigating to ₹Feature Preview’, where you have the enabling feature.
The next step, Shauvik says, is to get back to the chat window and type a prompt to get your project started.
If you’ve been tasked with creating a login page for a business, you could create a prompt like this:
Design a login page (plain html). The login form needs to have a username and password as the first step. It also needs a ₹forgot password’ feature. Further on successful login, it should show Multifactor authentication. Use Material stylesheet and do basic validation. To test the system, you can use user name and default password like admin, admin and OTP as 1111. On successful login a message should be shown.

“Claude will generate the code and an HTML version of the login page side-by-side.
You can quickly test the output and instruct Claude to refine it. For plain HTML and vanilla JavaScript, Claude typically provides a demo. It can also generate Angular or React code, though not a live demo as of now,” says Shauvik.
Once you have your code, test it, starting with small, isolated tests, before integrating it into larger systems, says Arun Prakash Agrawal, professor & head of the department of computer science & applications at Sharda School of Engineering and Technology in Greater Noida.
Maintaining a comprehensive documentation of the code and decisions made during the project, Arun says, will aid in debugging and future maintenance.
Master prompts
Mastering the art of writing prompts might be the most crucial skill to gain to make your coding journey more productive. This is the method by which a developer communicates with AI systems, and so being clear and concise is crucial.
“Developers need to be specific, and provide proper context to a problem statement. Breaking down tasks, giving examples of similar codes, and asking for code comments will help the prompt responses to be more aligned with the desired outcome. A basic prompt can be refined through proper feedback,” says Deepak Visweswaraiah, VP of platform engineering, and site MD at Pegasystems, India.
Vijay Navaluri, co-founder at Supervity, says structuring interactions as multi-turn conversations is also beneficial for complex tasks, as it allows the model to build on previous responses and maintain context.
End of Article
FOLLOW US ON SOCIAL MEDIA