diff --git a/.agent/skills/enterprise-fizzbuzz/SKILL.md b/.agent/skills/enterprise-fizzbuzz/SKILL.md new file mode 100644 index 00000000..57e671be --- /dev/null +++ b/.agent/skills/enterprise-fizzbuzz/SKILL.md @@ -0,0 +1,44 @@ +--- +name: enterprise-fizzbuzz +description: Adding complex enterprise level code for fizzbuzz +--- + +# Enterprise FizzBuzz Skill + +This skill provides instructions on how to write code for the FizzBuzz Enterprise Edition project. The goal is to maximize complexity, abstraction, and adherence to Enterprise Java Design Patterns. + +## Core Directives + +1. **Never Do Anything Directly**: + - Never instantiate an object with `new` directly unless inside a Factory. + - Never use simple loops (like a `for` loop) if you can use an Iterable, Iterator, Stream, or custom LoopContext combined with a Strategy pattern. + - Never use primitives if you can use their boxed equivalents, or better yet, custom wrapping classes (e.g., `FizzBuzzIntegerWrapper`). + +2. **Maximum Abstraction**: + - Every class must implement at least one interface. + - Interfaces should be named with an `I` prefix or `Interface` suffix (e.g., `StringReturnerInterface`). + - Use deeply nested package structures with names that describe the design pattern utilized (e.g., `com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.factories`). + +3. **Naming Conventions**: + - Names must be exhaustively descriptive. Avoid abbreviations. + - Examples: `EnterpriseGradeFizzBuzzExecutionStrategyFactory`, `FizzBuzzOutputGenerationParameterContainer`. + +4. **Design Patterns Requirement**: + If a design pattern can be applied, it MUST be applied. Frequently required patterns include: + - **Abstract Factory / Builder**: For object creation. + - **Strategy**: For any conditional logic. + - **Visitor**: For operations on element structures. + - **Observer**: For triggering cross-cutting concerns (like decoupled logging). + +5. **Documentation**: + - Every class, interface, and method must have verbose Javadoc comments, even if it simply restates the name of the method. + +## Example Usage + +When instructed to add a new string mapping (e.g., "Muzz" for multiples of 7): +1. Create `MuzzStringReturner` implementing `StringStringReturner`. +2. Create `MuzzStrategy` implementing `IsEvenlyDivisibleStrategy`. +3. Create `MuzzStrategyFactory` implementing `StrategyFactory`. +4. Register the new factories with the central container. + +Do not just add an `if (i % 7 == 0)` statement. That is not Enterprise Quality™ code. diff --git a/README.md b/README.md index d27f9fef..eac135aa 100644 --- a/README.md +++ b/README.md @@ -32,3 +32,22 @@ Although this project is intended as satire, we take openness and inclusivity very seriously. To that end we have adopted the following code of conduct. [Contributor Code of Conduct](CONTRIBUTING.md) + +## Agent Skills + +We support agent skills to enhance development workflows. You can install new skills using the provided `install_skill.sh` script at the root of the project. + +### Usage + +1. **Create from Template**: Create an empty skill with a `SKILL.md` template. + ```bash + ./install_skill.sh my-new-skill + ``` +2. **Install from Local Folder**: Import an existing local skill directory. + ```bash + ./install_skill.sh my-new-skill /path/to/skill/folder + ``` +3. **Install from Git Repository**: Automatically clone and deploy a skill from an external repository. + ```bash + ./install_skill.sh my-new-skill https://github.com/user/repo.git + ``` diff --git a/install_skill.sh b/install_skill.sh new file mode 100755 index 00000000..61b10d85 --- /dev/null +++ b/install_skill.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +# Script to install a new skill into the agent's skills directory + +set -e + +SKILL_DIR=".agent/skills" +SKILL_NAME=$1 +SKILL_SOURCE=$2 + +if [ -z "$SKILL_NAME" ]; then + echo "Usage: $0 [skill-source-path-or-url]" + echo "Example 1 (Create from template): $0 my-new-skill" + echo "Example 2 (Install from local dir): $0 my-new-skill /path/to/skill/folder" + echo "Example 3 (Install from Git repo): $0 my-new-skill https://github.com/user/repo.git" + exit 1 +fi + +TARGET_DIR="$SKILL_DIR/$SKILL_NAME" + +# Check if skill already exists +if [ -d "$TARGET_DIR" ]; then + echo "Error: Skill '$SKILL_NAME' already exists in $TARGET_DIR." + exit 1 +fi + +mkdir -p "$TARGET_DIR" + +if [ -n "$SKILL_SOURCE" ]; then + # If source is a URL (git clone) + if [[ "$SKILL_SOURCE" == http* || "$SKILL_SOURCE" == git@* ]]; then + echo "Installing skill '$SKILL_NAME' from repository $SKILL_SOURCE..." + git clone "$SKILL_SOURCE" "$TARGET_DIR" + # Removing the .git folder so it's just the skill files inside the main project + rm -rf "$TARGET_DIR/.git" + # If source is a local directory (copy) + elif [ -d "$SKILL_SOURCE" ]; then + echo "Installing skill '$SKILL_NAME' from local directory $SKILL_SOURCE..." + cp -r "$SKILL_SOURCE/"* "$TARGET_DIR/" + else + echo "Error: Skill source '$SKILL_SOURCE' is not a valid directory or git URL." + rm -rf "$TARGET_DIR" + exit 1 + fi +else + # Create a basic skill template if no source is provided + echo "Creating empty skill template for '$SKILL_NAME'..." + cat < "$TARGET_DIR/SKILL.md" +--- +name: $SKILL_NAME +description: Auto-generated template for $SKILL_NAME +--- + +# $SKILL_NAME Skill + +This skill provides instructions for... + +## Core Directives + +1. Point 1 +2. Point 2 +EOF +fi + +# Ensure SKILL.md exists +if [ ! -f "$TARGET_DIR/SKILL.md" ]; then + echo "Warning: Installed skill does not contain a SKILL.md file! A skill requires this file." +fi + +echo "Skill '$SKILL_NAME' has been installed to '$TARGET_DIR' successfully!"