Learn-skills.dev laravel-api-tool-kit
git clone https://github.com/NeverSight/learn-skills.dev
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/ahmedesa/laravel-api-tool-kit/laravel-api-tool-kit" ~/.claude/skills/neversight-learn-skills-dev-laravel-api-tool-kit && rm -rf "$T"
data/skills-md/ahmedesa/laravel-api-tool-kit/laravel-api-tool-kit/SKILL.mdLaravel API Tool Kit Skill
This project uses the
essa/api-tool-kit package. All API code MUST follow the standards in this skill — both the general Laravel best practices and the package-specific patterns.
Assumed Setup
is installed via Composeressa/api-tool-kit- Base
already uses theController
traitApiResponse - The
global helper is availabledateTimeFormat()
macro is registered on the query builderdynamicPaginate()
Project Defaults
Fill these in when installing the skill. The AI reads this section to match existing project conventions.
- Primary key type:
← change toulid
if this project uses auto-incrementid - Auth guard:
← change if different (e.g.sanctum
)api - Test class:
← change if the project uses a custom baseTests\TestCase
Structure Mapping & Customization
The rules in the
rules/ directory are pattern-based. While examples use standard Laravel paths (e.g., app/Models), they are designed to be mapped to any structure.
DDD / Domain-Driven Design
If the project uses a DDD structure, the rules apply to the corresponding domain folders. Folder naming may vary by project (e.g.,
Repository vs Repositories). Examples include:
- Models:
app/Domain/{Domain}/Models/ - Actions:
app/Domain/{Domain}/Actions/ - Repositories:
(orapp/Domain/{Domain}/Repository/
)Repositories/ - DTOs:
(orapp/Domain/{Domain}/DTO/
)DTOs/ - Filters:
app/Domain/{Domain}/Filters/
Note for AI: Always run
ls app/Domain/ to identify the project's specific naming conventions before creating new files. Priority is always: Project Patterns > Global Rules.
Project-Specific Rules
If a specific project requires overrides (e.g., "We use
id instead of ulid" or "We return raw arrays instead of DTOs"), do not modify these global rules. Instead:
- Add the override to your project's AI instructions file (e.g.
,AGENTS.md
, orCLAUDE.md
for Claude Code)..claude/rules/ - The AI will prioritize project-level instructions over these global patterns.
Baseline — Applies to Every File
Before reading anything else, these rules apply universally:
- Every PHP file MUST start with
declare(strict_types=1); - Every method MUST have parameter types and a return type
- Constructor dependencies MUST use
promotionprivate readonly - User-facing strings MUST use
— never hardcodedtrans()
See
rules/code-quality.md for the full baseline.
Component Map
When working on a specific concern, read the corresponding rule file:
General Standards (applies everywhere)
| Task | Read |
|---|---|
| Code style, types, naming, constants | |
| Injecting dependencies | |
| Events and listeners | |
| Standalone queued jobs | |
| Authorization and policies | |
| Error and exception handling | |
| Writing feature tests | |
| Database patterns, ULIDs, transactions, bulk ops | |
| External 3rd-party integrations | |
| DDD structure, domain boundaries, cross-domain rules | |
Package-Specific Patterns
| Task | Read |
|---|---|
| Return a JSON response | |
| Add filtering / sorting / search to an endpoint | |
| Create a new Action class | |
| Create a DTO for an Action or Service | |
| Write or review a Controller | |
| Write a FormRequest | |
| Write an API Resource | |
| Create or update a Model | |
| Create or update a Repository | |
| Create an Enum | |
| Add pagination | |
Always Check First
| Task | Read |
|---|---|
| Before writing any code | |
Building a New Endpoint
Follow
workflows/new-endpoint.md for the full step-by-step process.
The order is always: Model → Migration → Filter → Enum → Requests → Resource → Policy → Action (if needed) → Controller → Language file → Route → Test
Available Workflows
Building
— add a complete CRUD resource from scratchworkflows/new-endpoint.md
— add filtering to an existing modelworkflows/add-filter.md
Reviewing
— multi-phase code review (structural + defense + scope discipline)workflows/code-review.md
Debugging
— structured debugging (data-first, multi-source, 15-min checkpoint)workflows/investigate.md
— test an endpoint with curl and cross-reference response vs DBworkflows/curl-test.md
Knowledge Management
— save learnings into rules or knowledge filesworkflows/update-knowledge.md
— consolidate scattered docs into one-file-per-featureworkflows/organize-knowledge.md
— capture a discovered process as a reusable workflowworkflows/create-workflow.md
Knowledge Base
Per-feature accumulated knowledge lives in a
knowledge/ directory. The exact location depends on your AI tool:
- Claude Code:
.claude/knowledge/[feature].md - Antigravity:
.agent/knowledge/[feature].md - Cursor / Copilot:
(project root)knowledge/[feature].md
Each file contains:
- Past issues and their confirmed root causes
- Reusable diagnostic queries (with placeholder variables)
- DB/data gotchas specific to this project
- Lessons that don't fit into general rules
When investigating a bug, check
first. When confirming a root cause, update knowledge/
before closing the session.knowledge/