agentleFS
sriramvrinda-osssriramvrinda-oss/oci-db-management-mcp-server/skills/oci-dbm-vault/SKILL.md

oci-dbm-vault

Skill3 starsChanged 7 months agoMITView on GitHub

Creates or validates a vault secret for the ADB ADMIN password and ensures the IAM policy has both required statements for DBM secret access. Trigger when a user says "set up vault for DBM", "create the DBM secret", or when oci-dbm-commission directs here.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Call VaultsClient.list_secrets(compartment_id=compartment_ocid, vault_id=vault_ocid) and filter by secret_name.

    line 31
  2. Very specific:

    If a matching secret is found with lifecycle_state not PENDING_DELETION or DELETED: print its OCID, confirm it, and skip creation (go to …

    line 33
  3. Distinctive:

    If not found, proceed to Step 2.

    line 34
  4. Very specific:

    Call KmsManagementClient.list_keys(compartment_id=compartment_ocid) to retrieve the master encryption key OCID (key_id) from the vault.

    line 38
  5. Very specific:

    Call IdentityClient.list_policies(compartment_id=compartment_ocid) and scan all policies for these two statements (substituting actual …

    line 54
  6. Very specific:

    If the target policy exists, retrieve its current statements, append the missing one, and call IdentityClient.update_policy() using …

    line 70
  7. Very specific:

    If no policy exists yet, create one with IdentityClient.create_policy() containing both statements.

    line 71
  8. Distinctive:

    Before handing off, verify:

    line 91
  9. Distinctive:

    Do not proceed if either check fails.

    line 95

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

oci-dbm-vault

This skill is a worker in the oci-dbm-commission chain. It does NOT generate scripts. It uses the OCI Python SDK directly to store the ADB ADMIN password as a vault secret and to configure the two IAM policy statements that Database Management requires to read that secret.


Inputs

These values are passed by oci-dbm-commission (or supplied directly by the user):

InputDescriptionExample
compartment_ocidOCID of the compartment where the vault and policy liveocid1.compartment.oc1..aaa...
vault_ocidOCID of an existing OCI Vault (must already exist)ocid1.vault.oc1.iad.aaa...
admin_passwordThe ADB ADMIN password — prompt securely if not provided; never log itStr0ngP@ss!
secret_nameName for the secret (default: <dbname>_admin_pwd)dbmdemo_admin_pwd
db_nameADB DB name, used to derive default secret_name if not specifieddbmdemo
policy_nameName of the IAM policy to create or updatedbm-secret-access-policy

What This Skill Executes

Step 1 — Check Whether the Secret Already Exists

Call VaultsClient.list_secrets(compartment_id=compartment_ocid, vault_id=vault_ocid) and filter by secret_name.

  • If a matching secret is found with lifecycle_state not PENDING_DELETION or DELETED: print its OCID, confirm it, and skip creation (go to Step 3).
  • If not found, proceed to Step 2.

Step 2 — Create the Secret

  1. Call KmsManagementClient.list_keys(compartment_id=compartment_ocid) to retrieve the master encryption key OCID (key_id) from the vault.
  2. Base64-encode the admin_password:
    import base64
    encoded = base64.b64encode(admin_password.encode()).decode()
  3. Call VaultsClient.create_secret() with:
    • compartment_id=compartment_ocid
    • vault_id=vault_ocid
    • key_id=key_id
    • secret_name=secret_name
    • secret_content=Base64SecretContentDetails(content=encoded, content_type='BASE64', stage='CURRENT')
  4. Poll until secret.lifecycle_state == 'ACTIVE'. Print the resulting secret_ocid.

Step 3 — Verify IAM Policy Has Both Required Statements

Call IdentityClient.list_policies(compartment_id=compartment_ocid) and scan all policies for these two statements (substituting actual compartment name and secret OCID):

Statement A — grants DBM managed database principal access to the secret:

Allow any-user to read secret-family in compartment <compartment_name>
  where ALL {target.secret.id = '<secret_ocid>',
              request.principal.type = 'dbmgmtmanageddatabase'}

Statement B — grants the DBM service itself access during the enablement process:

Allow service dbmgmt to read secret-family in compartment <compartment_name>
  where target.secret.id = '<secret_ocid>'

For each missing statement:

  • If the target policy exists, retrieve its current statements, append the missing one, and call IdentityClient.update_policy() using UpdatePolicyDetails(statements=[...existing + new...], version_date=None) — do not pass version_date (see Gotcha 2).
  • If no policy exists yet, create one with IdentityClient.create_policy() containing both statements.

Step 4 — Output

Print a summary:

  • Secret name and OCID
  • The two IAM policy statements, confirmed present

Output the following values for the next skill:

secret_ocid: <ocid>
compartment_ocid: <ocid>
vault_validated: true

Confirmation Before Finishing

Before handing off, verify:

  • VaultsClient.get_secret(secret_id=secret_ocid) returns lifecycle_state = ACTIVE
  • Both IAM policy statements are present when list_policies is re-read

Do not proceed if either check fails.


What This Skill Hands Back

Outputs passed to oci-dbm-commission (and subsequently to oci-dbm-enable):

  • secret_ocid — OCID of the active vault secret containing the ADMIN password
  • compartment_ocid — unchanged, forwarded for downstream skills
  • vault_validated: true — signal that this step completed successfully

Gotchas

Gotcha 1 — Statement B is required even before a managed database exists.

Statement A (granting dbmgmtmanageddatabase principal type) only takes effect once the database is registered as a managed database. Statement B (granting service dbmgmt) is what allows the enablement call itself to read the secret. Omitting Statement B causes a silent credential-access failure during enable_autonomous_database_management_feature(). Both statements must be present before calling the enable skill.

Gotcha 2 — Omit version_date from UpdatePolicyDetails.

Passing version_date (even as None explicitly typed as a date object, or as an empty string) triggers a 400 InvalidParameter error from the IAM API. Leave the field entirely absent from the UpdatePolicyDetails constructor, or pass version_date=None only if the SDK accepts it as a no-op. Test with a GET after the update to confirm the statements persisted.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.