Skip to main content

Command Palette

Search for a command to run...

Agentic AI for Oracle Development

Updated
•8 min read•View as Markdown
Agentic AI for Oracle Development

Remember when AI first became your go-to for Oracle syntax questions and error messages? No more digging through Oracle documentation or searching Stack Overflow for that elusive PL/SQL pattern. Just ask, and get an answer.
We're now entering the era of agentic AI—systems that don't just tell you how to optimize that query or debug that stored procedure, but actually do it for you. The AI that once explained the difference between a nested loop and a hash join now analyzes your execution plans, rewrites your SQL, and tests the performance improvements.
Where AI was your coding reference guide, agentic AI is your developer. Tell it to "migrate this legacy procedure to modern PL/SQL standards" or "optimize these slow-running queries," and watch it break down the work, implement the changes, validate the results, and present them for your review.
In this blog I give an overview how to build and steer one or more agents.

AI Agents?

Agents are autonomous executors that plan, research, and complete complex multi-step tasks independently. Rather than just responding, agents break down goals, use tools, make decisions, and work toward outcomes with minimal supervision. An agent might research your codebase, create an implementation plan, write code, run tests, and validate results—all autonomously. They can also be enriched with skills.
Skills are reusable packages of specialized knowledge. Modules that teach the AI how to handle specific domains consistently. A "database migration skill" ensures your AI follows your team's exact patterns every time. Skills activate automatically when relevant, providing domain expertise on demand. Recently Oracle has added development skills to github, they can be found here: https://github.com/oracle/skills. There are a vast amount of rules and best practices listed, like PL/SQL security and ORDS design patterns.

Creating a agent

To create a agent that can be used in Github co-pilot you need to add .github-folder to your repository. If you use Claude code as you AI provider the folder is named .claude. Here we can add another folder called agents. The agents-folder will contain markdown files where we write our agent instructions. For now I've created the file oracle-agent.md. The file starts with some yaml-statements

  • Name for the selection in the chat-window

  • Description will be shown after the agent is selected

  • Model is the default model. It's still possible to change this when prompting the agent

---
name: oracle agent
description: Writes Oracle PL/SQL code following mandatory coding principles
model: Claude Sonnet 4.5 (copilot)
---

The instructions can be something like below. This is free format and you need to experiment yourself what works and what doesn't work.

# Oracle PL/SQL Developer

You are an expert Oracle PL/SQL developer with deep knowledge of Oracle Database development practices. Your primary responsibility is to build robust, performant database solutions using PL/SQL. You will write stored procedures, functions, packages, views, queries and  triggers. You're also responsible for creating and maintaining the datamodel. Your code should be clean, well-documented, and maintainable.

## Expertise

- **PL/SQL Programming**: Write efficient stored procedures, functions, packages, and triggers
- **Database Design**: Design normalized schemas, indexes, constraints, and relationships
- **Performance Optimization**: Optimize queries, use appropriate indexes, analyze execution plans, and implement bulk operations
- **Error Handling**: Implement robust exception handling with proper logging
- **Best Practices**: Follow Oracle coding standards, use bind variables, implement proper transaction control

## Guidelines

- Write clean, well-commented PL/SQL code with proper formatting
- Use meaningful naming conventions (lowercase with underscores for objects)
- Implement error handling with custom exception types when appropriate
- Prefer bulk operations (BULK COLLECT, FORALL) for processing multiple rows
- Use explicit cursors for complex queries and REF CURSORS for returning result sets
- Follow security best practices: use bind variables to prevent SQL injection
- Consider performance implications: avoid unnecessary commits, use appropriate isolation levels
- Document complex logic and business rules in comments

## Code Style

- Use consistent indentation (2 or 4 spaces)
- Write SQL keywords in lowercase
- Use meaningful variable names with prefixes (l_ for variables, c_ for cursors, p_ for parameters)
- Group related procedures and functions into packages
- Include header comments describing purpose, parameters, and return values

Using the agent

To use the agents you need to open the chat window of copilot. If we click on the "Agent" dropdown we now see an extra entry with oracle agent.

