Skip to content

Add initial Claude Skills, and apply them#84

Merged
odunbar merged 5 commits into
mainfrom
orad/ai-readiness
May 22, 2026
Merged

Add initial Claude Skills, and apply them#84
odunbar merged 5 commits into
mainfrom
orad/ai-readiness

Conversation

@odunbar
Copy link
Copy Markdown
Member

@odunbar odunbar commented May 22, 2026

Purpose

  • Infrastructure and some initial application of the Claude skills
  • I have then applied these and iterated upon them for improved behaviour. Happy in future PRs for greater iteration - in theory almost every application can be used to improve the skill

Content

  • Create Claude settings.json - it encourages users to use skills and subagents. It prevents Claude using non-read-type git commands.
  • Build some skills
    • used skill-creator - to build new skills.
      • base-show adds show and summary methods to structs
      • docstrings manages the docstring formatting and manages docs/src/API
      • error-message-manager manages the error messaging format, to ensure actionable, context-laden messages
  • I then used these skills on the repository:
    • base-show was used to create show and summary methods for all structs. Includes both a compact and full show-type method (e.g. so that in arrays the compact 1-line show() method is used). unit tests are also written for this.
    • docstrings methods was used to overhaul the docstrings.
    • error-message-manager was used to remove @assert and update all error messages, it also adds test_throw error messages tested in the unit tests. Any longer >3 line message is now put into a helper function _throw_xyz that are listed at the bottom of files.
  • The skill-creator ensures that skills have a self-improvement request after every application. Skills were performed a couple of times, using this self-improvement to improve their performance. Also I had it add examples from the repo into skills to help with consistency.

Examples:

Base-show

full show methods, compact methods for vectors, and summaries in show.jl

julia> sf = ScalarFeature(n_features, feature_sampler, relu)
ScalarFeature
  n_features     : 20
  scalar_function: Relu
  feature_params : Dict with 1 entry

julia> [sf,sf]
2-element Vector{ScalarFeature{String, Relu}}:
 ScalarFeature (20 features, Relu)
 ScalarFeature (20 features, Relu)

julia> rfm = RandomFeatureMethod(sff, regularization = lambda_warn, batch_sizes = batch_sizes)
RandomFeatureMethod
  feature type  : ScalarFeature
  n_features    : 100
  regularization: UniformScaling
  batch_sizes   : train=100, test=100, feature=100
  threading     : true

julia> [rfm, rfm]
2-element Vector{RandomFeatureMethod{String}}:
 RandomFeatureMethod (ScalarFeature, n=100)
 RandomFeatureMethod (ScalarFeature, n=100)


julia> summary(rfm_warn)
"RandomFeatureMethod (ScalarFeature, n=100)"

docstrings

Now structs contain typedef, and recommended constructors/factories (even if names differ from struct name).
Also the docs API has been added to

help?> Fit

  struct Fit{V<:(AbstractVector), USorM<:Union{UniformScaling, AbstractMatrix}}

  Holds the coefficients and matrix decomposition produced by fit, describing a trained random
  feature regression model. Pass to predict, predictive_mean, or predictive_cov to obtain
  predictions at new input locations.

    •  feature_factors::RandomFeatures.Utilities.Decomposition: The LinearAlgreba matrix
       decomposition of (1 / m) * Feature^T * regularization^-1 * Feature + I

    •  coeffs::AbstractVector: Coefficients of the fit to data

    •  regularization::Union{UniformScaling, AbstractMatrix}: output-dim x output_dim matrix
       'regularization^{-1}' used during fit

  Constructors
  ≡≡≡≡≡≡≡≡≡≡≡≡

  Produced by fit(rfm, input_output_pairs; decomposition_type = "cholesky") — not intended to be
  constructed directly.

help?> VectorFourierFeature

   VectorFourierFeature(
      n_features::Int64,
      output_dim::Int64,
      sampler::Sampler;
      feature_parameters
  ) -> VectorFeature{String, RandomFeatures.Features.Cosine}
  
  Construct a VectorFeature with cosine (Fourier) features mapping to output_dim-dimensional outputs.

  The sigma feature parameter (default sqrt(2)) scales the output.
  
help?> FeatureSampler
FeatureSampler(
      parameter_distribution::ParameterDistribution,
      bias_distribution::Union{Nothing, ParameterDistribution};
      rng
  ) -> Sampler{TaskLocalRNG}
  

  Construct a Sampler from a parameter_distribution and an optional bias_distribution.

  When bias_distribution is nothing, no bias term is added to the feature inner product. When a
  ParameterDistribution is supplied, it is combined with parameter_distribution into a single joint
  distribution before wrapping in the Sampler.

  Pass a ParameterDistribution with name "xi" for the feature weights.

error-message-manager

Constructs error-messages with context

#inline error
"xi"  get_name(get_parameter_distribution(feature_sampler)) ||
        _throw_missing_xi(get_parameter_distribution(feature_sampler); where = :ScalarFeature)

# defined elsewhere
@noinline function _throw_missing_xi(pd; where::Symbol)
    throw(ArgumentError("""
$where: parameter distribution must include a component named "xi" for feature sampling.

Expected:
    "xi" ∈ get_name(parameter_distribution)

Got:
    available names = $(get_name(pd))

Suggestion:
    Add a ParameterDistribution component named "xi" when constructing FeatureSampler,
    e.g. via constrained_gaussian("xi", μ, σ).
"""))

Also i like this neat @test_throws type error block to ensure (the main expected/got are retained)

 let thrown = @test_throws ArgumentError ScalarFeature(n_features, feature_sampler_err, relu)
        @test contains(thrown.value.msg, "ScalarFeature")
        @test contains(thrown.value.msg, "\"xi\"")
        @test contains(thrown.value.msg, "available names")
 end

  • I have read and checked the items on the review checklist.

@odunbar odunbar merged commit c89818f into main May 22, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant