Class: ClaudeFormatter¶
Defined in: formatters/src/formatters/claude.ts:120
Formatter for Claude Code instructions.
Supports three versions: - simple (default): Single CLAUDE.md file - multifile: Main + .claude/rules/*.md with path-specific rules - full: Multifile + .claude/skills/<name>/SKILL.md + CLAUDE.local.md
Example¶
See¶
https://claude.com/docs/code/memory
Extends¶
Constructors¶
Constructor¶
new ClaudeFormatter():
ClaudeFormatter
Returns¶
ClaudeFormatter
Inherited from¶
Properties¶
defaultConvention¶
readonlydefaultConvention:"markdown"='markdown'
Defined in: formatters/src/formatters/claude.ts:124
Default convention for this formatter
Overrides¶
BaseFormatter.defaultConvention
description¶
readonlydescription:"Claude Code instructions (concise Markdown)"='Claude Code instructions (concise Markdown)'
Defined in: formatters/src/formatters/claude.ts:123
Human-readable description
Overrides¶
name¶
readonlyname:"claude"='claude'
Defined in: formatters/src/formatters/claude.ts:121
Unique formatter identifier
Overrides¶
outputPath¶
readonlyoutputPath:"CLAUDE.md"='CLAUDE.md'
Defined in: formatters/src/formatters/claude.ts:122
Default output file path
Overrides¶
Methods¶
createRenderer()¶
protectedcreateRenderer(options?):ConventionRenderer
Defined in: formatters/src/base-formatter.ts:20
Create a convention renderer for this formatter. Uses the provided convention from options or falls back to the default.
Parameters¶
options?¶
Returns¶
Inherited from¶
extractSectionWithCodeBlock()¶
protectedextractSectionWithCodeBlock(text,header):string|null
Defined in: formatters/src/base-formatter.ts:140
Safe extraction of a section that contains a header + content + code block + content Avoids ReDoS by using string search instead of backtracking regex. Matches pattern: Header ... ...
Parameters¶
text¶
string
header¶
string
Returns¶
string | null
Inherited from¶
BaseFormatter.extractSectionWithCodeBlock
extractText()¶
protectedextractText(content):string
Defined in: formatters/src/base-formatter.ts:42
Extract text from block content.
Parameters¶
content¶
Returns¶
string
Inherited from¶
findBlock()¶
protectedfindBlock(ast,name):Block|undefined
Defined in: formatters/src/base-formatter.ts:35
Find a block by name, ignoring internal blocks (starting with __).
Parameters¶
ast¶
name¶
string
Returns¶
Block | undefined
Inherited from¶
format()¶
format(
ast,options?):FormatterOutput
Defined in: formatters/src/formatters/claude.ts:133
Transform AST to tool-specific format
Parameters¶
ast¶
options?¶
Returns¶
Overrides¶
formatArray()¶
protectedformatArray(arr):string
Defined in: formatters/src/base-formatter.ts:84
Format an array as comma-separated string.
Parameters¶
arr¶
unknown[]
Returns¶
string
Inherited from¶
getArrayElements()¶
protectedgetArrayElements(content):Value[]
Defined in: formatters/src/base-formatter.ts:108
Extract array elements from block content.
Parameters¶
content¶
Returns¶
Value[]
Inherited from¶
BaseFormatter.getArrayElements
getMetaField()¶
protectedgetMetaField(ast,key):string|undefined
Defined in: formatters/src/base-formatter.ts:98
Get meta field value as string.
Parameters¶
ast¶
key¶
string
Returns¶
string | undefined
Inherited from¶
getOutputPath()¶
protectedgetOutputPath(options?):string
Defined in: formatters/src/base-formatter.ts:28
Get the output path, respecting options override.
Parameters¶
options?¶
Returns¶
string
Inherited from¶
getProp()¶
protectedgetProp(content,key):Value|undefined
Defined in: formatters/src/base-formatter.ts:56
Get a specific property from block content.
Parameters¶
content¶
key¶
string
Returns¶
Value | undefined
Inherited from¶
getProps()¶
protectedgetProps(content):Record\<string,Value>
Defined in: formatters/src/base-formatter.ts:70
Get all properties from block content.
Parameters¶
content¶
Returns¶
Record\<string, Value>
Inherited from¶
truncate()¶
protectedtruncate(str,max):string
Defined in: formatters/src/base-formatter.ts:91
Truncate string to max length with ellipsis.
Parameters¶
str¶
string
max¶
number
Returns¶
string
Inherited from¶
valueToString()¶
protectedvalueToString(value):string
Defined in: formatters/src/base-formatter.ts:118
Convert value to string representation.
Parameters¶
value¶
Returns¶
string
Inherited from¶
getSupportedVersions()¶
staticgetSupportedVersions():object
Defined in: formatters/src/formatters/claude.ts:129
Get supported versions for this formatter.
Returns¶
object
full¶
readonlyfull:object
full.description¶
readonlydescription:"Multifile + skills (.claude/skills/) + agents (.claude/agents/) + local memory"='Multifile + skills (.claude/skills/) + agents (.claude/agents/) + local memory'
full.name¶
readonlyname:"full"='full'
full.outputPath¶
readonlyoutputPath:"CLAUDE.md"='CLAUDE.md'
multifile¶
readonlymultifile:object
multifile.description¶
readonlydescription:"Main + modular rules (.claude/rules/*.md)"='Main + modular rules (.claude/rules/*.md)'
multifile.name¶
readonlyname:"multifile"='multifile'
multifile.outputPath¶
readonlyoutputPath:"CLAUDE.md"='CLAUDE.md'
simple¶
readonlysimple:object
simple.description¶
readonlydescription:"Single file output (CLAUDE.md)"='Single file output (CLAUDE.md)'
simple.name¶
readonlyname:"simple"='simple'
simple.outputPath¶
readonlyoutputPath:"CLAUDE.md"='CLAUDE.md'