By selecting our own agent the instructions provided by the oracle_coder.md are loaded. We also see the description provided by the file.

Now we can use the agent to generate code, a datamodel or refactor legacy code.

Enhancing the agent

The file created earlier lacks specificity and doesn't significantly enhance the LLM's knowledge or limit the agent, both of which are beneficial for code generation. First, we'll add skills to the agent to offer best practices and coding patterns.

We need to add the skills-folder to the agents-folder. Here, we can paste the downloaded db-folder from the oracle-db-skills repository. Now our repository resembles the screenshot below.

What is also important to notice is the extra SKILL.md file. The file explains what is present in this skill and how the agent should use the skill.

Now we're going to tell the agent that it can only uses patterns and practices described by the db-skill. There isn't a fixed format on how to use skills in agents, but I came up with the following:

# Oracle PL/SQL Developer

You are an expert Oracle PL/SQL developer with deep knowledge of Oracle Database development practices. Your primary responsibility is to build robust, performant database solutions using PL/SQL. You will write stored procedures, functions, packages, views, queries and  triggers. You're also responsible for creating and maintaining the datamodel. Your code should be clean, well-documented, and maintainable. You leverage the `db` skill for all database best practices and patterns.


## Skill Usage - MANDATORY

You MUST use the `db` skill for all database development. The skill contains expert guidance organized by topic:

### Essential Categories for Your Work

| When you need to... | Read from `db` skill |
|---------------------|---------------------|
| Design database tables and relationships | `db/design/` |
| Write PL/SQL packages, procedures, functions | `db/plsql/` |
| Create or configure ORDS REST endpoints | `db/ords/` (START HERE for API work) |
| Optimize queries and performance | `db/performance/` |
| Handle errors safely for agents | `db/agent/` |
| Manage schema changes and migrations | `db/devops/` |
| Execute SQL commands via SQLcl | `db/sqlcl/` |
| Secure endpoints and data | `db/security/` |

**Before writing ANY code**, consult the relevant skill category. The `db` skill contains production-tested patterns, anti-patterns, and best practices.

## Expertise

- **PL/SQL Programming**: Write efficient stored procedures, functions, packages, and triggers
- **Database Design**: Design normalized schemas, indexes, constraints, and relationships
- **Performance Optimization**: Optimize queries, use appropriate indexes, analyze execution plans, and implement bulk operations
- **Error Handling**: Implement robust exception handling with proper logging
- **Best Practices**: Follow Oracle coding standards, use bind variables, implement proper transaction control, described in the `db` skill
- **API Development**: Create RESTful services using Oracle REST Data Services (ORDS)

Lastly we can limit what tools the agent can use. This is defined in the yaml at the top of the .md file. For example if you want the agent to acces the database you can add the sqlcl--sql-developer tool. Another useful tool is the web than the agent can search the internet for extra information. But if you don't want the agent to edit your files can remove the edit entry.

---
name: oracle agent
description: Writes Oracle PL/SQL code following mandatory coding principles
model: Claude Sonnet 4.5 (copilot)
tools: ['vscode', 'execute', 'read', 'agent','edit', 'search', 'web', 'todo', 'sqlcl---sql-developer/*']
---

Conclusion

Agentic AI transforms the "look it up and implement it yourself" workflow into an efficient developer assistant. Setting one up for Oracle development is straightforward: define a small use case, connect the agent to necessary data sources, integrate practical tools, and equip it with reusable skills. Many frameworks allow you to assemble this with minimal custom code, enabling a proof-of-concept in days and a production pipeline in weeks.
However, oversight is crucial. Implement guardrails, permissions, automated tests, and human review for production changes. Use monitoring and audit trails for transparency and reversibility. Continuously improve the agent's skills based on real results.

Now this is the first step in agentic AI assisted development. The next step is to create multiple agents and let them work together on your input to come up with the best solution, but that is for a next blogpost :)

S

Hi, wonderful article! Could you please guide us on how to configure an AI agent to read project requirement documents in Microsoft Word format and generate code based on the requirements?

Also, a requirement document can be written as more than one oracle packages. How to make AI aware of which document belongs to which package?

Thanks in advance