B4X Skill for Claude Code

Jerryk

Active Member
Licensed User
Longtime User

B4X Skill for Claude Code​

A focused Agent Skill that helps Claude write, review, and explain idiomatic B4X code for B4A, B4J, and B4i.

It gives Claude practical guidance for B4XPages, XUI, SQLite, JSON, resumable subs, platform-specific APIs, custom views, and .b4xlib libraries. Its main goal is to prevent common AI-generated mistakes such as mixing B4X with VB.NET or Java, using the wrong module scope, and combining incompatible B4A, B4J, and B4i APIs.

[!NOTE] B4R (Arduino and ESP boards) is intentionally outside the scope of this skill because it uses a different runtime, type system, and development model.

What this skill improves​

  • Correct B4X syntax, module types, and variable scope
  • Modern B4XPages architecture for new UI projects
  • Cross-platform UI code with XUI and B4XView
  • Clear separation of B4A-, B4J-, and B4i-specific APIs
  • Safe SQLite queries, file handling, and JSON processing
  • Correct Sleep, Wait For, resumable-sub, and HttpJob patterns
  • Practical checks for initialization, resource cleanup, and event signatures
  • Review and modernization of older B4X code

Supported platforms​

PlatformSupportMain topics
B4AYesAndroid, permissions, manifest, JavaObject
B4JYesDesktop UI, JavaFX boundaries, headless servers, jServer
B4iYesiOS UI, build and signing, ATS, NativeObject
Shared B4XYesXUI, B4XPages, SQLite, JSON, I/O, networking
B4RNoIntentionally out of scope

Installation​

Claude Code marketplace​

Run these commands inside Claude Code:
Claude code:
/plugin marketplace add Jerryk133/b4x-skill
/plugin install b4x@b4x-marketplace
/reload-plugins

The plugin is then available across the installation scope you selected. Claude can activate the skill automatically when your request involves B4X.

Test locally without installing​

Clone the repository and start Claude Code with the plugin directory:
PowerShell:
git clone https://github.com/Jerryk133/b4x-skill.git
claude --plugin-dir ./b4x-skill

This is useful when evaluating or developing the skill.

Install as a standalone Claude Code skill​

Copy the skills/b4x directory to one of these locations:

ScopeDestination
Personal β€” all projects~/.claude/skills/b4x/
Project β€” current repository.claude/skills/b4x/

PowerShell:
PowerShell:
git clone https://github.com/Jerryk133/b4x-skill.git
New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null
Copy-Item -Recurse -Force ".\b4x-skill\skills\b4x" "$HOME\.claude\skills\b4x"

Bash:
Bash:
git clone https://github.com/Jerryk133/b4x-skill.git
mkdir -p ~/.claude/skills
cp -R ./b4x-skill/skills/b4x ~/.claude/skills/b4x

Start a new Claude Code session after copying the skill if it is not detected in the current session.

Usage​

The installed plugin can be invoked explicitly as /b4x:b4x:
Claude code:
/b4x:b4x Review this B4A B4XPages code and fix any compile errors.

When installed as a standalone skill, invoke it as /b4x.

In normal use, explicit invocation is optional. Ask Claude naturally:

Claude code:
Create a B4XPages settings page shared by B4A and B4J.
Explain why Process_Globals does not compile in my B4XMainPage class.
Refactor this SQLite query to use ExecQuery2 and close the ResultSet safely.
Convert this B4A-only view code to cross-platform XUI code.

For the most useful result, include:

  • the target platform or platforms;
  • the module type, such as B4XMainPage, class, code module, or service;
  • the relevant libraries;
  • the complete compiler error and affected code when debugging.

Knowledge included​

The skill uses progressive disclosure: SKILL.md contains the routing rules and essential checks, while detailed guidance is loaded only for the topic being handled.

ReferenceCoverage
language-and-modules.mdSyntax, types, scope, modules, collections
b4xpages-and-xui.mdB4XPages, XUI, Designer, views, canvas, bitmap, fonts
data-and-io.mdSQLite, ResultSet, transactions, files, JSON
async-network.mdSleep, Wait For, resumable subs, timers, HttpJob
custom-views-and-libraries.mdXUI custom views and .b4xlib packaging
bundled-libraries.mdLibraries shipped with the IDE and what they are for
platform-b4a.mdAndroid manifest, permissions, JavaObject
platform-b4j.mdDesktop, JavaFX, servers, handlers, packaging
platform-b4i.mdiOS build, signing, ATS, NativeObject
common-mistakes.mdFrequent AI and migration errors, version-gated features

