Skip to content

Commit 60db903

Browse files
committed
wip
1 parent 10c91eb commit 60db903

File tree

3 files changed

+139
-6
lines changed

3 files changed

+139
-6
lines changed

.claude_config

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"env": {
77
"ALLOWED_DIRECTORIES": [
88
".",
9+
"./.claude",
910
"./app",
1011
"./resources",
1112
"./database",
@@ -105,7 +106,11 @@
105106
{
106107
"pattern": "**/bootstrap/app.php",
107108
"instructions": "Use Laravel 12 Application class patterns for configuring middleware, events, and exceptions. Register middleware through withMiddleware(), events through withEvents(), and exception handling through withExceptions(). Follow the streamlined bootstrap configuration approach."
109+
},
110+
{
111+
"pattern": "**/.claude/**/*.md",
112+
"instructions": "These are project context files containing coding standards, development guidelines, and project-specific documentation. Reference these files when asked about project conventions, standards, tech stack, or development patterns. These files contain the definitive coding standards and development guidelines for this Laravel 12 project."
108113
}
109114
],
110-
"customInstructions": "You are an expert Laravel 12 developer using FluxUI for component-based development and Livewire Volt for functional components. You build production-quality applications using Laravel 12, Livewire 3.x with Volt, Alpine.js, FluxUI, and Tailwind CSS. Always prefer Livewire Volt functional components over traditional class-based components. Use Laravel 12 features like the new Attribute class for accessors/mutators, enhanced validation, improved model features, and modern syntax. Use FluxUI components for all UI elements instead of building custom components. Follow PSR-12 standards, use typed properties, constructor property promotion, and maintain clean, readable code with proper separation of concerns."
115+
"customInstructions": "You are an expert Laravel 12 developer using FluxUI for component-based development and Livewire Volt for functional components. You build production-quality applications using Laravel 12, Livewire 3.x with Volt, Alpine.js, FluxUI, and Tailwind CSS. Always prefer Livewire Volt functional components over traditional class-based components. Use Laravel 12 features like the new Attribute class for accessors/mutators, enhanced validation, improved model features, and modern syntax. Use FluxUI components for all UI elements instead of building custom components. Follow PSR-12 standards, use typed properties, constructor property promotion, and maintain clean, readable code with proper separation of concerns.\n\nIMPORTANT: When asked about coding standards, project conventions, tech stack, or development patterns, always check the .claude/context/ directory first. This directory contains comprehensive project documentation including coding-standards.md, project-context.md, and various development guidelines that define the specific standards for this project."
111116
}

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ This Laravel 12 project has been configured with Claude Code and optimized MCP s
3131
- **Node.js 20+** - For frontend asset compilation
3232
- **Claude Code** - AI development assistant
3333

34+
> **Important**: The setup script creates a `.claude_config` file that enables Claude Code to access the project's context files in the `.claude/` directory. This allows Claude to reference your project's coding standards and development guidelines.
35+
3436
### Installation Options
3537

3638
**Option 1: One-line installation (recommended)**
@@ -414,6 +416,21 @@ npx playwright install
414416
# Solution: This is expected - the official server is deprecated but still functional
415417
```
416418

419+
**Claude Code Can't Access Context Files**
420+
```bash
421+
# Issue: Claude Code can't find .claude/context files when asked about coding standards
422+
# Cause: Missing .claude_config file or .claude directory not in ALLOWED_DIRECTORIES
423+
424+
# Solution 1: Ensure .claude_config exists in project root
425+
ls -la .claude_config
426+
427+
# Solution 2: If missing, re-run setup script
428+
./setup.sh
429+
430+
# Solution 3: Restart Claude Code to reload configuration
431+
# Close and reopen Claude Code after creating .claude_config
432+
```
433+
417434
**Understanding Database MCP Server Installation**
418435
```bash
419436
# The setup process has two phases for database integration:

setup.sh

Lines changed: 116 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,99 @@ EOF
12601260
# Install NetSuite context (optional)
12611261
copy_or_download_context_file "netsuite_context.md" "NetSuite context" || print_status "NetSuite context skipped (project-specific)"
12621262

