### Prompting AI Assistant to Utilize Knowledge Graph Source: https://github.com/vfarcic/nu-scripts.git/blob/main/docs/development.md This prompt is used to initiate a development session with an AI assistant. It instructs the assistant to retrieve and process all information from its 'memory' MCP knowledge graph, ensuring the session is guided by its existing knowledge. ```Prompt Retrieve and process all information from the `memory` MCP knowledge graph to guide our session. ``` -------------------------------- ### Implement Error Handling in Nushell Source: https://github.com/vfarcic/nu-scripts.git/blob/main/CLAUDE.md Provides an example of basic error handling in Nushell scripts. It demonstrates checking a condition and exiting the script with a non-zero status code (`exit 1`) along with a descriptive error message, indicating failure. ```nu def check_status [status_code] { if ($status_code != 0) { print "Error: Operation failed with status code ($status_code)" exit 1 } print "Operation successful" } check_status 0 # check_status 1 # Uncomment to see error handling ``` -------------------------------- ### Run Project Tests (Nu and Go) Source: https://github.com/vfarcic/nu-scripts.git/blob/main/CLAUDE.md Commands to execute all tests within the `nu-scripts` project, covering both Nushell scripts and Go-based tests. The Nushell command runs the project's test script, while the Go command directly invokes Go's testing framework. ```nu ./tests.nu ``` ```go go test -v $"(pwd)/..." ``` -------------------------------- ### Define Functions in Nushell Source: https://github.com/vfarcic/nu-scripts.git/blob/main/CLAUDE.md Illustrates how to define standard functions using `def` and environment-modifying functions using `def --env` in Nushell. Environment functions are useful for setting variables or aliases that persist after the function call. ```nu def my_standard_function [] { print "Hello from standard function" } def --env my_env_function [] { # This function can modify the environment let-env MY_VAR = "env_value" print "Hello from env function" } ``` -------------------------------- ### Name Primary Functions in Nushell Source: https://github.com/vfarcic/nu-scripts.git/blob/main/CLAUDE.md Guidelines for naming primary command functions in Nushell. Functions intended as main entry points or commands should be prefixed with `main_` followed by an action, promoting discoverability and organization. ```nu def main_deploy_application [] { print "Deploying application..." # ... deployment logic } def main_cleanup_resources [] { print "Cleaning up resources..." # ... cleanup logic } ``` -------------------------------- ### Declare Variables in Nushell Source: https://github.com/vfarcic/nu-scripts.git/blob/main/CLAUDE.md Shows the Nushell syntax for declaring variables. `let` is used for immutable constants, while `mut` is used for mutable variables whose values can be reassigned later. ```nu let my_constant = "This cannot be changed" mut my_mutable_var = 10 set my_mutable_var = ($my_mutable_var + 5) ``` -------------------------------- ### Add Comments in Nushell Source: https://github.com/vfarcic/nu-scripts.git/blob/main/CLAUDE.md Illustrates the standard way to add single-line comments in Nushell scripts. Comments begin with a hash symbol (`#`) followed by a space, improving code readability. ```nu # This is a single-line comment in Nushell let x = 10 # Inline comment ``` -------------------------------- ### Generate Crossplane Composition Mermaid Diagram Source: https://github.com/vfarcic/nu-scripts.git/blob/main/prompts/create-diagram.md Instructions for generating a Mermaid diagram from Crossplane Compositions, detailing resource inclusion, dependency establishment using `matchControllerRef` and `providerConfigRef`, coloring rules for different resource types, and naming conventions. ```Mermaid Specification Generate Mermaid diagram of resources based on the Crossplane Compositions. I am interested only in `kind`, `apiVersion`, and `name` of resources. Include all resources into the diagram. Use references like `matchControllerRef` and `providerConfigRef` to establish relations between resources. When you see those, it means that it is a dependency. If you cannot find a dependency of some resource, assume that it depends on the Composite resource (the top resource). Do not put labels on relations. Use full resource name that combines `metadata.name`, `kind`, `api`. Avoid duplicated references between resources. If one resource depends on the other, there is no need to reference it to the Composite Resource at the top. Paint the Composite Resource as blue, AWS, Google Cloud, and Azure resources should be dark orange and all other resources should be purple. Use `
` to separate lines. ``` -------------------------------- ### Define Function Parameters with Defaults in Nushell Source: https://github.com/vfarcic/nu-scripts.git/blob/main/CLAUDE.md Demonstrates how to declare function parameters, including optional parameters with default values, in Nushell. Positional parameters are listed in brackets, while named parameters with defaults use `--param = value` syntax. ```nu def greet [name, --greeting = "Hello"] { print $"($greeting), ($name)!" } greet "World" greet "Alice" --greeting "Hi" ``` -------------------------------- ### Add Nushell Shebang to Scripts Source: https://github.com/vfarcic/nu-scripts.git/blob/main/CLAUDE.md Ensures Nushell scripts are executable directly by specifying the interpreter path at the beginning of the file. This is a standard practice for shell scripts. ```nu #!/usr/bin/env nu ``` -------------------------------- ### Define Output File Format for Crossplane Diagram Source: https://github.com/vfarcic/nu-scripts.git/blob/main/prompts/create-diagram.md Specifies the required format for the output file containing the Crossplane Composition diagram, including a header, the Composite Resource content, and the Mermaid diagram itself. ```File Format Specification 1. Header "dot-sql" 2. Content of the Composite Resource. 3. Mermaid diagram ``` -------------------------------- ### Perform String Interpolation in Nushell Source: https://github.com/vfarcic/nu-scripts.git/blob/main/CLAUDE.md Explains how to embed variable values directly within strings using Nushell's string interpolation syntax. Variables are enclosed in parentheses and prefixed with a dollar sign within double-quoted strings. ```nu let item = "Nushell" let version = "0.80.0" let message = $"Learning ($item) version ($version) is fun!" print $message ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.