Agent skill
general
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/general
SKILL.md
Name: Laravel General Conventions Description: Project-wide Laravel conventions that always apply: configuration access, database patterns, logging, activity logging, and code formatting. Compatible Agents: general-purpose, backend Tags: app/**/*.php, laravel, php, backend, config, logging, formatting, conventions
Rules
- Use
config()helper to read configuration values — never useenv()directly outside of config files - Add new config keys to the appropriate file in
config/ - Use Eloquent or Query Builder — no raw DB queries
- Wrap multi-step writes in
DB::transaction() - Use
Illuminate\Support\Facades\Logwith structured context arrays for logging - Add the
Spatie\Activitylog\Traits\LogsActivitytrait on all models that track business data - Configure
getActivitylogOptions()withlogAll(),logOnlyDirty(),dontSubmitEmptyLogs() - Use
activity()->performedOn($model)->log(...)for manual log entries in jobs and controllers - Run Laravel Pint on all PHP code before committing
Examples
// Configuration — always use config()
$secret = config('services.stripe.secret');
// ❌ env('STRIPE_SECRET')
// Structured logging
Log::info('Invoice created.', [
'invoice_id' => $invoice->id,
'order_id' => $order->id,
'amount' => $invoice->amount,
]);
Log::error('Payment failed.', [
'invoice_id' => $invoice->id,
'error' => $exception->getMessage(),
]);
// Database transactions for multi-step writes
$payment = DB::transaction(function () use ($order) {
$invoice = $this->createInvoice->execute($order);
$payment = $this->chargePaymentMethod->execute($order, $invoice);
return $payment;
});
// Manual activity log entry
activity()
->performedOn($invoice)
->withProperties(['amount' => $invoice->amount])
->log('Invoice paid manually via admin panel.');
Anti-Patterns
- Using
env('KEY')directly in application code outside of config files - Writing raw SQL queries with
DB::statement()orDB::select()when Eloquent/Query Builder can be used - Using
Log::info('Message')without a context array — always include structured data - Not wrapping related database operations in a transaction
References
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?