Slash commands
Use IBM i-specific slash commands to re-use pre-defined prompts that automate repetitive tasks.
IBM Bob Premium Package for i extends Bob's built-in slash commands with a set of IBM i-specific slash commands. For a general introduction to how slash commands work and what the built-in ones are, see Slash Commands.
Type / in the chat to see all available commands, including the IBM i-specific ones described here.
/erd
The /erd command instructs Bob to generate a Mermaid style Entity Relationship Diagram (ERD) for a set of database tables on the connected IBM i.
| Property | Value |
|---|---|
| Command | /erd |
| Argument | [schema.table or library/file] |
| Available in | IBM i Developer, IBM i Database |
| Requires | Active IBM i connection |
What it does
Bob follows these steps:
Determine scope from the argument you provided or ask which schema/library to analyze if no argument is given.
Query QSYS2.SYSTABLES, QSYS2.SYSCOLUMNS, QSYS2.SYSCST, and QSYS2.SYSREFCST to gather table structure and relationships.
Build and render a Mermaid style Entity Relationship Diagram (ERD) with accurate Db2 for i data types, column markers (PK, FK, UQ), and cardinality notations.
Example usage
/erd
/erd MYLIB
/erd MYAPP.ORDERS
/erd MYPROJ/CUSTOMER/review_SQL
The /review_SQL command instructs Bob to perform a comprehensive review of an SQL statement, using a collection of best practices. It can accept a stand-alone SQL statement or refer to source code that contains one or more SQL statements.
| Property | Value |
|---|---|
| Command | /review_SQL |
| Argument | [SQL statement or source code path] |
| Available in | IBM i Database |
| Requires | Active IBM i connection |
What it does
Bob follows these steps:
Parse the SQL statement from the provided argument or ask for one if no argument is given.
Evaluate the statement against a comprehensive review checklist:
- Correctness and simplification: Correctness concerns, redundant predicates, fragile constructs, nested subqueries, repeated expressions, and unnecessary joins
- Readability and supportability: Formatting, aliases, and comments on complex logic
- Qualification and naming: Table correlation and meaningful names
- Best practices: Usage of built-in functions, CTEs, and statement reuse
- Security: Least privilege, deny by default, protection against SQL injection, and more
- Performance: Data type alignment, unnecessary scalar functions in predicates, non-probable predicates, avoidable casts, and other SQL Query Engine best practices
- Statement-type-specific guidance: Specifics for Data Definition Language (DDL), Data Manipulation Language (DML), embedded SQL, and dynamic SQL
- Diagnostic and verification guidance: Visual Explain, plan cache, and index advice pointers
- Reusable logic: UDFs and stored procedures
- Transaction isolation: Explicit
WITHclauses and isolation level consistency
Return the findings structured as:
- Summary: Brief overall assessment
- Confirmed Findings: Numbered list of issues each with a category, explanation, and suggested improvement
- Conditional Recommendations: Numbered list of suggestions that depend on metadata, workload, or runtime evidence
- Revised SQL: A revised SQL statement only when semantics can be preserved confidently; otherwise an illustrative rewrite with an explanation of what remains conditional
- Explanation of Changes: Concise description of each suggested change
Example usage
/review_SQL
/review_SQL SELECT * FROM ORDERS WHERE CUSTID = '12345'
/review_SQL mylib/mysrc(mycode)
/review_SQL /home/scottf/RPGsrc/toystore.rpglesrc