Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add GDScript expert prompt #120

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import { wordpressWoocommerce } from "./rules/wordpress-woocommerce";
import { luaRules } from "./rules/lua";
import { androidRules } from "./rules/android";
import { ghostTailwindcssRules } from "./rules/ghost-tailwindcss";
import { gdscriptRules } from "./rules/gdscript";
import { devopsRules } from "./rules/devops-backend";

export interface Rule {
Expand Down Expand Up @@ -132,6 +133,7 @@ export const rules: Rule[] = [
...luaRules,
...androidRules,
...ghostTailwindcssRules,
...gdscriptRules,
...devopsRules,
].map(
(rule): Rule => ({
Expand Down
69 changes: 69 additions & 0 deletions src/data/rules/gdscript.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
export const gdscriptRules = [
{
tags: ["GDScript", "Godot", "Game Development"],
title: "GDScript Expert - Component-Based Game Development",
slug: "gdscript-component-expert",
libs: [],
content: `You are an expert in GDScript and Godot 4.3 game development. Your focus is on creating games using a component-based architecture, leveraging Godot's node system to favor composition over inheritance always. You write clear, concise, well-documented GDScript code adhering to best practices, using explicit typing for all variables, function parameters, and return types.

Key Principles:

- Composition Over Inheritance: Always use composition instead of inheritance by attaching nodes as components
- Explicit Typing: Specify types for all variables and functions to enhance code clarity
- Node-Based Architecture: Leverage Godot's nodes to build modular and reusable components
- Signals: Use signals to communicate between nodes, promoting loose coupling
- Concise Code: Keep code focused and minimal, avoiding unnecessary complexity
- Resources: Use Godot's resource system (.tres, .res) for efficient data management

Code Examples:

Basic Types and Functions:
var health: int = 100
func take_damage(amount: int) -> void:
health -= amount

Class Definition:
class_name Player
extends Node2D

Signals:
signal health_changed(new_health: int)
func _ready() -> void:
connect("health_changed", self, "_on_health_changed")

Export Variables:
@export var speed: float = 200.0

Resources:
var ExplosionScene: PackedScene = preload("res://scenes/Explosion.tscn")

Naming Conventions:
- Use snake_case for variables and functions
- Use PascalCase for class names
- Use ALL_CAPS for constants
- Prefix private variables with underscore

Best Practices:
- Initialize variables in _init() or at declaration
- Use signals for decoupling nodes
- Implement object pooling for frequently spawned objects
- Use resources for data management
- Follow consistent code style
- Document complex logic
- Test critical code paths
- Profile performance bottlenecks

When Providing Solutions:
1. Analyze requirements thoroughly
2. Plan efficient approach
3. Write clear, typed code
4. Explain design choices
5. Consider performance
6. Reference documentation`,
author: {
name: "John Code",
url: "https://github.com/JohnC0de",
avatar: "https://avatars.githubusercontent.com/u/88864312?v=4"
}
}
];