Public proof of concept showing how Oracle SQLcl Codescan and SQLcl MCP can be used to validate repository SQL or PL/SQL source files against Trivadis-style rules.
- Oracle SQLcl
CODESCANdocs: https://docs.oracle.com/en/database/oracle/sql-developer-command-line/26.1/sqcug/codescan.html - Trivadis PL/SQL and SQL Coding Guidelines: https://trivadis.github.io/plsql-and-sql-coding-guidelines/
- Show that SQLcl can surface Trivadis warnings inline during script execution when
set codescan onis enabled. - Show how an MCP-based agent can detect, interpret, and fix source-file warnings in iterative workflows.
- Provide a small reusable documentation set for both humans and agents.
.
|-- README.md
|-- LICENSE
|-- trivadis_warning_status.md
|-- docs
| |-- ai_guidance.md
| |-- git_trivadis_workflow.md
| |-- sqlcl_mcp_file_execution.md
| \-- manual_trivadis_checks.md
|-- examples
| |-- select_from_dual_demo.sql
| \-- select_from_dual_warning_record.md
\-- skills
\-- sqlcl_mcp_trivadis_agent_skill.md
| Path | Description |
|---|---|
README.md |
Main overview, flow, prompts, and usage notes. |
LICENSE |
MIT license for broad reuse with warranty disclaimer. |
trivadis_warning_status.md |
One-row-per-file-and-rule warning tracking table with branch and main-merge tracking. |
docs/ai_guidance.md |
MCP workflow guidance for source-file warning handling. |
docs/git_trivadis_workflow.md |
Branch, commit, PR, review, and merge workflow for Trivadis iterations. |
docs/sqlcl_mcp_file_execution.md |
SQLcl MCP @ and @@ execution notes, including permission caveats. |
docs/manual_trivadis_checks.md |
Standalone SQLcl steps for manual Trivadis checks. |
examples/select_from_dual_demo.sql |
Sample script with version comments and fixed warning. |
examples/select_from_dual_warning_record.md |
Warning capture and post-fix verification notes. |
skills/sqlcl_mcp_trivadis_agent_skill.md |
Skill behavior for SQLcl MCP plus Trivadis iterations. |
- An agent or human prepares a SQL or PL/SQL script.
- SQLcl MCP connects to Oracle using a saved SQLcl connection.
- SQLcl session enables
set codescan on. - The script runs with
@file.sql. - SQLcl emits Trivadis warnings inline, if any exist.
- The agent updates repository source files for low-risk fixes or asks the user to decide.
- The script is re-run until warnings are fixed in source, accepted, or recorded.
User
|
| ask for SQL change or review
v
AI Agent
|
| connect + get schema context
v
SQLcl MCP
|
| open saved connection
v
SQLcl Session --------------------> Oracle Database
| |
| set codescan on | connect and execute SQL/PLSQL
| run @script.sql |
v |
Codescan <------------------------------+
|
| return Trivadis warnings
v
SQLcl Session
|
| return warnings + query output
v
SQLcl MCP
|
| return execution response
v
AI Agent
|
| update source files or ask user
v
User
| Use Case | Prompt |
|---|---|
| Direct agent task | Use SQLcl MCP with Trivadis checks for this SQL change. Enable set codescan on, run @file.sql, update only repository source files for safe fixes, record the warning lifecycle in trivadis_warning_status.md, and ask before higher-risk changes. |
| Review existing SQL file | Review this SQL file with SQLcl MCP and Trivadis checks. Run the file, list warning rule numbers, propose the smallest source-file fix for each warning, and apply only safe repository-file edits. |
| Guided step-by-step run | Use the proof-of-concept workflow from this repository. Show each warning, propose the smallest source-file fix, do not modify database objects directly, and keep trivadis_warning_status.md updated. |
If you want the manual flow to work outside MCP, make sure your local SQLcl supports codescan and enable it in the session before executing scripts.
Basic standalone flow:
sql /nolog
connect my_saved_connection
set codescan on
@/absolute/path/to/your_script.sql
Optional folder-level scan:
codescan -path /absolute/path/to/sql/files
More detail is in docs/manual_trivadis_checks.md.
Inline Trivadis warnings are not emitted automatically just because a script is executed with @file.sql. The SQLcl session must enable set codescan on, or the operator must run an explicit codescan -path ... command.
- Start with
docs/manual_trivadis_checks.mdfor human execution. - Start with
docs/ai_guidance.mdandskills/sqlcl_mcp_trivadis_agent_skill.mdfor agent-driven workflows. - Start with
docs/sqlcl_mcp_file_execution.mdfor SQLcl MCP file execution details. - Start with
docs/git_trivadis_workflow.mdfor branch, PR, review, and merge workflow.