Skip to content

Commit 554b859

Browse files
chore: add Claude Code configuration (#236)
* chore: add Claude Code configuration Add CLAUDE.md with project-specific guidance for Claude Code including: - Build commands for Maven operations - Architecture overview with key packages - Documentation of OSCAL-specific Metapath functions - Code style conventions - Git workflow and worktree requirements - Testing requirements Also adds settings.json for Claude Code plugins configuration. * fix: format bare URL as Markdown link in CLAUDE.md
1 parent d3462f1 commit 554b859

File tree

2 files changed

+161
-0
lines changed

2 files changed

+161
-0
lines changed

.claude/CLAUDE.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Build Commands
6+
7+
```bash
8+
# Build and install
9+
mvn install
10+
11+
# Replicate CI/CD build (recommended before pushing)
12+
mvn install -PCI -Prelease
13+
14+
# Run tests only
15+
mvn test
16+
17+
# Run a single test class
18+
mvn test -Dtest=ExamplesTest
19+
20+
# Run a single test method
21+
mvn test -Dtest=ExamplesTest#testExample
22+
23+
# Skip tests during build
24+
mvn install -DskipTests
25+
26+
# Check license headers
27+
mvn license:check
28+
29+
# Auto-format source code
30+
mvn formatter:format
31+
32+
# Check for Checkstyle issues
33+
mvn checkstyle:check
34+
```
35+
36+
## Project Overview
37+
38+
liboscal-java is a Java library for processing [OSCAL](https://pages.nist.gov/OSCAL/) content. It provides:
39+
40+
- Reading/writing OSCAL documents in XML, JSON, and YAML formats
41+
- OSCAL profile resolution to produce resolved catalogs
42+
- Validation of OSCAL content well-formedness and syntax
43+
- Experimental Metaschema constraint validation
44+
- Builders for programmatically creating OSCAL data elements
45+
46+
This library is built on the [Metaschema Java Tools](https://github.com/metaschema-framework/metaschema-java) project.
47+
48+
## Architecture
49+
50+
This is a single-module Maven project. Key packages:
51+
52+
- `dev.metaschema.oscal.lib` - Core library classes including `OscalBindingContext`
53+
- `dev.metaschema.oscal.lib.model` - Generated OSCAL model classes (Catalog, Profile, SSP, etc.)
54+
- `dev.metaschema.oscal.lib.profile.resolver` - Profile resolution implementation
55+
- `dev.metaschema.oscal.lib.metapath.function.library` - OSCAL-specific Metapath functions
56+
57+
### Generated Model Classes
58+
59+
OSCAL model classes are generated from Metaschema definitions in the `oscal/` submodule during the build. These appear in `target/generated-sources/metaschema/` and include classes like `Catalog`, `Profile`, `SystemSecurityPlan`, `ComponentDefinition`, etc. Abstract base classes in `dev.metaschema.oscal.lib.model` provide common functionality.
60+
61+
### OSCAL-Specific Metapath Functions
62+
63+
Custom functions beyond core Metaschema (registered in `OscalFunctionLibrary`):
64+
- `has-oscal-namespace` - Check OSCAL namespace membership
65+
- `resolve-profile` - Resolve an OSCAL profile to a catalog
66+
- `resolve-reference` - Resolve OSCAL internal references
67+
68+
## Code Style
69+
70+
- Java 11 target
71+
- Uses SpotBugs annotations (`@NonNull`, `@Nullable`) for null safety
72+
- Package structure follows `dev.metaschema.oscal.*` convention
73+
74+
## Git Workflow
75+
76+
- Repository: <https://github.com/metaschema-framework/liboscal-java>
77+
- **All PRs MUST be created from a personal fork** (required by CONTRIBUTING.md)
78+
- **All PRs MUST target the `develop` branch**
79+
- All changes require PR review
80+
81+
## Git Worktrees (MANDATORY)
82+
83+
**All development work MUST be done in a git worktree, not in the main repository checkout.**
84+
85+
### Why Worktrees Are Required
86+
87+
- Isolates feature work from the main checkout
88+
- Prevents accidental commits to the wrong branch
89+
- Allows parallel work on multiple features
90+
- Keeps the main checkout clean for reference and review
91+
92+
### Worktree Location
93+
94+
Worktrees are stored in `.worktrees/` directory (gitignored) relative to the repository root.
95+
96+
### Workflow
97+
98+
1. **Before starting any feature work**, create a worktree:
99+
100+
```bash
101+
# Create worktree for a new feature branch
102+
git worktree add .worktrees/<feature-name> -b <feature-branch> origin/develop
103+
```
104+
105+
2. **Check for existing worktrees** before making changes:
106+
107+
```bash
108+
git worktree list
109+
```
110+
111+
3. **Switch to the appropriate worktree** if one already exists for your task
112+
113+
4. **Remove worktrees** after PRs are merged:
114+
115+
```bash
116+
git worktree remove .worktrees/<feature-name>
117+
```
118+
119+
### Red Flags (You're Working in the Wrong Directory)
120+
121+
- Making changes without first checking `git worktree list`
122+
- Working in the main repository when a worktree exists for the feature
123+
- Creating files or commits in the main checkout for feature work
124+
125+
Use the `superpowers:using-git-worktrees` skill for guided worktree creation and management.
126+
127+
## Testing
128+
129+
- Tests use JUnit 5
130+
- All PRs require passing CI checks before merge
131+
- 100% of unit tests must pass before pushing code
132+
133+
## Dependencies
134+
135+
This library depends on:
136+
- `metaschema-java` (core Metaschema framework)
137+
- OSCAL model bindings (generated from OSCAL Metaschema modules in `oscal/` submodule)

.claude/settings.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"extraKnownMarketplaces": {
3+
"metaschema-framework": {
4+
"source": {
5+
"source": "github",
6+
"repo": "metaschema-framework/claude-plugins"
7+
}
8+
},
9+
"superpowers-marketplace": {
10+
"source": {
11+
"source": "github",
12+
"repo": "obra/superpowers"
13+
}
14+
}
15+
},
16+
"enabledPlugins": {
17+
"metaschema@metaschema-framework": true,
18+
"metaschema-tools@metaschema-framework": true,
19+
"oscal@metaschema-framework": true,
20+
"oscal-tools@metaschema-framework": true,
21+
"dev-metaschema@metaschema-framework": true,
22+
"superpowers@superpowers-marketplace": true
23+
}
24+
}

0 commit comments

Comments
 (0)