1263+
# Create project-specific .claude_config file
1264+
print_status "Creating project-specific Claude configuration..."
1265+
cat > ".claude_config" << 'EOF'
1266+
{
1267+
"mcpServers": {
1268+
"filesystem": {
1269+
"command": "npx",
1270+
"args": ["-y", "@modelcontextprotocol/server-filesystem"],
1271+
"env": {
1272+
"ALLOWED_DIRECTORIES": [
1273+
".",
1274+
"./.claude",
1275+
"./app",
1276+
"./resources",
1277+
"./database",
1278+
"./config",
1279+
"./routes",
1280+
"./tests",
1281+
"./storage",
1282+
"./public",
1283+
"./vendor"
1284+
]
1285+
}
1286+
},
1287+
"git": {
1288+
"command": "npx",
1289+
"args": ["-y", "@modelcontextprotocol/server-git"]
1290+
}
1291+
},
1292+
"rules": [
1293+
{
1294+
"pattern": "**/config/*.php",
1295+
"instructions": "Use kebab-case for config file names, snake_case for config keys. Avoid env() helper outside config files. Use Laravel 12 configuration patterns and new config features."
1296+
},
1297+
{
1298+
"pattern": "**/*.php",
1299+
"instructions": "Follow Laravel 12 conventions strictly. Use PSR-12 standards, constructor property promotion, typed properties, and the new Attribute class for accessors/mutators. Use FluxUI components for UI elements. Follow modern Laravel patterns including new validation syntax and enhanced model features."
1300+
},
1301+
{
1302+
"pattern": "**/app/Models/*.php",
1303+
"instructions": "Use Laravel 12 model features: Attribute class for accessors/mutators, #[Scope] attribute for query scopes, proper casting with enum support, new validation methods, and enhanced relationship definitions. Always use typed properties and constructor promotion where applicable."
1304+
},
1305+
{
1306+
"pattern": "**/routes/*.php",
1307+
"instructions": "Use kebab-case URLs, camelCase route names and parameters. Use route tuple notation [Controller::class, 'method']. Put HTTP verbs first when defining routes. Use Laravel 12 route model binding enhancements."
1308+
},
1309+
{
1310+
"pattern": "**/app/Http/Controllers/*.php",
1311+
"instructions": "Use plural resource names for controllers. Stick to CRUD keywords (index, create, store, show, edit, update, destroy). Extract new controllers for non-CRUD actions. Use Laravel 12 request validation and response patterns."
1312+
},
1313+
{
1314+
"pattern": "**/resources/views/**/*.blade.php",
1315+
"instructions": "Use camelCase for view files. Prefer FluxUI components over custom HTML/CSS. Use Flux components for forms, buttons, modals, etc. Indent with 4 spaces. Use {{ __() }} for translations."
1316+
},
1317+
{
1318+
"pattern": "**/app/Livewire/*.php",
1319+
"instructions": "Follow Livewire 3.x best practices with Laravel 12. Use Livewire Volt for class-based components - prefer functional components over traditional class components. Use FluxUI components in Livewire views. Use public properties for data binding. Implement proper validation with Laravel 12 validation features. Use wire:model for form inputs."
1320+
},
1321+
{
1322+
"pattern": "**/resources/views/livewire/**/*.blade.php",
1323+
"instructions": "Create Livewire Volt functional components using <?php use() ?> syntax at the top of blade files. Prefer Volt functional components over traditional class-based components. Use FluxUI components exclusively. Follow Volt patterns for state management and actions."
1324+
},
1325+
{
1326+
"pattern": "**/resources/js/**/*.js",
1327+
"instructions": "Use Alpine.js patterns that complement FluxUI components. Keep JavaScript minimal and declarative. Use x-data, x-show, x-if appropriately. Follow Alpine.js conventions and work seamlessly with FluxUI."
1328+
},
1329+
{
1330+
"pattern": "**/resources/css/**/*.css",
1331+
"instructions": "Use Tailwind CSS utility classes. FluxUI provides most styling - only add custom CSS when FluxUI components don't cover the use case. Follow FluxUI design system principles."
1332+
},
1333+
{
1334+
"pattern": "**/database/migrations/*.php",
1335+
"instructions": "Use Laravel 12 migration features including new column types, enhanced indexing, and improved foreign key constraints. Use descriptive migration names following Laravel conventions."
1336+
},
1337+
{
1338+
"pattern": "**/tests/**/*.php",
1339+
"instructions": "Follow Laravel 12 testing conventions with Pest PHP preferred. Use Feature tests for HTTP requests, Unit tests for models and services. Use Laravel 12 testing helpers and assertions."
1340+
},
1341+
{
1342+
"pattern": "**/bootstrap/app.php",
1343+
"instructions": "Use Laravel 12 Application class patterns for configuring middleware, events, and exceptions. Register middleware through withMiddleware(), events through withEvents(), and exception handling through withExceptions(). Follow the streamlined bootstrap configuration approach."
1344+
},
1345+
{
1346+
"pattern": "**/.claude/**/*.md",
1347+
"instructions": "These are project context files containing coding standards, development guidelines, and project-specific documentation. Reference these files when asked about project conventions, standards, tech stack, or development patterns. These files contain the definitive coding standards and development guidelines for this Laravel 12 project."
1348+
}
1349+
],
1350+
"customInstructions": "You are an expert Laravel 12 developer using FluxUI for component-based development and Livewire Volt for functional components. You build production-quality applications using Laravel 12, Livewire 3.x with Volt, Alpine.js, FluxUI, and Tailwind CSS. Always prefer Livewire Volt functional components over traditional class-based components. Use Laravel 12 features like the new Attribute class for accessors/mutators, enhanced validation, improved model features, and modern syntax. Use FluxUI components for all UI elements instead of building custom components. Follow PSR-12 standards, use typed properties, constructor property promotion, and maintain clean, readable code with proper separation of concerns.\n\nIMPORTANT: When asked about coding standards, project conventions, tech stack, or development patterns, always check the .claude/context/ directory first. This directory contains comprehensive project documentation including coding-standards.md, project-context.md, and various development guidelines that define the specific standards for this project."
1351+
}
1352+
EOF
1353+
print_success "Claude configuration created (.claude_config)"
1354+
print_status "This file enables Claude Code to access your .claude/context/ files"
1355+
12631356
# Create FluxUI quick reference
12641357
print_status "Creating FluxUI quick reference..."
12651358
cat > ".claude/context/fluxui-reference.md" << EOF
@@ -1558,6 +1651,10 @@ EOF
15581651
"README.md"
15591652
)
15601653

