Ci4 Shield logo

Ci4 Shield

Community
enlivenapp
ci4-shield

Comprehensive CodeIgniter 4 Shield authentication and authorization skill. Use when working with Shield auth — session login, access tokens, HMAC tokens, JWT, groups, permissions, user model/entity, filters, email activation, two-factor auth, magic links, banning, force password reset, or customizing auth views/controllers. Activates on mentions of "Shield", "auth()", "loggedIn", "groups", "permissions", "access token", "HMAC", "JWT", "Email2FA", "EmailActivator", "magic link", "Shield filter", or any Shield-specific pattern in a CI4 context.

Overview

Publisherenlivenapp
RepositoryCodeigniter4-App-and-API-Skills-for-Claude-Code
Skill nameci4-shield
Stars
27
Forks
9
Bundled files
8
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 8 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by enlivenapp on GitHub. Read the source before you install it.

Installation

Install the Ci4 Shield AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/enlivenapp/Codeigniter4-App-and-API-Skills-for-Claude-Code/tree/main/ci4-shield
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/enlivenapp/Codeigniter4-App-and-API-Skills-for-Claude-Code.git /tmp/Codeigniter4-App-and-API-Skills-for-Claude-Code
mkdir -p .claude/skills
cp -r /tmp/Codeigniter4-App-and-API-Skills-for-Claude-Code/ci4-shield .claude/skills/ci4-shield
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Ci4 Shield in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Ci4 Shield on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Ci4 Shield is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

CodeIgniter 4 Shield — Auth Reference

Shield is the official authentication and authorization library for CodeIgniter 4. It is not Laravel Sanctum, Passport, or Breeze. Do not apply Laravel auth patterns here.

Related skills: ci4 for core framework patterns, ci4-api for REST API patterns.

Reference Documents

For deep dives, read the relevant reference from references/:

ReferenceWhen to read
references/configuration.mdAuth.php, AuthGroups.php, password validators, views, authenticators
references/session-auth.mdLogin/logout flow, remember me, web authentication
references/token-auth.mdAccess tokens, HMAC tokens, JWT — generation, revocation, scopes
references/groups-permissions.mdGroups, permissions, matrix, direct user permissions, wildcards
references/user-model.mdUser entity, UserModel, extending, creating/finding/updating users
references/filters.mdAll Shield filters, route protection, filter arguments
references/actions.mdEmail activation, Email 2FA, magic links, password handling, banning
references/events-customization.mdEvents, custom views, extending controllers, routes, testing

Installation & Setup

bash
composer require codeigniter4/shield
php spark shield:setup   # publishes Config files + migrations
php spark migrate        # creates Shield's database tables

Database Tables

TablePurpose
usersCore user data (username, active, last_active)
auth_identitiesAll credential types (email/password, access tokens, HMAC keys)
auth_loginsLogin attempt log (success + failure)
auth_remember_tokensRemember-me tokens
auth_groups_usersUser-to-group pivot
auth_permissions_usersUser-to-permission pivot

Auth Helper — Core Functions

The auth() helper is globally available. No manual loading needed.

php
auth()->loggedIn();         // bool — is someone logged in?
auth()->user();             // User entity or null
auth()->id();               // int user ID or null

// Specify authenticator
auth('session')->loggedIn();
auth('tokens')->user();

// Attempt login
$result = auth()->attempt([
    'email'    => $email,
    'password' => $password,
]);
if ($result->isOK()) { /* success */ }
// $result->reason() — error message on failure

// Logout
auth()->logout();

// Check credentials without logging in
$result = auth()->check(['email' => $email, 'password' => $password]);

GOTCHA: attempt() returns a Result object, not a boolean. Always check $result->isOK().


Groups & Permissions (Quick Reference)

See references/groups-permissions.md for complete reference.

php
$user = auth()->user();

// Groups
$user->addGroup('admin');
$user->removeGroup('admin');
$user->inGroup('admin');                // bool
$user->inGroup('admin', 'superadmin');  // true if in ANY
$user->getGroups();                     // ['admin', 'developer']

