Using with AI Assistants
codeknit ships with ready-made skills that teach AI coding assistants how to use it effectively. These skills enable assistants to extract code structure, detect duplicates, and perform structural analysis without manual prompting.
Skills overview
Section titled “Skills overview”codeknit provides two skills:
codeknit-parse: Teaches assistants to extract code structure (functions, classes, methods, variables) and relationships (calls, inheritance, containment) into.sktfiles.codeknit-fingerprint: Teaches assistants to detect duplicate and near-duplicate code using fuzzy hashing.
Each skill includes documentation that the assistant reads on demand to understand usage, flags, output formats, and workflows.
Installation
Section titled “Installation”Use the installer helper to copy the skill directories to your assistant’s skills folder. The installer downloads only the bundled skill files, so you do not need to clone the repository.
Install for Codex, Kiro, and Claude Code:
curl -fsSL https://raw.githubusercontent.com/awslabs/codeknit/main/scripts/install-skills.sh | bashInstall for one assistant:
curl -fsSL https://raw.githubusercontent.com/awslabs/codeknit/main/scripts/install-skills.sh | bash -s -- --assistant codexcurl -fsSL https://raw.githubusercontent.com/awslabs/codeknit/main/scripts/install-skills.sh | bash -s -- --assistant kirocurl -fsSL https://raw.githubusercontent.com/awslabs/codeknit/main/scripts/install-skills.sh | bash -s -- --assistant claudeFrom a local checkout, you can use Makefile helpers:
make skills-install-dry-runmake skills-installThe installer skips existing skill directories by default. To replace them, add --force:
curl -fsSL https://raw.githubusercontent.com/awslabs/codeknit/main/scripts/install-skills.sh | bash -s -- --assistant all --forceAfter installation, the assistant automatically knows how to invoke codeknit commands, select appropriate flags, and interpret .skt output.
What each skill teaches
Section titled “What each skill teaches”codeknit-parse
Section titled “codeknit-parse”The codeknit-parse skill teaches assistants to:
- Run
codeknit parsewith appropriate flags for different scenarios - Choose the right output mode:
directory-flat(default) for most projectsinlinefor single files or small inputsdirectory-treeto mirror source structure
- Read and interpret
.sktoutput files, including[symbols],[edges], and optional[dict]sections - Use structural data for refactoring, dependency mapping, and code review
- Run
codeknit graph analyzefor deeper code quality insights (cyclic dependencies, hub symbols, god classes, etc.)
codeknit-fingerprint
Section titled “codeknit-fingerprint”The codeknit-fingerprint skill teaches assistants to:
- Use
codeknit fingerprintfor duplicate detection, DRY audits, and refactor identification - Select appropriate similarity ranges (
--min-similarity,--max-similarity) - Read the
[duplicates]section to identify near-duplicate code - Understand that fingerprints measure structural shape, not semantic intent
- Use
--rerankwith Ollama embeddings to reduce false positives when needed
Workflow examples
Section titled “Workflow examples”Structural analysis
Section titled “Structural analysis”- Ask the assistant to analyze your codebase structure
- It runs
codeknit parse ./srcand reads the resulting.sktfiles - It answers structural questions: dependencies, call chains, dead code
- For deeper insights, it runs
codeknit graph analyze ./srcand interprets the report
[symbols]## src/service.goS1 type/struct L5-L8 AuthService {}S2 callable/method L10-L15 Authenticate(token: string) {receiver=*AuthService}
[edges]S1 --contains--> S2Duplicate detection
Section titled “Duplicate detection”- Ask the assistant to find duplicated code
- It runs
codeknit fingerprint ./src - It reads the
[duplicates]section in the output - It investigates flagged pairs and proposes consolidation
[duplicates]S1, S2: 87% similarityS3, S4: 76% similarity- Always read
.sktfiles, not raw source, for structural questions — they contain the extracted structure in a compact, reliable format - Use
codeknit graph analyzeto uncover code quality issues like cyclic dependencies, hub symbols, and deep inheritance chains - Run
codeknit fingerprintbefore large refactors to identify copy-pasted code that should be consolidated - The
.sktformat is designed to be token-efficient, making it ideal for LLM context windows - Use
--minifyto further reduce token usage when processing large codebases