Repository structure​

b4x-skill/
β”œβ”€β”€ .claude-plugin/
β”‚ β”œβ”€β”€ marketplace.json
β”‚ └── plugin.json
β”œβ”€β”€ .github/
β”‚ └── workflows/
β”‚ └── validate.yml
β”œβ”€β”€ evals/
β”‚ β”œβ”€β”€ README.md
β”‚ β”œβ”€β”€ cases.md
β”‚ └── content-checks.mjs
β”œβ”€β”€ scripts/
β”‚ └── validate.mjs
β”œβ”€β”€ skills/
β”‚ └── b4x/
β”‚ β”œβ”€β”€ SKILL.md
β”‚ └── references/
β”‚ β”œβ”€β”€ async-network.md
β”‚ β”œβ”€β”€ b4xpages-and-xui.md
β”‚ β”œβ”€β”€ bundled-libraries.md
β”‚ β”œβ”€β”€ common-mistakes.md
β”‚ β”œβ”€β”€ custom-views-and-libraries.md
β”‚ β”œβ”€β”€ data-and-io.md
β”‚ β”œβ”€β”€ language-and-modules.md
β”‚ β”œβ”€β”€ platform-b4a.md
β”‚ β”œβ”€β”€ platform-b4i.md
β”‚ └── platform-b4j.md
β”œβ”€β”€ CHANGELOG.md
β”œβ”€β”€ LICENSE
└── README.md

Limitations​

  • This is a knowledge skill, not a B4X compiler, IDE extension, or language server.
  • It does not install B4X, platform SDKs, libraries, or build tools.
  • Code still needs to be compiled and tested in the appropriate B4X IDE.
  • B4X and mobile-platform requirements evolve. Claims involving the latest IDE, Android SDK, iOS, or store policies should be verified against current official documentation.
  • Some third-party B4X library APIs vary by version. Include the library name and version when asking about them.

Development and validation​

Load the repository directly while making changes:

claude --plugin-dir ./b4x-skill

Validate the plugin, marketplace catalog, and skill metadata from Claude Code:

/plugin validate .

After editing plugin files, run:

/reload-plugins

When publishing a new release, update the version in .claude-plugin/plugin.json.

References and credits​

The Working Style guidance in SKILL.md adapts ideas from multica-ai/andrej-karpathy-skills, licensed under MIT.

B4X, B4A, B4J, B4i, and B4R are products of Anywhere Software.

License​

Released under the MIT License.
 
Last edited:

Jerryk

Active Member
Licensed User
Longtime User

[1.3.1] β€” 2026-08-09​

B4A 13.7 was released as stable. Its edge-to-edge API was verified against the installed libraries rather than forum posts, which corrected the guidance 1.2.0 shipped.

Added​

  • Verified IME members for edge-to-edge work in platform-b4a.md: GetContentRect, IsEdgeToEdge, GetActionBarHeight, AddHeightChangedEvent with the InsetsChanged event, and UpdatePercentageReference for layouts using %x / %y inside a root panel smaller than the screen.
  • Errors section in language-and-modules.md. Catch takes no parameter and the exception is read from LastException; this was only visible in a table row and one example before.
  • ThrowException(Message) and Exception.StackTrace, both Core members added in B4A 13.7, with their pre-13.7 fallbacks.

Changed​

  • Inset support is now recorded with the component versions it needs β€” B4A 13.7, IME 2.01, B4XPages 1.15 β€” since B4XPages depends on IME on B4A to do it.
 

Jerryk

Active Member
Licensed User
Longtime User
Hi Mashiane, thanks β€” good question, and I wanted to check properly before answering rather than guess.

Short answer: the skill wasn't built by transcribing Erel's lists, but it overlaps with them heavily, because we were both aiming at the same failure modes. I've just gone through "Code Smells" and "Features that Erel recommends to avoid" item by item against what's actually in the skill.