// Permissions
$user->can('posts.create');             // bool (via group matrix OR direct)
$user->cannot('users.delete');          // bool
$user->addPermission('admin.access');   // direct permission
$user->removePermission('admin.access');

Groups and permissions are defined in app/Config/AuthGroups.php.


Filters (Quick Reference)

See references/filters.md for complete reference. Shield auto-registers these — no manual registration needed.

FilterPurpose
sessionRequires session auth
tokensRequires Bearer token auth
hmacRequires HMAC token auth
jwtRequires JWT auth
chainTries session, then tokens (SPA + mobile)
groupChecks group membership
permissionChecks permission
force-resetChecks if password reset required
auth-ratesRate limiting for auth routes
php
// Route protection
$routes->get('dashboard', 'DashboardController::index', ['filter' => 'session']);
$routes->get('admin', 'AdminController::index', ['filter' => ['session', 'group:admin,superadmin']]);
$routes->get('api/me', 'Api\UserController::me', ['filter' => 'tokens']);

User Entity (Quick Reference)

See references/user-model.md for complete reference.

php
$user = auth()->user();

$user->getEmail();                // email address
$user->username;                  // username
$user->password = 'new-pass';    // auto-hashed via setter

$user->isBanned();                // bool
$user->ban('Reason');             // ban user
$user->unBan();                   // remove ban

$user->isActivated();             // bool
$user->activate();                // manual activation

$user->forcePasswordReset();      // require change on next login

// Access tokens
$token = $user->generateAccessToken('name');
$user->revokeAccessToken($tokenId);

Configuration (Quick Reference)

See references/configuration.md for complete reference.

php
// app/Config/Auth.php — key settings
public array $redirects = ['register' => '/', 'login' => '/', 'logout' => 'login'];
public array $actions = [
    'register' => null,   // EmailActivator::class for email verification
    'login'    => null,   // Email2FA::class for two-factor auth
];
public array $validFields = ['email'];  // add 'username' for username login
public string $defaultAuthenticator = 'session';
php
// app/Config/AuthGroups.php — groups + permissions
public array $groups = ['superadmin' => [...], 'admin' => [...], 'user' => [...]];
public string $defaultGroup = 'user';
public array $permissions = ['admin.access' => '...', 'users.create' => '...'];
public array $matrix = ['superadmin' => ['admin.*', 'users.*'], 'admin' => ['admin.access']];

Key Gotchas

See references/events-customization.md for the complete list.

  1. attempt() returns a Result, not bool — always use $result->isOK()
  2. raw_token only available once — capture at generation, hashed before storage
  3. Filter order matters — session must run before group (auth before authz)
  4. Parent route group filters don't merge into children — declare on each group
  5. Custom UserModel must be registered in Auth.php's $userProvider
  6. Password auto-hashed by entity setter — never manually hash before setting
  7. Credentials live in auth_identities — not the users table
  8. Email config required for activation, 2FA, and magic links
  9. $validFields controls login fields — add 'username' to allow username login
  10. chain filter is for dual-client endpoints — don't use when auth type is known

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Ci4 Shield AI skill do?

Comprehensive CodeIgniter 4 Shield authentication and authorization skill. Use when working with Shield auth — session login, access tokens, HMAC tokens, JWT, groups, permissions, user model/entity, filters, email activation, two-factor auth, magic links, banning, force password reset, or customizing auth views/controllers. Activates on mentions of "Shield", "auth()", "loggedIn", "groups", "permissions", "access token", "HMAC", "JWT", "Email2FA", "EmailActivator", "magic link", "Shield filter", or any Shield-specific pattern in a CI4 context.

Why use Ci4 Shield on TypingMind?

Because you install it once and use it with any model. Ci4 Shield is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Ci4 Shield in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/enlivenapp/Codeigniter4-App-and-API-Skills-for-Claude-Code/tree/main/ci4-shield. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Ci4 Shield?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Ci4 Shield?

As many as you like. As long as a model supports skills, you can use Ci4 Shield with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Ci4 Shield AI skill free?

Yes. It is published on GitHub by enlivenapp under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