1654+
local project_files=(
1655+
".claude_config"
1656+
)
1657+
15611658
local optional_files=(
15621659
"context/netsuite_context.md"
15631660
)
@@ -1571,6 +1668,15 @@ EOF
15711668
fi
15721669
done
15731670

1671+
# Count project files (in root directory)
1672+
for file in "${project_files[@]}"; do
1673+
if [ -f "$file" ]; then
1674+
((files_created++))
1675+
else
1676+
print_error "Failed to create required file: $file"
1677+
fi
1678+
done
1679+
15741680
# Count optional files
15751681
local optional_created=0
15761682
for file in "${optional_files[@]}"; do
@@ -1580,9 +1686,10 @@ EOF
15801686
fi
15811687
done
15821688

1583-
local total_possible_files=$((${#required_files[@]} + ${#optional_files[@]}))
1689+
local total_expected_files=$((${#required_files[@]} + ${#project_files[@]}))
1690+
local total_possible_files=$((${#required_files[@]} + ${#project_files[@]} + ${#optional_files[@]}))
15841691

1585-
if [ $files_created -ge ${#required_files[@]} ]; then
1692+
if [ $files_created -ge $total_expected_files ]; then
15861693
print_success "All required context files created! ($files_created/$total_possible_files files total)"
15871694
if [ $optional_created -gt 0 ]; then
15881695
print_status "Optional files installed: $optional_created"
@@ -1811,12 +1918,16 @@ main() {
18111918
echo " npm run dev # Vite development server"
18121919
echo " herd open # Open project in browser (Herd automatically serves Laravel)"
18131920
echo ""
1814-
echo "3. Test Claude Code integration:"
1815-
echo " - Ask Claude: 'What MCP servers are available?'"
1921+
echo "3. Restart Claude Code to load configuration:"
1922+
echo " - Close and reopen Claude Code to load .claude_config"
1923+
echo " - This enables access to project context files"
1924+
echo ""
1925+
echo "4. Test Claude Code integration:"
1926+
echo " - Ask Claude: 'What are the coding standards for this project?'"
18161927
echo " - Try: 'Show me the project structure'"
18171928
echo " - Test: 'What's in my database?' (if database is configured)"
18181929
echo ""
1819-
echo "4. Start building with FluxUI:"
1930+
echo "5. Start building with FluxUI:"
18201931
echo " - Use FluxUI components instead of custom HTML"
18211932
echo " - Follow Laravel 12 patterns (new Attribute class)"
18221933
echo " - Write tests with Pest PHP"

0 commit comments

Comments
 (0)