Skip to content

Add SKILL.md documentation for Enumify usage and best practices#15

Merged
iqbalhasandev merged 2 commits intomainfrom
feat/add-support-boost-skill
Mar 10, 2026
Merged

Add SKILL.md documentation for Enumify usage and best practices#15
iqbalhasandev merged 2 commits intomainfrom
feat/add-support-boost-skill

Conversation

@iqbalhasandev
Copy link
Copy Markdown
Member

@iqbalhasandev iqbalhasandev commented Mar 10, 2026

Add SKILL.md documentation for Enumify usage and best practices

@iqbalhasandev iqbalhasandev self-assigned this Mar 10, 2026
Copilot AI review requested due to automatic review settings March 10, 2026 06:10
@iqbalhasandev iqbalhasandev added the enhancement New feature or request label Mar 10, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “Enumify” skill document intended to guide consistent PHP enum usage and TypeScript enum generation/sync practices in Laravel projects using this package.

Changes:

  • Introduces resources/boost/skills/enumify/SKILL.md with backend/frontend rules and anti-pattern guidance.
  • Documents an end-to-end implementation sequence (enum → cast → usage → sync → frontend usage).
  • Provides references for config, artisan commands, and generated TypeScript structure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +102 to +110
8. **ALWAYS cover every case** in `match()` for `label()` and custom methods. Missing cases will cause runtime errors and break TypeScript generation.

9. **Custom methods MUST follow these constraints** or they will be silently skipped during TypeScript generation:
- MUST be `public` (not `protected` or `private`)
- MUST NOT be `static`
- MUST have zero required parameters
- MUST declare a return type
- Return type MUST be `string`, `int`, `float`, `bool`, `null`, or nullable/union of these
- MUST NOT throw exceptions on any case
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule 8 says missing match() cases “will cause runtime errors and break TypeScript generation”, but Enumify catches exceptions when resolving labels and will fall back to other label sources or humanize() in the generated TS. For custom methods, if a case throws, the method is skipped (it doesn’t crash generation). Please adjust the wording to reflect the actual behavior (e.g., missing cases can lead to missing/incorrect labels or skipped method generation).

Copilot uses AI. Check for mistakes.
Comment on lines +157 to +165
13. **ALWAYS import from the barrel file** `@/enums` (maps to `resources/js/enums/index.ts`):

```typescript
// CORRECT
import { OrderStatus, OrderStatusUtils } from "@/enums";

// WRONG — bypasses barrel file, fragile path
import { OrderStatus } from "@/enums/order-status";
```
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frontend rule 13 says the barrel file is always available at resources/js/enums/index.ts and should always be imported via @/enums, but the barrel file can be disabled (enumify.features.generate_index_barrel = false) and the output directory may differ (enumify.paths.output). Consider rewording this as a best practice when the barrel is enabled, and avoid hardcoding the filesystem path/alias mapping.

Copilot uses AI. Check for mistakes.
@iqbalhasandev iqbalhasandev merged commit 12db780 into main Mar 10, 2026
@iqbalhasandev iqbalhasandev deleted the feat/add-support-boost-skill branch March 10, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants