agentleFS
polardbpolardb/polardbx-skills/skills/polardbx-ccl/SKILL.md

polardbx-ccl

Skill8 starsChanged 30 days agoApache-2.0View on GitHub

Explain, write, and review PolarDB-X Enterprise Edition CCL SQL, including template and keyword matching, account and table scope, per-CN concurrency, waiting, rejection, rule observation, and removal effects. Use for CCL syntax questions, rule reviews, unexpected matching, and throttling behavior. This is a knowledge skill; incident mitigation and CLI execution belong to a separately installed polardbx-emergency skill. Triggers: "CCL", "SQL throttling", "concurrency control", "CCL syntax", "CCL 语法", "限流规则", "模板限流", "关键词限流", "限流未命中", "排队超时".

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    Do not apply this syntax to Standard Edition.

    line 17
  2. Very specific:

    Do not sort or lowercase the keyword list, treat it as a regex, or widen the table scope to * merely to make a rule match.

    line 58
  3. Very specific:

    Do not use CLEAR CCL_RULES as a substitute for removing one rule.

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

PolarDB-X CCL

Explain CCL semantics and produce or review SQL without executing incident interventions.

Scope

  • PolarDB-X Enterprise Edition with CN version 5.4.9-16167266 or later for ordinary CCL; slow-SQL triggers require 5.4.11-16251897 or later.
  • Do not apply this syntax to Standard Edition. For version-specific advice, use supplied instance metadata or an authorized SQL connection with SELECT VERSION();, then confirm the edition and CN build.
  • General knowledge questions do not require an instance ID or a live connection. An example is not permission to create a rule or a test resource.

Core Workflow

  1. Identify whether the request asks for an explanation, SQL review, or live intervention. Explain knowledge questions directly; generate SQL as a proposal, not as an executed change.
  2. Establish the intended SQL type, table/account scope, and template or keyword filter. Use a verified template ID from SQL logs (sql_code), SHOW FULL PROCESSLIST, or EXPLAIN; do not invent a hash or substitute a DAS SQL ID.
  3. Explain per-CN concurrency, waiting capacity, and timeout using the quick reference below. Check wildcards, keyword overmatching, overlapping rules, and node coverage. Use the detailed reference for examples and observation fields.
  4. For a live limit/removal request, use polardbx-emergency if installed. That separate skill owns authorization, supported CLI parameters, execution receipts, and recovery checks. If unavailable, provide the proposed SQL and state the missing execution workflow; do not improvise a write channel. Use polardbx-diagnostics, when available, for incident evidence rather than inferring root cause from a rule alone.

SQL and Behavior Quick Reference

Illustrative template rule; replace all example identifiers and values using actual evidence:

CREATE CCL_RULE `example_template_rule`
ON `example_db`.`example_table`
TO 'example_user'@'%'
FOR SELECT
FILTER BY TEMPLATE('9037e5e2')
WITH MAX_CONCURRENCY=2, WAIT_QUEUE_SIZE=0, WAIT_TIMEOUT=1;

For a query such as SELECT example_column FROM example_table, replace the filter clause with FILTER BY KEYWORD('example_column', 'example_table'); preserve the order in which the tokens occur in the SQL. Native rules combine SQL type, table/account scope, and optional filters. Native types include SELECT, INSERT, UPDATE, and DELETE; each rule selects one type.

Setting or commandMeaning
MAX_CONCURRENCYConcurrent matching executions per CN, not QPS or a shared instance-wide quota. Set explicitly; default 0 can reject all matches.
WAIT_QUEUE_SIZEWaiting capacity per CN; default 0. Waiting consumes thread resources.
WAIT_TIMEOUTQueue wait in seconds, default 600; neither execution timeout nor rule TTL.
FAST_MATCHMatching-cache switch: 0 off, 1 on; default 1.
SHOW CCL_RULES;Inspect all rules.
SHOW CCL_RULE example_template_rule;Inspect a named rule and its counters.
DROP CCL_RULE IF EXISTS example_template_rule;Remove that rule; queued requests may then run.

Below the concurrency cap, a match runs. At the cap it waits if queue capacity remains; a full queue or expired wait causes an error. Ordinary CCL does not guarantee immediate termination of in-flight work. Slow-SQL triggers are a separate mechanism that can also terminate excess slow queries.

Best Practices

  1. Distinguish native engine capabilities from management-interface parameters. The separately verified DAS create path exposes keyword filtering; this does not mean native CCL supports only keywords.
  2. Preserve keyword order and verify identifier spelling against actual SQL samples. On tested build 5.7.25-TDDL-5.4.21-20260701, keyword lists matched in SQL token order; parameter values and backtick-quoted identifiers were case-sensitive, while unquoted identifier tokens matched case-insensitively. Exact table scope also failed to match a differently cased table reference. Do not generalize these observations to every version or assume FAST_MATCH=0 fixes them. See version-scoped matching evidence. Do not sort or lowercase the keyword list, treat it as a regex, or widen the table scope to * merely to make a rule match. A template filter does not bypass the rule's table/account conditions.
  3. Interpret NO. as priority, not a DAS ItemId. Separate current running/waiting counts from cumulative match/rejection counters and use window deltas.
  4. Explain retry amplification and post-removal bursts. A rule disappearing is not proof that normal business has recovered; configuration read-back alone is not proof of actual throttling.
  5. Do not use CLEAR CCL_RULES as a substitute for removing one rule. Do not silently enable slow-SQL triggers when the user requests ordinary CCL advice.

References

ReferenceContents
references/ccl-sql.mdDetailed SQL examples, matching semantics, observation fields, removal effects, and official sources.

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.