Already covered:
  • Non-parameterized queries β†’ ExecQuery2 / ExecNonQuery2 (this is one of the skill's seven top-level rules)
  • Cursor β†’ ResultSet
  • Activities β†’ B4XPages
  • Layouts in code β†’ Designer + Anchors + AutoScaleAll
  • ListView / TableView β†’ xCustomListView
  • Custom dialogs β†’ B4XDialogs
  • DoEvents / Msgbox β†’ async equivalents
  • Callbacks β†’ Wait For, and CallSubDelayed β†’ ResumableSub
  • TextReader / TextWriter β†’ AsyncStreams and File.ReadString
  • Manual JSON building β†’ JSONGenerator
  • Map ordering assumptions β†’ B4XOrderedMap
  • StartServiceAt β†’ StartReceiverAt
  • String concatenation β†’ smart strings
  • Platform-specific APIs β†’ XUI / B4XView
Not covered yet β€” and I'd rather name them than pretend otherwise:
  • GetKeyAt / GetValueAt β†’ For Each over Keys
  • File.DirDefaultExternal β†’ XUI.DefaultFolder, and DirRootExternal β†’ ContentChooser / SaveAs
  • Round2 β†’ NumberFormat / B4XFormatter
  • VideoView β†’ ExoPlayer
  • Byte-to-string conversion β†’ B4XBytesBuilder
  • ExecQuerySingleResult when the result can be missing
  • The general code-quality items (repetition, redundant boolean logic, unnecessary globals, initializing an object then reassigning it)
I'll work through that list for the next release.

One thing worth mentioning about the angle, since it explains the differences: Erel's lists target what developers get wrong. The skill targets what LLMs get wrong, which is an overlapping but not identical set. Its single biggest section is about B4X not being VB.NET or Java β€” Dim x = 5, i++, ElseIf, x != y, catch (Exception e) β€” which isn't a human problem at all, but is the number one thing models produce. The other big one is silently mixing B4A, B4J and B4i APIs inside code presented as cross-platform.

So I'd say the two are complementary rather than one containing the other. Folding in the remaining items above should close most of the gap in the direction that matters.
 

Jerryk

Active Member
Licensed User
Longtime User

[1.4.0] β€” 2026-08-09​

Closes the gap between this skill and Erel's own recommendations, and gives the skill a way to know what already exists before it invents something.

Added​

  • references/bundled-libraries.md. The skill previously documented only the libraries that are architecturally load-bearing or universally needed, so a whole tier of things that ship with the IDE β€” B4XTable, KeyValueStore, Xml2Map, MediaChooser, NB6, B4XDrawer, PreoptimizedCLV and the rest β€” was invisible. The file is organised for recall rather than reference: what exists and what it is for, deliberately without signatures, which is the part that goes stale.
  • ListOfArrays (LoA) covered in that file: tabular data in memory instead of a List of Maps or parallel arrays, with its LOAUtils entry points. It was released in May 2026, so no model has seen it β€” without the skill it will never be suggested. For the same reason it carries an explicit instruction not to write LoA code from memory: it was pre-1.0 at the time of writing and has roughly 70 public subs, which is an invitation to confabulate the rest.
  • Section 13 of common-mistakes.md, covering the items from Erel's "Code Smells" and "Features to avoid" that the skill did not have: GetKeyAt/GetValueAt, File.DirDefaultExternal, File.DirRootExternal, Round2 used for display, VideoView, BytesToString on non-text bytes, ExecQuerySingleResult with a possibly-absent row, TextReader/TextWriter, hand-built XML and JSON, and initialise-then-reassign. Plus repetition, redundant boolean returns and needless globals.
  • A closing note in bundled-libraries.md on how to check an API without inventing one, including that a Subs-only listing cannot see a Public variable in Process_Globals β€” the mistake made in 1.3.0.
 

Jerryk

Active Member
Licensed User
Longtime User

[1.5.0] β€” 2026-08-10​

Reported from practice: generated projects kept failing to compile because a variable, a Sub and a module had ended up with the same name.

Added​

  • Naming and collisions in language-and-modules.md. Identifiers are case-insensitive, so names that coexist happily in Java or C# collide in B4X. Tabulates what shares a namespace: a Sub and a variable in one module; a Sub parameter and a global, which fails with "Parameter name cannot hide global variable name"; anything and a module name, since modules are qualifiers; a Designer view and anything else in its module, because LoadLayout binds views to same-named variables; and anything named after a library type. Notes the m prefix for module-level state that Erel's own library sources use.
  • Section 13 of common-mistakes.md for the same trap, with the point that matters when generating: pick names against the set already in use across the module and project, not per sub. Choosing a name in isolation is what produces the collision.
  • A name-collision line in the SKILL.md compile checklist, which is where it gets checked before code is handed over.
 

Jerryk

Active Member
Licensed User
Longtime User

[1.7.0] β€” 2026-08-15​

The last open audit finding: nothing checked what the skill says. Every serious defect so far passed the structural validator.

Added​

  • evals/content-checks.mjs, run in CI after the validator. Enforces platform purity β€” no code block labelled ' B4X may name a single-platform type, with #If B4A … #End If exempt, since that guard is how shared code is supposed to reach a platform API. It would have caught the CSBuilder and ThrowException mislabels.
  • Eleven regression assertions in the same file, one per bug that has shipped, each tagged with the version that fixed it and the reason it matters. Verified by reintroducing three of the original defects, each of which failed the run.
  • evals/cases.md: eight behavioural cases graded by reading rather than string matching, since asserting exact output would only teach one phrasing. Each descends from a real defect. Case 8 asks directly for a member that does not exist, which is the failure mode the skill exists to prevent.
  • evals/README.md on why there are two layers and when to run each, including that API resolution needs a local B4X install and reports itself skipped rather than passing quietly.

Changed​

  • The validator's README check now accepts any .md that exists anywhere in the repo, not only under references/, so documentation outside the skill does not register as a stale reference.

[1.6.0] β€” 2026-08-15​

Acts on an external audit. Every finding below was re-verified against the installed libraries or the official sources before being acted on.

If you copied shared code from 1.5.0, re-check it: three fixes here reclassify code that was presented as cross-platform but is not.

Fixed​

  • A B4J server sharing one SQL object across multithreaded handlers. The third argument of AddHandler is "whether this handler should always run in the main thread", so the False in platform-b4j.md meant worker threads, while data-and-io.md said to keep the database in Main.Process_Globals. Neither file was wrong alone; together they produced concurrent use of a single connection, which corrupts behaviour with no compile error. platform-b4j.md now uses ConnectionPool with a connection taken and closed per request and documents both values of the flag, and data-and-io.md carries the exception to its own rule.
  • CSBuilder presented as cross-platform. The type does not exist in B4J β€” swapping Typeface for the XUI font factories makes the font portable, not CSBuilder. Relabelled B4A/B4i, with BCTextEngine / BBLabel named for B4J.
  • ThrowException and Exception.StackTrace labelled ' B4X. Both are B4A Core additions and absent from B4J; the block even contradicted itself with an inline "B4A 13.7+" note. Split into a genuinely cross-platform Try/Catch/LastException.Message example and a B4A-only one, with the #If B4A form for shared code.
  • B4i orientation attribute. #SupportedOrientations: 2 is B4A's form. B4i uses #iPhoneOrientations and #iPadOrientations with named values.
  • Google Play tense. The API 36 requirement was written as already in force; 31 August 2026 is still ahead. Now stated as a future date, with the per-device thresholds and the extension to 1 November 2026.
  • #Region described as setting the B4J app type. It only folds a block in the editor; the type comes from creating a Non-UI project.
  • Pseudo-code in a copyable block. req.InputStream ... is now a working TextReader.Initialize2 read of the request body.
  • AddPageAndCreate was described as constructing the page. Both it and AddPage take an instance you already initialized; they differ in when B4XPage_Created runs.
  • README credited "Working Style guidance" for a section that does not exist.

Added​

  • Threading section in platform-b4j.md: what each value of the AddHandler flag means and which database access each one permits.
  • B4J 10.2 and B4i 8.90 floors alongside B4A 13.3 for Initialized() and the B4XCollections helpers, with the rule that shared code takes the highest of the three.
  • A caveat in bundled-libraries.md that the list was checked against a B4A install and availability is per platform and per IDE version.

Changed​

  • Softened rules the skill's own section on over-absolute guidance contradicted: "Always add the Sender filter" is now driven by collision risk, B4XPages is the default rather than "mandatory", and the unsourced "roughly 80% of B4X UI" quantification is gone.
 
Top