SQL Optimization Patterns
ynulihao/AgentSkillOS
Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries.
Diagnose and fix common Cartography intel-module errors — ModuleNotFoundError, PropertyRef validation failed, GraphJob failed, missing relationships, MatchLink misses, cleanup deleting too much…
$ npx skills add cartography-cncf/cartography --skill troubleshooting -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install cartography-cncf/cartography troubleshooting --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/cartography-cncf/cartography.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/troubleshooting .claude/skills/troubleshooting && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "troubleshooting" agent skill from https://github.com/cartography-cncf/cartography/tree/master/.agents/skills/troubleshooting into .claude/skills/troubleshooting/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "troubleshooting", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/cartography-cncf/cartography/tree/master/.agents/skills/troubleshootingType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add cartography-cncf/cartography --skill troubleshooting -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install cartography-cncf/cartography troubleshooting --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/cartography-cncf/cartography.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/troubleshooting .agents/skills/troubleshooting && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "troubleshooting" agent skill from https://github.com/cartography-cncf/cartography/tree/master/.agents/skills/troubleshooting into .agents/skills/troubleshooting/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "troubleshooting", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add cartography-cncf/cartography --skill troubleshooting -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install cartography-cncf/cartography troubleshooting --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/cartography-cncf/cartography.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/troubleshooting .cursor/skills/troubleshooting && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "troubleshooting" agent skill from https://github.com/cartography-cncf/cartography/tree/master/.agents/skills/troubleshooting into .cursor/skills/troubleshooting/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "troubleshooting", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/cartography-cncf/cartography.git --path .agents/skills/troubleshooting--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add cartography-cncf/cartography --skill troubleshooting -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install cartography-cncf/cartography troubleshooting --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/cartography-cncf/cartography.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/troubleshooting .gemini/skills/troubleshooting && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "troubleshooting" agent skill from https://github.com/cartography-cncf/cartography/tree/master/.agents/skills/troubleshooting into .gemini/skills/troubleshooting/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "troubleshooting", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install cartography-cncf/cartography troubleshootingInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add cartography-cncf/cartography --skill troubleshooting -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/cartography-cncf/cartography.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/troubleshooting .github/skills/troubleshooting && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "troubleshooting" agent skill from https://github.com/cartography-cncf/cartography/tree/master/.agents/skills/troubleshooting into .github/skills/troubleshooting/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "troubleshooting", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add cartography-cncf/cartography --skill troubleshooting -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install cartography-cncf/cartography troubleshooting --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/cartography-cncf/cartography.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/troubleshooting .opencode/skills/troubleshooting && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "troubleshooting" agent skill from https://github.com/cartography-cncf/cartography/tree/master/.agents/skills/troubleshooting into .opencode/skills/troubleshooting/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "troubleshooting", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
troubleshootingDiagnose and fix common Cartography intel-module errors — ModuleNotFoundError, PropertyRef validation failed, GraphJob failed, missing relationships, MatchLink misses, cleanup deleting too much…
Troubleshooting is an agent skill from cartography-cncf/cartography. Diagnose and fix common Cartography intel-module errors — ModuleNotFoundError, PropertyRef validation failed, GraphJob failed, missing relationships, MatchLink misses, cleanup deleting too much, slow queries, ignored custom schema fields, key errors during transform. Use when the user reports an error while developing or running a Cartography module.
Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Databases, covering Query optimization. The repository describes itself as: Cartography is a Python tool that pulls infrastructure assets and their relationships into a Neo4j graph database. The licence is Apache-2.0.
3 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit e345364. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
nodeFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Troubleshooting loads about 2.5k tokens when it runs. Until then it costs about 94 tokens; SKILL.md has 418 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from cartography-cncf/cartography at commit e345364, republished under its Apache-2.0 licence (© cartography-cncf). 418 words, ~2,490 tokens.
.claude/skills/troubleshooting/SKILL.md (or your agent's skills folder).Diagnostic playbook for the most common errors encountered while developing Cartography intel modules.
# Problem: ModuleNotFoundError for your new module
# Solution: ensure __init__.py files exist in all directories
cartography/intel/your_service/__init__.py
cartography/models/your_service/__init__.pyChecklist:
__init__.py exists in cartography/intel/your_service/__init__.py exists in cartography/models/your_service/__init__.py if needed# Problem: "PropertyRef validation failed"
# Solution: check dataclass syntax and PropertyRef definitions
@dataclass(frozen=True) # do not forget frozen=True
class YourNodeProperties(CartographyNodeProperties):
id: PropertyRef = PropertyRef("id") # must have type annotation
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)Common causes:
frozen=True in @dataclass.: PropertyRef).PropertyRef field name.# Problem: relationships not created
# Solution: ensure target nodes exist before creating relationships
# Load parent nodes first:
load(neo4j_session, TenantSchema(), tenant_data, lastupdated=update_tag)
# Then load child nodes with relationships:
load(neo4j_session, UserSchema(), user_data, lastupdated=update_tag, TENANT_ID=tenant_id)Debugging steps:
target_node_matcher keys match the target node's property names.None.# Problem: "GraphJob failed" during cleanup
# Solution: check common_job_parameters
common_job_parameters = {
"UPDATE_TAG": config.update_tag, # must match what is set on nodes
"TENANT_ID": tenant_id, # if using scoped cleanup (default)
}# Problem: cleanup deletes too much (wrong scoped_cleanup setting)
# Solution: verify scoped_cleanup is appropriate
@dataclass(frozen=True)
class MySchema(CartographyNodeSchema):
# tenant-scoped resources — default, do not specify
# scoped_cleanup: bool = True
# global resources only — rare
scoped_cleanup: bool = False # vuln data, threat intel, etc.For details on when to override scoped_cleanup, see the add-node-type skill.
# Problem: KeyError during transform
# Solution: handle required vs optional fields correctly
{
"id": data["id"], # required — let it fail
"name": data.get("name"), # optional
# avoid empty-string defaults — they hide missing data
# "email": data.get("email", ""),
"email": data.get("email"), # use None default
}# Problem: adding custom fields to schema classes
# Solution: remove them — only standard fields are recognised
@dataclass(frozen=True)
class MyRel(CartographyRelSchema):
# Remove custom fields — they are silently ignored:
# conditional_match_property: str = "some_field"
# custom_flag: bool = True
# extra_config: dict = {}
# Keep only the standard relationship fields
target_node_label: str = "TargetNode"
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(...)
direction: LinkDirection = LinkDirection.OUTWARD
rel_label: str = "CONNECTS_TO"
properties: MyRelProperties = MyRelProperties()For the standard schema fields, see the add-node-type skill.
# Problem: slow queries
# Solution: index frequently queried fields
email: PropertyRef = PropertyRef("email", extra_index=True)
# Query on indexed fields when possible
MATCH (u:User {id: $user_id}) # good — id is always indexed
MATCH (u:User {name: $name}) # bad — name might not be indexedFields used inside a target_node_matcher are indexed automatically.
# Problem: MatchLinks not creating relationships
# Solution: both source and target nodes must exist first
load(neo4j_session, SourceNodeSchema(), source_data, ...) # 1. source nodes
load(neo4j_session, TargetNodeSchema(), target_data, ...) # 2. target nodes
load_matchlinks( # 3. then MatchLinks
neo4j_session,
YourMatchLinkSchema(),
mapping_data,
lastupdated=update_tag,
_sub_resource_label="AWSAccount",
_sub_resource_id=account_id,
)# Problem: MatchLink cleanup not working
# Solution: use GraphJob.from_matchlink with the right args
GraphJob.from_matchlink(
YourMatchLinkSchema(),
"AWSAccount", # _sub_resource_label
common_job_parameters["AWS_ID"], # _sub_resource_id
common_job_parameters["UPDATE_TAG"], # update_tag
).run(neo4j_session)For full MatchLink details, see the add-relationship skill.
cartography/intel/ before inventing new ones.CartographyNodeSchema / CartographyRelSchema imports must point to cartography.models.core.*.cartography/intel/lastpass/users.py).sync(), not isolated load() calls.| File | Purpose |
|---|---|
cartography/client/core/tx.py | Core load() and load_matchlinks() — query generation lives here |
cartography/graph/job.py | GraphJob cleanup operations |
cartography/models/core/common.py | PropertyRef definition |
cartography/models/core/nodes.py | CartographyNodeSchema, CartographyNodeProperties, ExtraNodeLabels, etc. |
cartography/models/core/relationships.py | CartographyRelSchema, LinkDirection, matchers, MatchLinks |
cartography/config.py | Config object — check missing fields here |
cartography/cli.py | Typer CLI with help panels |
cartography/data/indexes.cypher | Manual index definitions (legacy) |
cartography/data/jobs/cleanup/ | Legacy cleanup JSON files |
cartography/analysis/*/analysis.py | Typed analysis jobs (see analysis-jobs skill) |
cartography/data/jobs/analysis/ | Legacy migration/cleanup JSON jobs |
cartography/data/jobs/scoped_analysis/ | Legacy scoped migration/cleanup JSON jobs |
from tests.integration.util import check_nodes, check_rels
# Nodes
expected_nodes = {
("user-123", "alice@example.com"),
("user-456", "bob@example.com"),
}
assert check_nodes(neo4j_session, "YourServiceUser", ["id", "email"]) == expected_nodes
# Relationships
expected_rels = {
("user-123", "tenant-123"),
("user-456", "tenant-123"),
}
assert check_rels(
neo4j_session,
"YourServiceUser", "id",
"YourServiceTenant", "id",
"RESOURCE",
rel_direction_right=True,
) == expected_rels| Error message | Likely cause | Solution |
|---|---|---|
PropertyRef validation failed | Missing type annotation or frozen=True | Check dataclass definition |
Node not found for relationship | Target node does not exist | Load parent nodes first |
GraphJob failed | Wrong common_job_parameters | Check UPDATE_TAG and tenant ID |
KeyError: 'field_name' | Required field missing in API response | Use .get() for optional fields |
ModuleNotFoundError | Missing __init__.py | Add __init__.py to all directories |
Relationship not created | Matcher property mismatch | Verify property names match exactly |
Stop and ask the user when:
© cartography-cncf, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/troubleshooting of cartography-cncf/cartography.
Open the folder on GitHubat commit e345364
Troubleshooting next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Troubleshooting this skillcartography-cncf/cartography | 4.1k | — | ~2.5k | Automated safety check: Pass | Apache-2.0 | |
| SQL Optimization Patternsynulihao/AgentSkillOS | 617 | 11 repos | ~3.3k | Automated safety check: Pass | None | |
| Cloud Trace Queryinggoogle/skills | 21k | — | ~1.7k | Automated safety check: Pass | Apache-2.0 | |
| Query Engine Designrevfactory/claude-code-harness | 120 | — | ~474 | Automated safety check: Pass | None | |
| Query Plan Snapshot CLIeclipse-rdf4j/rdf4j | 420 | — | ~1.5k | Automated safety check: Pass | BSD-3-Clause | |
| Wp Acf And Content Modelingjorgerosal/wordpress-skills | 102 | — | ~3.2k | Automated safety check: Pass | MIT |
ynulihao/AgentSkillOS
Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries.
google/skills
Query Cloud Trace spans, filter by latency thresholds or error status, correlate distributed traces with Cloud Logging, and diagnose latency bottlenecks across Google Cloud services.
revfactory/claude-code-harness
SQL query engine design and implementation guide. An agent skill from revfactory/claude-code-harness.
eclipse-rdf4j/rdf4j
Use QueryPlanSnapshotCli to capture and compare RDF4J query plans, then assess likely performance improvements/regressions from execution verification and semantic plan diffs.
jorgerosal/wordpress-skills
WordPress ACF and content modeling review. An agent skill from jorgerosal/wordpress-skills.
affaan-m/ECC
JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.
cartography-cncf/cartography
Define a new node schema under cartography/models/MODULENAME/, including required properties, sub-resource relationships, extra labels, conditional labels, scoped cleanup, and one-to-many transforms.
cartography-cncf/cartography
Define a CartographyRelSchema (standard relationship), one-to-many edge, or MatchLink connecting existing nodes.
cartography-cncf/cartography
Add a post-ingestion typed analysis job to a Cartography module to enrich the graph after sync.
cartography-cncf/cartography
Author a new Cartography intel module end-to-end (entry point, sync GET/TRANSFORM/LOAD/CLEANUP, declarative data model, integration test, schema docs).
cartography-cncf/cartography
Author a Cartography security rule (one or more Cypher Facts plus a Pydantic Finding output model) under cartography/rules/data/rules/.
cartography-cncf/cartography
Map a Cartography node into the Ontology system using semantic labels (UserAccount, DeviceInstance, Tenant, Database, ObjectStorage, FileStorage) or canonical nodes (User, Device).
Categories
Diagnose and fix common Cartography intel-module errors — ModuleNotFoundError, PropertyRef validation failed, GraphJob failed, missing relationships, MatchLink misses, cleanup deleting too much…. Troubleshooting is an agent skill from cartography-cncf/cartography. Diagnose and fix common Cartography intel-module errors — ModuleNotFoundError, PropertyRef validation failed, GraphJob failed, missing relationships, MatchLink misses, cleanup deleting too much, slow queries, ignored custom schema fields, key errors during transform.
Troubleshooting fits situations like: the user reports an error while developing; running a Cartography module.
Run `npx skills add cartography-cncf/cartography --skill troubleshooting -a claude-code`. Or copy the skill folder (.agents/skills/troubleshooting in cartography-cncf/cartography) into .claude/skills/troubleshooting in your project. Claude Code loads it when a task matches its description.
Run `npx skills add cartography-cncf/cartography --skill troubleshooting -a codex`. Or copy the skill folder (.agents/skills/troubleshooting in cartography-cncf/cartography) into .agents/skills/troubleshooting in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add cartography-cncf/cartography --skill troubleshooting -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/troubleshooting, .gemini/skills/troubleshooting, .github/skills/troubleshooting and .opencode/skills/troubleshooting in your project.
Going by SKILL.md and its folder, Troubleshooting needs the command-line tools its instructions call (node). Our summary lists: Python 3.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Troubleshooting is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Troubleshooting: SQL Optimization Patterns (ynulihao/AgentSkillOS, 617 stars), Cloud Trace Querying (google/skills, 21k stars), Query Engine Design (revfactory/claude-code-harness, 120 stars) and Query Plan Snapshot CLI (eclipse-rdf4j/rdf4j, 420 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
cartography-cncf (a GitHub organization) maintains it in cartography-cncf/cartography, which has 4,128 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on October 9, 2026.
Source: cartography-cncf/cartography on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.